uicore-ts 1.1.375 → 1.1.377
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/compiledScripts/UIAutocompleteTextField.d.ts +1 -0
- package/compiledScripts/UIBaseButton.d.ts +2 -0
- package/compiledScripts/UIDateTimeInput.d.ts +1 -0
- package/compiledScripts/UILinkButton.d.ts +2 -0
- package/compiledScripts/UIRectangle.d.ts +48 -0
- package/compiledScripts/UIRectangle.js +239 -18
- package/compiledScripts/UIRectangle.js.map +3 -3
- package/compiledScripts/UITextField.d.ts +1 -0
- package/compiledScripts/UIView.d.ts +4 -2
- package/compiledScripts/UIView.js +36 -9
- package/compiledScripts/UIView.js.map +2 -2
- package/package.json +1 -1
- package/scripts/UIRectangle.ts +303 -9
- package/scripts/UIView.ts +35 -10
|
@@ -39,6 +39,7 @@ export declare class UIAutocompleteTextField<T = string> extends UITextField {
|
|
|
39
39
|
readonly UpArrowDown: "UpArrowDown";
|
|
40
40
|
readonly Focus: "Focus";
|
|
41
41
|
readonly Blur: "Blur";
|
|
42
|
+
readonly ScrollWheel: "ScrollWheel";
|
|
42
43
|
} & {
|
|
43
44
|
TextChange: string;
|
|
44
45
|
ValidationChange: string;
|
|
@@ -23,6 +23,7 @@ export declare class UIBaseButton extends UIView {
|
|
|
23
23
|
readonly UpArrowDown: "UpArrowDown";
|
|
24
24
|
readonly Focus: "Focus";
|
|
25
25
|
readonly Blur: "Blur";
|
|
26
|
+
readonly ScrollWheel: "ScrollWheel";
|
|
26
27
|
} & {
|
|
27
28
|
readonly PrimaryActionTriggered: "PrimaryActionTriggered";
|
|
28
29
|
};
|
|
@@ -49,6 +50,7 @@ export declare class UIBaseButton extends UIView {
|
|
|
49
50
|
readonly UpArrowDown: "UpArrowDown";
|
|
50
51
|
readonly Focus: "Focus";
|
|
51
52
|
readonly Blur: "Blur";
|
|
53
|
+
readonly ScrollWheel: "ScrollWheel";
|
|
52
54
|
} & {
|
|
53
55
|
readonly PrimaryActionTriggered: "PrimaryActionTriggered";
|
|
54
56
|
};
|
|
@@ -27,6 +27,7 @@ export declare class UILinkButton extends UILink {
|
|
|
27
27
|
readonly UpArrowDown: "UpArrowDown";
|
|
28
28
|
readonly Focus: "Focus";
|
|
29
29
|
readonly Blur: "Blur";
|
|
30
|
+
readonly ScrollWheel: "ScrollWheel";
|
|
30
31
|
} & {
|
|
31
32
|
readonly PrimaryActionTriggered: "PrimaryActionTriggered";
|
|
32
33
|
} & {
|
|
@@ -55,6 +56,7 @@ export declare class UILinkButton extends UILink {
|
|
|
55
56
|
readonly UpArrowDown: "UpArrowDown";
|
|
56
57
|
readonly Focus: "Focus";
|
|
57
58
|
readonly Blur: "Blur";
|
|
59
|
+
readonly ScrollWheel: "ScrollWheel";
|
|
58
60
|
} & {
|
|
59
61
|
readonly PrimaryActionTriggered: "PrimaryActionTriggered";
|
|
60
62
|
} & {
|
|
@@ -2,7 +2,40 @@ import { UIObject } from "./UIObject";
|
|
|
2
2
|
import { UIPoint } from "./UIPoint";
|
|
3
3
|
import { UIView } from "./UIView";
|
|
4
4
|
export type SizeNumberOrFunctionOrView = number | ((constrainingOrthogonalSize: number) => number) | UIView;
|
|
5
|
+
export type UIGroupingWrapperFrameConfiguration = {
|
|
6
|
+
/** Stable identity used to reuse the same wrapper when surrounding conditional layout changes. */
|
|
7
|
+
identifier?: string;
|
|
8
|
+
/** CSS classes applied to the generated outer wrapper element. */
|
|
9
|
+
classNames?: string[];
|
|
10
|
+
/** HTML attributes applied to the generated outer wrapper element. */
|
|
11
|
+
attributes?: Record<string, string>;
|
|
12
|
+
/** Presentational CSS applied to the generated outer wrapper element. */
|
|
13
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
14
|
+
/** Optionally transforms the bounding frame calculated from all assigned view frames. */
|
|
15
|
+
frame?: (defaultFrame: UIRectangle, assignedFrames: UIRectangle[]) => UIRectangle;
|
|
16
|
+
};
|
|
17
|
+
type UIGroupingWrapperFrameContext = {
|
|
18
|
+
configuration: UIGroupingWrapperFrameConfiguration;
|
|
19
|
+
views: UIView[];
|
|
20
|
+
framesByView: Map<UIView, UIRectangle>;
|
|
21
|
+
};
|
|
22
|
+
type UIGroupingWrapperFrameLayoutPass = {
|
|
23
|
+
owner: UIView;
|
|
24
|
+
groupingContext?: UIGroupingWrapperFrameContext;
|
|
25
|
+
requests: UIGroupingWrapperFrameContext[];
|
|
26
|
+
};
|
|
27
|
+
type UIGroupingWrapperFrameRecord = {
|
|
28
|
+
identifier?: string;
|
|
29
|
+
wrapperHTMLElement: HTMLDivElement;
|
|
30
|
+
coordinateSpaceHTMLElement: HTMLDivElement;
|
|
31
|
+
views: UIView[];
|
|
32
|
+
configuredClassNames: string[];
|
|
33
|
+
configuredAttributeNames: string[];
|
|
34
|
+
configuredStyleNames: string[];
|
|
35
|
+
};
|
|
5
36
|
export declare class UIRectangle extends UIObject {
|
|
37
|
+
static _groupingWrapperFrameLayoutPasses: UIGroupingWrapperFrameLayoutPass[];
|
|
38
|
+
static _groupingWrapperFrameRecordsByOwner: WeakMap<UIView, UIGroupingWrapperFrameRecord[]>;
|
|
6
39
|
_isBeingUpdated: boolean;
|
|
7
40
|
rectanglePointDidChange?: (b: any) => void;
|
|
8
41
|
private _data;
|
|
@@ -132,6 +165,21 @@ export declare class UIRectangle extends UIObject {
|
|
|
132
165
|
settingMaxWidth(maxWidth?: number): this;
|
|
133
166
|
rectangleByEnforcingMinAndMaxSizes(centeredOnXPosition?: number, centeredOnYPosition?: number): UIRectangle;
|
|
134
167
|
assignedAsFrameOfView(view: UIView, isWeakFrame?: boolean): this;
|
|
168
|
+
/**
|
|
169
|
+
* Begins collecting views assigned through the rectangle frame-assignment API into a DOM wrapper.
|
|
170
|
+
* The matching endGroupingWrapperFrame() returns the current rectangle unchanged, preserving the chain.
|
|
171
|
+
*/
|
|
172
|
+
beginGroupingWrapperFrame(configuration?: UIGroupingWrapperFrameConfiguration): this;
|
|
173
|
+
/** Ends the current grouping wrapper frame and returns this rectangle unchanged. */
|
|
174
|
+
endGroupingWrapperFrame(): this;
|
|
175
|
+
static _beginGroupingWrapperFrameLayoutPass(owner: UIView): void;
|
|
176
|
+
static _endGroupingWrapperFrameLayoutPass(owner: UIView): void;
|
|
177
|
+
static _assignFrameToView(frame: UIRectangle, view: UIView): void;
|
|
178
|
+
static _reconcileGroupingWrapperFrames(layoutPass: UIGroupingWrapperFrameLayoutPass): void;
|
|
179
|
+
static _newGroupingWrapperFrameRecord(): UIGroupingWrapperFrameRecord;
|
|
180
|
+
static _configureGroupingWrapperFrameRecord(record: UIGroupingWrapperFrameRecord, request: UIGroupingWrapperFrameContext, owner: UIView): void;
|
|
181
|
+
static _topLevelHTMLElementForView(view: UIView): HTMLElement & import("./UIView").LooseObject;
|
|
182
|
+
static _detachViewFromGroupingWrapperFrame(view: UIView): void;
|
|
135
183
|
toString(): string;
|
|
136
184
|
get [Symbol.toStringTag](): string;
|
|
137
185
|
IF(condition: boolean): UIRectangleConditionalChain<UIRectangle>;
|
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(UIRectangle_exports);
|
|
|
24
24
|
var import_UIObject = require("./UIObject");
|
|
25
25
|
var import_UIPoint = require("./UIPoint");
|
|
26
26
|
var import_UIView = require("./UIView");
|
|
27
|
-
class
|
|
27
|
+
const _UIRectangle = class extends import_UIObject.UIObject {
|
|
28
28
|
constructor(x = 0, y = 0, height = 0, width = 0) {
|
|
29
29
|
super();
|
|
30
30
|
this._isLazyCopy = import_UIObject.NO;
|
|
@@ -72,7 +72,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
lazyCopy() {
|
|
75
|
-
const result = Object.create(
|
|
75
|
+
const result = Object.create(_UIRectangle.prototype);
|
|
76
76
|
result._data = this._data;
|
|
77
77
|
result._data.refCount++;
|
|
78
78
|
result._isLazyCopy = import_UIObject.YES;
|
|
@@ -125,7 +125,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
125
125
|
this._data.maxWidth = value;
|
|
126
126
|
}
|
|
127
127
|
copy() {
|
|
128
|
-
const result = new
|
|
128
|
+
const result = new _UIRectangle(this.x, this.y, this.height, this.width);
|
|
129
129
|
result.minHeight = this.minHeight;
|
|
130
130
|
result.minWidth = this.minWidth;
|
|
131
131
|
result.maxHeight = this.maxHeight;
|
|
@@ -136,7 +136,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
136
136
|
return (0, import_UIObject.IS)(rectangle) && this.min.isEqualTo(rectangle.min) && this.max.isEqualTo(rectangle.max);
|
|
137
137
|
}
|
|
138
138
|
static zero() {
|
|
139
|
-
return new
|
|
139
|
+
return new _UIRectangle(0, 0, 0, 0);
|
|
140
140
|
}
|
|
141
141
|
containsPoint(point) {
|
|
142
142
|
return this.min.x <= point.x && this.min.y <= point.y && point.x <= this.max.x && point.y <= this.max.y;
|
|
@@ -528,7 +528,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
528
528
|
weights = [weights].arrayByRepeating(views.length);
|
|
529
529
|
}
|
|
530
530
|
const frames = this.rectanglesBySplittingWidth(weights, paddings, absoluteWidths);
|
|
531
|
-
frames.forEach((frame, index) => (0, import_UIObject.FIRST_OR_NIL)(views[index])
|
|
531
|
+
frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, (0, import_UIObject.FIRST_OR_NIL)(views[index])));
|
|
532
532
|
return this;
|
|
533
533
|
}
|
|
534
534
|
distributeViewsAlongHeight(views, weights = 1, paddings, absoluteHeights) {
|
|
@@ -536,17 +536,17 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
536
536
|
weights = [weights].arrayByRepeating(views.length);
|
|
537
537
|
}
|
|
538
538
|
const frames = this.rectanglesBySplittingHeight(weights, paddings, absoluteHeights);
|
|
539
|
-
frames.forEach((frame, index) => (0, import_UIObject.FIRST_OR_NIL)(views[index])
|
|
539
|
+
frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, (0, import_UIObject.FIRST_OR_NIL)(views[index])));
|
|
540
540
|
return this;
|
|
541
541
|
}
|
|
542
542
|
distributeViewsEquallyAlongWidth(views, padding) {
|
|
543
543
|
const frames = this.rectanglesByEquallySplittingWidth(views.length, padding);
|
|
544
|
-
frames.forEach((frame, index) => views[index]
|
|
544
|
+
frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, views[index]));
|
|
545
545
|
return this;
|
|
546
546
|
}
|
|
547
547
|
distributeViewsEquallyAlongHeight(views, padding) {
|
|
548
548
|
const frames = this.rectanglesByEquallySplittingHeight(views.length, padding);
|
|
549
|
-
frames.forEach((frame, index) => views[index]
|
|
549
|
+
frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, views[index]));
|
|
550
550
|
return this;
|
|
551
551
|
}
|
|
552
552
|
_heightNumberFromSizeNumberOrFunctionOrView(height) {
|
|
@@ -617,7 +617,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
617
617
|
if ((0, import_UIObject.IS_NOT_NIL)(absoluteHeights[i])) {
|
|
618
618
|
frame.height = absoluteHeights[i];
|
|
619
619
|
}
|
|
620
|
-
views[i]
|
|
620
|
+
_UIRectangle._assignFrameToView(frame, views[i]);
|
|
621
621
|
frames.push(frame);
|
|
622
622
|
const padding = paddings[i] || 0;
|
|
623
623
|
currentRectangle = frame.rectangleForNextRow(padding);
|
|
@@ -653,7 +653,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
653
653
|
frame.x += offset;
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
frames.forEach((frame, index) => views[index]
|
|
656
|
+
frames.forEach((frame, index) => _UIRectangle._assignFrameToView(frame, views[index]));
|
|
657
657
|
return frames;
|
|
658
658
|
}
|
|
659
659
|
framesByDistributingViewsAsGrid(views, paddings = 0, absoluteHeights = import_UIObject.nil) {
|
|
@@ -676,7 +676,7 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
676
676
|
const heightNumber = absoluteHeights[i];
|
|
677
677
|
rowFrames.forEach((frame, j) => {
|
|
678
678
|
frame.height = heightNumber;
|
|
679
|
-
rowViews[j]
|
|
679
|
+
_UIRectangle._assignFrameToView(frame, rowViews[j]);
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
frames.push(rowFrames);
|
|
@@ -722,10 +722,228 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
722
722
|
);
|
|
723
723
|
}
|
|
724
724
|
assignedAsFrameOfView(view, isWeakFrame = view.hasWeakFrame) {
|
|
725
|
-
|
|
725
|
+
_UIRectangle._assignFrameToView(this, view);
|
|
726
726
|
view.hasWeakFrame = isWeakFrame;
|
|
727
727
|
return this;
|
|
728
728
|
}
|
|
729
|
+
beginGroupingWrapperFrame(configuration = {}) {
|
|
730
|
+
const layoutPass = _UIRectangle._groupingWrapperFrameLayoutPasses.lastElement;
|
|
731
|
+
if (!layoutPass) {
|
|
732
|
+
throw new Error("beginGroupingWrapperFrame() must be called during a UIView layout pass");
|
|
733
|
+
}
|
|
734
|
+
if (layoutPass.groupingContext) {
|
|
735
|
+
throw new Error("Nested grouping wrapper frames are not supported");
|
|
736
|
+
}
|
|
737
|
+
layoutPass.groupingContext = {
|
|
738
|
+
configuration,
|
|
739
|
+
views: [],
|
|
740
|
+
framesByView: /* @__PURE__ */ new Map()
|
|
741
|
+
};
|
|
742
|
+
return this;
|
|
743
|
+
}
|
|
744
|
+
endGroupingWrapperFrame() {
|
|
745
|
+
const layoutPass = _UIRectangle._groupingWrapperFrameLayoutPasses.lastElement;
|
|
746
|
+
if (!(layoutPass == null ? void 0 : layoutPass.groupingContext)) {
|
|
747
|
+
throw new Error("endGroupingWrapperFrame() requires a matching beginGroupingWrapperFrame()");
|
|
748
|
+
}
|
|
749
|
+
layoutPass.requests.push(layoutPass.groupingContext);
|
|
750
|
+
layoutPass.groupingContext = void 0;
|
|
751
|
+
return this;
|
|
752
|
+
}
|
|
753
|
+
static _beginGroupingWrapperFrameLayoutPass(owner) {
|
|
754
|
+
_UIRectangle._groupingWrapperFrameLayoutPasses.push({
|
|
755
|
+
owner,
|
|
756
|
+
requests: []
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
static _endGroupingWrapperFrameLayoutPass(owner) {
|
|
760
|
+
const layoutPass = _UIRectangle._groupingWrapperFrameLayoutPasses.pop();
|
|
761
|
+
if (!layoutPass || layoutPass.owner !== owner) {
|
|
762
|
+
throw new Error("Unbalanced grouping wrapper frame layout pass");
|
|
763
|
+
}
|
|
764
|
+
if (layoutPass.groupingContext) {
|
|
765
|
+
console.error("beginGroupingWrapperFrame() was not balanced with endGroupingWrapperFrame()", owner);
|
|
766
|
+
layoutPass.requests.push(layoutPass.groupingContext);
|
|
767
|
+
}
|
|
768
|
+
if (!import_UIView.UIView.isVirtualLayouting) {
|
|
769
|
+
_UIRectangle._reconcileGroupingWrapperFrames(layoutPass);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
static _assignFrameToView(frame, view) {
|
|
773
|
+
var _a;
|
|
774
|
+
view.frame = frame;
|
|
775
|
+
const groupingContext = (_a = _UIRectangle._groupingWrapperFrameLayoutPasses.lastElement) == null ? void 0 : _a.groupingContext;
|
|
776
|
+
if (!groupingContext) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (!groupingContext.framesByView.has(view)) {
|
|
780
|
+
groupingContext.views.push(view);
|
|
781
|
+
}
|
|
782
|
+
groupingContext.framesByView.set(view, frame.copy());
|
|
783
|
+
}
|
|
784
|
+
static _reconcileGroupingWrapperFrames(layoutPass) {
|
|
785
|
+
var _a;
|
|
786
|
+
const owner = layoutPass.owner;
|
|
787
|
+
const previousRecords = (_a = _UIRectangle._groupingWrapperFrameRecordsByOwner.get(owner)) != null ? _a : [];
|
|
788
|
+
const availablePreviousRecords = previousRecords.copy();
|
|
789
|
+
const nextRecords = [];
|
|
790
|
+
const groupedViews = /* @__PURE__ */ new Set();
|
|
791
|
+
layoutPass.requests.forEach((request, requestIndex) => {
|
|
792
|
+
var _a2;
|
|
793
|
+
if (!request.views.length) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
request.views.forEach((view) => {
|
|
797
|
+
if (view.superview !== owner) {
|
|
798
|
+
throw new Error("Views in a grouping wrapper frame must be direct subviews of the layout owner");
|
|
799
|
+
}
|
|
800
|
+
if (groupedViews.has(view)) {
|
|
801
|
+
throw new Error("A view cannot belong to multiple grouping wrapper frames in one layout pass");
|
|
802
|
+
}
|
|
803
|
+
groupedViews.add(view);
|
|
804
|
+
});
|
|
805
|
+
let record;
|
|
806
|
+
if (request.configuration.identifier) {
|
|
807
|
+
record = availablePreviousRecords.find(
|
|
808
|
+
(candidate) => candidate.identifier === request.configuration.identifier
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
record = (_a2 = record != null ? record : availablePreviousRecords[requestIndex]) != null ? _a2 : availablePreviousRecords.firstElement;
|
|
812
|
+
if (record) {
|
|
813
|
+
availablePreviousRecords.removeElement(record);
|
|
814
|
+
} else {
|
|
815
|
+
record = _UIRectangle._newGroupingWrapperFrameRecord();
|
|
816
|
+
}
|
|
817
|
+
_UIRectangle._configureGroupingWrapperFrameRecord(record, request, owner);
|
|
818
|
+
nextRecords.push(record);
|
|
819
|
+
});
|
|
820
|
+
availablePreviousRecords.forEach((record) => {
|
|
821
|
+
record.views.forEach((view) => {
|
|
822
|
+
var _a2;
|
|
823
|
+
if (view.viewHTMLElement.parentElement === record.coordinateSpaceHTMLElement) {
|
|
824
|
+
(_a2 = record.wrapperHTMLElement.parentElement) == null ? void 0 : _a2.insertBefore(
|
|
825
|
+
view.viewHTMLElement,
|
|
826
|
+
record.wrapperHTMLElement
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
record.wrapperHTMLElement.remove();
|
|
831
|
+
});
|
|
832
|
+
const recordByView = /* @__PURE__ */ new Map();
|
|
833
|
+
nextRecords.forEach((record) => record.views.forEach((view) => recordByView.set(view, record)));
|
|
834
|
+
const desiredTopLevelElements = [];
|
|
835
|
+
owner.subviews.forEach((view) => {
|
|
836
|
+
var _a2;
|
|
837
|
+
const record = recordByView.get(view);
|
|
838
|
+
const element = (_a2 = record == null ? void 0 : record.wrapperHTMLElement) != null ? _a2 : view.viewHTMLElement;
|
|
839
|
+
if (!desiredTopLevelElements.contains(element)) {
|
|
840
|
+
desiredTopLevelElements.push(element);
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
const currentTopLevelElements = Array.from(owner.viewHTMLElement.children).filter(
|
|
844
|
+
(element) => desiredTopLevelElements.contains(element)
|
|
845
|
+
);
|
|
846
|
+
if (!currentTopLevelElements.isEqualToArray(desiredTopLevelElements)) {
|
|
847
|
+
desiredTopLevelElements.forEach((element) => owner.viewHTMLElement.appendChild(element));
|
|
848
|
+
}
|
|
849
|
+
_UIRectangle._groupingWrapperFrameRecordsByOwner.set(owner, nextRecords);
|
|
850
|
+
}
|
|
851
|
+
static _newGroupingWrapperFrameRecord() {
|
|
852
|
+
const wrapperHTMLElement = document.createElement("div");
|
|
853
|
+
const coordinateSpaceHTMLElement = document.createElement("div");
|
|
854
|
+
wrapperHTMLElement.classList.add("UICore_UIGroupingWrapperFrame");
|
|
855
|
+
wrapperHTMLElement.setAttribute("data-uicore-grouping-wrapper-frame", "");
|
|
856
|
+
coordinateSpaceHTMLElement.classList.add("UICore_UIGroupingWrapperFrame_CoordinateSpace");
|
|
857
|
+
coordinateSpaceHTMLElement.setAttribute("data-uicore-grouping-wrapper-coordinate-space", "");
|
|
858
|
+
wrapperHTMLElement.appendChild(coordinateSpaceHTMLElement);
|
|
859
|
+
return {
|
|
860
|
+
wrapperHTMLElement,
|
|
861
|
+
coordinateSpaceHTMLElement,
|
|
862
|
+
views: [],
|
|
863
|
+
configuredClassNames: [],
|
|
864
|
+
configuredAttributeNames: [],
|
|
865
|
+
configuredStyleNames: []
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
static _configureGroupingWrapperFrameRecord(record, request, owner) {
|
|
869
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
870
|
+
const wrapperHTMLElement = record.wrapperHTMLElement;
|
|
871
|
+
record.configuredClassNames.forEach((className) => wrapperHTMLElement.classList.remove(className));
|
|
872
|
+
record.configuredAttributeNames.forEach((attributeName) => wrapperHTMLElement.removeAttribute(attributeName));
|
|
873
|
+
record.configuredStyleNames.forEach((styleName) => wrapperHTMLElement.style[styleName] = "");
|
|
874
|
+
wrapperHTMLElement.classList.add("UICore_UIGroupingWrapperFrame");
|
|
875
|
+
wrapperHTMLElement.setAttribute("data-uicore-grouping-wrapper-frame", "");
|
|
876
|
+
record.identifier = request.configuration.identifier;
|
|
877
|
+
record.views = request.views.copy();
|
|
878
|
+
record.configuredClassNames = (_b = (_a = request.configuration.classNames) == null ? void 0 : _a.copy()) != null ? _b : [];
|
|
879
|
+
record.configuredAttributeNames = Object.keys((_c = request.configuration.attributes) != null ? _c : {});
|
|
880
|
+
record.configuredStyleNames = Object.keys((_d = request.configuration.style) != null ? _d : {});
|
|
881
|
+
record.configuredClassNames.forEach((className) => wrapperHTMLElement.classList.add(className));
|
|
882
|
+
Object.keys((_e = request.configuration.attributes) != null ? _e : {}).forEach((attributeName) => {
|
|
883
|
+
wrapperHTMLElement.setAttribute(
|
|
884
|
+
attributeName,
|
|
885
|
+
request.configuration.attributes[attributeName]
|
|
886
|
+
);
|
|
887
|
+
});
|
|
888
|
+
Object.keys((_f = request.configuration.style) != null ? _f : {}).forEach((styleName) => {
|
|
889
|
+
wrapperHTMLElement.style[styleName] = request.configuration.style[styleName];
|
|
890
|
+
});
|
|
891
|
+
if (record.identifier) {
|
|
892
|
+
wrapperHTMLElement.setAttribute("data-uicore-grouping-wrapper-frame-identifier", record.identifier);
|
|
893
|
+
} else {
|
|
894
|
+
wrapperHTMLElement.removeAttribute("data-uicore-grouping-wrapper-frame-identifier");
|
|
895
|
+
}
|
|
896
|
+
const assignedFrames = request.views.map((view) => request.framesByView.get(view));
|
|
897
|
+
const framePoints = [];
|
|
898
|
+
assignedFrames.forEach((frame) => {
|
|
899
|
+
framePoints.push(frame.min);
|
|
900
|
+
framePoints.push(frame.max);
|
|
901
|
+
});
|
|
902
|
+
const defaultFrame = _UIRectangle.boundingBoxForPoints(framePoints);
|
|
903
|
+
const wrapperFrame = (_i = (_h = (_g = request.configuration).frame) == null ? void 0 : _h.call(_g, defaultFrame.copy(), assignedFrames.copy())) != null ? _i : defaultFrame;
|
|
904
|
+
wrapperHTMLElement.style.position = "absolute";
|
|
905
|
+
wrapperHTMLElement.style.left = wrapperFrame.x + "px";
|
|
906
|
+
wrapperHTMLElement.style.top = wrapperFrame.y + "px";
|
|
907
|
+
wrapperHTMLElement.style.width = wrapperFrame.width + "px";
|
|
908
|
+
wrapperHTMLElement.style.height = wrapperFrame.height + "px";
|
|
909
|
+
wrapperHTMLElement.style.boxSizing = "border-box";
|
|
910
|
+
if (wrapperHTMLElement.parentElement !== owner.viewHTMLElement) {
|
|
911
|
+
owner.viewHTMLElement.appendChild(wrapperHTMLElement);
|
|
912
|
+
}
|
|
913
|
+
const coordinateSpaceHTMLElement = record.coordinateSpaceHTMLElement;
|
|
914
|
+
coordinateSpaceHTMLElement.classList.add("UICore_UIGroupingWrapperFrame_CoordinateSpace");
|
|
915
|
+
coordinateSpaceHTMLElement.setAttribute("data-uicore-grouping-wrapper-coordinate-space", "");
|
|
916
|
+
coordinateSpaceHTMLElement.style.position = "absolute";
|
|
917
|
+
coordinateSpaceHTMLElement.style.left = -wrapperFrame.x - (wrapperHTMLElement.clientLeft || 0) + "px";
|
|
918
|
+
coordinateSpaceHTMLElement.style.top = -wrapperFrame.y - (wrapperHTMLElement.clientTop || 0) + "px";
|
|
919
|
+
coordinateSpaceHTMLElement.style.width = owner.bounds.width + "px";
|
|
920
|
+
coordinateSpaceHTMLElement.style.height = owner.bounds.height + "px";
|
|
921
|
+
const currentViewElements = Array.from(coordinateSpaceHTMLElement.children);
|
|
922
|
+
const desiredViewElements = request.views.map((view) => view.viewHTMLElement);
|
|
923
|
+
if (!currentViewElements.isEqualToArray(desiredViewElements)) {
|
|
924
|
+
desiredViewElements.forEach((element) => coordinateSpaceHTMLElement.appendChild(element));
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
static _topLevelHTMLElementForView(view) {
|
|
928
|
+
var _a;
|
|
929
|
+
let element = view.viewHTMLElement;
|
|
930
|
+
while (element.parentElement && element.parentElement !== ((_a = view.superview) == null ? void 0 : _a.viewHTMLElement)) {
|
|
931
|
+
element = element.parentElement;
|
|
932
|
+
}
|
|
933
|
+
return element;
|
|
934
|
+
}
|
|
935
|
+
static _detachViewFromGroupingWrapperFrame(view) {
|
|
936
|
+
var _a, _b;
|
|
937
|
+
const superviewHTMLElement = (_a = view.superview) == null ? void 0 : _a.viewHTMLElement;
|
|
938
|
+
if (!superviewHTMLElement || view.viewHTMLElement.parentElement === superviewHTMLElement) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const wrapperHTMLElement = view.viewHTMLElement.closest("[data-uicore-grouping-wrapper-frame]");
|
|
942
|
+
superviewHTMLElement.appendChild(view.viewHTMLElement);
|
|
943
|
+
if (wrapperHTMLElement && !((_b = wrapperHTMLElement.querySelector("[data-uicore-grouping-wrapper-coordinate-space]")) == null ? void 0 : _b.children.length)) {
|
|
944
|
+
wrapperHTMLElement.remove();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
729
947
|
toString() {
|
|
730
948
|
const result = "[" + this.class.name + "] { x: " + this.x + ", y: " + this.y + ", height: " + this.height.toFixed(2) + ", width: " + this.height.toFixed(2) + " }";
|
|
731
949
|
return result;
|
|
@@ -751,10 +969,10 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
751
969
|
}
|
|
752
970
|
static boundingBoxForPoints(points) {
|
|
753
971
|
if (points.length === 0) {
|
|
754
|
-
return new
|
|
972
|
+
return new _UIRectangle();
|
|
755
973
|
}
|
|
756
974
|
const first = points[0];
|
|
757
|
-
const result = new
|
|
975
|
+
const result = new _UIRectangle(first.x, first.y, 0, 0);
|
|
758
976
|
for (let i = 1; i < points.length; i++) {
|
|
759
977
|
result.updateByAddingPoint(points[i]);
|
|
760
978
|
}
|
|
@@ -762,13 +980,13 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
762
980
|
}
|
|
763
981
|
static boundingBoxForRectanglesAndPoints(rectanglesAndPoints) {
|
|
764
982
|
if (rectanglesAndPoints.length === 0) {
|
|
765
|
-
return new
|
|
983
|
+
return new _UIRectangle();
|
|
766
984
|
}
|
|
767
985
|
const first = rectanglesAndPoints[0];
|
|
768
|
-
const result = first instanceof
|
|
986
|
+
const result = first instanceof _UIRectangle ? new _UIRectangle(first.x, first.y, first.height, first.width) : new _UIRectangle(first.x, first.y, 0, 0);
|
|
769
987
|
for (let i = 1; i < rectanglesAndPoints.length; i++) {
|
|
770
988
|
const rectangleOrPoint = rectanglesAndPoints[i];
|
|
771
|
-
if (rectangleOrPoint instanceof
|
|
989
|
+
if (rectangleOrPoint instanceof _UIRectangle) {
|
|
772
990
|
result.updateByAddingPoint(rectangleOrPoint.min);
|
|
773
991
|
result.updateByAddingPoint(rectangleOrPoint.max);
|
|
774
992
|
} else {
|
|
@@ -791,7 +1009,10 @@ class UIRectangle extends import_UIObject.UIObject {
|
|
|
791
1009
|
this.didChange();
|
|
792
1010
|
}
|
|
793
1011
|
}
|
|
794
|
-
}
|
|
1012
|
+
};
|
|
1013
|
+
let UIRectangle = _UIRectangle;
|
|
1014
|
+
UIRectangle._groupingWrapperFrameLayoutPasses = [];
|
|
1015
|
+
UIRectangle._groupingWrapperFrameRecordsByOwner = /* @__PURE__ */ new WeakMap();
|
|
795
1016
|
class UIRectangleConditionalBlock {
|
|
796
1017
|
constructor(initialResult, condition) {
|
|
797
1018
|
this._stack = [{
|