cx 26.8.0 → 26.9.0
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/build/charts/Legend.d.ts +8 -1
- package/build/charts/Legend.d.ts.map +1 -1
- package/build/charts/Legend.js +8 -4
- package/build/jsx-dev-runtime.d.ts +2 -1
- package/build/jsx-dev-runtime.d.ts.map +1 -1
- package/build/svg/Svg.d.ts +9 -0
- package/build/svg/Svg.d.ts.map +1 -1
- package/build/svg/Svg.js +9 -1
- package/build/ui/index.d.ts +3 -2
- package/build/ui/index.d.ts.map +1 -1
- package/build/ui/index.js +1 -1
- package/build/util/DOM.d.ts.map +1 -1
- package/build/util/DOM.js +16 -4
- package/build/util/getActiveElement.d.ts +1 -1
- package/build/util/getActiveElement.d.ts.map +1 -1
- package/build/util/getActiveElement.js +14 -2
- package/build/widgets/form/TextArea.d.ts +4 -0
- package/build/widgets/form/TextArea.d.ts.map +1 -1
- package/build/widgets/form/TextArea.js +7 -1
- package/build/widgets/grid/Grid.d.ts +3 -2
- package/build/widgets/grid/Grid.d.ts.map +1 -1
- package/build/widgets/nav/MenuItem.js +2 -2
- package/build/widgets/overlay/Dropdown.d.ts +4 -4
- package/build/widgets/overlay/Dropdown.d.ts.map +1 -1
- package/build/widgets/overlay/Dropdown.js +82 -38
- package/build/widgets/overlay/Overlay.d.ts.map +1 -1
- package/build/widgets/overlay/Overlay.js +7 -3
- package/build/widgets/overlay/Window.d.ts.map +1 -1
- package/build/widgets/overlay/Window.js +2 -1
- package/dist/charts.js +10 -3
- package/dist/manifest.js +789 -789
- package/dist/svg.js +13 -0
- package/dist/util.js +31 -9
- package/dist/widgets.js +139 -47
- package/package.json +1 -1
- package/src/charts/Legend.tsx +22 -2
- package/src/jsx-dev-runtime.ts +2 -1
- package/src/svg/Svg.tsx +24 -1
- package/src/ui/Cx.tsx +505 -505
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/exprHelpers.ts +96 -96
- package/src/ui/index.ts +3 -6
- package/src/util/DOM.ts +15 -4
- package/src/util/getActiveElement.ts +16 -2
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/form/ColorField.scss +112 -112
- package/src/widgets/form/DateTimeField.scss +111 -111
- package/src/widgets/form/LookupField.maps.scss +26 -26
- package/src/widgets/form/MonthField.scss +113 -113
- package/src/widgets/form/Select.scss +104 -104
- package/src/widgets/form/TextArea.tsx +10 -1
- package/src/widgets/form/TextField.scss +66 -66
- package/src/widgets/grid/Grid.tsx +3 -2
- package/src/widgets/index.ts +41 -41
- package/src/widgets/nav/MenuItem.tsx +2 -2
- package/src/widgets/overlay/Dropdown.tsx +87 -27
- package/src/widgets/overlay/Overlay.tsx +5 -3
- package/src/widgets/overlay/Window.tsx +2 -1
package/src/widgets/index.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
export { Widget } from "../ui/Widget";
|
|
2
|
-
export { Text } from "../ui/Text";
|
|
3
|
-
export { StaticText } from "../ui/StaticText";
|
|
4
|
-
export { PureContainer } from "../ui/PureContainer";
|
|
5
|
-
export { IsolatedScope } from "../ui/IsolatedScope";
|
|
6
|
-
export { DetachedScope } from "../ui/DetachedScope";
|
|
7
|
-
export { Restate, PrivateStore } from "../ui/Restate";
|
|
8
|
-
export { DataProxy } from "../ui/DataProxy";
|
|
9
|
-
export { Content } from "../ui/layout/Content";
|
|
10
|
-
export { ContentPlaceholder, ContentPlaceholderScope } from "../ui/layout/ContentPlaceholder";
|
|
11
|
-
export { LabelsTopLayout, LabelsTopLayoutCell } from "../ui/layout/LabelsTopLayout";
|
|
12
|
-
export { LabelsLeftLayout } from "../ui/layout/LabelsLeftLayout";
|
|
13
|
-
export { ContentResolver } from "../ui/ContentResolver";
|
|
14
|
-
export { Rescope } from "../ui/Rescope";
|
|
15
|
-
export { Repeater } from "../ui/Repeater";
|
|
16
|
-
|
|
17
|
-
export * from "./cx";
|
|
18
|
-
export * from "./HtmlElement";
|
|
19
|
-
export * from "./Button";
|
|
20
|
-
export * from "./DocumentTitle";
|
|
21
|
-
export * from "./List";
|
|
22
|
-
export * from "./Sandbox";
|
|
23
|
-
export * from "./CxCredit";
|
|
24
|
-
export * from "./Heading";
|
|
25
|
-
export * from "./Section";
|
|
26
|
-
export * from "./FlexBox";
|
|
27
|
-
export * from "./Icon";
|
|
28
|
-
export * from "./ProgressBar";
|
|
29
|
-
export * from "./Resizer";
|
|
30
|
-
export * from "./HighlightedSearchText";
|
|
31
|
-
export * from "./autoFocus";
|
|
32
|
-
export * from "./ReactElementWrapper";
|
|
33
|
-
|
|
34
|
-
export * from "./icons/index";
|
|
35
|
-
export * from "./overlay/index";
|
|
36
|
-
export * from "./nav/index";
|
|
37
|
-
export * from "./form/index";
|
|
38
|
-
export * from "./grid/index";
|
|
39
|
-
export * from "./drag-drop/index";
|
|
40
|
-
|
|
41
|
-
export * from "./enableAllInternalDependencies";
|
|
1
|
+
export { Widget } from "../ui/Widget";
|
|
2
|
+
export { Text } from "../ui/Text";
|
|
3
|
+
export { StaticText } from "../ui/StaticText";
|
|
4
|
+
export { PureContainer } from "../ui/PureContainer";
|
|
5
|
+
export { IsolatedScope } from "../ui/IsolatedScope";
|
|
6
|
+
export { DetachedScope } from "../ui/DetachedScope";
|
|
7
|
+
export { Restate, PrivateStore } from "../ui/Restate";
|
|
8
|
+
export { DataProxy } from "../ui/DataProxy";
|
|
9
|
+
export { Content } from "../ui/layout/Content";
|
|
10
|
+
export { ContentPlaceholder, ContentPlaceholderScope } from "../ui/layout/ContentPlaceholder";
|
|
11
|
+
export { LabelsTopLayout, LabelsTopLayoutCell } from "../ui/layout/LabelsTopLayout";
|
|
12
|
+
export { LabelsLeftLayout } from "../ui/layout/LabelsLeftLayout";
|
|
13
|
+
export { ContentResolver } from "../ui/ContentResolver";
|
|
14
|
+
export { Rescope } from "../ui/Rescope";
|
|
15
|
+
export { Repeater } from "../ui/Repeater";
|
|
16
|
+
|
|
17
|
+
export * from "./cx";
|
|
18
|
+
export * from "./HtmlElement";
|
|
19
|
+
export * from "./Button";
|
|
20
|
+
export * from "./DocumentTitle";
|
|
21
|
+
export * from "./List";
|
|
22
|
+
export * from "./Sandbox";
|
|
23
|
+
export * from "./CxCredit";
|
|
24
|
+
export * from "./Heading";
|
|
25
|
+
export * from "./Section";
|
|
26
|
+
export * from "./FlexBox";
|
|
27
|
+
export * from "./Icon";
|
|
28
|
+
export * from "./ProgressBar";
|
|
29
|
+
export * from "./Resizer";
|
|
30
|
+
export * from "./HighlightedSearchText";
|
|
31
|
+
export * from "./autoFocus";
|
|
32
|
+
export * from "./ReactElementWrapper";
|
|
33
|
+
|
|
34
|
+
export * from "./icons/index";
|
|
35
|
+
export * from "./overlay/index";
|
|
36
|
+
export * from "./nav/index";
|
|
37
|
+
export * from "./form/index";
|
|
38
|
+
export * from "./grid/index";
|
|
39
|
+
export * from "./drag-drop/index";
|
|
40
|
+
|
|
41
|
+
export * from "./enableAllInternalDependencies";
|
|
@@ -385,7 +385,7 @@ class MenuItemComponent extends VDOM.Component<MenuItemComponentProps, MenuItemC
|
|
|
385
385
|
debug(menuFlag, "MenuItem", "mouseLeave", this.el);
|
|
386
386
|
this.clearAutoFocusTimer();
|
|
387
387
|
|
|
388
|
-
if (widget.hoverToOpen &&
|
|
388
|
+
if (widget.hoverToOpen && getActiveElement() == this.el) unfocusElement(this.el!);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
tooltipMouseLeave(e, this.props.instance, widget.tooltip);
|
|
@@ -486,7 +486,7 @@ class MenuItemComponent extends VDOM.Component<MenuItemComponentProps, MenuItemC
|
|
|
486
486
|
let { widget } = this.props.instance;
|
|
487
487
|
if (widget.dropdown) {
|
|
488
488
|
oneFocusOut(this, this.el!, this.onFocusOut.bind(this));
|
|
489
|
-
debug(menuFlag, "MenuItem", "focus", this.el,
|
|
489
|
+
debug(menuFlag, "MenuItem", "focus", this.el, getActiveElement());
|
|
490
490
|
this.clearAutoFocusTimer();
|
|
491
491
|
if (widget.openOnFocus) this.openDropdown();
|
|
492
492
|
}
|
|
@@ -5,6 +5,7 @@ import { Widget, VDOM } from "../../ui/Widget";
|
|
|
5
5
|
import { calculateNaturalElementHeight } from "../../util/calculateNaturalElementHeight";
|
|
6
6
|
import { closestParent, findFirst, isFocusable } from "../../util/DOM";
|
|
7
7
|
import { getTopLevelBoundingClientRect } from "../../util/getTopLevelBoundingClientRect";
|
|
8
|
+
import { getParentFrameBoundingClientRect } from "../../util/getParentFrameBoundingClientRect";
|
|
8
9
|
import { isTouchDevice } from "../../util/isTouchDevice";
|
|
9
10
|
import {
|
|
10
11
|
ConfigureOverlayContainerContext,
|
|
@@ -224,6 +225,23 @@ export class DropdownBase<
|
|
|
224
225
|
component.updateDropdownPosition,
|
|
225
226
|
);
|
|
226
227
|
|
|
228
|
+
//if the related element lives in a different document (e.g. inside a same-origin
|
|
229
|
+
//iframe), that document/window has its own scroll position and its own resize event
|
|
230
|
+
//(which also fires when the <iframe> element itself is resized) - neither is observed
|
|
231
|
+
//by the top-level `window` above or by the relatedElement's parentElement chain, so
|
|
232
|
+
//track every frame window between the related element's document and the top document.
|
|
233
|
+
var frameWindows: Window[] = (component.frameWindows = []);
|
|
234
|
+
var frameWin: Window | null | undefined =
|
|
235
|
+
instance.relatedElement?.ownerDocument?.defaultView;
|
|
236
|
+
while (frameWin && frameWin !== window) {
|
|
237
|
+
frameWindows.push(frameWin);
|
|
238
|
+
frameWin = frameWin.frameElement?.ownerDocument?.defaultView;
|
|
239
|
+
}
|
|
240
|
+
frameWindows.forEach((w) => {
|
|
241
|
+
w.addEventListener("scroll", component.updateDropdownPosition);
|
|
242
|
+
w.addEventListener("resize", component.updateDropdownPosition);
|
|
243
|
+
});
|
|
244
|
+
|
|
227
245
|
if (this.onDropdownDidMount)
|
|
228
246
|
instance.invoke("onDropdownDidMount", instance, component);
|
|
229
247
|
|
|
@@ -246,14 +264,21 @@ export class DropdownBase<
|
|
|
246
264
|
}
|
|
247
265
|
|
|
248
266
|
overlayWillUnmount(instance: InstanceType, component: any): void {
|
|
249
|
-
var { scrollableParents } = component;
|
|
267
|
+
var { scrollableParents, frameWindows } = component;
|
|
250
268
|
if (scrollableParents) {
|
|
251
269
|
scrollableParents.forEach((el: Element) => {
|
|
252
270
|
el.removeEventListener("scroll", component.updateDropdownPosition);
|
|
253
271
|
});
|
|
254
272
|
delete component.scrollableParents;
|
|
255
|
-
delete component.updateDropdownPosition;
|
|
256
273
|
}
|
|
274
|
+
if (frameWindows) {
|
|
275
|
+
frameWindows.forEach((w: Window) => {
|
|
276
|
+
w.removeEventListener("scroll", component.updateDropdownPosition);
|
|
277
|
+
w.removeEventListener("resize", component.updateDropdownPosition);
|
|
278
|
+
});
|
|
279
|
+
delete component.frameWindows;
|
|
280
|
+
}
|
|
281
|
+
delete component.updateDropdownPosition;
|
|
257
282
|
if (component.offResize) component.offResize();
|
|
258
283
|
|
|
259
284
|
if (this.pipeValidateDropdownPosition)
|
|
@@ -278,7 +303,17 @@ export class DropdownBase<
|
|
|
278
303
|
updateDropdownPosition(instance: InstanceType, component: any): void {
|
|
279
304
|
var { el, initialScreenPosition } = component;
|
|
280
305
|
var { data, relatedElement } = instance;
|
|
281
|
-
var
|
|
306
|
+
var elDocument: Document = el.ownerDocument || document;
|
|
307
|
+
|
|
308
|
+
//if the dropdown renders in the same document as its related element (e.g. not
|
|
309
|
+
//portaled to the top-level body, such as an inline dropdown living inside an
|
|
310
|
+
//iframe together with its field), no cross-document offset should be applied -
|
|
311
|
+
//getBoundingClientRect() is already relative to that shared document/viewport.
|
|
312
|
+
var isSameDocument =
|
|
313
|
+
el && relatedElement && el.ownerDocument === relatedElement.ownerDocument;
|
|
314
|
+
var parentBounds = isSameDocument
|
|
315
|
+
? relatedElement!.getBoundingClientRect()
|
|
316
|
+
: getTopLevelBoundingClientRect(relatedElement!);
|
|
282
317
|
|
|
283
318
|
//getBoundingClientRect() will return an empty rect if the element is hidden or removed
|
|
284
319
|
if (
|
|
@@ -291,19 +326,33 @@ export class DropdownBase<
|
|
|
291
326
|
parentBounds = component.parentBounds;
|
|
292
327
|
} else component.parentBounds = parentBounds;
|
|
293
328
|
|
|
294
|
-
|
|
329
|
+
//instance.mousePosition (set from getCursorPos) is always expressed in top-document
|
|
330
|
+
//coordinates. When the dropdown and its related element share a document that isn't
|
|
331
|
+
//the top document (e.g. both live inside the same iframe), parentBounds above is in
|
|
332
|
+
//that document's own coordinate space, so the mouse position must be translated into
|
|
333
|
+
//the same space before it can replace part of parentBounds.
|
|
334
|
+
var mousePosition = instance.mousePosition;
|
|
335
|
+
if (mousePosition && isSameDocument && elDocument !== document) {
|
|
336
|
+
const frameOffset = getParentFrameBoundingClientRect(relatedElement!);
|
|
337
|
+
mousePosition = {
|
|
338
|
+
x: mousePosition.x - frameOffset.left,
|
|
339
|
+
y: mousePosition.y - frameOffset.top,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (this.trackMouseX && mousePosition) {
|
|
295
344
|
parentBounds = new DOMRect(
|
|
296
|
-
|
|
345
|
+
mousePosition.x,
|
|
297
346
|
parentBounds.top,
|
|
298
347
|
0,
|
|
299
348
|
parentBounds.bottom - parentBounds.top,
|
|
300
349
|
);
|
|
301
350
|
}
|
|
302
351
|
|
|
303
|
-
if (this.trackMouseY &&
|
|
352
|
+
if (this.trackMouseY && mousePosition) {
|
|
304
353
|
parentBounds = new DOMRect(
|
|
305
354
|
parentBounds.left,
|
|
306
|
-
|
|
355
|
+
mousePosition.y,
|
|
307
356
|
parentBounds.right - parentBounds.left,
|
|
308
357
|
0,
|
|
309
358
|
);
|
|
@@ -334,6 +383,7 @@ export class DropdownBase<
|
|
|
334
383
|
parentBounds,
|
|
335
384
|
data.placement,
|
|
336
385
|
component.lastPlacement,
|
|
386
|
+
elDocument,
|
|
337
387
|
);
|
|
338
388
|
|
|
339
389
|
var arrowAdjust = this.getArrowAdjust(component);
|
|
@@ -346,6 +396,7 @@ export class DropdownBase<
|
|
|
346
396
|
el,
|
|
347
397
|
false,
|
|
348
398
|
arrowAdjust,
|
|
399
|
+
elDocument,
|
|
349
400
|
);
|
|
350
401
|
component.setCustomStyle(style);
|
|
351
402
|
this.setDirectionClass(component, placement);
|
|
@@ -366,6 +417,7 @@ export class DropdownBase<
|
|
|
366
417
|
el,
|
|
367
418
|
true,
|
|
368
419
|
arrowAdjust,
|
|
420
|
+
elDocument,
|
|
369
421
|
);
|
|
370
422
|
component.setCustomStyle(newStyle);
|
|
371
423
|
}
|
|
@@ -412,8 +464,9 @@ export class DropdownBase<
|
|
|
412
464
|
el: HTMLElement,
|
|
413
465
|
noAuto: boolean,
|
|
414
466
|
arrowAdjust: number = 0,
|
|
467
|
+
elDocument: Document,
|
|
415
468
|
): void {
|
|
416
|
-
let viewport = getViewportRect(this.screenPadding);
|
|
469
|
+
let viewport = getViewportRect(this.screenPadding, elDocument);
|
|
417
470
|
style.position = "fixed";
|
|
418
471
|
|
|
419
472
|
if (placement.startsWith("down")) {
|
|
@@ -431,7 +484,7 @@ export class DropdownBase<
|
|
|
431
484
|
? Math.max(this.screenPadding, top) + "px"
|
|
432
485
|
: "auto";
|
|
433
486
|
style.bottom =
|
|
434
|
-
|
|
487
|
+
elDocument.documentElement.clientHeight -
|
|
435
488
|
(this.cover ? rel.bottom : rel.top) +
|
|
436
489
|
this.offset +
|
|
437
490
|
"px";
|
|
@@ -450,7 +503,7 @@ export class DropdownBase<
|
|
|
450
503
|
break;
|
|
451
504
|
|
|
452
505
|
case "down-left":
|
|
453
|
-
style.right = `${
|
|
506
|
+
style.right = `${elDocument.documentElement.clientWidth - rel.right - arrowAdjust}px`;
|
|
454
507
|
style.left = "auto";
|
|
455
508
|
break;
|
|
456
509
|
|
|
@@ -466,7 +519,7 @@ export class DropdownBase<
|
|
|
466
519
|
break;
|
|
467
520
|
|
|
468
521
|
case "up-left":
|
|
469
|
-
style.right = `${
|
|
522
|
+
style.right = `${elDocument.documentElement.clientWidth - rel.right - arrowAdjust}px`;
|
|
470
523
|
style.left = "auto";
|
|
471
524
|
break;
|
|
472
525
|
|
|
@@ -488,45 +541,45 @@ export class DropdownBase<
|
|
|
488
541
|
case "right-up":
|
|
489
542
|
style.top = "auto";
|
|
490
543
|
style.right = "auto";
|
|
491
|
-
style.bottom = `${
|
|
544
|
+
style.bottom = `${elDocument.documentElement.clientHeight - rel.bottom - arrowAdjust}px`;
|
|
492
545
|
style.left = `${rel.right + this.offset}px`;
|
|
493
546
|
break;
|
|
494
547
|
|
|
495
548
|
case "left":
|
|
496
549
|
case "left-center":
|
|
497
550
|
style.top = `${Math.round((rel.top + rel.bottom - el.offsetHeight) / 2)}px`;
|
|
498
|
-
style.right = `${
|
|
551
|
+
style.right = `${elDocument.documentElement.clientWidth - rel.left + this.offset}px`;
|
|
499
552
|
style.bottom = "auto";
|
|
500
553
|
style.left = "auto";
|
|
501
554
|
break;
|
|
502
555
|
|
|
503
556
|
case "left-down":
|
|
504
557
|
style.top = `${rel.top - arrowAdjust}px`;
|
|
505
|
-
style.right = `${
|
|
558
|
+
style.right = `${elDocument.documentElement.clientWidth - rel.left + this.offset}px`;
|
|
506
559
|
style.bottom = "auto";
|
|
507
560
|
style.left = "auto";
|
|
508
561
|
break;
|
|
509
562
|
|
|
510
563
|
case "left-up":
|
|
511
564
|
style.top = "auto";
|
|
512
|
-
style.right = `${
|
|
513
|
-
style.bottom = `${
|
|
565
|
+
style.right = `${elDocument.documentElement.clientWidth - rel.left + this.offset}px`;
|
|
566
|
+
style.bottom = `${elDocument.documentElement.clientHeight - rel.bottom - arrowAdjust}px`;
|
|
514
567
|
style.left = "auto";
|
|
515
568
|
break;
|
|
516
569
|
|
|
517
570
|
case "screen-center":
|
|
518
571
|
let w = Math.min(
|
|
519
572
|
contentSize.width,
|
|
520
|
-
|
|
573
|
+
elDocument.documentElement.clientWidth - 2 * this.screenPadding,
|
|
521
574
|
);
|
|
522
575
|
let h = Math.min(
|
|
523
576
|
contentSize.height,
|
|
524
|
-
|
|
577
|
+
elDocument.documentElement.clientHeight - 2 * this.screenPadding,
|
|
525
578
|
);
|
|
526
|
-
style.top = `${Math.round((
|
|
527
|
-
style.right = `${Math.round((
|
|
528
|
-
style.bottom = `${Math.round((
|
|
529
|
-
style.left = `${Math.round((
|
|
579
|
+
style.top = `${Math.round((elDocument.documentElement.clientHeight - h) / 2)}px`;
|
|
580
|
+
style.right = `${Math.round((elDocument.documentElement.clientWidth - w) / 2)}px`;
|
|
581
|
+
style.bottom = `${Math.round((elDocument.documentElement.clientHeight - h) / 2)}px`;
|
|
582
|
+
style.left = `${Math.round((elDocument.documentElement.clientWidth - w) / 2)}px`;
|
|
530
583
|
break;
|
|
531
584
|
}
|
|
532
585
|
}
|
|
@@ -539,8 +592,9 @@ export class DropdownBase<
|
|
|
539
592
|
el: HTMLElement,
|
|
540
593
|
noAuto: boolean,
|
|
541
594
|
arrowAdjust: number = 0,
|
|
595
|
+
elDocument: Document,
|
|
542
596
|
): void {
|
|
543
|
-
var viewport = getViewportRect(this.screenPadding);
|
|
597
|
+
var viewport = getViewportRect(this.screenPadding, elDocument);
|
|
544
598
|
|
|
545
599
|
style.position = "absolute";
|
|
546
600
|
|
|
@@ -647,6 +701,7 @@ export class DropdownBase<
|
|
|
647
701
|
el: HTMLElement,
|
|
648
702
|
noAuto: boolean,
|
|
649
703
|
arrowAdjust: number = 0,
|
|
704
|
+
elDocument: Document,
|
|
650
705
|
): void {
|
|
651
706
|
switch (this.positioning) {
|
|
652
707
|
case "absolute":
|
|
@@ -658,6 +713,7 @@ export class DropdownBase<
|
|
|
658
713
|
el,
|
|
659
714
|
noAuto,
|
|
660
715
|
arrowAdjust,
|
|
716
|
+
elDocument,
|
|
661
717
|
);
|
|
662
718
|
break;
|
|
663
719
|
|
|
@@ -671,6 +727,7 @@ export class DropdownBase<
|
|
|
671
727
|
el,
|
|
672
728
|
noAuto,
|
|
673
729
|
arrowAdjust,
|
|
730
|
+
elDocument,
|
|
674
731
|
);
|
|
675
732
|
else
|
|
676
733
|
this.applyFixedPositioningPlacementStyles(
|
|
@@ -681,6 +738,7 @@ export class DropdownBase<
|
|
|
681
738
|
el,
|
|
682
739
|
noAuto,
|
|
683
740
|
arrowAdjust,
|
|
741
|
+
elDocument,
|
|
684
742
|
);
|
|
685
743
|
break;
|
|
686
744
|
|
|
@@ -693,6 +751,7 @@ export class DropdownBase<
|
|
|
693
751
|
el,
|
|
694
752
|
noAuto,
|
|
695
753
|
arrowAdjust,
|
|
754
|
+
elDocument,
|
|
696
755
|
);
|
|
697
756
|
break;
|
|
698
757
|
}
|
|
@@ -749,13 +808,14 @@ export class DropdownBase<
|
|
|
749
808
|
target: any,
|
|
750
809
|
placement: string,
|
|
751
810
|
lastPlacement: any,
|
|
811
|
+
elDocument: Document,
|
|
752
812
|
): any {
|
|
753
813
|
var placementOrder = this.placementOrder.split(" ");
|
|
754
814
|
var best = lastPlacement || placement;
|
|
755
815
|
var first;
|
|
756
816
|
|
|
757
817
|
var score: Record<string, number> = {};
|
|
758
|
-
var viewport = getViewportRect();
|
|
818
|
+
var viewport = getViewportRect(0, elDocument);
|
|
759
819
|
|
|
760
820
|
for (var i = 0; i < placementOrder.length; i++) {
|
|
761
821
|
var p = placementOrder[i];
|
|
@@ -970,11 +1030,11 @@ export class Dropdown extends DropdownBase<DropdownConfig, DropdownInstance> {}
|
|
|
970
1030
|
Widget.alias("dropdown", Dropdown);
|
|
971
1031
|
Localization.registerPrototype("cx/widgets/Dropdown", Dropdown);
|
|
972
1032
|
|
|
973
|
-
function getViewportRect(padding = 0) {
|
|
1033
|
+
function getViewportRect(padding = 0, elDocument: Document = document) {
|
|
974
1034
|
return {
|
|
975
1035
|
left: padding,
|
|
976
1036
|
top: padding,
|
|
977
|
-
right:
|
|
978
|
-
bottom:
|
|
1037
|
+
right: elDocument.documentElement.clientWidth - padding,
|
|
1038
|
+
bottom: elDocument.documentElement.clientHeight - padding,
|
|
979
1039
|
};
|
|
980
1040
|
}
|
|
@@ -765,9 +765,11 @@ export class OverlayComponent<
|
|
|
765
765
|
widget.handleResize(e, instance, this);
|
|
766
766
|
} else {
|
|
767
767
|
let prefix = this.getResizePrefix(e);
|
|
768
|
-
this.setCustomStyle({
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
if (prefix) this.setCustomStyle({ cursor: `${prefix}-resize` });
|
|
769
|
+
else if (this.customStyle.cursor) {
|
|
770
|
+
delete this.customStyle.cursor;
|
|
771
|
+
if (this.el) this.el.style.cursor = data.style?.cursor ?? "";
|
|
772
|
+
}
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
775
|
|
|
@@ -21,6 +21,7 @@ import { isDefined } from "../../util/isDefined";
|
|
|
21
21
|
import { isString } from "../../util/isString";
|
|
22
22
|
import { BooleanProp, StringProp, StyleProp, ClassProp } from "../../ui/Prop";
|
|
23
23
|
import { RenderingContext } from "../../ui/RenderingContext";
|
|
24
|
+
import { getActiveElement } from "../../util/getActiveElement";
|
|
24
25
|
|
|
25
26
|
export interface WindowConfig extends OverlayConfig {
|
|
26
27
|
/** Text to be displayed in the header. */
|
|
@@ -292,7 +293,7 @@ class WindowComponent extends OverlayComponent<WindowComponentProps, WindowCompo
|
|
|
292
293
|
onFocusIn() {
|
|
293
294
|
super.onFocusIn();
|
|
294
295
|
if (!this.state.active) {
|
|
295
|
-
if (this.containerEl?.contains(
|
|
296
|
+
if (this.containerEl?.contains(getActiveElement())) this.setZIndex(ZIndexManager.next());
|
|
296
297
|
this.setState({ active: true });
|
|
297
298
|
}
|
|
298
299
|
}
|