@anglr/common 11.3.0-beta.20220412054621 → 11.3.0-beta.20220413080437

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 (138) hide show
  1. package/changelog.md +39 -5
  2. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js +2 -1
  3. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  4. package/es2015/forms/src/index.js +1 -0
  5. package/es2015/forms/src/index.js.map +1 -1
  6. package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +74 -0
  7. package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -0
  8. package/es2015/forms/src/modules/errorMessage/components/index.js +2 -0
  9. package/es2015/forms/src/modules/errorMessage/components/index.js.map +1 -0
  10. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +75 -0
  11. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -0
  12. package/es2015/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.js +2 -0
  13. package/es2015/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.js.map +1 -0
  14. package/es2015/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js +27 -0
  15. package/es2015/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js.map +1 -0
  16. package/es2015/forms/src/modules/errorMessage/directives/index.js +4 -0
  17. package/es2015/forms/src/modules/errorMessage/directives/index.js.map +1 -0
  18. package/es2015/forms/src/modules/errorMessage/index.js +5 -0
  19. package/es2015/forms/src/modules/errorMessage/index.js.map +1 -0
  20. package/es2015/forms/src/modules/errorMessage/modules/errorMessage.module.js +47 -0
  21. package/es2015/forms/src/modules/errorMessage/modules/errorMessage.module.js.map +1 -0
  22. package/es2015/forms/src/modules/errorMessage/modules/index.js +2 -0
  23. package/es2015/forms/src/modules/errorMessage/modules/index.js.map +1 -0
  24. package/es2015/forms/src/modules/errorMessage/pipes/index.js +2 -0
  25. package/es2015/forms/src/modules/errorMessage/pipes/index.js.map +1 -0
  26. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +33 -0
  27. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -0
  28. package/es2015/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.js +16 -2
  29. package/es2015/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.js.map +1 -1
  30. package/es2015/src/modules/commonUtils.module.js +7 -3
  31. package/es2015/src/modules/commonUtils.module.js.map +1 -1
  32. package/es2015/src/modules/tooltip/components/tooltip/tooltip.component.js +4 -33
  33. package/es2015/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -1
  34. package/es2015/src/modules/tooltip/directives/index.js +1 -0
  35. package/es2015/src/modules/tooltip/directives/index.js.map +1 -1
  36. package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js +23 -5
  37. package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
  38. package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.js +2 -0
  39. package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.js.map +1 -0
  40. package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +7 -0
  41. package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map +1 -1
  42. package/es2015/src/modules/tooltip/misc/tooltip.interface.js.map +1 -1
  43. package/es2015/src/pipes/index.js +1 -0
  44. package/es2015/src/pipes/index.js.map +1 -1
  45. package/es2015/src/pipes/keys/keys.pipe.js +25 -0
  46. package/es2015/src/pipes/keys/keys.pipe.js.map +1 -0
  47. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js +1 -1
  48. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  49. package/es2020/forms/src/index.js +1 -0
  50. package/es2020/forms/src/index.js.map +1 -1
  51. package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +72 -0
  52. package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -0
  53. package/es2020/forms/src/modules/errorMessage/components/index.js +2 -0
  54. package/es2020/forms/src/modules/errorMessage/components/index.js.map +1 -0
  55. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +74 -0
  56. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -0
  57. package/es2020/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.js +2 -0
  58. package/es2020/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.js.map +1 -0
  59. package/es2020/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js +27 -0
  60. package/es2020/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js.map +1 -0
  61. package/es2020/forms/src/modules/errorMessage/directives/index.js +4 -0
  62. package/es2020/forms/src/modules/errorMessage/directives/index.js.map +1 -0
  63. package/es2020/forms/src/modules/errorMessage/index.js +5 -0
  64. package/es2020/forms/src/modules/errorMessage/index.js.map +1 -0
  65. package/es2020/forms/src/modules/errorMessage/modules/errorMessage.module.js +47 -0
  66. package/es2020/forms/src/modules/errorMessage/modules/errorMessage.module.js.map +1 -0
  67. package/es2020/forms/src/modules/errorMessage/modules/index.js +2 -0
  68. package/es2020/forms/src/modules/errorMessage/modules/index.js.map +1 -0
  69. package/es2020/forms/src/modules/errorMessage/pipes/index.js +2 -0
  70. package/es2020/forms/src/modules/errorMessage/pipes/index.js.map +1 -0
  71. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +33 -0
  72. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -0
  73. package/es2020/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.js +16 -2
  74. package/es2020/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.js.map +1 -1
  75. package/es2020/src/modules/commonUtils.module.js +7 -3
  76. package/es2020/src/modules/commonUtils.module.js.map +1 -1
  77. package/es2020/src/modules/tooltip/components/tooltip/tooltip.component.js +4 -33
  78. package/es2020/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -1
  79. package/es2020/src/modules/tooltip/directives/index.js +1 -0
  80. package/es2020/src/modules/tooltip/directives/index.js.map +1 -1
  81. package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js +23 -5
  82. package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
  83. package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.js +2 -0
  84. package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.js.map +1 -0
  85. package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +7 -0
  86. package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map +1 -1
  87. package/es2020/src/modules/tooltip/misc/tooltip.interface.js.map +1 -1
  88. package/es2020/src/pipes/index.js +1 -0
  89. package/es2020/src/pipes/index.js.map +1 -1
  90. package/es2020/src/pipes/keys/keys.pipe.js +25 -0
  91. package/es2020/src/pipes/keys/keys.pipe.js.map +1 -0
  92. package/forms/src/index.d.ts +1 -0
  93. package/forms/src/index.d.ts.map +1 -1
  94. package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts +50 -0
  95. package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts.map +1 -0
  96. package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.html +7 -0
  97. package/forms/src/modules/errorMessage/components/index.d.ts +2 -0
  98. package/forms/src/modules/errorMessage/components/index.d.ts.map +1 -0
  99. package/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.d.ts +41 -0
  100. package/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.d.ts.map +1 -0
  101. package/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.d.ts +27 -0
  102. package/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.d.ts.map +1 -0
  103. package/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.d.ts +17 -0
  104. package/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.d.ts.map +1 -0
  105. package/forms/src/modules/errorMessage/directives/index.d.ts +4 -0
  106. package/forms/src/modules/errorMessage/directives/index.d.ts.map +1 -0
  107. package/forms/src/modules/errorMessage/index.d.ts +5 -0
  108. package/forms/src/modules/errorMessage/index.d.ts.map +1 -0
  109. package/forms/src/modules/errorMessage/modules/errorMessage.module.d.ts +16 -0
  110. package/forms/src/modules/errorMessage/modules/errorMessage.module.d.ts.map +1 -0
  111. package/forms/src/modules/errorMessage/modules/index.d.ts +2 -0
  112. package/forms/src/modules/errorMessage/modules/index.d.ts.map +1 -0
  113. package/forms/src/modules/errorMessage/pipes/index.d.ts +2 -0
  114. package/forms/src/modules/errorMessage/pipes/index.d.ts.map +1 -0
  115. package/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.d.ts +18 -0
  116. package/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.d.ts.map +1 -0
  117. package/package.json +1 -1
  118. package/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.d.ts +12 -3
  119. package/src/modules/clickOutside/directives/clickOutside/clickOutside.directive.d.ts.map +1 -1
  120. package/src/modules/commonUtils.module.d.ts +2 -1
  121. package/src/modules/commonUtils.module.d.ts.map +1 -1
  122. package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts +2 -6
  123. package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts.map +1 -1
  124. package/src/modules/tooltip/directives/index.d.ts +1 -0
  125. package/src/modules/tooltip/directives/index.d.ts.map +1 -1
  126. package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts +14 -3
  127. package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +1 -1
  128. package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.d.ts +10 -0
  129. package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.context.d.ts.map +1 -0
  130. package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.d.ts +7 -2
  131. package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.d.ts.map +1 -1
  132. package/src/modules/tooltip/misc/tooltip.interface.d.ts +11 -1
  133. package/src/modules/tooltip/misc/tooltip.interface.d.ts.map +1 -1
  134. package/src/pipes/index.d.ts +1 -0
  135. package/src/pipes/index.d.ts.map +1 -1
  136. package/src/pipes/keys/keys.pipe.d.ts +16 -0
  137. package/src/pipes/keys/keys.pipe.d.ts.map +1 -0
  138. package/version.bak +1 -1
package/changelog.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Version 11.3.0 (2022-04-12)
3
+ ## Version 11.3.0 (2022-04-13)
4
4
 
5
5
  ### Features
6
6
 
7
+ - new `KeysPipe` pipe, that gets object keys/property names
8
+ - updated `CommonUtilsModule`
9
+ - **exports**
10
+ - `KeysPipe` pipe
11
+ - updated `ClickOutsideDirective` directive
12
+ - now allows `clickOutside` *input* to be set to `''`, allows using empty `clickOutside` binding
7
13
  - new **Tooltip** module (based on `Position` service)
8
14
  - new `TooltipModule` module for rendering tooltips
9
15
  - **exports**
@@ -19,6 +25,8 @@
19
25
  - **content**
20
26
  - child `TooltipTemplateDirective` instance of template from element content, used for rendering
21
27
  - new `TooltipTemplateDirective` directive used for obtaining custom tooltip template
28
+ - new `TooltipTemplateContext` interface, that is context passed to template of tooltip
29
+ - property `$implicit` data that should be displayed in tooltip
22
30
  - new `TooltipComponent` component used for displaying tooltip content
23
31
  - implementation of `TooltipRenderer`
24
32
  - new `TOOLTIP_OPTIONS` injection token used for injecting tooltip options
@@ -36,6 +44,8 @@
36
44
  - property `tooltipCssClass` css class that is applied to tooltip renderer component
37
45
  - property `stopPropagation` indication whether stop propagation of "hover" event
38
46
  - property `tooltipRenderer` type of tooltip renderer that is used for rendering tooltip
47
+ - property `enterAnimation` animation used to tooltip component when it is displayed
48
+ - property `exitAnimation` animation used to tooltip component when it is hidden
39
49
  - *subpackage* `@anglr/common/material`
40
50
  - **TITLED DIALOG**
41
51
  - new `TitledDialogServiceOptions` class that represents, options for `TitledDialogService`
@@ -44,6 +54,30 @@
44
54
  - now using `TitledDialogServiceOptions`, using type of component for dialog from options
45
55
  - new `MovableTitledDialogComponent` component, that is used as wrapper for material dialog enhanced with title, which is movable
46
56
  - new `MovableTitledDialogModule` module for components for displaying movable titled dialog
57
+ - *subpackage* `@anglr/common/forms`
58
+ - new `ErrorMessageModule` module for error message directives, pipes and components
59
+ - **exports**
60
+ - `WithErrorMessagePipe` pipe
61
+ - `GroupErrorsTemplateDirective` directive
62
+ - `ErrorMessageDirective` directive
63
+ - `GroupErrorsComponent` directive
64
+ - new `WithErrorMessagePipe` pipe, that filters array of errors with messages
65
+ - new `GroupErrorsTemplateContext` interface, that is context passed to template of group error
66
+ - `$implicit` name/code of error
67
+ - `last` indication whether rendered error is last
68
+ - `first` indication whether rendered error is first
69
+ - `index` index of currently rendered item
70
+ - `errors` object storing all errors for form group
71
+ - new `GroupErrorsTemplateDirective` directive, that obtains template for displaying form group error
72
+ - new `ErrorMessageDirective` directive, that is used for displaying form error message
73
+ - **inputs**
74
+ - `errorMessage` name/code of error message to be displayed
75
+ - `errors` object storing all errors
76
+ - new `GroupErrorsComponent` component, that is used for rendering from group errors
77
+ - **inputs**
78
+ - `cssClass` css classes that are applied to default rendered divs
79
+ - **content**
80
+ - child `GroupErrorsTemplateDirective` custom template for rendering form group error
47
81
 
48
82
  ## Version 11.2.0 (2022-03-01)
49
83
 
@@ -234,7 +268,7 @@
234
268
  - added *subpackage* `@anglr/common/date-fns`
235
269
  - *subpackage* `@anglr/common/date-fns`
236
270
  - `readEncodedFilterWithDates` function that reads filter value from encoded string, deserialize date properties into date
237
- - *subpackage* `@anglr/common/moment`
271
+ - *subpackage* `@anglr/common/moment`
238
272
  - added new `readEncodedFilterWithDates` function that reads filter value from encoded string, deserialize date properties into moment
239
273
  - *subpackage* `@anglr/common/store`
240
274
  - added new `SessionTemporaryStorageService` as `TemporaryStorage` implementation using *Session*
@@ -399,7 +433,7 @@
399
433
  - added *subpackage* `@anglr/common/date-fns`
400
434
  - *subpackage* `@anglr/common/date-fns`
401
435
  - `readEncodedFilterWithDates` function that reads filter value from encoded string, deserialize date properties into date
402
- - *subpackage* `@anglr/common/moment`
436
+ - *subpackage* `@anglr/common/moment`
403
437
  - added new `readEncodedFilterWithDates` function that reads filter value from encoded string, deserialize date properties into moment
404
438
  - *subpackage* `@anglr/common/store`
405
439
  - added new `SessionTemporaryStorageService` as `TemporaryStorage` implementation using *Session*
@@ -682,7 +716,7 @@
682
716
  - removed static class `Utils` and all its parts except `runWhenModuleStable`, `APP_STABLE`, `extractAppStableResolve` which are exported independently
683
717
 
684
718
  ## Version 6.1.0
685
-
719
+
686
720
  - created *subpackage* `@anglr/common/hmr` containing new HMR `hmrAccept` and `hmrFinishedNotification`
687
721
  - `hmrAccept` and `hmrFinishedNotification` in `@anglr/common/` are deprecated
688
722
  - added new decorator `ModuleRoutes` used with Angular IVY for setting routes to module combining with `ComponentRoute` and `ComponentRedirectRoute` decorators
@@ -786,7 +820,7 @@
786
820
  ## Version 4.0.4
787
821
 
788
822
  - returned typescript version back to 2.4.2 and removed distJit
789
-
823
+
790
824
  ## Version 4.0.3
791
825
 
792
826
  - changed order of constructor parameters for ProgressIndicatorService
@@ -107,9 +107,10 @@ export class FloatingUiDomPosition {
107
107
  }
108
108
  }
109
109
  middlewares.push(offset(({ floating, placement }) => {
110
+ var _a;
110
111
  if (options.offset == PositionOffset.MouseEnter && options.mouseEvent) {
111
112
  return {
112
- crossAxis: options.mouseEvent.offsetX
113
+ crossAxis: options.mouseEvent.offsetX || ((_a = options.mouseEvent.layerX) !== null && _a !== void 0 ? _a : 0)
113
114
  };
114
115
  }
115
116
  let dimension;
@@ -1 +1 @@
1
- {"version":3,"file":"floatingUiDomPosition.service.js","sourceRoot":"","sources":["../../../../floating-ui/src/services/floatingUiDomPosition.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAgB,UAAU,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAA4C,cAAc,EAAE,iBAAiB,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AACxI,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,eAAe,EAAa,UAAU,EAAc,MAAM,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;;AAEhC;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,UAAU,EAAE,KAAK;IACjB,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,cAAc,CAAC,IAAI;IAC3B,SAAS,EAAE,iBAAiB,CAAC,GAAG;CACnC,CAAC;AAEF;;GAEG;AAEH,MAAM,OAAO,qBAAqB;IAE9B,iGAAiG;IAEjG;;OAEG;IACI,YAAY,CAAC,MAAe,EAAE,MAAe,EAAE,OAAkC;QAEpF,OAAO,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YAE/B,CAAC,GAAS,EAAE;gBAER,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;gBAC5D,MAAM,WAAW,GAAiB,EAAE,CAAC;gBAErC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;gBAC9C,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;gBAE5C,MAAM,cAAc,GAA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C,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,IAAI;gBAC3B;oBACI,OAAO,MAAM,CAAC;iBACjB;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,OAAO;gBAC9B;oBACI,OAAO,UAAU,CAAC;iBACrB;YACD,KAAK,iBAAiB,CAAC,KAAK;gBAC5B;oBACI,OAAO,OAAO,CAAC;iBAClB;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC;oBACI,OAAO,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHAtPQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AA0PX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GACjC;IACI,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import {ClassProvider, Injectable} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION} from '@anglr/common';\nimport {extend} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions =\n{\n autoUpdate: false,\n flip: false,\n offset: PositionOffset.None,\n placement: PositionPlacement.Top\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n \n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.offset != PositionOffset.None)\n {\n if(options.offset == PositionOffset.MouseEnter)\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopStart;\n }\n }\n\n middlewares.push(offset(({floating, placement}) =>\n {\n if(options.offset == PositionOffset.MouseEnter && options.mouseEvent)\n {\n return {\n crossAxis: options.mouseEvent.offsetX\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.width;\n }\n else\n {\n dimension = floating.height;\n }\n\n switch(options.offset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset.Full:\n {\n break;\n }\n case PositionOffset.Half:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset.NegativeFull:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset.NegativeHalf:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n\n/**\n * Provider for floating ui position implementation\n */\nexport const FLOATING_UI_POSITION: ClassProvider =\n{\n provide: POSITION,\n useClass: FloatingUiDomPosition\n};"]}
1
+ {"version":3,"file":"floatingUiDomPosition.service.js","sourceRoot":"","s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AAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,OAAO;gBAC9B;oBACI,OAAO,UAAU,CAAC;iBACrB;YACD,KAAK,iBAAiB,CAAC,KAAK;gBAC5B;oBACI,OAAO,OAAO,CAAC;iBAClB;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC;oBACI,OAAO,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHAtPQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AA0PX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GACjC;IACI,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import {ClassProvider, Injectable} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION} from '@anglr/common';\nimport {extend} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions =\n{\n autoUpdate: false,\n flip: false,\n offset: PositionOffset.None,\n placement: PositionPlacement.Top\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n \n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.offset != PositionOffset.None)\n {\n if(options.offset == PositionOffset.MouseEnter)\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopStart;\n }\n }\n\n middlewares.push(offset(({floating, placement}) =>\n {\n if(options.offset == PositionOffset.MouseEnter && options.mouseEvent)\n {\n return {\n crossAxis: options.mouseEvent.offsetX || ((options.mouseEvent as any).layerX ?? 0)\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.width;\n }\n else\n {\n dimension = floating.height;\n }\n\n switch(options.offset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset.Full:\n {\n break;\n }\n case PositionOffset.Half:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset.NegativeFull:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset.NegativeHalf:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n\n/**\n * Provider for floating ui position implementation\n */\nexport const FLOATING_UI_POSITION: ClassProvider =\n{\n provide: POSITION,\n useClass: FloatingUiDomPosition\n};"]}
@@ -17,5 +17,6 @@ export * from './modules/numberInput.module';
17
17
  export * from './modules/hasError.module';
18
18
  export * from './modules/requiredClass.module';
19
19
  export * from './modules/formPipes';
20
+ export * from './modules/errorMessage';
20
21
  export * from './misc/formModel';
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/types';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './misc/formModel';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/types';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './modules/errorMessage';\nexport * from './misc/formModel';\n"]}
@@ -0,0 +1,74 @@
1
+ import { Component, ChangeDetectionStrategy, Optional, ChangeDetectorRef, Input, ContentChild } from '@angular/core';
2
+ import { FormGroupDirective, FormGroupName } from '@angular/forms';
3
+ import { Subscription } from 'rxjs';
4
+ import { GroupErrorsTemplateDirective } from '../../directives';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@angular/forms";
7
+ import * as i2 from "@angular/common";
8
+ import * as i3 from "../../directives/errorMessage/errorMessage.directive";
9
+ import * as i4 from "../../pipes/withErrorMessage/withErrorMessage.pipe";
10
+ import * as i5 from "../../../../../../src/pipes/keys/keys.pipe";
11
+ /**
12
+ * Component used for rendering from group errors
13
+ */
14
+ export class GroupErrorsComponent {
15
+ //######################### constructor #########################
16
+ constructor(formGroupDirective, formGroupName, _changeDetector) {
17
+ this.formGroupDirective = formGroupDirective;
18
+ this.formGroupName = formGroupName;
19
+ this._changeDetector = _changeDetector;
20
+ /**
21
+ * Subscriptions created during initialization
22
+ */
23
+ this._initSubscriptions = new Subscription();
24
+ if (!this.formGroupDirective && !this.formGroupName) {
25
+ throw new Error('There is no parent formGroup or formGroupName directive');
26
+ }
27
+ }
28
+ //######################### public properties - template bindings #########################
29
+ /**
30
+ * Gets instance of currently used form group
31
+ * @internal
32
+ */
33
+ get formGroup() {
34
+ var _a, _b, _c, _d;
35
+ return ((_a = this._formGroup) !== null && _a !== void 0 ? _a : (this._formGroup = (_c = (_b = this.formGroupDirective) === null || _b === void 0 ? void 0 : _b.form) !== null && _c !== void 0 ? _c : (_d = this.formGroupName) === null || _d === void 0 ? void 0 : _d.control));
36
+ }
37
+ //######################### public methods - implementation of OnInit #########################
38
+ /**
39
+ * Initialize component
40
+ */
41
+ ngOnInit() {
42
+ this._initSubscriptions.add(this.formGroup.statusChanges.subscribe(state => {
43
+ if (this._lastState != state || state == 'INVALID') {
44
+ this._lastState = state;
45
+ this._changeDetector.detectChanges();
46
+ }
47
+ }));
48
+ }
49
+ //######################### public methods - implementation of OnDestroy #########################
50
+ /**
51
+ * Called when component is destroyed
52
+ */
53
+ ngOnDestroy() {
54
+ var _a;
55
+ (_a = this._initSubscriptions) === null || _a === void 0 ? void 0 : _a.unsubscribe();
56
+ this._initSubscriptions = null;
57
+ }
58
+ }
59
+ GroupErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupErrorsComponent, deps: [{ token: i1.FormGroupDirective, optional: true }, { token: i1.FormGroupName, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
60
+ GroupErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: GroupErrorsComponent, selector: "form-group-errors", inputs: { cssClass: "cssClass" }, queries: [{ propertyName: "template", first: true, predicate: GroupErrorsTemplateDirective, descendants: true }], ngImport: i0, template: "<ng-template #defaultTemplate let-errorName>\n <div [ngClass]=\"cssClass\" [errorMessage]=\"errorName\" [errors]=\"formGroup.errors\"></div>\n</ng-template>\n\n<ng-container *ngFor=\"let errorName of formGroup.errors | keys | withErrorMessage; let first=first; let last=last; let index=index\">\n <ng-container *ngTemplateOutlet=\"template?.template ?? defaultTemplate; context: {$implicit: errorName, first, last, index, errors: formGroup.errors}\"></ng-container>\n</ng-container>", directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.ErrorMessageDirective, selector: "[errorMessage]", inputs: ["errorMessage", "errors"], exportAs: ["errorMessage"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "withErrorMessage": i4.WithErrorMessagePipe, "keys": i5.KeysPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
61
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupErrorsComponent, decorators: [{
62
+ type: Component,
63
+ args: [{ selector: 'form-group-errors', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #defaultTemplate let-errorName>\n <div [ngClass]=\"cssClass\" [errorMessage]=\"errorName\" [errors]=\"formGroup.errors\"></div>\n</ng-template>\n\n<ng-container *ngFor=\"let errorName of formGroup.errors | keys | withErrorMessage; let first=first; let last=last; let index=index\">\n <ng-container *ngTemplateOutlet=\"template?.template ?? defaultTemplate; context: {$implicit: errorName, first, last, index, errors: formGroup.errors}\"></ng-container>\n</ng-container>" }]
64
+ }], ctorParameters: function () { return [{ type: i1.FormGroupDirective, decorators: [{
65
+ type: Optional
66
+ }] }, { type: i1.FormGroupName, decorators: [{
67
+ type: Optional
68
+ }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { cssClass: [{
69
+ type: Input
70
+ }], template: [{
71
+ type: ContentChild,
72
+ args: [GroupErrorsTemplateDirective]
73
+ }] } });
74
+ //# sourceMappingURL=groupErrors.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupErrors.component.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.ts","../../../../../../../forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAqB,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACtI,OAAO,EAA+B,kBAAkB,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,4BAA4B,EAAC,MAAM,kBAAkB,CAAC;;;;;;;AAE9D;;GAEG;AAOH,MAAM,OAAO,oBAAoB;IA8C7B,iEAAiE;IACjE,YAAkC,kBAAsC,EACtC,aAA4B,EACxC,eAAkC;QAFtB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,kBAAa,GAAb,aAAa,CAAe;QACxC,oBAAe,GAAf,eAAe,CAAmB;QAxCxD;;WAEG;QACO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etectorRef, Input, ContentChild} from '@angular/core';\nimport {FormControlStatus, FormGroup, FormGroupDirective, FormGroupName} from '@angular/forms';\nimport {Subscription} from 'rxjs';\n\nimport {GroupErrorsTemplateDirective} from '../../directives';\n\n/**\n * Component used for rendering from group errors\n */\n@Component(\n{\n selector: 'form-group-errors',\n templateUrl: 'groupErrors.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GroupErrorsComponent implements OnInit, OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Instance of currently used form group\n */\n protected _formGroup?: FormGroup;\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n /**\n * Last state of form control\n */\n protected _lastState?: FormControlStatus;\n\n //######################### public properties - template bindings #########################\n\n /**\n * Gets instance of currently used form group\n * @internal\n */\n public get formGroup(): FormGroup\n {\n return (this._formGroup ??= (this.formGroupDirective?.form ?? this.formGroupName?.control));\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Css classes that are applied to default rendered divs\n */\n @Input()\n public cssClass: string;\n\n //######################### public properties - children #########################\n\n /**\n * Custom template for rendering form group error\n */\n @ContentChild(GroupErrorsTemplateDirective)\n public template?: GroupErrorsTemplateDirective;\n\n //######################### constructor #########################\n constructor(@Optional() protected formGroupDirective: FormGroupDirective,\n @Optional() protected formGroupName: FormGroupName,\n protected _changeDetector: ChangeDetectorRef,)\n {\n if(!this.formGroupDirective && !this.formGroupName)\n {\n throw new Error('There is no parent formGroup or formGroupName directive');\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._initSubscriptions.add(this.formGroup.statusChanges.subscribe(state =>\n {\n if(this._lastState != state || state == 'INVALID')\n {\n this._lastState = state;\n this._changeDetector.detectChanges();\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n}","<ng-template #defaultTemplate let-errorName>\n <div [ngClass]=\"cssClass\" [errorMessage]=\"errorName\" [errors]=\"formGroup.errors\"></div>\n</ng-template>\n\n<ng-container *ngFor=\"let errorName of formGroup.errors | keys | withErrorMessage; let first=first; let last=last; let index=index\">\n <ng-container *ngTemplateOutlet=\"template?.template ?? defaultTemplate; context: {$implicit: errorName, first, last, index, errors: formGroup.errors}\"></ng-container>\n</ng-container>"]}
@@ -0,0 +1,2 @@
1
+ export * from './groupErrors/groupErrors.component';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../forms/src/modules/errorMessage/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC","sourcesContent":["export * from './groupErrors/groupErrors.component';\n"]}
@@ -0,0 +1,75 @@
1
+ import { Directive, ElementRef, Inject, Input } from '@angular/core';
2
+ import { STRING_LOCALIZATION } from '@anglr/common';
3
+ import { isBlank, nameof } from '@jscrpt/common';
4
+ import { Subscription } from 'rxjs';
5
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Directive used for displaying form error message
9
+ */
10
+ export class ErrorMessageDirective {
11
+ //######################### constructor #########################
12
+ constructor(_element, _localization, _errorMessages) {
13
+ this._element = _element;
14
+ this._localization = _localization;
15
+ this._errorMessages = _errorMessages;
16
+ //######################### protected properties #########################
17
+ /**
18
+ * Subscriptions created during initialization
19
+ */
20
+ this._initSubscriptions = new Subscription();
21
+ this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));
22
+ }
23
+ //######################### public methods - implementation of OnChanges #########################
24
+ /**
25
+ * Called when input value changes
26
+ */
27
+ ngOnChanges(changes) {
28
+ if (nameof('errorName') in changes) {
29
+ this._showMessage();
30
+ }
31
+ }
32
+ //######################### public methods - implementation of OnDestroy #########################
33
+ /**
34
+ * Called when component is destroyed
35
+ */
36
+ ngOnDestroy() {
37
+ var _a;
38
+ (_a = this._initSubscriptions) === null || _a === void 0 ? void 0 : _a.unsubscribe();
39
+ this._initSubscriptions = null;
40
+ }
41
+ //######################### protected methods #########################
42
+ /**
43
+ * Shows message inside of element
44
+ */
45
+ _showMessage() {
46
+ if (isBlank(this.errorName)) {
47
+ this._element.nativeElement.innerHTML = '';
48
+ return;
49
+ }
50
+ const errorMessage = this._errorMessages[this.errorName];
51
+ const message = this._localization.get(errorMessage, this.errors);
52
+ this._element.nativeElement.innerHTML = message;
53
+ }
54
+ }
55
+ ErrorMessageDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageDirective, deps: [{ token: i0.ElementRef }, { token: STRING_LOCALIZATION }, { token: VALIDATION_ERROR_MESSAGES }], target: i0.ɵɵFactoryTarget.Directive });
56
+ ErrorMessageDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: ErrorMessageDirective, selector: "[errorMessage]", inputs: { errorName: ["errorMessage", "errorName"], errors: "errors" }, exportAs: ["errorMessage"], usesOnChanges: true, ngImport: i0 });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageDirective, decorators: [{
58
+ type: Directive,
59
+ args: [{
60
+ selector: '[errorMessage]',
61
+ exportAs: 'errorMessage'
62
+ }]
63
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
64
+ type: Inject,
65
+ args: [STRING_LOCALIZATION]
66
+ }] }, { type: undefined, decorators: [{
67
+ type: Inject,
68
+ args: [VALIDATION_ERROR_MESSAGES]
69
+ }] }]; }, propDecorators: { errorName: [{
70
+ type: Input,
71
+ args: ['errorMessage']
72
+ }], errors: [{
73
+ type: Input
74
+ }] } });
75
+ //# sourceMappingURL=errorMessage.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorMessage.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAsC,MAAM,eAAe,CAAC;AACxG,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAa,OAAO,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;;AAEjE;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAuB9B,iEAAiE;IACjE,YAAsB,QAAiC,EACJ,aAAiC,EAC3B,cAAgC;QAFnE,aAAQ,GAAR,QAAQ,CAAyB;QACJ,kBAAa,GAAb,aAAa,CAAoB;QAC3B,mBAAc,GAAd,cAAc,CAAkB;QAxBzF,0EAA0E;QAE1E;;WAEG;QACO,uBAAkB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAqB5D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW,CAAC,OAAsB;QAErC,IAAG,MAAM,CAAwB,WAAW,CAAC,IAAI,OAAO,EACxD;YACI,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;;QAEd,MAAA,IAAI,CAAC,kBAAkB,0CAAE,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACO,YAAY;QAElB,IAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1B;YACI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;YAE3C,OAAO;SACV;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;IACpD,CAAC;;kHAzEQ,qBAAqB,4CAyBV,mBAAmB,aACnB,yBAAyB;sGA1BpC,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;iBAC3B;;0BA0BgB,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;4CAXtC,SAAS;sBADf,KAAK;uBAAC,cAAc;gBAOd,MAAM;sBADZ,KAAK","sourcesContent":["import {Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {Dictionary, isBlank, nameof, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Directive used for displaying form error message\n */\n@Directive(\n{\n selector: '[errorMessage]',\n exportAs: 'errorMessage'\n})\nexport class ErrorMessageDirective implements OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n //######################### public properties - inputs #########################\n\n /**\n * Name/code of error message to be displayed\n */\n @Input('errorMessage')\n public errorName: string;\n\n /**\n * Object storing all errors\n */\n @Input()\n public errors: Dictionary;\n\n //######################### constructor #########################\n constructor(protected _element: ElementRef<HTMLElement>,\n @Inject(STRING_LOCALIZATION) protected _localization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary,)\n {\n this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<ErrorMessageDirective>('errorName') in changes)\n {\n this._showMessage();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows message inside of element\n */\n protected _showMessage(): void\n {\n if(isBlank(this.errorName))\n {\n this._element.nativeElement.innerHTML = '';\n\n return;\n }\n\n const errorMessage = this._errorMessages[this.errorName];\n const message = this._localization.get(errorMessage, this.errors);\n\n this._element.nativeElement.innerHTML = message;\n }\n}"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=groupErrorsTemplate.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupErrorsTemplate.context.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.context.ts"],"names":[],"mappings":"","sourcesContent":["import {Dictionary} from '@jscrpt/common';\n\n/**\n * Context passed to template of group error\n */\nexport interface GroupErrorsTemplateContext\n{\n /**\n * Name/code of error\n */\n $implicit: string;\n\n /**\n * Indication whether rendered error is last\n */\n last: boolean;\n\n /**\n * Indication whether rendered error is first\n */\n first: boolean;\n\n /**\n * Index of currently rendered item\n */\n index: number;\n\n /**\n * Object storing all errors for form group\n */\n errors: Dictionary;\n}"]}
@@ -0,0 +1,27 @@
1
+ import { Directive, TemplateRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Obtains template for displaying form group error
5
+ */
6
+ export class GroupErrorsTemplateDirective {
7
+ //######################### constructor #########################
8
+ constructor(template) {
9
+ this.template = template;
10
+ }
11
+ //######################### ng language server #########################
12
+ /**
13
+ * Allows typechecking for template
14
+ */
15
+ static ngTemplateContextGuard(_dir, _ctx) {
16
+ return true;
17
+ }
18
+ }
19
+ GroupErrorsTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupErrorsTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
20
+ GroupErrorsTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: GroupErrorsTemplateDirective, selector: "[formGroupError]", ngImport: i0 });
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupErrorsTemplateDirective, decorators: [{
22
+ type: Directive,
23
+ args: [{
24
+ selector: '[formGroupError]'
25
+ }]
26
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
27
+ //# sourceMappingURL=groupErrorsTemplate.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupErrorsTemplate.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAIrD;;GAEG;AAKH,MAAM,OAAO,4BAA4B;IAErC,iEAAiE;IACjE,YAAmB,QAAiD;QAAjD,aAAQ,GAAR,QAAQ,CAAyC;IAEpE,CAAC;IAED,wEAAwE;IAExE;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAkC,EAAE,IAAa;QAE3E,OAAO,IAAI,CAAC;IAChB,CAAC;;yHAfQ,4BAA4B;6GAA5B,4BAA4B;2FAA5B,4BAA4B;kBAJxC,SAAS;mBACV;oBACI,QAAQ,EAAE,kBAAkB;iBAC/B","sourcesContent":["import {Directive, TemplateRef} from '@angular/core';\n\nimport {GroupErrorsTemplateContext} from './groupErrorsTemplate.context';\n\n/**\n * Obtains template for displaying form group error\n */\n@Directive(\n{\n selector: '[formGroupError]'\n})\nexport class GroupErrorsTemplateDirective\n{\n //######################### constructor #########################\n constructor(public template: TemplateRef<GroupErrorsTemplateContext>)\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Allows typechecking for template\n */\n static ngTemplateContextGuard(_dir: GroupErrorsTemplateDirective, _ctx: unknown): _ctx is GroupErrorsTemplateContext\n {\n return true;\n }\n}"]}
@@ -0,0 +1,4 @@
1
+ export * from './errorMessage/errorMessage.directive';
2
+ export * from './groupErrorsTemplate/groupErrorsTemplate.directive';
3
+ export * from './groupErrorsTemplate/groupErrorsTemplate.context';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../forms/src/modules/errorMessage/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC","sourcesContent":["export * from './errorMessage/errorMessage.directive';\nexport * from './groupErrorsTemplate/groupErrorsTemplate.directive';\nexport * from './groupErrorsTemplate/groupErrorsTemplate.context';\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './components';
2
+ export * from './directives';
3
+ export * from './modules';
4
+ export * from './pipes';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../forms/src/modules/errorMessage/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC","sourcesContent":["export * from './components';\nexport * from './directives';\nexport * from './modules';\nexport * from './pipes';\n"]}
@@ -0,0 +1,47 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { CommonUtilsModule } from '@anglr/common';
4
+ import { GroupErrorsComponent } from '../components';
5
+ import { ErrorMessageDirective, GroupErrorsTemplateDirective } from '../directives';
6
+ import { WithErrorMessagePipe } from '../pipes';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Module for error message directives, pipes and components
10
+ */
11
+ export class ErrorMessageModule {
12
+ }
13
+ ErrorMessageModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
14
+ ErrorMessageModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageModule, declarations: [WithErrorMessagePipe,
15
+ ErrorMessageDirective,
16
+ GroupErrorsTemplateDirective,
17
+ GroupErrorsComponent], imports: [CommonModule,
18
+ CommonUtilsModule], exports: [WithErrorMessagePipe,
19
+ ErrorMessageDirective,
20
+ GroupErrorsTemplateDirective,
21
+ GroupErrorsComponent] });
22
+ ErrorMessageModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageModule, imports: [[
23
+ CommonModule,
24
+ CommonUtilsModule,
25
+ ]] });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessageModule, decorators: [{
27
+ type: NgModule,
28
+ args: [{
29
+ imports: [
30
+ CommonModule,
31
+ CommonUtilsModule,
32
+ ],
33
+ declarations: [
34
+ WithErrorMessagePipe,
35
+ ErrorMessageDirective,
36
+ GroupErrorsTemplateDirective,
37
+ GroupErrorsComponent,
38
+ ],
39
+ exports: [
40
+ WithErrorMessagePipe,
41
+ ErrorMessageDirective,
42
+ GroupErrorsTemplateDirective,
43
+ GroupErrorsComponent,
44
+ ]
45
+ }]
46
+ }] });
47
+ //# sourceMappingURL=errorMessage.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorMessage.module.js","sourceRoot":"","sources":["../../../../../../forms/src/modules/errorMessage/modules/errorMessage.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAE,4BAA4B,EAAC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;;AAE9C;;GAEG;AAuBH,MAAM,OAAO,kBAAkB;;+GAAlB,kBAAkB;gHAAlB,kBAAkB,iBAbvB,oBAAoB;QACpB,qBAAqB;QACrB,4BAA4B;QAC5B,oBAAoB,aARpB,YAAY;QACZ,iBAAiB,aAWjB,oBAAoB;QACpB,qBAAqB;QACrB,4BAA4B;QAC5B,oBAAoB;gHAGf,kBAAkB,YAnB3B;YACI,YAAY;YACZ,iBAAiB;SACpB;2FAgBQ,kBAAkB;kBAtB9B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,YAAY;wBACZ,iBAAiB;qBACpB;oBACD,YAAY,EACZ;wBACI,oBAAoB;wBACpB,qBAAqB;wBACrB,4BAA4B;wBAC5B,oBAAoB;qBACvB;oBACD,OAAO,EACP;wBACI,oBAAoB;wBACpB,qBAAqB;wBACrB,4BAA4B;wBAC5B,oBAAoB;qBACvB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {CommonUtilsModule} from '@anglr/common';\n\nimport {GroupErrorsComponent} from '../components';\nimport {ErrorMessageDirective, GroupErrorsTemplateDirective} from '../directives';\nimport {WithErrorMessagePipe} from '../pipes';\n\n/**\n * Module for error message directives, pipes and components\n */\n@NgModule(\n{\n imports:\n [\n CommonModule,\n CommonUtilsModule,\n ],\n declarations:\n [\n WithErrorMessagePipe,\n ErrorMessageDirective,\n GroupErrorsTemplateDirective,\n GroupErrorsComponent,\n ],\n exports:\n [\n WithErrorMessagePipe,\n ErrorMessageDirective,\n GroupErrorsTemplateDirective,\n GroupErrorsComponent,\n ]\n})\nexport class ErrorMessageModule\n{\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './errorMessage.module';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../forms/src/modules/errorMessage/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './errorMessage.module';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './withErrorMessage/withErrorMessage.pipe';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../forms/src/modules/errorMessage/pipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC","sourcesContent":["export * from './withErrorMessage/withErrorMessage.pipe';\n"]}
@@ -0,0 +1,33 @@
1
+ import { Inject, Pipe } from '@angular/core';
2
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Filters array of errors with messages
6
+ */
7
+ export class WithErrorMessagePipe {
8
+ //######################### constructor #########################
9
+ constructor(_errorMessages) {
10
+ this._errorMessages = _errorMessages;
11
+ }
12
+ //######################### public methods - implementation of PipeTransform #########################
13
+ /**
14
+ * Filters array of errors with messages
15
+ * @param value - Array of error names
16
+ */
17
+ transform(value) {
18
+ if (!(value === null || value === void 0 ? void 0 : value.length)) {
19
+ return value;
20
+ }
21
+ return value.filter(itm => this._errorMessages[itm]);
22
+ }
23
+ }
24
+ WithErrorMessagePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: WithErrorMessagePipe, deps: [{ token: VALIDATION_ERROR_MESSAGES }], target: i0.ɵɵFactoryTarget.Pipe });
25
+ WithErrorMessagePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: WithErrorMessagePipe, name: "withErrorMessage" });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: WithErrorMessagePipe, decorators: [{
27
+ type: Pipe,
28
+ args: [{ name: 'withErrorMessage' }]
29
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
30
+ type: Inject,
31
+ args: [VALIDATION_ERROR_MESSAGES]
32
+ }] }]; } });
33
+ //# sourceMappingURL=withErrorMessage.pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withErrorMessage.pipe.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;;AAEjE;;GAEG;AAEH,MAAM,OAAO,oBAAoB;IAE7B,iEAAiE;IACjE,YAAyD,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEzF,CAAC;IAED,sGAAsG;IAEtG;;;OAGG;IACI,SAAS,CAAC,KAAe;QAE5B,IAAG,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EACjB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;;iHArBQ,oBAAoB,kBAGT,yBAAyB;+GAHpC,oBAAoB;2FAApB,oBAAoB;kBADhC,IAAI;mBAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC;;0BAIf,MAAM;2BAAC,yBAAyB","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Filters array of errors with messages\n */\n@Pipe({name: 'withErrorMessage'})\nexport class WithErrorMessagePipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Filters array of errors with messages\n * @param value - Array of error names\n */\n public transform(value: string[]): string[]\n {\n if(!value?.length)\n {\n return value;\n }\n\n return value.filter(itm => this._errorMessages[itm]);\n }\n}"]}
@@ -1,6 +1,6 @@
1
1
  import { Directive, Input, EventEmitter, Output, ElementRef, Inject } from '@angular/core';
2
2
  import { DOCUMENT } from '@angular/common';
3
- import { isDescendant } from '@jscrpt/common';
3
+ import { isDescendant, isString } from '@jscrpt/common';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * Directive that handles click outside of element
@@ -15,7 +15,7 @@ export class ClickOutsideDirective {
15
15
  * Used for emitting event when click outside occurs
16
16
  */
17
17
  this.clickOutsideConditionChange = new EventEmitter();
18
- //######################### private methods #########################
18
+ //######################### protected methods #########################
19
19
  /**
20
20
  * Handles click outside of element
21
21
  * @param event - Mouse event object
@@ -30,6 +30,20 @@ export class ClickOutsideDirective {
30
30
  }
31
31
  };
32
32
  }
33
+ //######################### public properties - inputs #########################
34
+ /**
35
+ * Variable that is used for displaying element that handles click outside
36
+ */
37
+ get clickOutsideCondition() {
38
+ return this._clickOutsideCondition;
39
+ }
40
+ set clickOutsideCondition(value) {
41
+ if (isString(value) && value === '') {
42
+ this._clickOutsideCondition = true;
43
+ return;
44
+ }
45
+ this._clickOutsideCondition = value;
46
+ }
33
47
  //######################### public methods - implementation of OnInit #########################
34
48
  /**
35
49
  * Initialize component