@anglr/common 11.2.0-beta.20220301064829 → 11.2.0-beta.20220301105549
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.
- package/changelog.md +7 -5
- package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js +73 -44
- package/es2015/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
- package/es2015/src/index.js +2 -1
- package/es2015/src/index.js.map +1 -1
- package/es2015/src/modules/position/directives/index.js +2 -0
- package/es2015/src/modules/position/directives/index.js.map +1 -0
- package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js +91 -0
- package/es2015/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -0
- package/es2015/src/modules/position/index.js +3 -0
- package/es2015/src/modules/position/index.js.map +1 -0
- package/es2015/src/modules/position/modules/index.js +2 -0
- package/es2015/src/modules/position/modules/index.js.map +1 -0
- package/es2015/src/modules/position/modules/position.module.js +24 -0
- package/es2015/src/modules/position/modules/position.module.js.map +1 -0
- package/es2015/src/services/position/position.interface.js.map +1 -1
- package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js +73 -42
- package/es2020/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
- package/es2020/src/index.js +2 -1
- package/es2020/src/index.js.map +1 -1
- package/es2020/src/modules/position/directives/index.js +2 -0
- package/es2020/src/modules/position/directives/index.js.map +1 -0
- package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js +88 -0
- package/es2020/src/modules/position/directives/positionTo/positionTo.directive.js.map +1 -0
- package/es2020/src/modules/position/index.js +3 -0
- package/es2020/src/modules/position/index.js.map +1 -0
- package/es2020/src/modules/position/modules/index.js +2 -0
- package/es2020/src/modules/position/modules/index.js.map +1 -0
- package/es2020/src/modules/position/modules/position.module.js +24 -0
- package/es2020/src/modules/position/modules/position.module.js.map +1 -0
- package/es2020/src/services/position/position.interface.js.map +1 -1
- package/floating-ui/src/services/floatingUiDomPosition.service.d.ts +2 -1
- package/floating-ui/src/services/floatingUiDomPosition.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.d.ts.map +1 -1
- package/src/modules/position/directives/index.d.ts +2 -0
- package/src/modules/position/directives/index.d.ts.map +1 -0
- package/src/modules/position/directives/positionTo/positionTo.directive.d.ts +48 -0
- package/src/modules/position/directives/positionTo/positionTo.directive.d.ts.map +1 -0
- package/src/modules/position/index.d.ts +3 -0
- package/src/modules/position/index.d.ts.map +1 -0
- package/src/modules/position/modules/index.d.ts +2 -0
- package/src/modules/position/modules/index.d.ts.map +1 -0
- package/src/modules/position/modules/position.module.d.ts +11 -0
- package/src/modules/position/modules/position.module.d.ts.map +1 -0
- package/src/services/position/position.interface.d.ts +2 -5
- package/src/services/position/position.interface.d.ts.map +1 -1
- package/version.bak +1 -1
package/changelog.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
|
+
- new `PositionToDirective` directive, that sets position of attached element relative to provided element
|
|
8
|
+
- new `PositionModule` module for `PositionToDirective`
|
|
7
9
|
- added new **Position**
|
|
8
10
|
- new `Position` interface, that represents service that is used for positioning two elements against each other
|
|
9
11
|
- new `PositionOptions` interface, that represents options that are passed to position service
|
|
@@ -11,7 +13,6 @@
|
|
|
11
13
|
- property `offset` offset which allows moving target element along the cross axis of placement
|
|
12
14
|
- property `flip` indication whether perform flip in case of collision (with view boundaries)
|
|
13
15
|
- property `autoUpdate` indication whether set up 'auto updating' of position
|
|
14
|
-
- method `autoUpdateProcessor` function that is called when auto updated is called for processing result
|
|
15
16
|
- property `mouseEvent` mouse event that occured when positioning was called
|
|
16
17
|
- new `PositionResult` interface, that represents result of positioning process, storing new coordinates
|
|
17
18
|
- property `target` target element to be positioned
|
|
@@ -26,10 +27,11 @@
|
|
|
26
27
|
- new `PositionPlacement` enum with available positions for placement of target element against its source
|
|
27
28
|
- new `PositionOffset` enum with applied offset to position of target in cross axis relative to placement
|
|
28
29
|
- new `POSITION` *Injection Token* used for injecting service that is used for positioning of one element against another
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
- added *subpackage* `@anglr/common/floating-ui`
|
|
31
|
+
- *subpackage* `@anglr/common/floating-ui`
|
|
32
|
+
- requires `@floating-ui/dom` package of minimal version `0.3.1`
|
|
33
|
+
- new `FloatingUiDomPosition` service that is used for positioning two elements against each other, using floating-ui dom implementation
|
|
34
|
+
- new `FLOATING_UI_POSITION` provider for floating ui position implementation
|
|
33
35
|
|
|
34
36
|
## Version 11.1.0 (2022-02-22)
|
|
35
37
|
|
|
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
|
|
|
3
3
|
import { PositionOffset, PositionPlacement, POSITION } from '@anglr/common';
|
|
4
4
|
import { extend } from '@jscrpt/common';
|
|
5
5
|
import { computePosition, autoUpdate, offset, flip } from '@floating-ui/dom';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
/**
|
|
8
9
|
* Default options for `FloatingUiDomPosition` implementation
|
|
@@ -22,49 +23,54 @@ export class FloatingUiDomPosition {
|
|
|
22
23
|
* @inheritdoc
|
|
23
24
|
*/
|
|
24
25
|
placeElement(target, source, options) {
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (computedOptions.autoUpdate && computedOptions.autoUpdateProcessor) {
|
|
36
|
-
computedOptions.autoUpdateProcessor({
|
|
37
|
-
target,
|
|
38
|
-
dispose: () => { },
|
|
39
|
-
x: result.x,
|
|
40
|
-
y: result.y
|
|
26
|
+
return new Observable(subscriber => {
|
|
27
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const computedOptions = extend({}, defaultOptions, options);
|
|
29
|
+
const middlewares = [];
|
|
30
|
+
this._setOffset(middlewares, computedOptions);
|
|
31
|
+
this._setFlip(middlewares, computedOptions);
|
|
32
|
+
const runComputation = () => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const result = yield computePosition(source, target, {
|
|
34
|
+
placement: this._getPlacement(computedOptions),
|
|
35
|
+
middleware: middlewares
|
|
41
36
|
});
|
|
37
|
+
if (computedOptions.autoUpdate) {
|
|
38
|
+
subscriber.next({
|
|
39
|
+
target,
|
|
40
|
+
dispose,
|
|
41
|
+
x: result.x,
|
|
42
|
+
y: result.y
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
});
|
|
47
|
+
let dispose = () => { };
|
|
48
|
+
if (computedOptions.autoUpdate) {
|
|
49
|
+
let options;
|
|
50
|
+
if (computedOptions.autoUpdate === true) {
|
|
51
|
+
options =
|
|
52
|
+
{
|
|
53
|
+
ancestorResize: true,
|
|
54
|
+
ancestorScroll: true,
|
|
55
|
+
elementResize: true
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
options = computedOptions.autoUpdate;
|
|
60
|
+
}
|
|
61
|
+
dispose = autoUpdate(source, target, runComputation, options);
|
|
62
|
+
}
|
|
63
|
+
const result = yield runComputation();
|
|
64
|
+
subscriber.next({
|
|
65
|
+
target,
|
|
66
|
+
dispose,
|
|
67
|
+
x: result.x,
|
|
68
|
+
y: result.y
|
|
69
|
+
});
|
|
70
|
+
if (!computedOptions.autoUpdate) {
|
|
71
|
+
subscriber.complete();
|
|
42
72
|
}
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
const result = yield runComputation();
|
|
46
|
-
let dispose = () => { };
|
|
47
|
-
if (computedOptions.autoUpdate) {
|
|
48
|
-
let options;
|
|
49
|
-
if (computedOptions.autoUpdate === true) {
|
|
50
|
-
options =
|
|
51
|
-
{
|
|
52
|
-
ancestorResize: true,
|
|
53
|
-
ancestorScroll: true,
|
|
54
|
-
elementResize: true
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
options = computedOptions.autoUpdate;
|
|
59
|
-
}
|
|
60
|
-
dispose = autoUpdate(source, target, runComputation, options);
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
target,
|
|
64
|
-
dispose,
|
|
65
|
-
x: result.x,
|
|
66
|
-
y: result.y
|
|
67
|
-
};
|
|
73
|
+
}))();
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
//######################### protected methods #########################
|
|
@@ -85,8 +91,27 @@ export class FloatingUiDomPosition {
|
|
|
85
91
|
*/
|
|
86
92
|
_setOffset(middlewares, options) {
|
|
87
93
|
if (options.offset != PositionOffset.None) {
|
|
88
|
-
|
|
94
|
+
if (options.offset == PositionOffset.MouseEnter) {
|
|
95
|
+
//fallback if not supported placement used
|
|
96
|
+
if (options.placement == PositionPlacement.Left ||
|
|
97
|
+
options.placement == PositionPlacement.LeftStart ||
|
|
98
|
+
options.placement == PositionPlacement.LeftEnd ||
|
|
99
|
+
options.placement == PositionPlacement.Right ||
|
|
100
|
+
options.placement == PositionPlacement.RightStart ||
|
|
101
|
+
options.placement == PositionPlacement.RightEnd ||
|
|
102
|
+
options.placement == PositionPlacement.Bottom ||
|
|
103
|
+
options.placement == PositionPlacement.BottomEnd ||
|
|
104
|
+
options.placement == PositionPlacement.Top ||
|
|
105
|
+
options.placement == PositionPlacement.TopEnd) {
|
|
106
|
+
options.placement = PositionPlacement.TopStart;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
89
109
|
middlewares.push(offset(({ floating, placement }) => {
|
|
110
|
+
if (options.offset == PositionOffset.MouseEnter && options.mouseEvent) {
|
|
111
|
+
return {
|
|
112
|
+
crossAxis: options.mouseEvent.offsetX
|
|
113
|
+
};
|
|
114
|
+
}
|
|
90
115
|
let dimension;
|
|
91
116
|
if (placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||
|
|
92
117
|
placement == 'top' || placement == 'top-start' || placement == 'top-end') {
|
|
@@ -97,7 +122,11 @@ export class FloatingUiDomPosition {
|
|
|
97
122
|
}
|
|
98
123
|
switch (options.offset) {
|
|
99
124
|
default:
|
|
100
|
-
|
|
125
|
+
{
|
|
126
|
+
dimension = 0;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case PositionOffset.Full:
|
|
101
130
|
{
|
|
102
131
|
break;
|
|
103
132
|
}
|
|
@@ -132,7 +161,7 @@ export class FloatingUiDomPosition {
|
|
|
132
161
|
default:
|
|
133
162
|
// case PositionPlacement.Top:
|
|
134
163
|
{
|
|
135
|
-
return '
|
|
164
|
+
return 'top';
|
|
136
165
|
}
|
|
137
166
|
case PositionPlacement.TopStart:
|
|
138
167
|
{
|
|
@@ -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;;AAElG;;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;IACU,YAAY,CAAC,MAAe,EAAE,MAAe,EAAE,OAAkC;;YAE1F,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;YAC5D,MAAM,WAAW,GAAiB,EAAE,C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YACI;gBACA,8BAA8B;gBAC9B;oBACI,OAAO,QAAQ,CAAC;iBACnB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;YACD,KAAK,iBAAiB,CAAC,MAAM;gBAC7B;oBACI,OAAO,SAAS,CAAC;iBACpB;YACD,KAAK,iBAAiB,CAAC,MAAM;gBAC7B;oBACI,OAAO,QAAQ,CAAC;iBACnB;YACD,KAAK,iBAAiB,CAAC,WAAW;gBAClC;oBACI,OAAO,cAAc,CAAC;iBACzB;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,IAAI;gBAC3B;oBACI,OAAO,MAAM,CAAC;iBACjB;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,OAAO;gBAC9B;oBACI,OAAO,UAAU,CAAC;iBACrB;YACD,KAAK,iBAAiB,CAAC,KAAK;gBAC5B;oBACI,OAAO,OAAO,CAAC;iBAClB;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC;oBACI,OAAO,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHA7MQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AAiNX;;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';\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 async placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Promise<PositionResult>\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 && computedOptions.autoUpdateProcessor)\n {\n computedOptions.autoUpdateProcessor(\n {\n target,\n dispose: () => {},\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n\n const result = await runComputation();\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 return {\n target,\n dispose,\n x: result.x,\n y: result.y\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 //TODO: mouse enter\n\n middlewares.push(offset(({floating, placement}) => \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 //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 'bottom';\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,E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ACjC;oBACI,OAAO,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHAtPQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AA0PX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GACjC;IACI,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import {ClassProvider, Injectable} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION} from '@anglr/common';\nimport {extend} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions =\n{\n autoUpdate: false,\n flip: false,\n offset: PositionOffset.None,\n placement: PositionPlacement.Top\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n \n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.offset != PositionOffset.None)\n {\n if(options.offset == PositionOffset.MouseEnter)\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopStart;\n }\n }\n\n middlewares.push(offset(({floating, placement}) =>\n {\n if(options.offset == PositionOffset.MouseEnter && options.mouseEvent)\n {\n return {\n crossAxis: options.mouseEvent.offsetX\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.width;\n }\n else\n {\n dimension = floating.height;\n }\n\n switch(options.offset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset.Full:\n {\n break;\n }\n case PositionOffset.Half:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset.NegativeFull:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset.NegativeHalf:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n\n/**\n * Provider for floating ui position implementation\n */\nexport const FLOATING_UI_POSITION: ClassProvider =\n{\n provide: POSITION,\n useClass: FloatingUiDomPosition\n};"]}
|
package/es2015/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { GlobalizationService } from './services/globalization/globalization.ser
|
|
|
2
2
|
export { CommonDynamicModule } from './modules/commonDynamic.module';
|
|
3
3
|
export { CommonLocalizeModule } from './modules/commonLocalize.module';
|
|
4
4
|
export { CommonUtilsModule } from './modules/commonUtils.module';
|
|
5
|
-
export * from './modules/goBack';
|
|
6
5
|
export { ProgressIndicatorOptions } from './modules/progressIndicator/services/progressIndicatorOptions';
|
|
7
6
|
export { ProgressIndicatorComponent } from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';
|
|
8
7
|
export { ProgressIndicatorModule } from './modules/progressIndicator/modules/progressIndicator.module';
|
|
@@ -16,6 +15,8 @@ export { ClickOutsideModule } from './modules/clickOutside/modules/clickOutside.
|
|
|
16
15
|
export { MultiButtonComponent } from './modules/multiButton/components/multiButton/multiButton.component';
|
|
17
16
|
export { MULTI_BUTTON_CSS_CLASSES } from './modules/multiButton/misc/tokens';
|
|
18
17
|
export { MultiButtonModule } from './modules/multiButton/modules/multiButton.module';
|
|
18
|
+
export * from './modules/goBack';
|
|
19
|
+
export * from './modules/position';
|
|
19
20
|
export * from './modules/castPipes';
|
|
20
21
|
export * from './types/tokens';
|
|
21
22
|
export * from './utils';
|
package/es2015/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAC,0BAA0B,EAAC,MAAM,sFAAsF,CAAC;AAChI,OAAO,EAAC,uBAAuB,EAAC,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAC,wBAAwB,EAAC,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAC,6BAA6B,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,CAAC;AAEpC,sBAAsB;AACtB,0BAA0B","sourcesContent":["export {GlobalizationService} from './services/globalization/globalization.service';\nexport {CommonDynamicModule} from './modules/commonDynamic.module';\nexport {CommonLocalizeModule} from './modules/commonLocalize.module';\nexport {CommonUtilsModule} from './modules/commonUtils.module';\nexport {ProgressIndicatorOptions} from './modules/progressIndicator/services/progressIndicatorOptions';\nexport {ProgressIndicatorComponent} from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';\nexport {ProgressIndicatorModule} from './modules/progressIndicator/modules/progressIndicator.module';\nexport {ProgressIndicatorService} from './modules/progressIndicator/services/progressIndicator.service';\nexport {PROGRESS_INDICATOR_GROUP_NAME} from './modules/progressIndicator/misc/tokens';\nexport {DebugDataModule} from './modules/debugData/modules/debugData.module';\nexport {DebugDataComponent} from './modules/debugData/components/debugData/debugData.component';\nexport {DebugDataEnabledService} from './modules/debugData/services/debugDataEnabled/debugDataEnabled.service';\nexport {ClickOutsideDirective} from './modules/clickOutside/directives/clickOutside/clickOutside.directive';\nexport {ClickOutsideModule} from './modules/clickOutside/modules/clickOutside.module';\nexport {MultiButtonComponent} from './modules/multiButton/components/multiButton/multiButton.component';\nexport {MultiButtonCssClasses} from './modules/multiButton/components/multiButton/multiButton.interface';\nexport {MULTI_BUTTON_CSS_CLASSES} from './modules/multiButton/misc/tokens';\nexport {MultiButtonModule} from './modules/multiButton/modules/multiButton.module';\nexport * from './modules/goBack';\nexport * from './modules/position';\nexport * from './modules/castPipes';\nexport * from './types/tokens';\nexport * from './utils';\nexport * from './pipes';\nexport * from './decorators';\nexport {CookieService} from './services/cookies/cookies.service';\nexport {StatusCodeService} from './services/statusCode/statusCode.service';\nexport {CookiePermanentStorageService, PermanentStorage} from './services/permanentStorage';\nexport {MemoryTemporaryStorageService, TemporaryStorage} from './services/temporaryStorage';\nexport {NoStringLocalizationService, StringLocalization} from './services/stringLocalization';\nexport {Logger} from './services/logger';\nexport {NgComponentOutletEx} from './directives/ngComponentOutletEx/ngComponentOutletEx.directive';\nexport {APP_STABLE, extractAppStableResolve, runWhenModuleStable} from './utils';\nexport {PROGRESS_INTERCEPTOR_PROVIDER, ProgressInterceptor} from './modules/progressIndicator/interceptors/progressInterceptor';\nexport {DEFAULT_NOTIFICATIONS, DefaultNotificationsService, Notification, NotificationSeverity, Notifications, NotificationsOptions, NotificationsProvider, NotificationsScopeProvider, NotificationsScopeProviderFactory} from './services/notifications';\nexport * from './services/position';\n\n//TODO: any to unknown\n//TODO: strict null checks"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/position/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './positionTo/positionTo.directive';\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { Directive, Input, ElementRef, Inject } from '@angular/core';
|
|
3
|
+
import { nameof, isPresent, isString } from '@jscrpt/common';
|
|
4
|
+
import { applyPositionResult, PositionPlacement } from '../../../../services/position';
|
|
5
|
+
import { POSITION } from '../../../../types/tokens';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Sets position of attached element relative to provided element
|
|
9
|
+
*/
|
|
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
|
+
//######################### constructor #########################
|
|
18
|
+
constructor(_target, _position) {
|
|
19
|
+
this._target = _target;
|
|
20
|
+
this._position = _position;
|
|
21
|
+
}
|
|
22
|
+
//######################### public properties - inputs #########################
|
|
23
|
+
/**
|
|
24
|
+
* Gets or sets html element which is used as source for positioning
|
|
25
|
+
*/
|
|
26
|
+
get source() {
|
|
27
|
+
return this._source;
|
|
28
|
+
}
|
|
29
|
+
set source(value) {
|
|
30
|
+
if (value instanceof ElementRef) {
|
|
31
|
+
this._source = value.nativeElement;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this._source = value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets or sets position placement value
|
|
38
|
+
*/
|
|
39
|
+
get placement() {
|
|
40
|
+
return this._placement;
|
|
41
|
+
}
|
|
42
|
+
set placement(value) {
|
|
43
|
+
if (isString(value)) {
|
|
44
|
+
this._placement = PositionPlacement[value];
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this._placement = value;
|
|
48
|
+
}
|
|
49
|
+
//######################### public methods - implementation of OnChanges #########################
|
|
50
|
+
/**
|
|
51
|
+
* Called when input value changes
|
|
52
|
+
*/
|
|
53
|
+
ngOnChanges(changes) {
|
|
54
|
+
if ((nameof('source') in changes ||
|
|
55
|
+
nameof('placement') in changes) &&
|
|
56
|
+
isPresent(this.source)) {
|
|
57
|
+
this._applyPosition();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//######################### protected methods #########################
|
|
61
|
+
/**
|
|
62
|
+
* Applies position according to specified parameters to specified elements
|
|
63
|
+
*/
|
|
64
|
+
_applyPosition() {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const options = {};
|
|
67
|
+
if (this._placement) {
|
|
68
|
+
options.placement = this._placement;
|
|
69
|
+
}
|
|
70
|
+
const result = yield this._position.placeElement(this._target.nativeElement, this._source, options).toPromise();
|
|
71
|
+
applyPositionResult(result);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
PositionToDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.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.2.2", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement" }, usesOnChanges: true, ngImport: i0 });
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionToDirective, decorators: [{
|
|
78
|
+
type: Directive,
|
|
79
|
+
args: [{
|
|
80
|
+
selector: '[positionTo]'
|
|
81
|
+
}]
|
|
82
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
83
|
+
type: Inject,
|
|
84
|
+
args: [POSITION]
|
|
85
|
+
}] }]; }, propDecorators: { source: [{
|
|
86
|
+
type: Input,
|
|
87
|
+
args: ['positionTo']
|
|
88
|
+
}], placement: [{
|
|
89
|
+
type: Input
|
|
90
|
+
}] } });
|
|
91
|
+
//# sourceMappingURL=positionTo.directive.js.map
|
|
@@ -0,0 +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,MAAM,+BAA+B,CAAC;AAChH,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;AAElD;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAwD5B,oFAAoF;IAEpF,MAAM;IACN,gDAAgD;IAChD,MAAM;IACN,YAAY;IACZ,8DAA8D;IAE9D,iEAAiE;IACjE,YAAsB,OAAgC,EACd,SAAmB;QADrC,YAAO,GAAP,OAAO,CAAyB;QACd,cAAS,GAAT,SAAS,CAAU;IAE3D,CAAC;IAtDD,gFAAgF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kER,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/position/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC","sourcesContent":["export * from './directives';\nexport * from './modules';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/position/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './position.module';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { PositionToDirective } from '../directives/positionTo/positionTo.directive';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Module for position to directive
|
|
6
|
+
*/
|
|
7
|
+
export class PositionModule {
|
|
8
|
+
}
|
|
9
|
+
PositionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
10
|
+
PositionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, declarations: [PositionToDirective], exports: [PositionToDirective] });
|
|
11
|
+
PositionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, imports: [[]] });
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, decorators: [{
|
|
13
|
+
type: NgModule,
|
|
14
|
+
args: [{
|
|
15
|
+
imports: [],
|
|
16
|
+
declarations: [
|
|
17
|
+
PositionToDirective
|
|
18
|
+
],
|
|
19
|
+
exports: [
|
|
20
|
+
PositionToDirective
|
|
21
|
+
]
|
|
22
|
+
}]
|
|
23
|
+
}] });
|
|
24
|
+
//# sourceMappingURL=position.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.module.js","sourceRoot":"","sources":["../../../../../src/modules/position/modules/position.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,+CAA+C,CAAC;;AAElF;;GAEG;AAeH,MAAM,OAAO,cAAc;;2GAAd,cAAc;4GAAd,cAAc,iBAPnB,mBAAmB,aAInB,mBAAmB;4GAGd,cAAc,YAXvB,EACC;2FAUQ,cAAc;kBAd1B,QAAQ;mBACT;oBACI,OAAO,EACP,EACC;oBACD,YAAY,EACZ;wBACI,mBAAmB;qBACtB;oBACD,OAAO,EACP;wBACI,mBAAmB;qBACtB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {PositionToDirective} from '../directives/positionTo/positionTo.directive';\n\n/**\n * Module for position to directive\n */\n@NgModule(\n{\n imports:\n [\n ],\n declarations:\n [\n PositionToDirective\n ],\n exports:\n [\n PositionToDirective\n ]\n})\nexport class PositionModule\n{\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {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 *
|
|
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"]}
|
|
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
|
|
2
2
|
import { PositionOffset, PositionPlacement, POSITION } from '@anglr/common';
|
|
3
3
|
import { extend } from '@jscrpt/common';
|
|
4
4
|
import { computePosition, autoUpdate, offset, flip } from '@floating-ui/dom';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* Default options for `FloatingUiDomPosition` implementation
|
|
@@ -20,49 +21,56 @@ export class FloatingUiDomPosition {
|
|
|
20
21
|
/**
|
|
21
22
|
* @inheritdoc
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
placeElement(target, source, options) {
|
|
25
|
+
return new Observable(subscriber => {
|
|
26
|
+
(async () => {
|
|
27
|
+
const computedOptions = extend({}, defaultOptions, options);
|
|
28
|
+
const middlewares = [];
|
|
29
|
+
this._setOffset(middlewares, computedOptions);
|
|
30
|
+
this._setFlip(middlewares, computedOptions);
|
|
31
|
+
const runComputation = async () => {
|
|
32
|
+
const result = await computePosition(source, target, {
|
|
33
|
+
placement: this._getPlacement(computedOptions),
|
|
34
|
+
middleware: middlewares
|
|
35
|
+
});
|
|
36
|
+
if (computedOptions.autoUpdate) {
|
|
37
|
+
subscriber.next({
|
|
38
|
+
target,
|
|
39
|
+
dispose,
|
|
40
|
+
x: result.x,
|
|
41
|
+
y: result.y
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
let dispose = () => { };
|
|
47
|
+
if (computedOptions.autoUpdate) {
|
|
48
|
+
let options;
|
|
49
|
+
if (computedOptions.autoUpdate === true) {
|
|
50
|
+
options =
|
|
51
|
+
{
|
|
52
|
+
ancestorResize: true,
|
|
53
|
+
ancestorScroll: true,
|
|
54
|
+
elementResize: true
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
options = computedOptions.autoUpdate;
|
|
59
|
+
}
|
|
60
|
+
dispose = autoUpdate(source, target, runComputation, options);
|
|
61
|
+
}
|
|
62
|
+
const result = await runComputation();
|
|
63
|
+
subscriber.next({
|
|
35
64
|
target,
|
|
36
|
-
dispose
|
|
65
|
+
dispose,
|
|
37
66
|
x: result.x,
|
|
38
67
|
y: result.y
|
|
39
68
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (computedOptions.autoUpdate) {
|
|
46
|
-
let options;
|
|
47
|
-
if (computedOptions.autoUpdate === true) {
|
|
48
|
-
options =
|
|
49
|
-
{
|
|
50
|
-
ancestorResize: true,
|
|
51
|
-
ancestorScroll: true,
|
|
52
|
-
elementResize: true
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
options = computedOptions.autoUpdate;
|
|
57
|
-
}
|
|
58
|
-
dispose = autoUpdate(source, target, runComputation, options);
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
target,
|
|
62
|
-
dispose,
|
|
63
|
-
x: result.x,
|
|
64
|
-
y: result.y
|
|
65
|
-
};
|
|
69
|
+
if (!computedOptions.autoUpdate) {
|
|
70
|
+
subscriber.complete();
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
});
|
|
66
74
|
}
|
|
67
75
|
//######################### protected methods #########################
|
|
68
76
|
/**
|
|
@@ -82,8 +90,27 @@ export class FloatingUiDomPosition {
|
|
|
82
90
|
*/
|
|
83
91
|
_setOffset(middlewares, options) {
|
|
84
92
|
if (options.offset != PositionOffset.None) {
|
|
85
|
-
|
|
93
|
+
if (options.offset == PositionOffset.MouseEnter) {
|
|
94
|
+
//fallback if not supported placement used
|
|
95
|
+
if (options.placement == PositionPlacement.Left ||
|
|
96
|
+
options.placement == PositionPlacement.LeftStart ||
|
|
97
|
+
options.placement == PositionPlacement.LeftEnd ||
|
|
98
|
+
options.placement == PositionPlacement.Right ||
|
|
99
|
+
options.placement == PositionPlacement.RightStart ||
|
|
100
|
+
options.placement == PositionPlacement.RightEnd ||
|
|
101
|
+
options.placement == PositionPlacement.Bottom ||
|
|
102
|
+
options.placement == PositionPlacement.BottomEnd ||
|
|
103
|
+
options.placement == PositionPlacement.Top ||
|
|
104
|
+
options.placement == PositionPlacement.TopEnd) {
|
|
105
|
+
options.placement = PositionPlacement.TopStart;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
86
108
|
middlewares.push(offset(({ floating, placement }) => {
|
|
109
|
+
if (options.offset == PositionOffset.MouseEnter && options.mouseEvent) {
|
|
110
|
+
return {
|
|
111
|
+
crossAxis: options.mouseEvent.offsetX
|
|
112
|
+
};
|
|
113
|
+
}
|
|
87
114
|
let dimension;
|
|
88
115
|
if (placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||
|
|
89
116
|
placement == 'top' || placement == 'top-start' || placement == 'top-end') {
|
|
@@ -94,7 +121,11 @@ export class FloatingUiDomPosition {
|
|
|
94
121
|
}
|
|
95
122
|
switch (options.offset) {
|
|
96
123
|
default:
|
|
97
|
-
|
|
124
|
+
{
|
|
125
|
+
dimension = 0;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case PositionOffset.Full:
|
|
98
129
|
{
|
|
99
130
|
break;
|
|
100
131
|
}
|
|
@@ -129,7 +160,7 @@ export class FloatingUiDomPosition {
|
|
|
129
160
|
default:
|
|
130
161
|
// case PositionPlacement.Top:
|
|
131
162
|
{
|
|
132
|
-
return '
|
|
163
|
+
return 'top';
|
|
133
164
|
}
|
|
134
165
|
case PositionPlacement.TopStart:
|
|
135
166
|
{
|
|
@@ -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;;AAElG;;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,KAAK,CAAC,YAAY,CAAC,MAAe,EAAE,MAAe,EAAE,OAAkC;QAE1F,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,WAAW,GAAiB,EAAE,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC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CAAC;iBACtB;YACD,KAAK,iBAAiB,CAAC,MAAM;gBAC7B;oBACI,OAAO,SAAS,CAAC;iBACpB;YACD,KAAK,iBAAiB,CAAC,MAAM;gBAC7B;oBACI,OAAO,QAAQ,CAAC;iBACnB;YACD,KAAK,iBAAiB,CAAC,WAAW;gBAClC;oBACI,OAAO,cAAc,CAAC;iBACzB;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,IAAI;gBAC3B;oBACI,OAAO,MAAM,CAAC;iBACjB;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC;oBACI,OAAO,YAAY,CAAC;iBACvB;YACD,KAAK,iBAAiB,CAAC,OAAO;gBAC9B;oBACI,OAAO,UAAU,CAAC;iBACrB;YACD,KAAK,iBAAiB,CAAC,KAAK;gBAC5B;oBACI,OAAO,OAAO,CAAC;iBAClB;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC;oBACI,OAAO,aAAa,CAAC;iBACxB;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B;oBACI,OAAO,WAAW,CAAC;iBACtB;SACJ;IACL,CAAC;;kHA7MQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AAiNX;;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';\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 async placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Promise<PositionResult>\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 && computedOptions.autoUpdateProcessor)\n {\n computedOptions.autoUpdateProcessor(\n {\n target,\n dispose: () => {},\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n\n const result = await runComputation();\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 return {\n target,\n dispose,\n x: result.x,\n y: result.y\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 //TODO: mouse enter\n\n middlewares.push(offset(({floating, placement}) => \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 //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 'bottom';\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,EAAC,MAAM,eAAe,CAAC;AACxI,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC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CAAC;;kHAtPQ,qBAAqB;sHAArB,qBAAqB;2FAArB,qBAAqB;kBADjC,UAAU;;AA0PX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GACjC;IACI,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,qBAAqB;CAClC,CAAC","sourcesContent":["import {ClassProvider, Injectable} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION} from '@anglr/common';\nimport {extend} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions =\n{\n autoUpdate: false,\n flip: false,\n offset: PositionOffset.None,\n placement: PositionPlacement.Top\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n \n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions): void\n {\n if(options.offset != PositionOffset.None)\n {\n if(options.offset == PositionOffset.MouseEnter)\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopStart;\n }\n }\n\n middlewares.push(offset(({floating, placement}) =>\n {\n if(options.offset == PositionOffset.MouseEnter && options.mouseEvent)\n {\n return {\n crossAxis: options.mouseEvent.offsetX\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.width;\n }\n else\n {\n dimension = floating.height;\n }\n\n switch(options.offset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset.Full:\n {\n break;\n }\n case PositionOffset.Half:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset.NegativeFull:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset.NegativeHalf:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n\n/**\n * Provider for floating ui position implementation\n */\nexport const FLOATING_UI_POSITION: ClassProvider =\n{\n provide: POSITION,\n useClass: FloatingUiDomPosition\n};"]}
|
package/es2020/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { GlobalizationService } from './services/globalization/globalization.ser
|
|
|
2
2
|
export { CommonDynamicModule } from './modules/commonDynamic.module';
|
|
3
3
|
export { CommonLocalizeModule } from './modules/commonLocalize.module';
|
|
4
4
|
export { CommonUtilsModule } from './modules/commonUtils.module';
|
|
5
|
-
export * from './modules/goBack';
|
|
6
5
|
export { ProgressIndicatorOptions } from './modules/progressIndicator/services/progressIndicatorOptions';
|
|
7
6
|
export { ProgressIndicatorComponent } from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';
|
|
8
7
|
export { ProgressIndicatorModule } from './modules/progressIndicator/modules/progressIndicator.module';
|
|
@@ -16,6 +15,8 @@ export { ClickOutsideModule } from './modules/clickOutside/modules/clickOutside.
|
|
|
16
15
|
export { MultiButtonComponent } from './modules/multiButton/components/multiButton/multiButton.component';
|
|
17
16
|
export { MULTI_BUTTON_CSS_CLASSES } from './modules/multiButton/misc/tokens';
|
|
18
17
|
export { MultiButtonModule } from './modules/multiButton/modules/multiButton.module';
|
|
18
|
+
export * from './modules/goBack';
|
|
19
|
+
export * from './modules/position';
|
|
19
20
|
export * from './modules/castPipes';
|
|
20
21
|
export * from './types/tokens';
|
|
21
22
|
export * from './utils';
|
package/es2020/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAC,0BAA0B,EAAC,MAAM,sFAAsF,CAAC;AAChI,OAAO,EAAC,uBAAuB,EAAC,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAC,wBAAwB,EAAC,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAC,6BAA6B,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAC,kBAAkB,EAAC,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAC,uBAAuB,EAAC,MAAM,wEAAwE,CAAC;AAC/G,OAAO,EAAC,qBAAqB,EAAC,MAAM,uEAAuE,CAAC;AAC5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAC,oBAAoB,EAAC,MAAM,oEAAoE,CAAC;AAExG,OAAO,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAC,iBAAiB,EAAC,MAAM,kDAAkD,CAAC;AACnF,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAC,6BAA6B,EAAmB,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAC,6BAA6B,EAAmB,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAC,2BAA2B,EAAqB,MAAM,+BAA+B,CAAC;AAE9F,OAAO,EAAC,mBAAmB,EAAC,MAAM,gEAAgE,CAAC;AACnG,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AACjF,OAAO,EAAC,6BAA6B,EAAE,mBAAmB,EAAC,MAAM,8DAA8D,CAAC;AAChI,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAE,YAAY,EAAE,oBAAoB,EAAiB,oBAAoB,EAAuF,MAAM,0BAA0B,CAAC;AAC3P,cAAc,qBAAqB,CAAC;AAEpC,sBAAsB;AACtB,0BAA0B","sourcesContent":["export {GlobalizationService} from './services/globalization/globalization.service';\nexport {CommonDynamicModule} from './modules/commonDynamic.module';\nexport {CommonLocalizeModule} from './modules/commonLocalize.module';\nexport {CommonUtilsModule} from './modules/commonUtils.module';\nexport {ProgressIndicatorOptions} from './modules/progressIndicator/services/progressIndicatorOptions';\nexport {ProgressIndicatorComponent} from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';\nexport {ProgressIndicatorModule} from './modules/progressIndicator/modules/progressIndicator.module';\nexport {ProgressIndicatorService} from './modules/progressIndicator/services/progressIndicator.service';\nexport {PROGRESS_INDICATOR_GROUP_NAME} from './modules/progressIndicator/misc/tokens';\nexport {DebugDataModule} from './modules/debugData/modules/debugData.module';\nexport {DebugDataComponent} from './modules/debugData/components/debugData/debugData.component';\nexport {DebugDataEnabledService} from './modules/debugData/services/debugDataEnabled/debugDataEnabled.service';\nexport {ClickOutsideDirective} from './modules/clickOutside/directives/clickOutside/clickOutside.directive';\nexport {ClickOutsideModule} from './modules/clickOutside/modules/clickOutside.module';\nexport {MultiButtonComponent} from './modules/multiButton/components/multiButton/multiButton.component';\nexport {MultiButtonCssClasses} from './modules/multiButton/components/multiButton/multiButton.interface';\nexport {MULTI_BUTTON_CSS_CLASSES} from './modules/multiButton/misc/tokens';\nexport {MultiButtonModule} from './modules/multiButton/modules/multiButton.module';\nexport * from './modules/goBack';\nexport * from './modules/position';\nexport * from './modules/castPipes';\nexport * from './types/tokens';\nexport * from './utils';\nexport * from './pipes';\nexport * from './decorators';\nexport {CookieService} from './services/cookies/cookies.service';\nexport {StatusCodeService} from './services/statusCode/statusCode.service';\nexport {CookiePermanentStorageService, PermanentStorage} from './services/permanentStorage';\nexport {MemoryTemporaryStorageService, TemporaryStorage} from './services/temporaryStorage';\nexport {NoStringLocalizationService, StringLocalization} from './services/stringLocalization';\nexport {Logger} from './services/logger';\nexport {NgComponentOutletEx} from './directives/ngComponentOutletEx/ngComponentOutletEx.directive';\nexport {APP_STABLE, extractAppStableResolve, runWhenModuleStable} from './utils';\nexport {PROGRESS_INTERCEPTOR_PROVIDER, ProgressInterceptor} from './modules/progressIndicator/interceptors/progressInterceptor';\nexport {DEFAULT_NOTIFICATIONS, DefaultNotificationsService, Notification, NotificationSeverity, Notifications, NotificationsOptions, NotificationsProvider, NotificationsScopeProvider, NotificationsScopeProviderFactory} from './services/notifications';\nexport * from './services/position';\n\n//TODO: any to unknown\n//TODO: strict null checks"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/position/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './positionTo/positionTo.directive';\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Directive, Input, ElementRef, Inject } from '@angular/core';
|
|
2
|
+
import { nameof, isPresent, isString } from '@jscrpt/common';
|
|
3
|
+
import { applyPositionResult, PositionPlacement } from '../../../../services/position';
|
|
4
|
+
import { POSITION } from '../../../../types/tokens';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Sets position of attached element relative to provided element
|
|
8
|
+
*/
|
|
9
|
+
export class PositionToDirective {
|
|
10
|
+
// //######################### public properties - outputs #########################
|
|
11
|
+
// /**
|
|
12
|
+
// * Occurs when flip occurs during positioning
|
|
13
|
+
// */
|
|
14
|
+
// @Output()
|
|
15
|
+
// public flip: EventEmitter<void> = new EventEmitter<void>();
|
|
16
|
+
//######################### constructor #########################
|
|
17
|
+
constructor(_target, _position) {
|
|
18
|
+
this._target = _target;
|
|
19
|
+
this._position = _position;
|
|
20
|
+
}
|
|
21
|
+
//######################### public properties - inputs #########################
|
|
22
|
+
/**
|
|
23
|
+
* Gets or sets html element which is used as source for positioning
|
|
24
|
+
*/
|
|
25
|
+
get source() {
|
|
26
|
+
return this._source;
|
|
27
|
+
}
|
|
28
|
+
set source(value) {
|
|
29
|
+
if (value instanceof ElementRef) {
|
|
30
|
+
this._source = value.nativeElement;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
this._source = value;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets or sets position placement value
|
|
37
|
+
*/
|
|
38
|
+
get placement() {
|
|
39
|
+
return this._placement;
|
|
40
|
+
}
|
|
41
|
+
set placement(value) {
|
|
42
|
+
if (isString(value)) {
|
|
43
|
+
this._placement = PositionPlacement[value];
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this._placement = value;
|
|
47
|
+
}
|
|
48
|
+
//######################### public methods - implementation of OnChanges #########################
|
|
49
|
+
/**
|
|
50
|
+
* Called when input value changes
|
|
51
|
+
*/
|
|
52
|
+
ngOnChanges(changes) {
|
|
53
|
+
if ((nameof('source') in changes ||
|
|
54
|
+
nameof('placement') in changes) &&
|
|
55
|
+
isPresent(this.source)) {
|
|
56
|
+
this._applyPosition();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//######################### protected methods #########################
|
|
60
|
+
/**
|
|
61
|
+
* Applies position according to specified parameters to specified elements
|
|
62
|
+
*/
|
|
63
|
+
async _applyPosition() {
|
|
64
|
+
const options = {};
|
|
65
|
+
if (this._placement) {
|
|
66
|
+
options.placement = this._placement;
|
|
67
|
+
}
|
|
68
|
+
const result = await this._position.placeElement(this._target.nativeElement, this._source, options).toPromise();
|
|
69
|
+
applyPositionResult(result);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
PositionToDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionToDirective, deps: [{ token: i0.ElementRef }, { token: POSITION }], target: i0.ɵɵFactoryTarget.Directive });
|
|
73
|
+
PositionToDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.2", type: PositionToDirective, selector: "[positionTo]", inputs: { source: ["positionTo", "source"], placement: "placement" }, usesOnChanges: true, ngImport: i0 });
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionToDirective, decorators: [{
|
|
75
|
+
type: Directive,
|
|
76
|
+
args: [{
|
|
77
|
+
selector: '[positionTo]'
|
|
78
|
+
}]
|
|
79
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
80
|
+
type: Inject,
|
|
81
|
+
args: [POSITION]
|
|
82
|
+
}] }]; }, propDecorators: { source: [{
|
|
83
|
+
type: Input,
|
|
84
|
+
args: ['positionTo']
|
|
85
|
+
}], placement: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}] } });
|
|
88
|
+
//# sourceMappingURL=positionTo.directive.js.map
|
|
@@ -0,0 +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,MAAM,+BAA+B,CAAC;AAChH,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;AAElD;;GAEG;AAKH,MAAM,OAAO,mBAAmB;IAwD5B,oFAAoF;IAEpF,MAAM;IACN,gDAAgD;IAChD,MAAM;IACN,YAAY;IACZ,8DAA8D;IAE9D,iEAAiE;IACjE,YAAsB,OAAgC,EACd,SAAmB;QADrC,YAAO,GAAP,OAAO,CAAyB;QACd,cAAS,GAAT,SAAS,CAAU;IAE3D,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;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AK","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/position/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC","sourcesContent":["export * from './directives';\nexport * from './modules';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/position/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './position.module';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { PositionToDirective } from '../directives/positionTo/positionTo.directive';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Module for position to directive
|
|
6
|
+
*/
|
|
7
|
+
export class PositionModule {
|
|
8
|
+
}
|
|
9
|
+
PositionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
10
|
+
PositionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, declarations: [PositionToDirective], exports: [PositionToDirective] });
|
|
11
|
+
PositionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, imports: [[]] });
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: PositionModule, decorators: [{
|
|
13
|
+
type: NgModule,
|
|
14
|
+
args: [{
|
|
15
|
+
imports: [],
|
|
16
|
+
declarations: [
|
|
17
|
+
PositionToDirective
|
|
18
|
+
],
|
|
19
|
+
exports: [
|
|
20
|
+
PositionToDirective
|
|
21
|
+
]
|
|
22
|
+
}]
|
|
23
|
+
}] });
|
|
24
|
+
//# sourceMappingURL=position.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.module.js","sourceRoot":"","sources":["../../../../../src/modules/position/modules/position.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,+CAA+C,CAAC;;AAElF;;GAEG;AAeH,MAAM,OAAO,cAAc;;2GAAd,cAAc;4GAAd,cAAc,iBAPnB,mBAAmB,aAInB,mBAAmB;4GAGd,cAAc,YAXvB,EACC;2FAUQ,cAAc;kBAd1B,QAAQ;mBACT;oBACI,OAAO,EACP,EACC;oBACD,YAAY,EACZ;wBACI,mBAAmB;qBACtB;oBACD,OAAO,EACP;wBACI,mBAAmB;qBACtB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {PositionToDirective} from '../directives/positionTo/positionTo.directive';\n\n/**\n * Module for position to directive\n */\n@NgModule(\n{\n imports:\n [\n ],\n declarations:\n [\n PositionToDirective\n ],\n exports:\n [\n PositionToDirective\n ]\n})\nexport class PositionModule\n{\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.interface.js","sourceRoot":"","sources":["../../../../src/services/position/position.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {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 *
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import { ClassProvider } from '@angular/core';
|
|
2
2
|
import { Position, PositionResult, PositionOptions } from '@anglr/common';
|
|
3
3
|
import { Placement, Middleware } from '@floating-ui/dom';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Service that is used for positioning two elements against each other, using floating-ui dom implementation
|
|
@@ -9,7 +10,7 @@ export declare class FloatingUiDomPosition implements Position {
|
|
|
9
10
|
/**
|
|
10
11
|
* @inheritdoc
|
|
11
12
|
*/
|
|
12
|
-
placeElement(target: Element, source: Element, options?: Partial<PositionOptions>):
|
|
13
|
+
placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;
|
|
13
14
|
/**
|
|
14
15
|
* Sets flip middleware
|
|
15
16
|
* @param middlewares - Array of middlewares that will set
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floatingUiDomPosition.service.d.ts","sourceRoot":"","sources":["floatingUiDomPosition.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAa,MAAM,eAAe,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAiE,MAAM,eAAe,CAAC;AAExI,OAAO,EAAkB,SAAS,EAAc,UAAU,EAAe,MAAM,kBAAkB,CAAC;;
|
|
1
|
+
{"version":3,"file":"floatingUiDomPosition.service.d.ts","sourceRoot":"","sources":["floatingUiDomPosition.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAa,MAAM,eAAe,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAiE,MAAM,eAAe,CAAC;AAExI,OAAO,EAAkB,SAAS,EAAc,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;;AAahC;;GAEG;AACH,qBACa,qBAAsB,YAAW,QAAQ;IAIlD;;OAEG;IACI,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC;IAiFrH;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAQ7E;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAkF/E;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS;yCAhMnD,qBAAqB;6CAArB,qBAAqB;CAuPjC;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAIlC,CAAC"}
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { GlobalizationService } from './services/globalization/globalization.ser
|
|
|
2
2
|
export { CommonDynamicModule } from './modules/commonDynamic.module';
|
|
3
3
|
export { CommonLocalizeModule } from './modules/commonLocalize.module';
|
|
4
4
|
export { CommonUtilsModule } from './modules/commonUtils.module';
|
|
5
|
-
export * from './modules/goBack';
|
|
6
5
|
export { ProgressIndicatorOptions } from './modules/progressIndicator/services/progressIndicatorOptions';
|
|
7
6
|
export { ProgressIndicatorComponent } from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';
|
|
8
7
|
export { ProgressIndicatorModule } from './modules/progressIndicator/modules/progressIndicator.module';
|
|
@@ -17,6 +16,8 @@ export { MultiButtonComponent } from './modules/multiButton/components/multiButt
|
|
|
17
16
|
export { MultiButtonCssClasses } from './modules/multiButton/components/multiButton/multiButton.interface';
|
|
18
17
|
export { MULTI_BUTTON_CSS_CLASSES } from './modules/multiButton/misc/tokens';
|
|
19
18
|
export { MultiButtonModule } from './modules/multiButton/modules/multiButton.module';
|
|
19
|
+
export * from './modules/goBack';
|
|
20
|
+
export * from './modules/position';
|
|
20
21
|
export * from './modules/castPipes';
|
|
21
22
|
export * from './types/tokens';
|
|
22
23
|
export * from './utils';
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAC,0BAA0B,EAAC,MAAM,sFAAsF,CAAC;AAChI,OAAO,EAAC,uBAAuB,EAAC,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAC,wBAAwB,EAAC,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAC,6BAA6B,EAAC,MAAM,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AAChI,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,iCAAiC,EAAC,MAAM,0BAA0B,CAAC;AAC3P,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ElementRef, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { Position, PositionPlacement } from '../../../../services/position';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Sets position of attached element relative to provided element
|
|
6
|
+
*/
|
|
7
|
+
export declare class PositionToDirective implements OnChanges {
|
|
8
|
+
protected _target: ElementRef<HTMLElement>;
|
|
9
|
+
protected _position: Position;
|
|
10
|
+
/**
|
|
11
|
+
* Position placement value
|
|
12
|
+
*/
|
|
13
|
+
protected _placement: PositionPlacement | null | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Html element which is used as source for positioning
|
|
16
|
+
*/
|
|
17
|
+
protected _source: HTMLElement;
|
|
18
|
+
/**
|
|
19
|
+
* Gets or sets html element which is used as source for positioning
|
|
20
|
+
*/
|
|
21
|
+
get source(): HTMLElement;
|
|
22
|
+
set source(value: HTMLElement);
|
|
23
|
+
/**
|
|
24
|
+
* Gets or sets position placement value
|
|
25
|
+
*/
|
|
26
|
+
get placement(): PositionPlacement | null | undefined;
|
|
27
|
+
set placement(value: PositionPlacement | null | undefined);
|
|
28
|
+
constructor(_target: ElementRef<HTMLElement>, _position: Position);
|
|
29
|
+
/**
|
|
30
|
+
* Called when input value changes
|
|
31
|
+
*/
|
|
32
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
33
|
+
/**
|
|
34
|
+
* Applies position according to specified parameters to specified elements
|
|
35
|
+
*/
|
|
36
|
+
protected _applyPosition(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Custom input type for `placement` input
|
|
39
|
+
*/
|
|
40
|
+
static ngAcceptInputType_placement: PositionPlacement | undefined | null | keyof typeof PositionPlacement;
|
|
41
|
+
/**
|
|
42
|
+
* Custom input type for `positionTo` input
|
|
43
|
+
*/
|
|
44
|
+
static ngAcceptInputType_positionTo: HTMLElement | ElementRef<HTMLElement>;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PositionToDirective, never>;
|
|
46
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PositionToDirective, "[positionTo]", never, { "source": "positionTo"; "placement": "placement"; }, {}, never>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=positionTo.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positionTo.directive.d.ts","sourceRoot":"","sources":["positionTo.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAE,aAAa,EAAS,MAAM,eAAe,CAAC;AAG7F,OAAO,EAAsB,QAAQ,EAAE,iBAAiB,EAAkB,MAAM,+BAA+B,CAAC;;AAGhH;;GAEG;AACH,qBAIa,mBAAoB,YAAW,SAAS;IAiErC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC;IACxB,SAAS,CAAC,SAAS,EAAE,QAAQ;IA9D3D;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,iBAAiB,GAAC,IAAI,GAAC,SAAS,CAAC;IAEvD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAG,WAAW,CAAC;IAIhC;;OAEG;IACH,IACW,MAAM,IAAI,WAAW,CAG/B;IACD,IAAW,MAAM,CAAC,KAAK,EAAE,WAAW,EAUnC;IAED;;OAEG;IACH,IACW,SAAS,IAAI,iBAAiB,GAAC,IAAI,GAAC,SAAS,CAGvD;IACD,IAAW,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAC,IAAI,GAAC,SAAS,EAU3D;gBAWqB,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,EACd,SAAS,EAAE,QAAQ;IAM3D;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAYhD;;OAEG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB/C;;OAEG;IACH,OAAc,2BAA2B,EAAE,iBAAiB,GAAC,SAAS,GAAC,IAAI,GAAC,MAAM,OAAO,iBAAiB,CAAC;IAI3G;;OAEG;IACH,OAAc,4BAA4B,EAAE,WAAW,GAAC,UAAU,CAAC,WAAW,CAAC,CAAC;yCAxHvE,mBAAmB;2CAAnB,mBAAmB;CAyH/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "../directives/positionTo/positionTo.directive";
|
|
3
|
+
/**
|
|
4
|
+
* Module for position to directive
|
|
5
|
+
*/
|
|
6
|
+
export declare class PositionModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PositionModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PositionModule, [typeof i1.PositionToDirective], never, [typeof i1.PositionToDirective]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<PositionModule>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=position.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.module.d.ts","sourceRoot":"","sources":["position.module.ts"],"names":[],"mappings":";;AAIA;;GAEG;AACH,qBAca,cAAc;yCAAd,cAAc;0CAAd,cAAc;0CAAd,cAAc;CAE1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import { PositionOffset, PositionPlacement } from './position.types';
|
|
2
3
|
/**
|
|
3
4
|
* Options for autoupdate specific functionality
|
|
@@ -36,10 +37,6 @@ export interface PositionOptions {
|
|
|
36
37
|
* Indication whether set up 'auto updating' of position
|
|
37
38
|
*/
|
|
38
39
|
autoUpdate: boolean | AutoUpdateOptions;
|
|
39
|
-
/**
|
|
40
|
-
* Function that is called when auto updated is called for processing result
|
|
41
|
-
*/
|
|
42
|
-
autoUpdateProcessor?: (result: PositionResult) => void;
|
|
43
40
|
/**
|
|
44
41
|
* Mouse event that occured when positioning was called
|
|
45
42
|
*/
|
|
@@ -76,6 +73,6 @@ export interface Position {
|
|
|
76
73
|
* @param source - Source element to be placed against
|
|
77
74
|
* @param options - Optional options with informations about new position
|
|
78
75
|
*/
|
|
79
|
-
placeElement(target: Element, source: Element, options?: Partial<PositionOptions>):
|
|
76
|
+
placeElement(target: Element, source: Element, options?: Partial<PositionOptions>): Observable<PositionResult>;
|
|
80
77
|
}
|
|
81
78
|
//# sourceMappingURL=position.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.interface.d.ts","sourceRoot":"","sources":["position.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAE9B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAI5B;;OAEG;IACH,SAAS,EAA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AAC,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;CAClH"}
|
package/version.bak
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
11.2.0-beta.
|
|
1
|
+
11.2.0-beta.20220301105549
|