@anglr/common 12.0.0-beta.20220413122054 → 12.0.0-beta.20220419062525

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 (165) hide show
  1. package/changelog.md +64 -2
  2. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js +3 -1
  3. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  4. package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +43 -0
  5. package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
  6. package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
  7. package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
  8. package/es2015/forms/src/components/index.js +4 -0
  9. package/es2015/forms/src/components/index.js.map +1 -0
  10. package/es2015/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +75 -0
  11. package/es2015/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -0
  12. package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +31 -0
  13. package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -0
  14. package/es2015/forms/src/directives/hasError/hasError.directive.js +38 -8
  15. package/es2015/forms/src/directives/hasError/hasError.directive.js.map +1 -1
  16. package/es2015/forms/src/directives/index.js +3 -0
  17. package/es2015/forms/src/directives/index.js.map +1 -0
  18. package/es2015/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +24 -0
  19. package/es2015/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -0
  20. package/es2015/forms/src/index.js +3 -0
  21. package/es2015/forms/src/index.js.map +1 -1
  22. package/es2015/forms/src/misc/tokens.js +4 -0
  23. package/es2015/forms/src/misc/tokens.js.map +1 -1
  24. package/es2015/forms/src/misc/validationErrorsContainerView.js +31 -0
  25. package/es2015/forms/src/misc/validationErrorsContainerView.js.map +1 -0
  26. package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +3 -2
  27. package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -1
  28. package/es2015/forms/src/modules/hasError.module.js +27 -5
  29. package/es2015/forms/src/modules/hasError.module.js.map +1 -1
  30. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +1 -1
  31. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  32. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
  33. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -145
  34. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
  35. package/es2015/positions/src/index.js +0 -7
  36. package/es2015/positions/src/index.js.map +1 -1
  37. package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js +12 -8
  38. package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -1
  39. package/es2015/src/services/position/position.interface.js.map +1 -1
  40. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js +3 -1
  41. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  42. package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +43 -0
  43. package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
  44. package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
  45. package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
  46. package/es2020/forms/src/components/index.js +4 -0
  47. package/es2020/forms/src/components/index.js.map +1 -0
  48. package/es2020/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +75 -0
  49. package/es2020/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -0
  50. package/es2020/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +31 -0
  51. package/es2020/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -0
  52. package/es2020/forms/src/directives/hasError/hasError.directive.js +37 -8
  53. package/es2020/forms/src/directives/hasError/hasError.directive.js.map +1 -1
  54. package/es2020/forms/src/directives/index.js +3 -0
  55. package/es2020/forms/src/directives/index.js.map +1 -0
  56. package/es2020/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +24 -0
  57. package/es2020/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -0
  58. package/es2020/forms/src/index.js +3 -0
  59. package/es2020/forms/src/index.js.map +1 -1
  60. package/es2020/forms/src/misc/tokens.js +4 -0
  61. package/es2020/forms/src/misc/tokens.js.map +1 -1
  62. package/es2020/forms/src/misc/validationErrorsContainerView.js +31 -0
  63. package/es2020/forms/src/misc/validationErrorsContainerView.js.map +1 -0
  64. package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +3 -2
  65. package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -1
  66. package/es2020/forms/src/modules/hasError.module.js +27 -5
  67. package/es2020/forms/src/modules/hasError.module.js.map +1 -1
  68. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +1 -1
  69. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  70. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
  71. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -143
  72. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
  73. package/es2020/positions/src/index.js +0 -7
  74. package/es2020/positions/src/index.js.map +1 -1
  75. package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js +12 -8
  76. package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -1
  77. package/es2020/src/services/position/position.interface.js.map +1 -1
  78. package/floating-ui/src/services/floatingUiDomPosition.service.d.ts.map +1 -1
  79. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.css +4 -0
  80. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts +32 -0
  81. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts.map +1 -0
  82. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html +3 -0
  83. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.css +4 -0
  84. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts +51 -0
  85. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts.map +1 -0
  86. package/forms/src/components/index.d.ts +4 -0
  87. package/forms/src/components/index.d.ts.map +1 -0
  88. package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.css +4 -0
  89. package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts +53 -0
  90. package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts.map +1 -0
  91. package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html +3 -0
  92. package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts +10 -0
  93. package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts.map +1 -0
  94. package/forms/src/directives/hasError/hasError.directive.d.ts +21 -6
  95. package/forms/src/directives/hasError/hasError.directive.d.ts.map +1 -1
  96. package/forms/src/directives/index.d.ts +3 -0
  97. package/forms/src/directives/index.d.ts.map +1 -0
  98. package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts +12 -0
  99. package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts.map +1 -0
  100. package/forms/src/index.d.ts +3 -0
  101. package/forms/src/index.d.ts.map +1 -1
  102. package/forms/src/misc/tokens.d.ts +5 -0
  103. package/forms/src/misc/tokens.d.ts.map +1 -1
  104. package/forms/src/misc/validationErrorsContainerView.d.ts +25 -0
  105. package/forms/src/misc/validationErrorsContainerView.d.ts.map +1 -0
  106. package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts.map +1 -1
  107. package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.html +1 -1
  108. package/forms/src/modules/hasError.module.d.ts +7 -1
  109. package/forms/src/modules/hasError.module.d.ts.map +1 -1
  110. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts +43 -12
  111. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts.map +1 -1
  112. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts +15 -63
  113. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts.map +1 -1
  114. package/package.json +3 -3
  115. package/positions/src/index.d.ts +0 -7
  116. package/positions/src/index.d.ts.map +1 -1
  117. package/src/modules/position/directives/positionTo/positionTo.directive.d.ts +6 -2
  118. package/src/modules/position/directives/positionTo/positionTo.directive.d.ts.map +1 -1
  119. package/src/services/position/position.interface.d.ts +4 -0
  120. package/src/services/position/position.interface.d.ts.map +1 -1
  121. package/version.bak +1 -1
  122. package/es2015/positions/src/modules/positions/directives/positionTo/positionTo.directive.js +0 -58
  123. package/es2015/positions/src/modules/positions/directives/positionTo/positionTo.directive.js.map +0 -1
  124. package/es2015/positions/src/modules/positions/modules/positions.module.js +0 -24
  125. package/es2015/positions/src/modules/positions/modules/positions.module.js.map +0 -1
  126. package/es2015/positions/src/modules/tooltip/components/tooltip/tooltip.component.js +0 -98
  127. package/es2015/positions/src/modules/tooltip/components/tooltip/tooltip.component.js.map +0 -1
  128. package/es2015/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.js +0 -230
  129. package/es2015/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +0 -1
  130. package/es2015/positions/src/modules/tooltip/misc/tokens.js +0 -6
  131. package/es2015/positions/src/modules/tooltip/misc/tokens.js.map +0 -1
  132. package/es2015/positions/src/modules/tooltip/misc/tooltip.interface.js +0 -2
  133. package/es2015/positions/src/modules/tooltip/misc/tooltip.interface.js.map +0 -1
  134. package/es2015/positions/src/modules/tooltip/modules/tooltip.module.js +0 -32
  135. package/es2015/positions/src/modules/tooltip/modules/tooltip.module.js.map +0 -1
  136. package/es2020/positions/src/modules/positions/directives/positionTo/positionTo.directive.js +0 -58
  137. package/es2020/positions/src/modules/positions/directives/positionTo/positionTo.directive.js.map +0 -1
  138. package/es2020/positions/src/modules/positions/modules/positions.module.js +0 -24
  139. package/es2020/positions/src/modules/positions/modules/positions.module.js.map +0 -1
  140. package/es2020/positions/src/modules/tooltip/components/tooltip/tooltip.component.js +0 -98
  141. package/es2020/positions/src/modules/tooltip/components/tooltip/tooltip.component.js.map +0 -1
  142. package/es2020/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.js +0 -229
  143. package/es2020/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +0 -1
  144. package/es2020/positions/src/modules/tooltip/misc/tokens.js +0 -6
  145. package/es2020/positions/src/modules/tooltip/misc/tokens.js.map +0 -1
  146. package/es2020/positions/src/modules/tooltip/misc/tooltip.interface.js +0 -2
  147. package/es2020/positions/src/modules/tooltip/misc/tooltip.interface.js.map +0 -1
  148. package/es2020/positions/src/modules/tooltip/modules/tooltip.module.js +0 -32
  149. package/es2020/positions/src/modules/tooltip/modules/tooltip.module.js.map +0 -1
  150. package/positions/src/modules/positions/directives/positionTo/positionTo.directive.d.ts +0 -34
  151. package/positions/src/modules/positions/directives/positionTo/positionTo.directive.d.ts.map +0 -1
  152. package/positions/src/modules/positions/modules/positions.module.d.ts +0 -11
  153. package/positions/src/modules/positions/modules/positions.module.d.ts.map +0 -1
  154. package/positions/src/modules/tooltip/components/tooltip/tooltip.component.css +0 -10
  155. package/positions/src/modules/tooltip/components/tooltip/tooltip.component.d.ts +0 -63
  156. package/positions/src/modules/tooltip/components/tooltip/tooltip.component.d.ts.map +0 -1
  157. package/positions/src/modules/tooltip/components/tooltip/tooltip.component.html +0 -6
  158. package/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts +0 -106
  159. package/positions/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +0 -1
  160. package/positions/src/modules/tooltip/misc/tokens.d.ts +0 -7
  161. package/positions/src/modules/tooltip/misc/tokens.d.ts.map +0 -1
  162. package/positions/src/modules/tooltip/misc/tooltip.interface.d.ts +0 -71
  163. package/positions/src/modules/tooltip/misc/tooltip.interface.d.ts.map +0 -1
  164. package/positions/src/modules/tooltip/modules/tooltip.module.d.ts +0 -13
  165. package/positions/src/modules/tooltip/modules/tooltip.module.d.ts.map +0 -1
@@ -1,46 +1,37 @@
1
- import { Injectable, Inject, InjectionToken, Optional, ComponentFactoryResolver, ApplicationRef } from '@angular/core';
2
- import { DOCUMENT } from '@angular/common';
1
+ import { Injectable, Inject, Optional } from '@angular/core';
3
2
  import { extend } from '@jscrpt/common';
4
3
  import { ErrorMessagesExtractor } from '../errorMessagesExtractor/errorMessagesExtractor.service';
4
+ import { VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS } from '../../misc/tokens';
5
+ import { DefaultValidationErrorsComponent, DefaultValidationErrorsContainerComponent } from '../../components';
5
6
  import * as i0 from "@angular/core";
6
7
  import * as i1 from "../errorMessagesExtractor/errorMessagesExtractor.service";
7
- /**
8
- * Injection token used for injecting global options for ValidationErrorRendererFactory
9
- */
10
- export const VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS = new InjectionToken('VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS');
11
- //TODO: div renderer as custom component, wrapper div renderer
12
8
  /**
13
9
  * Service used for creating validation errors renderer
14
10
  */
15
11
  export class ValidationErrorRendererFactory {
16
12
  //######################### constructor #########################
17
- constructor(_errorMessagesExtractor, _document, options) {
13
+ constructor(_errorMessagesExtractor, options) {
18
14
  this._errorMessagesExtractor = _errorMessagesExtractor;
19
- this._document = _document;
20
15
  this._options = extend(true, {}, DEFAULT_OPTIONS, options);
21
16
  }
22
17
  //######################### public methods #########################
23
18
  /**
24
19
  * Creates new instance of ValidationErrorRenderer
25
20
  * @param control - Control that is being processed for errors
26
- * @param controlElement - Html element that represents control that is being processed
21
+ * @param containerView - Class that stores view container for rendering errors
22
+ * @param injector - Injector for obtaining dependencies
27
23
  * @param isSubmittedOrDirty - Function used for testing if control is submitted or dirty
28
- * @param options - Options for validation errors renderer factory
29
24
  */
30
- create(control, controlElement, injector, isSubmittedOrDirty, options) {
31
- const opts = extend(true, {}, this._options, options);
32
- return new opts.rendererType(this._errorMessagesExtractor, control, controlElement, this._document, injector, isSubmittedOrDirty, opts);
25
+ create(control, containerView, injector, isSubmittedOrDirty) {
26
+ return new this._options.rendererType(this._errorMessagesExtractor, control, containerView, injector, isSubmittedOrDirty, this._options);
33
27
  }
34
28
  }
35
- ValidationErrorRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorRendererFactory, deps: [{ token: i1.ErrorMessagesExtractor }, { token: DOCUMENT }, { token: VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
29
+ ValidationErrorRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorRendererFactory, deps: [{ token: i1.ErrorMessagesExtractor }, { token: VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
36
30
  ValidationErrorRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorRendererFactory, providedIn: 'root' });
37
31
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorRendererFactory, decorators: [{
38
32
  type: Injectable,
39
33
  args: [{ providedIn: 'root' }]
40
- }], ctorParameters: function () { return [{ type: i1.ErrorMessagesExtractor }, { type: Document, decorators: [{
41
- type: Inject,
42
- args: [DOCUMENT]
43
- }] }, { type: undefined, decorators: [{
34
+ }], ctorParameters: function () { return [{ type: i1.ErrorMessagesExtractor }, { type: undefined, decorators: [{
44
35
  type: Optional
45
36
  }, {
46
37
  type: Inject,
@@ -51,11 +42,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
51
42
  */
52
43
  export class DefaultValidationErrorRenderer {
53
44
  //######################### constructor #########################
54
- constructor(_errorMessagesExtractor, _control, _controlElement, _document, _injector, _isSubmittedOrDirty, _options) {
45
+ constructor(_errorMessagesExtractor, _control, _containerView, _injector, _isSubmittedOrDirty, _options) {
55
46
  this._errorMessagesExtractor = _errorMessagesExtractor;
56
47
  this._control = _control;
57
- this._controlElement = _controlElement;
58
- this._document = _document;
48
+ this._containerView = _containerView;
59
49
  this._injector = _injector;
60
50
  this._isSubmittedOrDirty = _isSubmittedOrDirty;
61
51
  this._options = _options;
@@ -63,157 +53,53 @@ export class DefaultValidationErrorRenderer {
63
53
  }
64
54
  //######################### public methods - implementation of ValiDationErrorRenderer #########################
65
55
  /**
66
- * Destroys renderer and everything that was rendered
56
+ * @inheritdoc
67
57
  */
68
58
  destroy() {
69
- var _a;
70
- if (this._component) {
71
- this._injector.get(ApplicationRef).detachView(this._component.hostView);
72
- this._component.destroy();
73
- this._component = null;
74
- }
75
- (_a = this.wrapperElement) === null || _a === void 0 ? void 0 : _a.remove();
76
- this.wrapperElement = null;
59
+ this._containerView.viewContainer.clear();
60
+ this._container = null;
77
61
  }
78
62
  /**
79
- * Updates rendered errors for current state and returns true if errors were rendered, otherwise false
80
- * @param errorMessages - Object storing error messages to be used as override
81
- * @param onlyShow - Indication that update performs only displaying of existing errors
63
+ * @inheritdoc
82
64
  */
83
- update(errorMessages) {
65
+ update(options, errorMessages) {
84
66
  let result = false;
85
- //hides old errors
86
- this._toggleErrors(false);
87
67
  this._lastErrors = this._errorMessagesExtractor.getErrors(this._control, errorMessages);
68
+ //has errors
88
69
  if (this._lastErrors) {
89
70
  this._isSubmittedOrDirty(() => {
90
- this._show();
91
- this._toggleErrors();
71
+ // const errorsClasses = this._lastErrors.errors.map(error => `${this._options.prefix}${error.toLowerCase()}${this._options.suffix}`);
72
+ const opts = extend(true, {}, this._options, options);
73
+ this._container.instance.show(this._lastErrors, opts);
92
74
  result = true;
93
75
  }, () => {
94
- this._hide();
76
+ this._container.instance.hide();
95
77
  result = false;
96
78
  });
97
79
  }
98
80
  else {
99
- this._hide();
81
+ this._container.instance.hide();
100
82
  result = false;
101
83
  }
102
84
  return result;
103
85
  }
104
- //######################### protected methods #########################
105
- /**
106
- * Toggles css classes for errors that are currently set
107
- * @param add - Indication whether add or remove errors
108
- */
109
- _toggleErrors(add = true) {
110
- if (!this._lastErrors) {
111
- return;
112
- }
113
- const errorsClasses = this._lastErrors.errors.map(error => `${this._options.prefix}${error.toLowerCase()}${this._options.suffix}`);
114
- (add ? this._controlElement.classList.add : this._controlElement.classList.remove).apply(this._controlElement.classList, errorsClasses);
115
- (add ? this.wrapperElement.classList.add : this.wrapperElement.classList.remove).apply(this.wrapperElement.classList, errorsClasses);
116
- this._errorMessageAttr.value = (add ? this._lastErrors.errorMessages : [])
117
- .join(' ');
118
- this._render(add);
119
- }
120
86
  /**
121
87
  * Initialize renderer
122
88
  */
123
89
  _initialize() {
124
- this.wrapperElement = this._document.createElement('div');
125
- this._hide();
126
- this.wrapperElement.classList.add(this._options.wrapperDivClass);
127
- this._errorMessageAttr = this._document.createAttribute('data-error-message');
128
- this.wrapperElement.attributes.setNamedItem(this._errorMessageAttr);
129
- this._controlElement.after(this.wrapperElement);
130
- }
131
- /**
132
- * Renders error messages
133
- * @param add - Indication whether add or remove errors
134
- */
135
- _render(add) {
136
- if (this._options.component) {
137
- this._renderComponent(add);
138
- }
139
- else if (this._options.template) {
140
- this._renderTemplate(add);
141
- }
142
- else {
143
- this._renderDivs(add);
144
- }
145
- }
146
- /**
147
- * Renders divs with errors
148
- * @param add - Indication whether add or remove errors
149
- */
150
- _renderDivs(add = true) {
151
- var _a, _b;
152
- if (!add) {
153
- const children = this.wrapperElement.children;
154
- //first clean old messages
155
- for (let x = children.length - 1; x >= 0; x--) {
156
- children.item(x).remove();
157
- }
158
- return;
159
- }
160
- if ((_b = (_a = this._lastErrors) === null || _a === void 0 ? void 0 : _a.errorMessages) === null || _b === void 0 ? void 0 : _b.length) {
161
- this._lastErrors.errorMessages.forEach(message => {
162
- const errorDiv = this._document.createElement('div');
163
- errorDiv.innerText = message;
164
- this.wrapperElement.append(errorDiv);
165
- });
166
- }
167
- }
168
- /**
169
- * Renders component with errors
170
- * @param add - Indication whether add or remove errors
171
- */
172
- _renderComponent(add = true) {
173
- if (add) {
174
- //render component
175
- if (!this._component) {
176
- // 1. Create a component reference from the component
177
- this._component = this._injector.get(ComponentFactoryResolver)
178
- .resolveComponentFactory(this._options.component)
179
- .create(this._injector);
180
- // 2. Attach component to the appRef so that it's inside the ng component tree
181
- this._injector.get(ApplicationRef).attachView(this._component.hostView);
182
- // 3. Get DOM element from component
183
- const domElem = this._component.hostView
184
- .rootNodes[0];
185
- // 4. Append DOM element to the body
186
- this.wrapperElement.append(domElem);
187
- }
188
- this._component.instance.show(this._lastErrors);
189
- }
190
- else if (this._component) {
191
- this._component.instance.show(null);
192
- }
193
- }
194
- /**
195
- * Renders template with errors
196
- * @param add - Indication whether add or remove errors
197
- */
198
- _renderTemplate(_add = true) {
199
- }
200
- /**
201
- * Shows wrapper element
202
- */
203
- _show() {
204
- this.wrapperElement.style.display = 'block';
205
- }
206
- /**
207
- * Hides wrapper element
208
- */
209
- _hide() {
210
- this.wrapperElement.style.display = 'none';
90
+ this._container = this._containerView.viewContainer.createComponent(this._options.container, { injector: this._injector });
91
+ this._container.instance.hide();
211
92
  }
212
93
  }
94
+ /**
95
+ * Default options for validation error renderer factory
96
+ */
213
97
  const DEFAULT_OPTIONS = {
214
98
  prefix: 'ng-',
215
99
  suffix: '-error',
216
100
  wrapperDivClass: 'validation-error-div',
217
- rendererType: DefaultValidationErrorRenderer
101
+ rendererType: DefaultValidationErrorRenderer,
102
+ component: DefaultValidationErrorsComponent,
103
+ container: DefaultValidationErrorsContainerComponent,
218
104
  };
219
105
  //# sourceMappingURL=validationErrorRenderer.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validationErrorRenderer.service.js","sourceRoot":"","sources":["../../../../../forms/src/services/validationErrorRenderer/validationErrorRenderer.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAY,wBAAwB,EAAE,cAAc,EAAgC,MAAM,eAAe,CAAC;AAE9J,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0DAA0D,CAAC;;;AAIhG;;GAEG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAA0D,IAAI,cAAc,CAAwC,2CAA2C,CAAC,CAAC;AAEvN,8DAA8D;AAE9D;;GAEG;AAEH,MAAM,OAAO,8BAA8B;IASvC,iEAAiE;IACjE,YAAsB,uBAA+C,EAC7B,SAAmB,EACgB,OAA8C;QAFnG,4BAAuB,GAAvB,uBAAuB,CAAwB;QAC7B,cAAS,GAAT,SAAS,CAAU;QAGvD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,oEAAoE;IAEpE;;;;;;OAMG;IACI,MAAM,CAAC,OAAoB,EACpB,cAA2B,EAC3B,QAAkB,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AAC,CAAC;gBAE5B,8EAA8E;gBAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAExE,oCAAoC;gBACpC,MAAM,OAAO,GAAI,IAAI,CAAC,UAAU,CAAC,QAAiC;qBAC7D,SAAS,CAAC,CAAC,CAAgB,CAAC;gBAEjC,oCAAoC;gBACpC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;aACvC;YAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACnD;aACI,IAAG,IAAI,CAAC,UAAU,EACvB;YACI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,OAAgB,IAAI;IAG9C,CAAC;IAED;;OAEG;IACO,KAAK;QAEX,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAChD,CAAC;IAED;;OAEG;IACO,KAAK;QAEX,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IAC/C,CAAC;CACJ;AAED,MAAM,eAAe,GACrB;IACI,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,sBAAsB;IACvC,YAAY,EAAE,8BAA8B;CAC/C,CAAC","sourcesContent":["import {Injectable, Inject, InjectionToken, Optional, Injector, ComponentFactoryResolver, ApplicationRef, EmbeddedViewRef, ComponentRef} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {DOCUMENT} from '@angular/common';\nimport {extend, StringDictionary} from '@jscrpt/common';\n\nimport {ErrorMessagesExtractor} from '../errorMessagesExtractor/errorMessagesExtractor.service';\nimport {ValidationErrorRenderer, IsSubmittedOrDirtyFunc, ValidationErrorsRendererOptions, ValidationErrorRendererFactoryOptions, ValidationErrorsComponent} from './validationErrorRenderer.interface';\nimport {ValidationErrorsResult} from '../errorMessagesExtractor/errorMessagesExtractor.interface';\n\n/**\n * Injection token used for injecting global options for ValidationErrorRendererFactory\n */\nexport const VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS: InjectionToken<ValidationErrorRendererFactoryOptions> = new InjectionToken<ValidationErrorRendererFactoryOptions>('VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS');\n\n//TODO: div renderer as custom component, wrapper div renderer\n\n/**\n * Service used for creating validation errors renderer\n */\n@Injectable({providedIn: 'root'})\nexport class ValidationErrorRendererFactory\n{\n //######################### protected fields #########################\n\n /**\n * Options for validation error renderer factory\n */\n protected _options: ValidationErrorRendererFactoryOptions;\n\n //######################### constructor #########################\n constructor(protected _errorMessagesExtractor: ErrorMessagesExtractor,\n @Inject(DOCUMENT) protected _document: Document,\n @Optional() @Inject(VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS) options: ValidationErrorRendererFactoryOptions)\n {\n this._options = extend(true, {}, DEFAULT_OPTIONS, options);\n }\n\n //######################### public methods #########################\n\n /**\n * Creates new instance of ValidationErrorRenderer\n * @param control - Control that is being processed for errors\n * @param controlElement - Html element that represents control that is being processed\n * @param isSubmittedOrDirty - Function used for testing if control is submitted or dirty\n * @param options - Options for validation errors renderer factory\n */\n public create(control: FormControl,\n controlElement: HTMLElement,\n injector: Injector,\n isSubmittedOrDirty: IsSubmittedOrDirtyFunc,\n options: ValidationErrorRendererFactoryOptions): ValidationErrorRenderer\n {\n const opts: ValidationErrorRendererFactoryOptions = extend(true, {}, this._options, options);\n\n return new opts.rendererType(this._errorMessagesExtractor,\n control,\n controlElement,\n this._document,\n injector,\n isSubmittedOrDirty,\n opts);\n }\n}\n\n/**\n * Default implementation of validation error renderer\n */\nexport class DefaultValidationErrorRenderer implements ValidationErrorRenderer\n{\n //######################### protected fields #########################\n\n /**\n * Html element attribute storing error messages\n */\n protected _errorMessageAttr: Attr;\n\n /**\n * Object storing last obtained errors\n */\n protected _lastErrors: ValidationErrorsResult;\n\n /**\n * Component used for displaying errors\n */\n protected _component: ComponentRef<ValidationErrorsComponent>;\n\n //######################### public properties - implementation of ValidationErrorRenderer #########################\n\n /**\n * Html element that is wrapping errors\n */\n public wrapperElement: HTMLElement;\n\n //######################### constructor #########################\n constructor(protected _errorMessagesExtractor: ErrorMessagesExtractor,\n protected _control: FormControl,\n protected _controlElement: HTMLElement,\n protected _document: Document,\n protected _injector: Injector,\n protected _isSubmittedOrDirty: IsSubmittedOrDirtyFunc,\n protected _options: ValidationErrorsRendererOptions)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of ValiDationErrorRenderer #########################\n\n /**\n * Destroys renderer and everything that was rendered\n */\n public destroy(): void\n {\n if(this._component)\n {\n this._injector.get(ApplicationRef).detachView(this._component.hostView);\n this._component.destroy();\n this._component = null;\n }\n\n this.wrapperElement?.remove();\n this.wrapperElement = null;\n }\n\n /**\n * Updates rendered errors for current state and returns true if errors were rendered, otherwise false\n * @param errorMessages - Object storing error messages to be used as override\n * @param onlyShow - Indication that update performs only displaying of existing errors\n */\n public update(errorMessages?: StringDictionary): boolean\n {\n let result = false;\n\n //hides old errors\n this._toggleErrors(false);\n this._lastErrors = this._errorMessagesExtractor.getErrors(this._control, errorMessages);\n\n if(this._lastErrors)\n {\n this._isSubmittedOrDirty(() =>\n {\n this._show();\n this._toggleErrors();\n result = true;\n },\n () =>\n {\n this._hide();\n result = false;\n });\n }\n else\n {\n this._hide();\n result = false;\n }\n\n return result;\n }\n\n //######################### protected methods #########################\n\n /**\n * Toggles css classes for errors that are currently set\n * @param add - Indication whether add or remove errors\n */\n protected _toggleErrors(add: boolean = true): void\n {\n if(!this._lastErrors)\n {\n return;\n }\n\n const errorsClasses = this._lastErrors.errors.map(error => `${this._options.prefix}${error.toLowerCase()}${this._options.suffix}`);\n\n (add ? this._controlElement.classList.add : this._controlElement.classList.remove).apply(this._controlElement.classList, errorsClasses);\n (add ? this.wrapperElement.classList.add : this.wrapperElement.classList.remove).apply(this.wrapperElement.classList, errorsClasses);\n\n this._errorMessageAttr.value = (add ? this._lastErrors.errorMessages : [])\n .join(' ');\n\n this._render(add);\n }\n\n /**\n * Initialize renderer\n */\n protected _initialize(): void\n {\n this.wrapperElement = this._document.createElement('div');\n this._hide();\n this.wrapperElement.classList.add(this._options.wrapperDivClass);\n\n this._errorMessageAttr = this._document.createAttribute('data-error-message');\n\n this.wrapperElement.attributes.setNamedItem(this._errorMessageAttr);\n this._controlElement.after(this.wrapperElement);\n }\n\n /**\n * Renders error messages\n * @param add - Indication whether add or remove errors\n */\n protected _render(add: boolean): void\n {\n if(this._options.component)\n {\n this._renderComponent(add);\n }\n else if(this._options.template)\n {\n this._renderTemplate(add);\n }\n else\n {\n this._renderDivs(add);\n }\n }\n\n /**\n * Renders divs with errors\n * @param add - Indication whether add or remove errors\n */\n protected _renderDivs(add: boolean = true): void\n {\n if(!add)\n {\n const children = this.wrapperElement.children;\n \n //first clean old messages\n for(let x = children.length - 1; x >= 0; x--)\n {\n children.item(x).remove();\n }\n\n return;\n }\n\n if(this._lastErrors?.errorMessages?.length)\n {\n this._lastErrors.errorMessages.forEach(message =>\n {\n const errorDiv = this._document.createElement('div');\n\n errorDiv.innerText = message;\n\n this.wrapperElement.append(errorDiv);\n });\n }\n }\n\n /**\n * Renders component with errors\n * @param add - Indication whether add or remove errors\n */\n protected _renderComponent(add: boolean = true): void\n {\n if(add)\n {\n //render component\n if(!this._component)\n {\n // 1. Create a component reference from the component \n this._component = this._injector.get(ComponentFactoryResolver)\n .resolveComponentFactory(this._options.component)\n .create(this._injector);\n\n // 2. Attach component to the appRef so that it's inside the ng component tree\n this._injector.get(ApplicationRef).attachView(this._component.hostView);\n\n // 3. Get DOM element from component\n const domElem = (this._component.hostView as EmbeddedViewRef<any>)\n .rootNodes[0] as HTMLElement;\n\n // 4. Append DOM element to the body\n this.wrapperElement.append(domElem);\n }\n\n this._component.instance.show(this._lastErrors);\n }\n else if(this._component)\n {\n this._component.instance.show(null);\n }\n }\n\n /**\n * Renders template with errors\n * @param add - Indication whether add or remove errors\n */\n protected _renderTemplate(_add: boolean = true): void\n {\n\n }\n\n /**\n * Shows wrapper element\n */\n protected _show(): void\n {\n this.wrapperElement.style.display = 'block';\n }\n\n /**\n * Hides wrapper element\n */\n protected _hide(): void\n {\n this.wrapperElement.style.display = 'none';\n }\n}\n\nconst DEFAULT_OPTIONS: ValidationErrorRendererFactoryOptions =\n{\n prefix: 'ng-',\n suffix: '-error',\n wrapperDivClass: 'validation-error-div',\n rendererType: DefaultValidationErrorRenderer\n};"]}
1
+ {"version":3,"file":"validationErrorRenderer.service.js","sourceRoot":"","sources":["../../../../../forms/src/services/validationErrorRenderer/validationErrorRenderer.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAC,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0DAA0D,CAAC;AAGhG,OAAO,EAAC,yCAAyC,EAAC,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAC,gCAAgC,EAAE,yCAAyC,EAAC,MAAM,kBAAkB,CAAC;;;AAE7G;;GAEG;AAEH,MAAM,OAAO,8BAA8B;IASvC,iEAAiE;IACjE,YAAsB,uBAA+C,EACM,OAA8C;QADnG,4BAAuB,GAAvB,uBAAuB,CAAwB;QAGjE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,oEAAoE;IAEpE;;;;;;OAMG;IACI,MAAM,CAAC,OAAoB,EACpB,aAA4C,EAC5C,QAAkB,EAClB,kBAA0C;QAEpD,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC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AAE,OAAO,CAAC,CAAC;gBAEtD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBACtD,MAAM,GAAG,IAAI,CAAC;YAClB,CAAC,EACD,GAAG,EAAE;gBAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAChC,MAAM,GAAG,KAAK,CAAC;YACnB,CAAC,CAAC,CAAC;SAC/B;aAED;YACI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChC,MAAM,GAAG,KAAK,CAAC;SAClB;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACO,WAAW;QAEjB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAC,CAAC,CAAC;QACzH,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,eAAe,GACrB;IACI,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,sBAAsB;IACvC,YAAY,EAAE,8BAA8B;IAC5C,SAAS,EAAE,gCAAgC;IAC3C,SAAS,EAAE,yCAAyC;CACvD,CAAC","sourcesContent":["import {Injectable, Inject, Optional, Injector, ComponentRef} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {extend, StringDictionary} from '@jscrpt/common';\n\nimport {ErrorMessagesExtractor} from '../errorMessagesExtractor/errorMessagesExtractor.service';\nimport {ValidationErrorRenderer, IsSubmittedOrDirtyFunc, ValidationErrorsRendererOptions, ValidationErrorRendererFactoryOptions, ValidationErrorsContainerComponent} from './validationErrorRenderer.interface';\nimport {ValidationErrorsResult} from '../errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS} from '../../misc/tokens';\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\nimport {DefaultValidationErrorsComponent, DefaultValidationErrorsContainerComponent} from '../../components';\n\n/**\n * Service used for creating validation errors renderer\n */\n@Injectable({providedIn: 'root'})\nexport class ValidationErrorRendererFactory\n{\n //######################### protected fields #########################\n\n /**\n * Options for validation error renderer factory\n */\n protected _options: ValidationErrorRendererFactoryOptions;\n\n //######################### constructor #########################\n constructor(protected _errorMessagesExtractor: ErrorMessagesExtractor,\n @Optional() @Inject(VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS) options: ValidationErrorRendererFactoryOptions)\n {\n this._options = extend(true, {}, DEFAULT_OPTIONS, options);\n }\n\n //######################### public methods #########################\n\n /**\n * Creates new instance of ValidationErrorRenderer\n * @param control - Control that is being processed for errors\n * @param containerView - Class that stores view container for rendering errors\n * @param injector - Injector for obtaining dependencies\n * @param isSubmittedOrDirty - Function used for testing if control is submitted or dirty\n */\n public create(control: FormControl,\n containerView: ValidationErrorsContainerView,\n injector: Injector,\n isSubmittedOrDirty: IsSubmittedOrDirtyFunc): ValidationErrorRenderer\n {\n return new this._options.rendererType(this._errorMessagesExtractor,\n control,\n containerView,\n injector,\n isSubmittedOrDirty,\n this._options);\n }\n}\n\n/**\n * Default implementation of validation error renderer\n */\nexport class DefaultValidationErrorRenderer implements ValidationErrorRenderer\n{\n //######################### protected fields #########################\n\n /**\n * Object storing last obtained errors\n */\n protected _lastErrors: ValidationErrorsResult;\n\n /**\n * Component used as validation errors container\n */\n protected _container: ComponentRef<ValidationErrorsContainerComponent>;\n\n //######################### constructor #########################\n constructor(protected _errorMessagesExtractor: ErrorMessagesExtractor,\n protected _control: FormControl,\n protected _containerView: ValidationErrorsContainerView,\n protected _injector: Injector,\n protected _isSubmittedOrDirty: IsSubmittedOrDirtyFunc,\n protected _options: ValidationErrorsRendererOptions)\n {\n this._initialize();\n }\n\n //######################### public methods - implementation of ValiDationErrorRenderer #########################\n\n /**\n * @inheritdoc\n */\n public destroy(): void\n {\n this._containerView.viewContainer.clear();\n this._container = null;\n }\n\n /**\n * @inheritdoc\n */\n public update(options: ValidationErrorsRendererOptions, errorMessages?: StringDictionary): boolean\n {\n let result = false;\n this._lastErrors = this._errorMessagesExtractor.getErrors(this._control, errorMessages);\n\n //has errors\n if(this._lastErrors)\n {\n this._isSubmittedOrDirty(() =>\n {\n // const errorsClasses = this._lastErrors.errors.map(error => `${this._options.prefix}${error.toLowerCase()}${this._options.suffix}`);\n const opts = extend(true, {}, this._options, options);\n\n this._container.instance.show(this._lastErrors, opts);\n result = true;\n },\n () =>\n {\n this._container.instance.hide();\n result = false;\n });\n }\n else\n {\n this._container.instance.hide();\n result = false;\n }\n\n return result;\n }\n\n /**\n * Initialize renderer\n */\n protected _initialize(): void\n {\n this._container = this._containerView.viewContainer.createComponent(this._options.container, {injector: this._injector});\n this._container.instance.hide();\n }\n}\n\n/**\n * Default options for validation error renderer factory\n */\nconst DEFAULT_OPTIONS: ValidationErrorRendererFactoryOptions =\n{\n prefix: 'ng-',\n suffix: '-error',\n wrapperDivClass: 'validation-error-div',\n rendererType: DefaultValidationErrorRenderer,\n component: DefaultValidationErrorsComponent,\n container: DefaultValidationErrorsContainerComponent,\n};"]}
@@ -1,9 +1,2 @@
1
1
  export * from './misc/utils';
2
- export * from './modules/positions/directives/positionTo/positionTo.directive';
3
- export * from './modules/positions/modules/positions.module';
4
- export * from './modules/tooltip/components/tooltip/tooltip.component';
5
- export * from './modules/tooltip/directives/tooltip/tooltip.directive';
6
- export * from './modules/tooltip/misc/tokens';
7
- export * from './modules/tooltip/misc/tooltip.interface';
8
- export * from './modules/tooltip/modules/tooltip.module';
9
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../positions/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gEAAgE,CAAC;AAC/E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wDAAwD,CAAC;AACvE,cAAc,wDAAwD,CAAC;AACvE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC","sourcesContent":["export * from './misc/utils';\nexport * from './modules/positions/directives/positionTo/positionTo.directive';\nexport * from './modules/positions/modules/positions.module';\nexport * from './modules/tooltip/components/tooltip/tooltip.component';\nexport * from './modules/tooltip/directives/tooltip/tooltip.directive';\nexport * from './modules/tooltip/misc/tokens';\nexport * from './modules/tooltip/misc/tooltip.interface';\nexport * from './modules/tooltip/modules/tooltip.module';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../positions/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './misc/utils';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Directive, Input, ElementRef, Inject } from '@angular/core';
2
+ import { Directive, Input, ElementRef, Inject, Output, EventEmitter } from '@angular/core';
3
3
  import { nameof, isPresent, isString } from '@jscrpt/common';
4
4
  import { applyPositionResult, PositionPlacement } from '../../../../services/position';
5
5
  import { POSITION } from '../../../../types/tokens';
@@ -8,16 +8,15 @@ import * as i0 from "@angular/core";
8
8
  * Sets position of attached element relative to provided element
9
9
  */
10
10
  export class PositionToDirective {
11
- // //######################### public properties - outputs #########################
12
- // /**
13
- // * Occurs when flip occurs during positioning
14
- // */
15
- // @Output()
16
- // public flip: EventEmitter<void> = new EventEmitter<void>();
17
11
  //######################### constructor #########################
18
12
  constructor(_target, _position) {
19
13
  this._target = _target;
20
14
  this._position = _position;
15
+ // //######################### public properties - outputs #########################
16
+ /**
17
+ * Occurs when flip occurs during positioning
18
+ */
19
+ this.flip = new EventEmitter();
21
20
  }
22
21
  //######################### public properties - inputs #########################
23
22
  /**
@@ -69,11 +68,14 @@ export class PositionToDirective {
69
68
  }
70
69
  const result = yield this._position.placeElement(this._target.nativeElement, this._source, options).toPromise();
71
70
  applyPositionResult(result);
71
+ if (result.flip) {
72
+ this.flip.next();
73
+ }
72
74
  });
73
75
  }
74
76
  }
75
77
  PositionToDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: PositionToDirective, deps: [{ token: i0.ElementRef }, { token: POSITION }], target: i0.ɵɵFactoryTarget.Directive });
76
- PositionToDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement" }, usesOnChanges: true, ngImport: i0 });
78
+ PositionToDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement" }, outputs: { flip: "flip" }, usesOnChanges: true, ngImport: i0 });
77
79
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: PositionToDirective, decorators: [{
78
80
  type: Directive,
79
81
  args: [{
@@ -87,5 +89,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
87
89
  args: ['positionTo']
88
90
  }], placement: [{
89
91
  type: Input
92
+ }], flip: [{
93
+ type: Output
90
94
  }] } });
91
95
  //# sourceMappingURL=positionTo.directive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"positionTo.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/position/directives/positionTo/positionTo.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAA4B,MAAM,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAY,iBAAiB,EAAkB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AG,IAAI,CAAC,UAAU,EAClB;gBACI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;aACvC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAC1B,IAAI,CAAC,OAAO,EACZ,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;YAEtE,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;KAAA;;gHA1GQ,mBAAmB,4CAkER,QAAQ;oGAlEnB,mBAAmB;2FAAnB,mBAAmB;kBAJ/B,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;iBAC3B;;0BAmEgB,MAAM;2BAAC,QAAQ;4CA9CjB,MAAM;sBADhB,KAAK;uBAAC,YAAY;gBAqBR,SAAS;sBADnB,KAAK","sourcesContent":["import {Directive, Input, ElementRef, OnChanges, SimpleChanges, Inject} from '@angular/core';\nimport {nameof, isPresent, isString} from '@jscrpt/common';\n\nimport {applyPositionResult, Position, PositionPlacement, PositionOptions} from '../../../../services/position';\nimport {POSITION} from '../../../../types/tokens';\n\n/**\n * Sets position of attached element relative to provided element\n */\n@Directive(\n{\n selector: '[positionTo]'\n})\nexport class PositionToDirective implements OnChanges\n{\n //######################### protected fields #########################\n\n /**\n * Position placement value\n */\n protected _placement: PositionPlacement|null|undefined;\n\n /**\n * Html element which is used as source for positioning\n */\n protected _source!: HTMLElement;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets html element which is used as source for positioning\n */\n @Input('positionTo')\n public get source(): HTMLElement\n {\n return this._source;\n }\n public set source(value: HTMLElement)\n {\n if(value instanceof ElementRef)\n {\n this._source = (value as ElementRef).nativeElement;\n\n return;\n }\n\n this._source = value;\n }\n\n /**\n * Gets or sets position placement value\n */\n @Input()\n public get placement(): PositionPlacement|null|undefined\n {\n return this._placement;\n }\n public set placement(value: PositionPlacement|null|undefined)\n {\n if(isString(value))\n {\n this._placement = PositionPlacement[value as keyof typeof PositionPlacement];\n\n return;\n }\n\n this._placement = value;\n }\n\n // //######################### public properties - outputs #########################\n\n // /**\n // * Occurs when flip occurs during positioning\n // */\n // @Output()\n // public flip: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(protected _target: ElementRef<HTMLElement>,\n @Inject(POSITION) protected _position: Position)\n {\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<PositionToDirective>('source') in changes ||\n nameof<PositionToDirective>('placement') in changes) &&\n isPresent(this.source))\n {\n this._applyPosition();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Applies position according to specified parameters to specified elements\n */\n protected async _applyPosition(): Promise<void>\n {\n const options: Partial<PositionOptions> =\n {\n };\n\n if(this._placement)\n {\n options.placement = this._placement;\n }\n\n const result = await this._position.placeElement(this._target.nativeElement,\n this._source,\n options).toPromise();\n\n applyPositionResult(result);\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `placement` input\n */\n public static ngAcceptInputType_placement: PositionPlacement|undefined|null|keyof typeof PositionPlacement;\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `positionTo` input\n */\n public static ngAcceptInputType_positionTo: HTMLElement|ElementRef<HTMLElement>;\n}\n"]}
1
+ {"version":3,"file":"positionTo.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/position/directives/positionTo/positionTo.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAA4B,MAAM,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAY,iBAAiB,EAAkB,MAAM,+BAA+B,CAAC;AAChH,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;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C;aACvC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAC1B,IAAI,CAAC,OAAO,EACZ,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;YAEtE,mBAAmB,CAAC,MAAM,CAAC,CAAC;YAE5B,IAAG,MAAM,CAAC,IAAI,EACd;gBACI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aACpB;QACL,CAAC;KAAA;;gHA/GQ,mBAAmB,4CAkER,QAAQ;oGAlEnB,mBAAmB;2FAAnB,mBAAmB;kBAJ/B,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;iBAC3B;;0BAmEgB,MAAM;2BAAC,QAAQ;4CA9CjB,MAAM;sBADhB,KAAK;uBAAC,YAAY;gBAqBR,SAAS;sBADnB,KAAK;gBAuBC,IAAI;sBADV,MAAM","sourcesContent":["import {Directive, Input, ElementRef, OnChanges, SimpleChanges, Inject, Output, EventEmitter} from '@angular/core';\nimport {nameof, isPresent, isString} from '@jscrpt/common';\n\nimport {applyPositionResult, Position, PositionPlacement, PositionOptions} from '../../../../services/position';\nimport {POSITION} from '../../../../types/tokens';\n\n/**\n * Sets position of attached element relative to provided element\n */\n@Directive(\n{\n selector: '[positionTo]'\n})\nexport class PositionToDirective implements OnChanges\n{\n //######################### protected fields #########################\n\n /**\n * Position placement value\n */\n protected _placement: PositionPlacement|null|undefined;\n\n /**\n * Html element which is used as source for positioning\n */\n protected _source!: HTMLElement;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets html element which is used as source for positioning\n */\n @Input('positionTo')\n public get source(): HTMLElement\n {\n return this._source;\n }\n public set source(value: HTMLElement)\n {\n if(value instanceof ElementRef)\n {\n this._source = (value as ElementRef).nativeElement;\n\n return;\n }\n\n this._source = value;\n }\n\n /**\n * Gets or sets position placement value\n */\n @Input()\n public get placement(): PositionPlacement|null|undefined\n {\n return this._placement;\n }\n public set placement(value: PositionPlacement|null|undefined)\n {\n if(isString(value))\n {\n this._placement = PositionPlacement[value as keyof typeof PositionPlacement];\n\n return;\n }\n\n this._placement = value;\n }\n\n // //######################### public properties - outputs #########################\n\n /**\n * Occurs when flip occurs during positioning\n */\n @Output()\n public flip: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(protected _target: ElementRef<HTMLElement>,\n @Inject(POSITION) protected _position: Position)\n {\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<PositionToDirective>('source') in changes ||\n nameof<PositionToDirective>('placement') in changes) &&\n isPresent(this.source))\n {\n this._applyPosition();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Applies position according to specified parameters to specified elements\n */\n protected async _applyPosition(): Promise<void>\n {\n const options: Partial<PositionOptions> =\n {\n };\n\n if(this._placement)\n {\n options.placement = this._placement;\n }\n\n const result = await this._position.placeElement(this._target.nativeElement,\n this._source,\n options).toPromise();\n\n applyPositionResult(result);\n\n if(result.flip)\n {\n this.flip.next();\n }\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `placement` input\n */\n public static ngAcceptInputType_placement: PositionPlacement|undefined|null|keyof typeof PositionPlacement;\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `positionTo` input\n */\n public static ngAcceptInputType_positionTo: HTMLElement|ElementRef<HTMLElement>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\nimport {PositionOffset, PositionPlacement} from './position.types';\n\n/**\n * Options for autoupdate specific functionality\n */\nexport interface AutoUpdateOptions\n{\n /**\n * Indication whether update position when ancestor scroll changes\n */\n ancestorScroll: boolean;\n\n /**\n * Indication whether update position when ancestor size changes\n */\n ancestorResize: boolean;\n\n /**\n * Indication whether update position when target element changes size\n */\n elementResize: boolean;\n}\n\n/**\n * Options that are passed to position service\n */\nexport interface PositionOptions\n{\n //######################### properties #########################\n\n /**\n * Placement of target element against source element\n */\n placement: PositionPlacement;\n\n /**\n * Offset which allows moving target element along the cross axis of placement\n */\n offset: PositionOffset;\n\n /**\n * Indication whether perform flip in case of collision (with view boundaries)\n */\n flip: boolean;\n\n /**\n * Indication whether set up 'auto updating' of position\n */\n autoUpdate: boolean|AutoUpdateOptions;\n\n /**\n * Mouse event that occured when positioning was called\n */\n mouseEvent?: MouseEvent;\n}\n\n/**\n * Result of positioning process, storing new coordinates\n */\nexport interface PositionResult<TElement extends Element = any>\n{\n /**\n * Target element to be positioned\n */\n target: TElement;\n\n /**\n * X coordinate of position of target\n */\n x: number;\n\n /**\n * Y coordinate of position of target\n */\n y: number;\n\n /**\n * Disposes instance of engine used for positioning\n */\n dispose(): void;\n}\n\n/**\n * Service that is used for positioning two elements against each other\n */\nexport interface Position\n{\n //######################### methods #########################\n\n /**\n * Places target element relatively to source element according options and returns result storing information about new position\n * @param target - Target element to be placed\n * @param source - Source element to be placed against\n * @param options - Optional options with informations about new position\n */\n placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;\n}\n"]}
1
+ {"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\nimport {PositionOffset, PositionPlacement} from './position.types';\n\n/**\n * Options for autoupdate specific functionality\n */\nexport interface AutoUpdateOptions\n{\n /**\n * Indication whether update position when ancestor scroll changes\n */\n ancestorScroll: boolean;\n\n /**\n * Indication whether update position when ancestor size changes\n */\n ancestorResize: boolean;\n\n /**\n * Indication whether update position when target element changes size\n */\n elementResize: boolean;\n}\n\n/**\n * Options that are passed to position service\n */\nexport interface PositionOptions\n{\n //######################### properties #########################\n\n /**\n * Placement of target element against source element\n */\n placement: PositionPlacement;\n\n /**\n * Offset which allows moving target element along the cross axis of placement\n */\n offset: PositionOffset;\n\n /**\n * Indication whether perform flip in case of collision (with view boundaries)\n */\n flip: boolean;\n\n /**\n * Indication whether set up 'auto updating' of position\n */\n autoUpdate: boolean|AutoUpdateOptions;\n\n /**\n * Mouse event that occured when positioning was called\n */\n mouseEvent?: MouseEvent;\n}\n\n/**\n * Result of positioning process, storing new coordinates\n */\nexport interface PositionResult<TElement extends Element = any>\n{\n /**\n * Target element to be positioned\n */\n target: TElement;\n\n /**\n * X coordinate of position of target\n */\n x: number;\n\n /**\n * Y coordinate of position of target\n */\n y: number;\n\n /**\n * Indication whether there was flip applied\n */\n flip: boolean;\n\n /**\n * Disposes instance of engine used for positioning\n */\n dispose(): void;\n}\n\n/**\n * Service that is used for positioning two elements against each other\n */\nexport interface Position\n{\n //######################### methods #########################\n\n /**\n * Places target element relatively to source element according options and returns result storing information about new position\n * @param target - Target element to be placed\n * @param source - Source element to be placed against\n * @param options - Optional options with informations about new position\n */\n placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Injectable } from '@angular/core';
2
2
  import { PositionOffset, PositionPlacement, POSITION } from '@anglr/common';
3
- import { extend } from '@jscrpt/common';
3
+ import { extend, isEmptyObject } from '@jscrpt/common';
4
4
  import { computePosition, autoUpdate, offset, flip } from '@floating-ui/dom';
5
5
  import { Observable } from 'rxjs';
6
6
  import * as i0 from "@angular/core";
@@ -37,6 +37,7 @@ export class FloatingUiDomPosition {
37
37
  subscriber.next({
38
38
  target,
39
39
  dispose,
40
+ flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),
40
41
  x: result.x,
41
42
  y: result.y
42
43
  });
@@ -63,6 +64,7 @@ export class FloatingUiDomPosition {
63
64
  subscriber.next({
64
65
  target,
65
66
  dispose,
67
+ flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),
66
68
  x: result.x,
67
69
  y: result.y
68
70
  });
@@ -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,KAAK,IAAI,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,GAAG,KAAK,IAAI,EAAE;oBAE9B,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,EACN,MAAqB,EACrB;wBACI,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;wBAC9C,UAAU,EAAE,WAAW;qBAC1B,CAAC,CAAC;oBA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BAAiB,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.x - (options.mouseEvent.target as HTMLElement).getBoundingClientRect().x\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":"","sources":["../../../../floating-ui/src/services/floatingUiDomPosition.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAC,MAAM,eAAe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AS;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;;kHAxPQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AA4PX;;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, isEmptyObject} 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 flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\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 flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\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.x - (options.mouseEvent.target as HTMLElement).getBoundingClientRect().x\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};"]}
@@ -0,0 +1,43 @@
1
+ import { Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core';
2
+ import { slideInOutTrigger, animateChildrenTrigger } from '@anglr/animations';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/common";
5
+ /**
6
+ * Default validation errors component, displaying validation errors
7
+ */
8
+ export class DefaultValidationErrorsComponent {
9
+ //######################### constructor #########################
10
+ constructor(_changeDetector) {
11
+ this._changeDetector = _changeDetector;
12
+ //######################### public properties - host #########################
13
+ /**
14
+ * Enables leave animations for internal stuff
15
+ */
16
+ this.animate = true;
17
+ }
18
+ //######################### public methods - implementation of ValidationErrorsComponent #########################
19
+ /**
20
+ * @inheritdoc
21
+ */
22
+ show(errors, options) {
23
+ this.errors = errors;
24
+ this.options = options;
25
+ this._changeDetector.detectChanges();
26
+ }
27
+ }
28
+ DefaultValidationErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
29
+ DefaultValidationErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DefaultValidationErrorsComponent, selector: "default-validation-errors", host: { properties: { "@animateChildren": "this.animate" } }, ngImport: i0, template: "<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>", styles: [":host\n{\n display: contents;\n}"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], animations: [
30
+ slideInOutTrigger,
31
+ animateChildrenTrigger
32
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsComponent, decorators: [{
34
+ type: Component,
35
+ args: [{ selector: 'default-validation-errors', animations: [
36
+ slideInOutTrigger,
37
+ animateChildrenTrigger
38
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>", styles: [":host\n{\n display: contents;\n}"] }]
39
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { animate: [{
40
+ type: HostBinding,
41
+ args: ['@animateChildren']
42
+ }] } });
43
+ //# sourceMappingURL=defaultValidationErrors.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultValidationErrors.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.ts","../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACjG,OAAO,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;;;AAK5E;;GAEG;AAaH,MAAM,OAAO,gCAAgC;IAwBzC,iEAAiE;IACjE,YAAsB,eAAkC;QAAlC,oBAAe,GAAf,eAAe,CAAmB;QATxD,8EAA8E;QAE9E;;WAEG;QAEI,YAAO,GAAY,IAAI,CAAC;IAK/B,CAAC;IAED,kHAAkH;IAElH;;OAEG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAgC;QAExE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC;;6HAxCQ,gCAAgC;iHAAhC,gCAAgC,+HCrB7C,kLAEM,mVDaF;QACI,iBAAiB;QACjB,sBAAsB;KACzB;2FAGQ,gCAAgC;kBAZ5C,SAAS;+BAEI,2BAA2B,cAIrC;wBACI,iBAAiB;wBACjB,sBAAsB;qBACzB,mBACgB,uBAAuB,CAAC,MAAM;wGAwBxC,OAAO;sBADb,WAAW;uBAAC,kBAAkB","sourcesContent":["import {Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding} from '@angular/core';\nimport {slideInOutTrigger, animateChildrenTrigger} from '@anglr/animations';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsOptions} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n/**\n * Default validation errors component, displaying validation errors\n */\n@Component(\n{\n selector: 'default-validation-errors',\n templateUrl: 'defaultValidationErrors.component.html',\n styleUrls: ['defaultValidationErrors.component.css'],\n animations: \n [\n slideInOutTrigger,\n animateChildrenTrigger\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultValidationErrorsComponent implements ValidationErrorsComponent\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n public errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n public options: ValidationErrorsOptions;\n\n //######################### public properties - host #########################\n\n /**\n * Enables leave animations for internal stuff\n */\n @HostBinding('@animateChildren')\n public animate: boolean = true;\n\n //######################### constructor #########################\n constructor(protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of ValidationErrorsComponent #########################\n\n /**\n * @inheritdoc\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsOptions): void\n {\n this.errors = errors;\n this.options = options;\n\n this._changeDetector.detectChanges();\n }\n}","<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>"]}