@anglr/common 14.2.0 → 15.0.0-beta.20221026052356

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 (66) hide show
  1. package/changelog.md +44 -0
  2. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js +80 -62
  3. package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  4. package/es2015/material/src/directives/confirmationDialog/confirmationDialog.directive.js +7 -5
  5. package/es2015/material/src/directives/confirmationDialog/confirmationDialog.directive.js.map +1 -1
  6. package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js +55 -19
  7. package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -1
  8. package/es2015/src/modules/progressIndicator/interceptors/progressInterceptor.js +1 -1
  9. package/es2015/src/modules/progressIndicator/interceptors/progressInterceptor.js.map +1 -1
  10. package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js +6 -6
  11. package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
  12. package/es2015/src/services/position/position.interface.js.map +1 -1
  13. package/es2015/src/services/position/position.types.js.map +1 -1
  14. package/es2015/src/utils/index.js +1 -1
  15. package/es2015/src/utils/index.js.map +1 -1
  16. package/es2015/structured-log/src/services/rest/restSink.service.js +4 -2
  17. package/es2015/structured-log/src/services/rest/restSink.service.js.map +1 -1
  18. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js +80 -62
  19. package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
  20. package/es2020/material/src/directives/confirmationDialog/confirmationDialog.directive.js +6 -5
  21. package/es2020/material/src/directives/confirmationDialog/confirmationDialog.directive.js.map +1 -1
  22. package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js +56 -19
  23. package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -1
  24. package/es2020/src/modules/progressIndicator/interceptors/progressInterceptor.js +1 -1
  25. package/es2020/src/modules/progressIndicator/interceptors/progressInterceptor.js.map +1 -1
  26. package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js +6 -6
  27. package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
  28. package/es2020/src/services/position/position.interface.js.map +1 -1
  29. package/es2020/src/services/position/position.types.js.map +1 -1
  30. package/es2020/src/utils/index.js +1 -1
  31. package/es2020/src/utils/index.js.map +1 -1
  32. package/es2020/structured-log/src/services/rest/restSink.service.js +3 -2
  33. package/es2020/structured-log/src/services/rest/restSink.service.js.map +1 -1
  34. package/floating-ui/src/services/floatingUiDomPosition.service.d.ts.map +1 -1
  35. package/material/src/directives/confirmationDialog/confirmationDialog.directive.d.ts +4 -4
  36. package/material/src/directives/confirmationDialog/confirmationDialog.directive.d.ts.map +1 -1
  37. package/package.json +31 -28
  38. package/src/modules/position/directives/positionTo/positionTo.directive.d.ts +35 -14
  39. package/src/modules/position/directives/positionTo/positionTo.directive.d.ts.map +1 -1
  40. package/src/modules/progressIndicator/interceptors/progressInterceptor.d.ts.map +1 -1
  41. package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +1 -1
  42. package/src/services/position/position.interface.d.ts +51 -3
  43. package/src/services/position/position.interface.d.ts.map +1 -1
  44. package/src/services/position/position.types.d.ts +4 -0
  45. package/src/services/position/position.types.d.ts.map +1 -1
  46. package/structured-log/src/services/rest/restSink.service.d.ts.map +1 -1
  47. package/{positions/src/types/positions.typings.d.ts → typings/positions/index.d.ts} +12 -4
  48. package/typings/store/index.d.ts +5 -0
  49. package/{structured-log/src/types/structured-log.typings.d.ts → typings/structured-log/index.d.ts} +49 -13
  50. package/version.bak +1 -1
  51. package/es2015/positions/src/types/positions.typings.js +0 -2
  52. package/es2015/positions/src/types/positions.typings.js.map +0 -1
  53. package/es2015/store/src/types/store.typings.js +0 -2
  54. package/es2015/store/src/types/store.typings.js.map +0 -1
  55. package/es2015/structured-log/src/types/structured-log.typings.js +0 -2
  56. package/es2015/structured-log/src/types/structured-log.typings.js.map +0 -1
  57. package/es2020/positions/src/types/positions.typings.js +0 -2
  58. package/es2020/positions/src/types/positions.typings.js.map +0 -1
  59. package/es2020/store/src/types/store.typings.js +0 -2
  60. package/es2020/store/src/types/store.typings.js.map +0 -1
  61. package/es2020/structured-log/src/types/structured-log.typings.js +0 -2
  62. package/es2020/structured-log/src/types/structured-log.typings.js.map +0 -1
  63. package/positions/src/types/positions.typings.d.ts.map +0 -1
  64. package/store/src/types/store.typings.d.ts +0 -4
  65. package/store/src/types/store.typings.d.ts.map +0 -1
  66. package/structured-log/src/types/structured-log.typings.d.ts.map +0 -1
package/changelog.md CHANGED
@@ -1,6 +1,50 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## Version 15.0.0 (2022-10-26)
5
+
6
+ ### Features
7
+
8
+ - now also typings are available for external usage
9
+ - new `PositionElements` interface
10
+ - stores positioned element and reference element
11
+ - **properties**
12
+ - `reference` reference element against which is object positioned
13
+ - `floating` element that is positioned
14
+ - new `PositionOffsets` interface
15
+ - defines object which describes offsets for positioned element
16
+ - **properties**
17
+ - `mainAxis` distance between positioned and reference element.
18
+ - `crossAxis` skidding between floating and reference element.
19
+ - `alignmentAxis` works on the same axis as crossAxis but applies only to aligned placements and works logically. The offset is inverted for -end alignments.
20
+ - new `PositionArguments` interface
21
+ - arguments that are passed during positioning
22
+ - **properties**
23
+ - `x` X coordinate of positioned element
24
+ - `y` Y coordinate of positioned element
25
+ - `elements` elements that are being used during positioning
26
+ - new `PositionOffsetString` type
27
+ - type that represents available names of position offset
28
+ - updated `PositionOptions` interface
29
+ - `offset` has new available definitions
30
+ - updated `PositionToDirective` directive
31
+ - **implements**
32
+ - `OnDestroy`
33
+ - new **inputs**
34
+ - `offset` offset which allows moving target element along the cross axis of placement, or any chosed direction
35
+ - `autoUpdate` indication whether set up 'auto updating' of position
36
+ - new **outputs**
37
+ - `done` occurs when element was positioned
38
+
39
+ ### BREAKING CHANGES
40
+
41
+ - minimal supported version of `@angular` is `14.2.0`
42
+ - minimal supported version of `rxjs` is `7.5.7`
43
+ - minimal supported version of `@jscrpt/common` is `3.2.0`
44
+ - minimal supported version of `tslib` is `2.4.0`
45
+ - updated `PositionOptions` interface
46
+ - `offset` is no longer enum, enum values are represented as string
47
+
4
48
  ## Version 14.2.0 (2022-10-25)
5
49
 
6
50
  ### Features
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { Injectable } from '@angular/core';
3
3
  import { PositionOffset, PositionPlacement, POSITION } from '@anglr/common';
4
- import { extend, isEmptyObject } from '@jscrpt/common';
4
+ import { extend, isEmptyObject, isFunction, isJsObject, isNumber, nameof } from '@jscrpt/common';
5
5
  import { computePosition, autoUpdate, offset, flip } from '@floating-ui/dom';
6
6
  import { Observable } from 'rxjs';
7
7
  import * as i0 from "@angular/core";
@@ -11,8 +11,8 @@ import * as i0 from "@angular/core";
11
11
  const defaultOptions = {
12
12
  autoUpdate: false,
13
13
  flip: false,
14
- offset: PositionOffset.None,
15
- placement: PositionPlacement.Top
14
+ offset: nameof('None'),
15
+ placement: PositionPlacement.TopStart,
16
16
  };
17
17
  /**
18
18
  * Service that is used for positioning two elements against each other, using floating-ui dom implementation
@@ -32,7 +32,7 @@ export class FloatingUiDomPosition {
32
32
  const runComputation = () => __awaiter(this, void 0, void 0, function* () {
33
33
  const result = yield computePosition(source, target, {
34
34
  placement: this._getPlacement(computedOptions),
35
- middleware: middlewares
35
+ middleware: middlewares,
36
36
  });
37
37
  if (computedOptions.autoUpdate) {
38
38
  subscriber.next({
@@ -92,67 +92,85 @@ export class FloatingUiDomPosition {
92
92
  * @param options - Options that contains definition of offset
93
93
  */
94
94
  _setOffset(middlewares, options) {
95
- if (options.offset != PositionOffset.None) {
96
- if (options.offset == PositionOffset.MouseEnter) {
97
- //fallback if not supported placement used
98
- if (options.placement == PositionPlacement.Left ||
99
- options.placement == PositionPlacement.LeftStart ||
100
- options.placement == PositionPlacement.LeftEnd ||
101
- options.placement == PositionPlacement.Right ||
102
- options.placement == PositionPlacement.RightStart ||
103
- options.placement == PositionPlacement.RightEnd ||
104
- options.placement == PositionPlacement.Bottom ||
105
- options.placement == PositionPlacement.BottomEnd ||
106
- options.placement == PositionPlacement.Top ||
107
- options.placement == PositionPlacement.TopEnd) {
108
- options.placement = PositionPlacement.TopStart;
109
- }
95
+ //no offset
96
+ if (options.offset === PositionOffset[PositionOffset.None]) {
97
+ return;
98
+ }
99
+ if (options.offset === PositionOffset[PositionOffset.MouseEnter]) {
100
+ //fallback if not supported placement used
101
+ if (options.placement == PositionPlacement.Left ||
102
+ options.placement == PositionPlacement.LeftStart ||
103
+ options.placement == PositionPlacement.LeftEnd ||
104
+ options.placement == PositionPlacement.Right ||
105
+ options.placement == PositionPlacement.RightStart ||
106
+ options.placement == PositionPlacement.RightEnd ||
107
+ options.placement == PositionPlacement.Bottom ||
108
+ options.placement == PositionPlacement.BottomEnd ||
109
+ options.placement == PositionPlacement.Top ||
110
+ options.placement == PositionPlacement.TopEnd) {
111
+ options.placement = PositionPlacement.TopStart;
110
112
  }
111
- middlewares.push(offset(({ floating, placement }) => {
112
- if (options.offset == PositionOffset.MouseEnter && options.mouseEvent) {
113
- return {
114
- crossAxis: options.mouseEvent.x - options.mouseEvent.target.getBoundingClientRect().x
115
- };
116
- }
117
- let dimension;
118
- if (placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||
119
- placement == 'top' || placement == 'top-start' || placement == 'top-end') {
120
- dimension = floating.width;
121
- }
122
- else {
123
- dimension = floating.height;
124
- }
125
- switch (options.offset) {
126
- default:
127
- {
128
- dimension = 0;
129
- break;
130
- }
131
- case PositionOffset.Full:
132
- {
133
- break;
134
- }
135
- case PositionOffset.Half:
136
- {
137
- dimension /= 2;
138
- break;
139
- }
140
- case PositionOffset.NegativeFull:
141
- {
142
- dimension *= -1;
143
- break;
144
- }
145
- case PositionOffset.NegativeHalf:
146
- {
147
- dimension *= -.5;
148
- break;
149
- }
150
- }
113
+ }
114
+ middlewares.push(offset(({ elements, placement, x, y }) => {
115
+ //offset is function
116
+ if (isFunction(options.offset)) {
117
+ return options.offset({ elements, x, y });
118
+ }
119
+ const { floating } = elements;
120
+ if (options.offset === PositionOffset[PositionOffset.MouseEnter] && options.mouseEvent) {
151
121
  return {
152
- crossAxis: dimension
122
+ crossAxis: options.mouseEvent.x - options.mouseEvent.target.getBoundingClientRect().x
153
123
  };
154
- }));
155
- }
124
+ }
125
+ const stringOffset = options.offset;
126
+ //offset is object
127
+ if (isJsObject(options.offset)) {
128
+ return options.offset;
129
+ }
130
+ //offset is skidding number
131
+ if (isNumber(stringOffset)) {
132
+ return {
133
+ crossAxis: stringOffset,
134
+ };
135
+ }
136
+ let dimension;
137
+ if (placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||
138
+ placement == 'top' || placement == 'top-start' || placement == 'top-end') {
139
+ dimension = floating.width;
140
+ }
141
+ else {
142
+ dimension = floating.height;
143
+ }
144
+ switch (stringOffset) {
145
+ default:
146
+ {
147
+ dimension = 0;
148
+ break;
149
+ }
150
+ case PositionOffset[PositionOffset.Full]:
151
+ {
152
+ break;
153
+ }
154
+ case PositionOffset[PositionOffset.Half]:
155
+ {
156
+ dimension /= 2;
157
+ break;
158
+ }
159
+ case PositionOffset[PositionOffset.NegativeFull]:
160
+ {
161
+ dimension *= -1;
162
+ break;
163
+ }
164
+ case PositionOffset[PositionOffset.NegativeHalf]:
165
+ {
166
+ dimension *= -.5;
167
+ break;
168
+ }
169
+ }
170
+ return {
171
+ crossAxis: dimension
172
+ };
173
+ }));
156
174
  }
157
175
  /**
158
176
  * Gets floating ui placement from position placement
@@ -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,MA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AI;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};"]}
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,EAAwC,MAAM,eAAe,CAAC;AAC/K,OAAO,EAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAC/F,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,MAAM,CAAwB,MAAM,CAAyB;IACrE,SAAS,EAAE,iBAAiB,CAAC,QAAQ;CACxC,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,GAAG,GAAS,EAAE;oBAE9B,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,EACN,MAAqB,EACrB;wBACI,SAAS,EAAE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,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHAnRQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AAuRX;;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, PositionOffsetString, PositionOffsets} from '@anglr/common';\nimport {extend, isEmptyObject, isFunction, isJsObject, isNumber, nameof} 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: nameof<typeof PositionOffset>('None') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\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 //no offset\n if(options.offset === PositionOffset[PositionOffset.None])\n {\n return;\n }\n\n if(options.offset === PositionOffset[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(({elements, placement, x, y}) =>\n {\n //offset is function\n if(isFunction(options.offset))\n {\n return options.offset({elements, x, y});\n }\n\n const {floating} = elements;\n\n if(options.offset === PositionOffset[PositionOffset.MouseEnter] && options.mouseEvent)\n {\n return {\n crossAxis: options.mouseEvent.x - (options.mouseEvent.target as HTMLElement).getBoundingClientRect().x\n };\n }\n\n const stringOffset = options.offset as PositionOffsetString|number;\n\n //offset is object\n if(isJsObject(options.offset))\n {\n return options.offset as PositionOffsets;\n }\n\n //offset is skidding number\n if(isNumber(stringOffset))\n {\n return {\n crossAxis: stringOffset,\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(stringOffset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset[PositionOffset.Full]:\n {\n break;\n }\n case PositionOffset[PositionOffset.Half]:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeFull]:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeHalf]:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\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,5 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { Directive, Input, EventEmitter, Output, HostListener } from '@angular/core';
3
+ import { lastValueFrom } from 'rxjs';
3
4
  import { TitledDialogService } from '../../services/titledDialog/titledDialog.service';
4
5
  import { ConfirmationDialogComponent } from '../../components/confirmationDialog/confirmationDialog.component';
5
6
  import * as i0 from "@angular/core";
@@ -51,6 +52,7 @@ export class ConfirmationDialogDirective {
51
52
  * Method called when user clicks on element
52
53
  */
53
54
  click(event) {
55
+ var _a, _b, _c;
54
56
  return __awaiter(this, void 0, void 0, function* () {
55
57
  if (this.preventDefaultsAndPropagation) {
56
58
  event.stopPropagation();
@@ -60,16 +62,16 @@ export class ConfirmationDialogDirective {
60
62
  this.confirm.emit();
61
63
  return;
62
64
  }
63
- const result = yield this._dialog.open(ConfirmationDialogComponent, {
65
+ const result = yield lastValueFrom(this._dialog.open(ConfirmationDialogComponent, {
64
66
  title: this.confirmationTitle,
65
67
  width: '33vw',
66
68
  data: {
67
69
  confirmationText: this.confirmationText || undefined,
68
- dialogCancelText: this.confirmationCancel,
69
- dialogConfirmText: this.confirmationConfirm,
70
- cssClasses: this.confirmationCssClasses,
70
+ dialogCancelText: (_a = this.confirmationCancel) !== null && _a !== void 0 ? _a : '',
71
+ dialogConfirmText: (_b = this.confirmationConfirm) !== null && _b !== void 0 ? _b : '',
72
+ cssClasses: (_c = this.confirmationCssClasses) !== null && _c !== void 0 ? _c : {},
71
73
  }
72
- }).afterClosed().toPromise();
74
+ }).afterClosed());
73
75
  if (result) {
74
76
  this.confirm.emit();
75
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"confirmationDialog.directive.js","sourceRoot":"","sources":["../../../../../material/src/directives/confirmationDialog/confirmationDialog.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAA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AC,kBAAkB;oBACzC,iBAAiB,EAAE,IAAI,CAAC,mBAAmB;oBAC3C,UAAU,EAAE,IAAI,CAAC,sBAAsB;iBAC1C;aACJ,CAAC,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,CAAC;YAE7B,IAAG,MAAM,EACT;gBACI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aACvB;QACL,CAAC;KAAA;;wHAjGQ,2BAA2B;4GAA3B,2BAA2B;2FAA3B,2BAA2B;kBAJvC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;iBAC7B;0GASU,gBAAgB;sBADtB,KAAK;uBAAC,cAAc;gBAOd,iBAAiB;sBADvB,KAAK;gBAOC,mBAAmB;sBADzB,KAAK;gBAOC,kBAAkB;sBADxB,KAAK;gBAOC,sBAAsB;sBAD5B,KAAK;gBAOC,gBAAgB;sBADtB,KAAK;gBAOC,6BAA6B;sBADnC,KAAK;gBASC,OAAO;sBADb,MAAM;gBAcM,KAAK;sBADjB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {Directive, Input, EventEmitter, Output, HostListener} from '@angular/core';\n\nimport {TitledDialogService} from '../../services/titledDialog/titledDialog.service';\nimport {ConfirmationDialogComponent} from '../../components/confirmationDialog/confirmationDialog.component';\nimport {ConfirmationDialogOptions, ConfirmationDialogCssClasses} from '../../misc/interfaces/confirmationDialog.interface';\n\n/**\n * Directive that enables confirmation dialog on click\n */\n@Directive(\n{\n selector: '[confirmation]'\n})\nexport class ConfirmationDialogDirective\n{\n //######################### public properties - inputs #########################\n\n /**\n * Confirmation text that is displayed in dialog\n */\n @Input('confirmation')\n public confirmationText: string = undefined;\n\n /**\n * Title for confirmation dialog\n */\n @Input()\n public confirmationTitle: string = 'Confirmation';\n\n /**\n * Text for confirm confirmation button\n */\n @Input()\n public confirmationConfirm: string = undefined;\n\n /**\n * Text for cancel confirmation button\n */\n @Input()\n public confirmationCancel: string = undefined;\n\n /**\n * Object with css classes to be applied to confirmation dialog component\n */\n @Input()\n public confirmationCssClasses: ConfirmationDialogCssClasses = undefined;\n\n /**\n * Condidition that determines whether display confirmation dialog or skip it and run confirm directly\n */\n @Input()\n public skipConfirmation: boolean = false;\n\n /**\n * Indication whether prevent default and stop propagation of click event, defaults to true\n */\n @Input()\n public preventDefaultsAndPropagation: boolean = true;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when user confirms confirmation\n */\n @Output()\n public confirm: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(private _dialog: TitledDialogService)\n {\n }\n\n //######################### public methods - host #########################\n\n /**\n * Method called when user clicks on element\n */\n @HostListener('click', ['$event'])\n public async click(event: MouseEvent): Promise<void>\n {\n if(this.preventDefaultsAndPropagation)\n {\n event.stopPropagation();\n event.preventDefault();\n }\n\n if(this.skipConfirmation)\n {\n this.confirm.emit();\n\n return;\n }\n\n const result = await this._dialog.open<ConfirmationDialogComponent, ConfirmationDialogOptions, boolean>(ConfirmationDialogComponent,\n {\n title: this.confirmationTitle,\n width: '33vw',\n data:\n {\n confirmationText: this.confirmationText || undefined,\n dialogCancelText: this.confirmationCancel,\n dialogConfirmText: this.confirmationConfirm,\n cssClasses: this.confirmationCssClasses,\n }\n }).afterClosed().toPromise();\n\n if(result)\n {\n this.confirm.emit();\n }\n }\n}"]}
1
+ {"version":3,"file":"confirmationDialog.directive.js","sourceRoot":"","sources":["../../../../../material/src/directives/confirmationDialog/confirmationDialog.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAC,mBAAmB,EAAC,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAC,2BAA2B,EAAC,MAAM,kEAAkE,CAAC;;;AAG7G;;GAEG;AAKH,MAAM,OAAO,2BAA2B;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E,CAAC,CAAC;YAElB,IAAG,MAAM,EACT;gBACI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aACvB;;KACJ;;wHAjGQ,2BAA2B;4GAA3B,2BAA2B;2FAA3B,2BAA2B;kBAJvC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;iBAC7B;0GASU,gBAAgB;sBADtB,KAAK;uBAAC,cAAc;gBAOd,iBAAiB;sBADvB,KAAK;gBAOC,mBAAmB;sBADzB,KAAK;gBAOC,kBAAkB;sBADxB,KAAK;gBAOC,sBAAsB;sBAD5B,KAAK;gBAOC,gBAAgB;sBADtB,KAAK;gBAOC,6BAA6B;sBADnC,KAAK;gBASC,OAAO;sBADb,MAAM;gBAcM,KAAK;sBADjB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {Directive, Input, EventEmitter, Output, HostListener} from '@angular/core';\nimport {lastValueFrom} from 'rxjs';\n\nimport {TitledDialogService} from '../../services/titledDialog/titledDialog.service';\nimport {ConfirmationDialogComponent} from '../../components/confirmationDialog/confirmationDialog.component';\nimport {ConfirmationDialogOptions, ConfirmationDialogCssClasses} from '../../misc/interfaces/confirmationDialog.interface';\n\n/**\n * Directive that enables confirmation dialog on click\n */\n@Directive(\n{\n selector: '[confirmation]'\n})\nexport class ConfirmationDialogDirective\n{\n //######################### public properties - inputs #########################\n\n /**\n * Confirmation text that is displayed in dialog\n */\n @Input('confirmation')\n public confirmationText: string|undefined|null = undefined;\n\n /**\n * Title for confirmation dialog\n */\n @Input()\n public confirmationTitle: string = 'Confirmation';\n\n /**\n * Text for confirm confirmation button\n */\n @Input()\n public confirmationConfirm: string|undefined|null = undefined;\n\n /**\n * Text for cancel confirmation button\n */\n @Input()\n public confirmationCancel: string|undefined|null = undefined;\n\n /**\n * Object with css classes to be applied to confirmation dialog component\n */\n @Input()\n public confirmationCssClasses: ConfirmationDialogCssClasses|undefined|null = undefined;\n\n /**\n * Condidition that determines whether display confirmation dialog or skip it and run confirm directly\n */\n @Input()\n public skipConfirmation: boolean = false;\n\n /**\n * Indication whether prevent default and stop propagation of click event, defaults to true\n */\n @Input()\n public preventDefaultsAndPropagation: boolean = true;\n\n //######################### public properties - outputs #########################\n\n /**\n * Occurs when user confirms confirmation\n */\n @Output()\n public confirm: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(private _dialog: TitledDialogService)\n {\n }\n\n //######################### public methods - host #########################\n\n /**\n * Method called when user clicks on element\n */\n @HostListener('click', ['$event'])\n public async click(event: MouseEvent): Promise<void>\n {\n if(this.preventDefaultsAndPropagation)\n {\n event.stopPropagation();\n event.preventDefault();\n }\n\n if(this.skipConfirmation)\n {\n this.confirm.emit();\n\n return;\n }\n\n const result = await lastValueFrom(this._dialog.open<ConfirmationDialogComponent, ConfirmationDialogOptions, boolean>(ConfirmationDialogComponent,\n {\n title: this.confirmationTitle,\n width: '33vw',\n data:\n {\n confirmationText: this.confirmationText || undefined,\n dialogCancelText: this.confirmationCancel ?? '',\n dialogConfirmText: this.confirmationConfirm ?? '',\n cssClasses: this.confirmationCssClasses ?? {},\n }\n }).afterClosed());\n\n if(result)\n {\n this.confirm.emit();\n }\n }\n}"]}
@@ -1,4 +1,3 @@
1
- import { __awaiter } from "tslib";
2
1
  import { Directive, Input, ElementRef, Inject, Output, EventEmitter } from '@angular/core';
3
2
  import { nameof, isPresent, isString } from '@jscrpt/common';
4
3
  import { applyPositionResult, PositionPlacement } from '../../../../services/position';
@@ -9,41 +8,53 @@ import * as i0 from "@angular/core";
9
8
  */
10
9
  export class PositionToDirective {
11
10
  //######################### constructor #########################
12
- constructor(_target, _position) {
13
- this._target = _target;
14
- this._position = _position;
15
- // //######################### public properties - outputs #########################
11
+ constructor(target, position) {
12
+ this.target = target;
13
+ this.position = position;
14
+ /**
15
+ * Offset which allows moving target element along the cross axis of placement, or any chosed direction
16
+ */
17
+ this.offset = 'None';
18
+ /**
19
+ * Indication whether set up 'auto updating' of position
20
+ */
21
+ this.autoUpdate = true;
22
+ //######################### public properties - outputs #########################
16
23
  /**
17
24
  * Occurs when flip occurs during positioning
18
25
  */
19
26
  this.flip = new EventEmitter();
27
+ /**
28
+ * Occurs when element was positioned
29
+ */
30
+ this.done = new EventEmitter();
20
31
  }
21
32
  //######################### public properties - inputs #########################
22
33
  /**
23
34
  * Gets or sets html element which is used as source for positioning
24
35
  */
25
36
  get source() {
26
- return this._source;
37
+ return this.ɵSource;
27
38
  }
28
39
  set source(value) {
29
40
  if (value instanceof ElementRef) {
30
- this._source = value.nativeElement;
41
+ this.ɵSource = value.nativeElement;
31
42
  return;
32
43
  }
33
- this._source = value;
44
+ this.ɵSource = value;
34
45
  }
35
46
  /**
36
47
  * Gets or sets position placement value
37
48
  */
38
49
  get placement() {
39
- return this._placement;
50
+ return this.ɵPlacement;
40
51
  }
41
52
  set placement(value) {
42
53
  if (isString(value)) {
43
- this._placement = PositionPlacement[value];
54
+ this.ɵPlacement = PositionPlacement[value];
44
55
  return;
45
56
  }
46
- this._placement = value;
57
+ this.ɵPlacement = value;
47
58
  }
48
59
  //######################### public methods - implementation of OnChanges #########################
49
60
  /**
@@ -56,26 +67,45 @@ export class PositionToDirective {
56
67
  this._applyPosition();
57
68
  }
58
69
  }
70
+ //######################### public methods - implementation of OnDestroy #########################
71
+ /**
72
+ * Called when component is destroyed
73
+ */
74
+ ngOnDestroy() {
75
+ var _a;
76
+ (_a = this.dispose) === null || _a === void 0 ? void 0 : _a.call(this);
77
+ }
59
78
  //######################### protected methods #########################
60
79
  /**
61
80
  * Applies position according to specified parameters to specified elements
62
81
  */
63
82
  _applyPosition() {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const options = {};
66
- if (this._placement) {
67
- options.placement = this._placement;
68
- }
69
- const result = yield this._position.placeElement(this._target.nativeElement, this._source, options).toPromise();
83
+ var _a;
84
+ if (!this.ɵSource) {
85
+ return;
86
+ }
87
+ const options = {
88
+ flip: true,
89
+ autoUpdate: this.autoUpdate,
90
+ offset: this.offset,
91
+ };
92
+ if (this.ɵPlacement) {
93
+ options.placement = this.ɵPlacement;
94
+ }
95
+ (_a = this.dispose) === null || _a === void 0 ? void 0 : _a.call(this);
96
+ this.position.placeElement(this.target.nativeElement, this.ɵSource, options)
97
+ .subscribe(result => {
98
+ this.dispose = result.dispose;
70
99
  applyPositionResult(result);
71
100
  if (result.flip) {
72
- this.flip.next();
101
+ this.flip.emit();
73
102
  }
103
+ this.done.emit();
74
104
  });
75
105
  }
76
106
  }
77
107
  PositionToDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: PositionToDirective, deps: [{ token: i0.ElementRef }, { token: POSITION }], target: i0.ɵɵFactoryTarget.Directive });
78
- PositionToDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement" }, outputs: { flip: "flip" }, usesOnChanges: true, ngImport: i0 });
108
+ PositionToDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement", offset: "offset", autoUpdate: "autoUpdate" }, outputs: { flip: "flip", done: "done" }, usesOnChanges: true, ngImport: i0 });
79
109
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: PositionToDirective, decorators: [{
80
110
  type: Directive,
81
111
  args: [{
@@ -89,7 +119,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
89
119
  args: ['positionTo']
90
120
  }], placement: [{
91
121
  type: Input
122
+ }], offset: [{
123
+ type: Input
124
+ }], autoUpdate: [{
125
+ type: Input
92
126
  }], flip: [{
93
127
  type: Output
128
+ }], done: [{
129
+ type: Output
94
130
  }] } });
95
131
  //# 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,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;;AAElD;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAgE5B,iEAAiE;IACjE,YAAsB,OAAgC,EACd,SAAmB;QADrC,YAAO,GAAP,OAAO,CAAyB;QACd,cAAS,GAAT,SAAS,CAAU;QAV3D,oFAAoF;QAEpF;;WAEG;QAEI,SAAI,GAAuB,IAAI,YAAY,EAAQ,CAAC;IAM3D,CAAC;IAtDD,gFAAgF;IAEhF;;OAEG;IACH,IACW,MAAM;QAEb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD,IAAW,MAAM,CAAC,KAAkB;QAEhC,IAAG,KAAK,YAAY,UAAU,EAC9B;YACI,IAAI,CAAC,OAAO,GAAI,KAAoB,CAAC,aAAa,CAAC;YAEnD,OAAO;SACV;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IACW,SAAS;QAEhB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,IAAW,SAAS,CAAC,KAAuC;QAExD,IAAG,QAAQ,CAAC,KAAK,CAAC,EAClB;YACI,IAAI,CAAC,UAAU,GAAG,iBAAiB,CAAC,KAAuC,CAAC,CAAC;YAE7E,OAAO;SACV;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAgBD,kGAAkG;IAElG;;OAEG;IACI,WAAW,CAAC,OAAsB;QAErC,IAAG,CAAC,MAAM,CAAsB,QAAQ,CAAC,IAAI,OAAO;YAChD,MAAM,CAAsB,WAAW,CAAC,IAAI,OAAO,CAAC;YACrD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EACzB;YACI,IAAI,CAAC,cAAc,EAAE,CAAC;SACzB;IACL,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACa,cAAc;;YAE1B,MAAM,OAAO,GACb,EACC,CAAC;YAEF,IAAG,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;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 `source` input\n */\n public static ngAcceptInputType_source: 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,EAAY,MAAM,eAAe,CAAC;AAC9H,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAC,mBAAmB,EAAY,iBAAiB,EAA+F,MAAM,+BAA+B,CAAC;AAC7L,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;AAElD;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAuF5B,iEAAiE;IACjE,YAAsB,MAA+B,EACb,QAAkB;QADpC,WAAM,GAAN,MAAM,CAAyB;QACb,aAAQ,GAAR,QAAQ,CAAU;QA5B1D;;WAEG;QAEI,WAAM,GAAiG,MAAM,CAAC;QAErH;;WAEG;QAEI,eAAU,GAA8B,IAAI,CAAC;QAEpD,iFAAiF;QAEjF;;WAEG;QAEI,SAAI,GAAuB,IAAI,YAAY,EAAQ,CAAC;QAE3D;;WAEG;QAEI,SAAI,GAAuB,IAAI,YAAY,EAAQ,CAAC;IAM3D,CAAC;IAxED,gFAAgF;IAEhF;;OAEG;IACH,IACW,MAAM;QAEb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD,IAAW,MAAM,CAAC,KAAiC;QAE/C,IAAG,KAAK,YAAY,UAAU,EAC9B;YACI,IAAI,CAAC,OAAO,GAAI,KAAoB,CAAC,aAAa,CAAC;YAEnD,OAAO;SACV;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IACW,SAAS;QAEhB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,I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C,IAAI,EAAE,CAAC;aACpB;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACX,CAAC;;gHAhKQ,mBAAmB,4CAyFR,QAAQ;oGAzFnB,mBAAmB;2FAAnB,mBAAmB;kBAJ/B,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;iBAC3B;;0BA0FgB,MAAM;2BAAC,QAAQ;4CAhEjB,MAAM;sBADhB,KAAK;uBAAC,YAAY;gBAqBR,SAAS;sBADnB,KAAK;gBAqBC,MAAM;sBADZ,KAAK;gBAOC,UAAU;sBADhB,KAAK;gBASC,IAAI;sBADV,MAAM;gBAOA,IAAI;sBADV,MAAM","sourcesContent":["import {Directive, Input, ElementRef, OnChanges, SimpleChanges, Inject, Output, EventEmitter, OnDestroy} from '@angular/core';\nimport {nameof, isPresent, isString, Func1, NoopAction} from '@jscrpt/common';\n\nimport {applyPositionResult, Position, PositionPlacement, PositionOptions, PositionOffsetString, PositionOffsets, PositionArguments, AutoUpdateOptions} 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, OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Position placement value\n */\n protected ɵPlacement: PositionPlacement|undefined|null;\n\n /**\n * Html element which is used as source for positioning\n */\n protected ɵSource: HTMLElement|undefined|null;\n\n /**\n * Method used for disposing auto positioning\n */\n protected dispose: NoopAction|undefined|null;\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|undefined|null\n {\n return this.ɵSource;\n }\n public set source(value: HTMLElement|undefined|null)\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|undefined|null\n {\n return this.ɵPlacement;\n }\n public set placement(value: PositionPlacement|undefined|null)\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 /**\n * Offset which allows moving target element along the cross axis of placement, or any chosed direction\n */\n @Input()\n public offset: PositionOffsetString|number|PositionOffsets|Func1<number|PositionOffsets, PositionArguments> = 'None';\n\n /**\n * Indication whether set up 'auto updating' of position\n */\n @Input()\n public autoUpdate: boolean|AutoUpdateOptions = true;\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 /**\n * Occurs when element was positioned\n */\n @Output()\n public done: 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 //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.dispose?.();\n }\n\n //######################### protected methods #########################\n\n /**\n * Applies position according to specified parameters to specified elements\n */\n protected _applyPosition(): void\n {\n if(!this.ɵSource)\n {\n return;\n }\n\n const options: Partial<PositionOptions> =\n {\n flip: true,\n autoUpdate: this.autoUpdate,\n offset: this.offset,\n };\n\n if(this.ɵPlacement)\n {\n options.placement = this.ɵPlacement;\n }\n\n this.dispose?.();\n\n this.position.placeElement(this.target.nativeElement,\n this.ɵSource,\n options)\n .subscribe(result =>\n {\n this.dispose = result.dispose;\n\n applyPositionResult(result);\n\n if(result.flip)\n {\n this.flip.emit();\n }\n\n this.done.emit();\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 `source` input\n */\n public static ngAcceptInputType_source: HTMLElement|ElementRef<HTMLElement>;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Injectable } from '@angular/core';
2
2
  import { HttpEventType, HTTP_INTERCEPTORS } from '@angular/common/http';
3
- import { tap } from 'rxjs/operators';
3
+ import { tap } from 'rxjs';
4
4
  import { ProgressIndicatorService } from '../services/progressIndicator.service';
5
5
  import { PROGRESS_INDICATOR_GROUP_NAME } from '../misc/tokens';
6
6
  import { IGNORED_INTERCEPTORS } from '../../../types/tokens';
@@ -1 +1 @@
1
- {"version":3,"file":"progressInterceptor.js","sourceRoot":"","sources":["../../../../../src/modules/progressIndicator/interceptors/progressInterceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgB,MAAM,eAAe,CAAC;AACxD,OAAO,EAA0C,aAAa,EAAE,iBAAiB,EAAc,MAAM,sBAAsB,CAAC;AAE5H,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AAEnC,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,6BAA6B,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;;;AAE3D;;GAEG;AAEH,MAAM,OAAO,mBAAmB;IAE5B,kEAAkE;IAClE,YAAoB,aAAuC;QAAvC,kBAAa,GAAb,aAAa,CAA0B;IAE3D,CAAC;IAED,wGAAwG;IAExG;;;;OAIG;IACI,SAAS,CAAC,GAAyB,EAAE,IAAiB;QAEzD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAEd,wBAAwB;YACxB,IAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,mBAAmB,CAAC,EAChF;gBACI,OAAO;aACV;YAED,iBAAiB;YACjB,IAAG,KAAK,CAAC,IAAI,IAAI,aAAa,CAAC,IAAI,EACnC;gBACI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;aACnF;YACD,mBAAmB;iBACd,IAAG,KAAK,CAAC,IAAI,IAAI,aAAa,CAAC,QAAQ,EAC5C;gBACI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;aACnF;QACL,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IACnG,CAAC;;gHApCQ,mBAAmB;oHAAnB,mBAAmB;2FAAnB,mBAAmB;kBAD/B,UAAU;;AAwCX;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAC1C;IACI,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,mBAAmB;IAC7B,KAAK,EAAE,IAAI;CACd,CAAC","sourcesContent":["import {Injectable, ClassProvider} from '@angular/core';\nimport {HttpEvent, HttpInterceptor, HttpHandler, HttpEventType, HTTP_INTERCEPTORS, HttpRequest} from '@angular/common/http';\nimport {Observable} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nimport {ProgressIndicatorService} from '../services/progressIndicator.service';\nimport {PROGRESS_INDICATOR_GROUP_NAME} from '../misc/tokens';\nimport {IGNORED_INTERCEPTORS} from '../../../types/tokens';\n\n/**\n * ProgressInterceptor used for intercepting http requests and displaying progress indicatior\n */\n@Injectable()\nexport class ProgressInterceptor implements HttpInterceptor\n{\n //######################### constructors #########################\n constructor(private _indicatorSvc: ProgressIndicatorService)\n {\n }\n\n //######################### public methods - implementation of HttpInterceptor #########################\n\n /**\n * Intercepts http request\n * @param req - Request to be intercepted\n * @param next - Next middleware that can be called for next processing\n */\n public intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>\n {\n return next.handle(req)\n .pipe(tap(event =>\n {\n //interceptor is ignored\n if(req.context.get(IGNORED_INTERCEPTORS).some(itm => itm == ProgressInterceptor))\n {\n return;\n }\n\n //request started\n if(event.type == HttpEventType.Sent)\n {\n this._indicatorSvc.showProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME));\n }\n //response received\n else if(event.type == HttpEventType.Response)\n {\n this._indicatorSvc.hideProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME));\n }\n }, () => this._indicatorSvc.hideProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME))));\n }\n}\n\n/**\n * Progress interceptor provider\n */\nexport const PROGRESS_INTERCEPTOR_PROVIDER: ClassProvider = \n{\n provide: HTTP_INTERCEPTORS, \n useClass: ProgressInterceptor, \n multi: true\n};"]}
1
+ {"version":3,"file":"progressInterceptor.js","sourceRoot":"","sources":["../../../../../src/modules/progressIndicator/interceptors/progressInterceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAgB,MAAM,eAAe,CAAC;AACxD,OAAO,EAA0C,aAAa,EAAE,iBAAiB,EAAc,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAAa,GAAG,EAAC,MAAM,MAAM,CAAC;AAErC,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,6BAA6B,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;;;AAE3D;;GAEG;AAEH,MAAM,OAAO,mBAAmB;IAE5B,kEAAkE;IAClE,YAAoB,aAAuC;QAAvC,kBAAa,GAAb,aAAa,CAA0B;IAE3D,CAAC;IAED,wGAAwG;IAExG;;;;OAIG;IACI,SAAS,CAAC,GAAyB,EAAE,IAAiB;QAEzD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAClB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAEd,wBAAwB;YACxB,IAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,mBAAmB,CAAC,EAChF;gBACI,OAAO;aACV;YAED,iBAAiB;YACjB,IAAG,KAAK,CAAC,IAAI,IAAI,aAAa,CAAC,IAAI,EACnC;gBACI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;aACnF;YACD,mBAAmB;iBACd,IAAG,KAAK,CAAC,IAAI,IAAI,aAAa,CAAC,QAAQ,EAC5C;gBACI,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;aACnF;QACL,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;IACnG,CAAC;;gHApCQ,mBAAmB;oHAAnB,mBAAmB;2FAAnB,mBAAmB;kBAD/B,UAAU;;AAwCX;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAC1C;IACI,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,mBAAmB;IAC7B,KAAK,EAAE,IAAI;CACd,CAAC","sourcesContent":["import {Injectable, ClassProvider} from '@angular/core';\nimport {HttpEvent, HttpInterceptor, HttpHandler, HttpEventType, HTTP_INTERCEPTORS, HttpRequest} from '@angular/common/http';\nimport {Observable, tap} from 'rxjs';\n\nimport {ProgressIndicatorService} from '../services/progressIndicator.service';\nimport {PROGRESS_INDICATOR_GROUP_NAME} from '../misc/tokens';\nimport {IGNORED_INTERCEPTORS} from '../../../types/tokens';\n\n/**\n * ProgressInterceptor used for intercepting http requests and displaying progress indicatior\n */\n@Injectable()\nexport class ProgressInterceptor implements HttpInterceptor\n{\n //######################### constructors #########################\n constructor(private _indicatorSvc: ProgressIndicatorService)\n {\n }\n\n //######################### public methods - implementation of HttpInterceptor #########################\n\n /**\n * Intercepts http request\n * @param req - Request to be intercepted\n * @param next - Next middleware that can be called for next processing\n */\n public intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>\n {\n return next.handle(req)\n .pipe(tap(event =>\n {\n //interceptor is ignored\n if(req.context.get(IGNORED_INTERCEPTORS).some(itm => itm == ProgressInterceptor))\n {\n return;\n }\n\n //request started\n if(event.type == HttpEventType.Sent)\n {\n this._indicatorSvc.showProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME));\n }\n //response received\n else if(event.type == HttpEventType.Response)\n {\n this._indicatorSvc.hideProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME));\n }\n }, () => this._indicatorSvc.hideProgress(req.context.get(PROGRESS_INDICATOR_GROUP_NAME))));\n }\n}\n\n/**\n * Progress interceptor provider\n */\nexport const PROGRESS_INTERCEPTOR_PROVIDER: ClassProvider = \n{\n provide: HTTP_INTERCEPTORS, \n useClass: ProgressInterceptor, \n multi: true\n};"]}
@@ -3,9 +3,10 @@ import { AnimationBuilder } from '@angular/animations';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { fadeInAnimation, fadeOutAnimation } from '@anglr/animations';
5
5
  import { extend, isBlank, isPresent, nameof } from '@jscrpt/common';
6
+ import { lastValueFrom } from 'rxjs';
6
7
  import { TooltipComponent } from '../../components/tooltip/tooltip.component';
7
8
  import { TOOLTIP_OPTIONS } from '../../misc/tokens';
8
- import { applyPositionResult, PositionOffset, PositionPlacement } from '../../../../services/position';
9
+ import { applyPositionResult, PositionPlacement } from '../../../../services/position';
9
10
  import { TooltipTemplateDirective } from '../tooltipTemplate/tooltipTemplate.directive';
10
11
  import { POSITION } from '../../../../types/tokens';
11
12
  import * as i0 from "@angular/core";
@@ -16,8 +17,8 @@ import * as i1 from "@angular/animations";
16
17
  const defaultOptions = {
17
18
  delay: 200,
18
19
  position: {
19
- offset: PositionOffset.MouseEnter,
20
- placement: PositionPlacement.TopStart
20
+ offset: nameof('MouseEnter'),
21
+ placement: PositionPlacement.TopStart,
21
22
  },
22
23
  allowSelection: false,
23
24
  tooltipRenderer: TooltipComponent,
@@ -149,14 +150,13 @@ export class TooltipDirective {
149
150
  return;
150
151
  }
151
152
  this._showData();
152
- this._position.placeElement(this._tooltipElement, this._element.nativeElement, {
153
+ lastValueFrom(this._position.placeElement(this._tooltipElement, this._element.nativeElement, {
153
154
  placement: this._options.position.placement,
154
155
  offset: this._options.position.offset,
155
156
  flip: true,
156
157
  mouseEvent: event,
157
158
  autoUpdate: false
158
- })
159
- .toPromise()
159
+ }))
160
160
  .then(result => applyPositionResult(result));
161
161
  }
162
162
  /**