uicore-ts 1.1.127 → 1.1.128
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.
|
@@ -7,6 +7,8 @@ export interface UIRootViewControllerLazyViewControllerObject<T extends typeof U
|
|
|
7
7
|
class: T;
|
|
8
8
|
shouldShow: () => (Promise<boolean> | boolean);
|
|
9
9
|
isInitialized: boolean;
|
|
10
|
+
deleteOnUnload: boolean;
|
|
11
|
+
deleteInstance: () => void;
|
|
10
12
|
}
|
|
11
13
|
export interface UIRootViewControllerLazyViewControllersObject {
|
|
12
14
|
[x: string]: UIRootViewControllerLazyViewControllerObject<typeof UIViewController>;
|
|
@@ -24,7 +26,10 @@ export declare class UIRootViewController extends UIViewController {
|
|
|
24
26
|
_detailsViewController?: UIViewController;
|
|
25
27
|
detailsViewControllers: UIRootViewControllerLazyViewControllersObject;
|
|
26
28
|
constructor(view: UIView);
|
|
27
|
-
lazyViewControllerObjectWithClass<T extends typeof UIViewController>(classObject: T,
|
|
29
|
+
lazyViewControllerObjectWithClass<T extends typeof UIViewController>(classObject: T, options?: {
|
|
30
|
+
shouldShow?: () => (Promise<boolean> | boolean);
|
|
31
|
+
deleteOnUnload?: boolean;
|
|
32
|
+
}): UIRootViewControllerLazyViewControllerObject<T>;
|
|
28
33
|
handleRoute(route: UIRoute): Promise<void>;
|
|
29
34
|
setContentViewControllerForRoute(route: UIRoute): Promise<void>;
|
|
30
35
|
setDetailsViewControllerForRoute(route: UIRoute): Promise<void>;
|
|
@@ -79,23 +79,36 @@ class UIRootViewController extends import_UIViewController.UIViewController {
|
|
|
79
79
|
this.detailsViewControllers = {};
|
|
80
80
|
this.view.addSubview(this.backgroundView);
|
|
81
81
|
}
|
|
82
|
-
lazyViewControllerObjectWithClass(classObject,
|
|
82
|
+
lazyViewControllerObjectWithClass(classObject, options = {}) {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
const shouldShow = (_a = options.shouldShow) != null ? _a : () => import_UIObject.YES;
|
|
85
|
+
const deleteOnUnload = (_b = options.deleteOnUnload) != null ? _b : import_UIObject.NO;
|
|
83
86
|
const result = {
|
|
84
87
|
class: classObject,
|
|
85
88
|
instance: import_UIObject.nil,
|
|
86
89
|
shouldShow,
|
|
87
|
-
isInitialized: import_UIObject.NO
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return new classObject(
|
|
94
|
-
new import_UIView.UIView(classObject.name.replace("ViewController", "View"))
|
|
95
|
-
);
|
|
90
|
+
isInitialized: import_UIObject.NO,
|
|
91
|
+
deleteOnUnload,
|
|
92
|
+
deleteInstance: () => {
|
|
93
|
+
if (result.isInitialized) {
|
|
94
|
+
result.isInitialized = import_UIObject.NO;
|
|
95
|
+
initializeLazyInstance();
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const initializeLazyInstance = () => {
|
|
100
|
+
import_UIObject.UIObject.configureWithObject(result, {
|
|
101
|
+
instance: (0, import_UIObject.LAZY_VALUE)(
|
|
102
|
+
() => {
|
|
103
|
+
result.isInitialized = import_UIObject.YES;
|
|
104
|
+
return new classObject(
|
|
105
|
+
new import_UIView.UIView(classObject.name.replace("ViewController", "View"))
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
initializeLazyInstance();
|
|
99
112
|
return result;
|
|
100
113
|
}
|
|
101
114
|
handleRoute(route) {
|
|
@@ -116,6 +129,14 @@ class UIRootViewController extends import_UIViewController.UIViewController {
|
|
|
116
129
|
),
|
|
117
130
|
this.contentViewControllers.mainViewController
|
|
118
131
|
);
|
|
132
|
+
if ((0, import_UIObject.IS)(this._contentViewController) && this._contentViewController !== contentViewControllerObject.instance) {
|
|
133
|
+
const oldViewControllerObject = this.contentViewControllers.allValues.find(
|
|
134
|
+
(value) => value.isInitialized && value.instance === this._contentViewController
|
|
135
|
+
);
|
|
136
|
+
if (oldViewControllerObject == null ? void 0 : oldViewControllerObject.deleteOnUnload) {
|
|
137
|
+
oldViewControllerObject.deleteInstance();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
119
140
|
this.contentViewController = contentViewControllerObject.instance;
|
|
120
141
|
});
|
|
121
142
|
}
|
|
@@ -129,12 +150,26 @@ class UIRootViewController extends import_UIViewController.UIViewController {
|
|
|
129
150
|
)
|
|
130
151
|
);
|
|
131
152
|
if ((0, import_UIObject.IS)(route) && (0, import_UIObject.IS)(this.detailsViewController) && (0, import_UIObject.IS_NOT)(detailsViewControllerObject)) {
|
|
153
|
+
const oldViewControllerObject = this.detailsViewControllers.allValues.find(
|
|
154
|
+
(value) => value.isInitialized && value.instance === this._detailsViewController
|
|
155
|
+
);
|
|
156
|
+
if (oldViewControllerObject == null ? void 0 : oldViewControllerObject.deleteOnUnload) {
|
|
157
|
+
oldViewControllerObject.deleteInstance();
|
|
158
|
+
}
|
|
132
159
|
this.detailsViewController = void 0;
|
|
133
160
|
this._detailsDialogView.dismiss();
|
|
134
161
|
this.view.setNeedsLayout();
|
|
135
162
|
return;
|
|
136
163
|
}
|
|
137
|
-
this.
|
|
164
|
+
if ((0, import_UIObject.IS)(this._detailsViewController) && this._detailsViewController !== (detailsViewControllerObject == null ? void 0 : detailsViewControllerObject.instance)) {
|
|
165
|
+
const oldViewControllerObject = this.detailsViewControllers.allValues.find(
|
|
166
|
+
(value) => value.isInitialized && value.instance === this._detailsViewController
|
|
167
|
+
);
|
|
168
|
+
if (oldViewControllerObject == null ? void 0 : oldViewControllerObject.deleteOnUnload) {
|
|
169
|
+
oldViewControllerObject.deleteInstance();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this.detailsViewController = detailsViewControllerObject == null ? void 0 : detailsViewControllerObject.instance;
|
|
138
173
|
});
|
|
139
174
|
}
|
|
140
175
|
get contentViewController() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../scripts/UIRootViewController.ts"],
|
|
4
|
-
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UIDialogView } from \"./UIDialogView\"\nimport { EXTEND, FIRST, FIRST_OR_NIL, IS, IS_NOT, LAZY_VALUE, nil, NO, UIObject, wrapInNil, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport interface UIRootViewControllerLazyViewControllerObject<T extends typeof UIViewController> {\n instance: InstanceType<T>;\n class: T;\n shouldShow: () => (Promise<boolean> | boolean);\n isInitialized: boolean\n}\n\n\nexport interface UIRootViewControllerLazyViewControllersObject {\n [x: string]: UIRootViewControllerLazyViewControllerObject<typeof UIViewController>\n}\n\n\nexport interface UIRootViewControllerLazyContentViewControllersObject extends UIRootViewControllerLazyViewControllersObject {\n mainViewController: UIRootViewControllerLazyViewControllerObject<typeof UIViewController>\n}\n\n\nexport class UIRootViewController extends UIViewController {\n \n topBarView?: UIView\n backgroundView: UIView = new UIView(this.view.elementID + \"BackgroundView\").configuredWithObject({\n style: {\n background: \"linear-gradient(\" + UIColor.whiteColor.stringValue + \", \" + UIColor.blueColor.stringValue + \")\",\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\"\n }\n })\n bottomBarView?: UIView\n \n _contentViewController?: UIViewController\n contentViewControllers: UIRootViewControllerLazyContentViewControllersObject = {\n mainViewController: this.lazyViewControllerObjectWithClass(UIViewController)\n }\n \n _detailsDialogView: UIDialogView = new UIDialogView(this.view.elementID + \"DetailsDialogView\")\n .configuredWithObject({\n dismiss: EXTEND(() => {\n const route = UIRoute.currentRoute\n this.detailsViewControllers.allValues.forEach(\n value => route.routeByRemovingComponentNamed(value.class.routeComponentName)\n )\n route.apply()\n }\n )\n })\n _detailsViewController?: UIViewController\n detailsViewControllers: UIRootViewControllerLazyViewControllersObject = {}\n \n \n constructor(view: UIView) {\n \n super(view)\n \n this.view.addSubview(this.backgroundView)\n \n }\n \n \n lazyViewControllerObjectWithClass<T extends typeof UIViewController>(\n classObject: T,\n shouldShow: () => (Promise<boolean> | boolean) = () => YES\n ): UIRootViewControllerLazyViewControllerObject<T> {\n const result: UIRootViewControllerLazyViewControllerObject<T> = {\n class: classObject,\n instance: nil,\n shouldShow: shouldShow,\n isInitialized: NO\n }\n UIObject.configureWithObject(result, {\n // @ts-ignore\n instance: LAZY_VALUE(\n () => {\n result.isInitialized = YES\n return new classObject(\n new UIView(classObject.name.replace(\"ViewController\", \"View\"))\n )\n }\n )\n })\n return result\n }\n \n \n override async handleRoute(route: UIRoute) {\n \n await super.handleRoute(route)\n \n UICore.languageService.updateCurrentLanguageKey()\n \n // Show content view\n await this.setContentViewControllerForRoute(route)\n \n await this.setDetailsViewControllerForRoute(route)\n \n }\n \n \n async setContentViewControllerForRoute(route: UIRoute) {\n const contentViewControllerObject = FIRST(\n await this.contentViewControllers.allValues.findAsyncSequential(\n async value => IS(route.componentWithViewController(value.class)) && await value.shouldShow()\n ),\n this.contentViewControllers.mainViewController\n )\n this.contentViewController = contentViewControllerObject.instance\n }\n \n async setDetailsViewControllerForRoute(route: UIRoute) {\n const detailsViewControllerObject = FIRST_OR_NIL(\n await this.detailsViewControllers.allValues.findAsyncSequential(\n async value => IS(route.componentWithViewController(value.class)) && await value.shouldShow()\n )\n )\n if (IS(route) && IS(this.detailsViewController) && IS_NOT(detailsViewControllerObject)) {\n this.detailsViewController = undefined\n this._detailsDialogView.dismiss()\n this.view.setNeedsLayout()\n return\n }\n this.detailsViewController = detailsViewControllerObject.instance\n }\n \n get contentViewController(): UIViewController | undefined {\n return this._contentViewController\n }\n \n set contentViewController(controller: UIViewController) {\n \n if (this.contentViewController == controller) {\n return\n }\n \n if (this.contentViewController) {\n this.removeChildViewController(this.contentViewController)\n }\n \n this._contentViewController = controller\n this.addChildViewControllerInContainer(controller, this.backgroundView)\n this._triggerLayoutViewSubviews()\n \n if (this.contentViewController) {\n this.contentViewController.view.style.boxShadow = \"0 3px 6px 0 rgba(0, 0, 0, 0.1)\"\n }\n \n this.view.setNeedsLayout()\n \n }\n \n \n get detailsViewController(): UIViewController | undefined {\n return this._detailsViewController\n }\n \n set detailsViewController(controller: UIViewController | undefined) {\n \n if (this.detailsViewController == controller) {\n return\n }\n \n if (IS(this.detailsViewController)) {\n this.removeChildViewController(this.detailsViewController)\n }\n \n this._detailsViewController = controller\n \n if (!IS(controller)) {\n return\n }\n \n this.addChildViewControllerInDialogView(controller, this._detailsDialogView)\n this._triggerLayoutViewSubviews()\n \n FIRST_OR_NIL(this.detailsViewController).view.style.borderRadius = \"5px\"\n \n this._detailsDialogView.showInView(this.view, YES)\n \n }\n \n updatePageScale(\n {\n minScaleWidth = 700,\n maxScaleWidth = 1500,\n minScale = 0.7,\n maxScale = 1\n } = {}\n ) {\n const actualPageWidth = window.innerWidth ?? (UIView.pageWidth * UIView.pageScale).integerValue\n let scale = minScale + (maxScale - minScale) *\n ((actualPageWidth - minScaleWidth) / (maxScaleWidth - minScaleWidth))\n scale = Math.min(scale, maxScale)\n scale = Math.max(scale, minScale)\n UIView.pageScale = scale\n }\n \n \n performDefaultLayout(\n {\n paddingLength = 20,\n contentViewMaxWidth = 1000,\n topBarHeight = 65,\n bottomBarMinHeight = 100\n } = {}\n ) {\n \n // View bounds\n const bounds = this.view.bounds\n \n if (this.topBarView) {\n this.topBarView.frame = new UIRectangle(0, 0, topBarHeight, bounds.width)\n }\n \n this.backgroundView.style.top = \"\" + (this.topBarView?.frame.height.integerValue ?? 0) + \"px\"\n this.backgroundView.style.width = \"100%\"\n this.backgroundView.style.height = \"fit-content\"\n this.backgroundView.style.minHeight = \"\" +\n (bounds.height - (this.topBarView?.frame.height ?? 0) - (this.bottomBarView?.frame.height ?? 0)).integerValue + \"px\"\n \n const contentView: UIView = this.contentViewController?.view ?? nil\n \n //var contentViewStyleString = contentView.viewHTMLElement.style.cssText\n \n contentView.style.position = \"relative\"\n contentView.style.bottom = \"0\"\n contentView.style.top = \"0\"\n contentView.style.width = \"100%\"\n contentView.setPaddings(nil, nil, paddingLength, nil)\n \n \n if (contentViewMaxWidth < this.backgroundView.bounds.width) {\n \n contentView.style.marginBottom = \"\" +\n Math.min(\n (this.backgroundView.bounds.width - contentViewMaxWidth) * 0.5,\n paddingLength\n ).integerValue + \"px\"\n contentView.style.marginTop = \"\" +\n Math.min(\n (this.backgroundView.bounds.width - contentViewMaxWidth) * 0.5,\n paddingLength\n ).integerValue + \"px\"\n contentView.style.maxWidth = contentViewMaxWidth + \"px\"\n \n contentView.style.left = \"\" +\n ((this.backgroundView.bounds.width - contentView.bounds.width) * 0.5).integerValue +\n \"px\"\n \n }\n else {\n \n contentView.style.margin = \"\"\n contentView.style.left = \"\"\n contentView.style.maxWidth = \"\"\n \n }\n \n // if (contentViewStyleString != contentView.style.cssText) {\n //\n // contentView.setNeedsLayout()\n //\n // }\n \n \n \n // Triggering immediate layout to ensure that the intrinsicContentHeight calculations work well\n this.contentViewController?._triggerLayoutViewSubviews()\n \n let contentViewControllerViewHeight = contentView.intrinsicContentHeight(\n contentView.bounds.width\n )\n \n const detailsViewControllerViewHeight = FIRST_OR_NIL(this.detailsViewController).view.intrinsicContentHeight(\n contentView.bounds.width)\n if (detailsViewControllerViewHeight > contentViewControllerViewHeight) {\n contentViewControllerViewHeight = detailsViewControllerViewHeight\n }\n \n \n contentView.style.height = \"\" + contentViewControllerViewHeight.integerValue + \"px\"\n //contentView.setNeedsLayout()\n \n if (IS(this.detailsViewController)) {\n \n contentView.style.transform = \"translateX(\" + 0 + \"px)\"\n \n this.detailsViewController.view.frame = this.backgroundView.frame.rectangleWithInset(\n paddingLength\n ).rectangleWithWidth(\n contentView.bounds.width,\n 0.5\n ).rectangleWithHeight(\n Math.max(\n this.detailsViewController.view.intrinsicContentHeight(\n this.detailsViewController.view.bounds.width\n ),\n contentView.bounds.height\n )\n )\n \n }\n else {\n \n contentView.style.transform = \"translateX(\" + 0 + \"px)\"\n \n }\n \n if (this.bottomBarView) {\n this.bottomBarView.frame = this.backgroundView.frame.rectangleWithY(\n this.backgroundView.frame.max.y\n ).rectangleWithHeight(\n Math.max(bottomBarMinHeight, this.bottomBarView.intrinsicContentHeight(this.backgroundView.frame.width))\n )\n }\n \n \n wrapInNil(this._detailsDialogView).setMaxSizes(this.bottomBarView?.frame.max.y ?? 0)\n \n }\n \n \n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,oBAAuB;AACvB,0BAA6B;AAC7B,sBAAuG;AACvG,yBAA4B;AAC5B,qBAAwB;AACxB,oBAAuB;AACvB,8BAAiC;
|
|
4
|
+
"sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UIDialogView } from \"./UIDialogView\"\nimport { EXTEND, FIRST, FIRST_OR_NIL, IS, IS_NOT, LAZY_VALUE, nil, NO, UIObject, wrapInNil, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView } from \"./UIView\"\nimport { UIViewController } from \"./UIViewController\"\n\n\nexport interface UIRootViewControllerLazyViewControllerObject<T extends typeof UIViewController> {\n instance: InstanceType<T>;\n class: T;\n shouldShow: () => (Promise<boolean> | boolean);\n isInitialized: boolean;\n deleteOnUnload: boolean;\n deleteInstance: () => void\n}\n\n\nexport interface UIRootViewControllerLazyViewControllersObject {\n [x: string]: UIRootViewControllerLazyViewControllerObject<typeof UIViewController>\n}\n\n\nexport interface UIRootViewControllerLazyContentViewControllersObject extends UIRootViewControllerLazyViewControllersObject {\n mainViewController: UIRootViewControllerLazyViewControllerObject<typeof UIViewController>\n}\n\n\nexport class UIRootViewController extends UIViewController {\n \n topBarView?: UIView\n backgroundView: UIView = new UIView(this.view.elementID + \"BackgroundView\").configuredWithObject({\n style: {\n background: \"linear-gradient(\" + UIColor.whiteColor.stringValue + \", \" + UIColor.blueColor.stringValue + \")\",\n backgroundSize: \"cover\",\n backgroundRepeat: \"no-repeat\"\n }\n })\n bottomBarView?: UIView\n \n _contentViewController?: UIViewController\n contentViewControllers: UIRootViewControllerLazyContentViewControllersObject = {\n mainViewController: this.lazyViewControllerObjectWithClass(UIViewController)\n }\n \n _detailsDialogView: UIDialogView = new UIDialogView(this.view.elementID + \"DetailsDialogView\")\n .configuredWithObject({\n dismiss: EXTEND(() => {\n const route = UIRoute.currentRoute\n this.detailsViewControllers.allValues.forEach(\n value => route.routeByRemovingComponentNamed(value.class.routeComponentName)\n )\n route.apply()\n }\n )\n })\n _detailsViewController?: UIViewController\n detailsViewControllers: UIRootViewControllerLazyViewControllersObject = {}\n \n \n constructor(view: UIView) {\n \n super(view)\n \n this.view.addSubview(this.backgroundView)\n \n }\n \n \n lazyViewControllerObjectWithClass<T extends typeof UIViewController>(\n classObject: T,\n options: {\n shouldShow?: () => (Promise<boolean> | boolean),\n deleteOnUnload?: boolean\n } = {}\n ): UIRootViewControllerLazyViewControllerObject<T> {\n const shouldShow = options.shouldShow ?? (() => YES)\n const deleteOnUnload = options.deleteOnUnload ?? NO\n \n const result: UIRootViewControllerLazyViewControllerObject<T> = {\n class: classObject,\n instance: nil,\n shouldShow: shouldShow,\n isInitialized: NO,\n deleteOnUnload: deleteOnUnload,\n deleteInstance: () => {\n if (result.isInitialized) {\n result.isInitialized = NO\n initializeLazyInstance()\n }\n }\n }\n \n const initializeLazyInstance = () => {\n UIObject.configureWithObject(result, {\n // @ts-ignore\n instance: LAZY_VALUE(\n () => {\n result.isInitialized = YES\n return new classObject(\n new UIView(classObject.name.replace(\"ViewController\", \"View\"))\n )\n }\n )\n })\n }\n \n initializeLazyInstance()\n \n return result\n }\n \n \n override async handleRoute(route: UIRoute) {\n \n await super.handleRoute(route)\n \n UICore.languageService.updateCurrentLanguageKey()\n \n // Show content view\n await this.setContentViewControllerForRoute(route)\n \n await this.setDetailsViewControllerForRoute(route)\n \n }\n \n \n async setContentViewControllerForRoute(route: UIRoute) {\n const contentViewControllerObject = FIRST(\n await this.contentViewControllers.allValues.findAsyncSequential(\n async value => IS(route.componentWithViewController(value.class)) && await value.shouldShow()\n ),\n this.contentViewControllers.mainViewController\n )\n \n // Delete old view controller if it has deleteOnUnload flag set\n if (IS(this._contentViewController) && this._contentViewController !== contentViewControllerObject.instance) {\n const oldViewControllerObject = this.contentViewControllers.allValues.find(\n value => value.isInitialized && value.instance === this._contentViewController\n )\n if (oldViewControllerObject?.deleteOnUnload) {\n oldViewControllerObject.deleteInstance()\n }\n }\n \n this.contentViewController = contentViewControllerObject.instance\n }\n \n async setDetailsViewControllerForRoute(route: UIRoute) {\n const detailsViewControllerObject = FIRST_OR_NIL(\n await this.detailsViewControllers.allValues.findAsyncSequential(\n async value => IS(route.componentWithViewController(value.class)) && await value.shouldShow()\n )\n )\n if (IS(route) && IS(this.detailsViewController) && IS_NOT(detailsViewControllerObject)) {\n // Delete old details view controller if it has deleteOnUnload flag set\n const oldViewControllerObject = this.detailsViewControllers.allValues.find(\n value => value.isInitialized && value.instance === this._detailsViewController\n )\n if (oldViewControllerObject?.deleteOnUnload) {\n oldViewControllerObject.deleteInstance()\n }\n \n this.detailsViewController = undefined\n this._detailsDialogView.dismiss()\n this.view.setNeedsLayout()\n return\n }\n \n // Delete old details view controller if it has deleteOnUnload flag set and is being replaced\n if (IS(this._detailsViewController) && this._detailsViewController !== detailsViewControllerObject?.instance) {\n const oldViewControllerObject = this.detailsViewControllers.allValues.find(\n value => value.isInitialized && value.instance === this._detailsViewController\n )\n if (oldViewControllerObject?.deleteOnUnload) {\n oldViewControllerObject.deleteInstance()\n }\n }\n \n this.detailsViewController = detailsViewControllerObject?.instance\n }\n \n get contentViewController(): UIViewController | undefined {\n return this._contentViewController\n }\n \n set contentViewController(controller: UIViewController) {\n \n if (this.contentViewController == controller) {\n return\n }\n \n if (this.contentViewController) {\n this.removeChildViewController(this.contentViewController)\n }\n \n this._contentViewController = controller\n this.addChildViewControllerInContainer(controller, this.backgroundView)\n this._triggerLayoutViewSubviews()\n \n if (this.contentViewController) {\n this.contentViewController.view.style.boxShadow = \"0 3px 6px 0 rgba(0, 0, 0, 0.1)\"\n }\n \n this.view.setNeedsLayout()\n \n }\n \n \n get detailsViewController(): UIViewController | undefined {\n return this._detailsViewController\n }\n \n set detailsViewController(controller: UIViewController | undefined) {\n \n if (this.detailsViewController == controller) {\n return\n }\n \n if (IS(this.detailsViewController)) {\n this.removeChildViewController(this.detailsViewController)\n }\n \n this._detailsViewController = controller\n \n if (!IS(controller)) {\n return\n }\n \n this.addChildViewControllerInDialogView(controller, this._detailsDialogView)\n this._triggerLayoutViewSubviews()\n \n FIRST_OR_NIL(this.detailsViewController).view.style.borderRadius = \"5px\"\n \n this._detailsDialogView.showInView(this.view, YES)\n \n }\n \n updatePageScale(\n {\n minScaleWidth = 700,\n maxScaleWidth = 1500,\n minScale = 0.7,\n maxScale = 1\n } = {}\n ) {\n const actualPageWidth = window.innerWidth ?? (UIView.pageWidth * UIView.pageScale).integerValue\n let scale = minScale + (maxScale - minScale) *\n ((actualPageWidth - minScaleWidth) / (maxScaleWidth - minScaleWidth))\n scale = Math.min(scale, maxScale)\n scale = Math.max(scale, minScale)\n UIView.pageScale = scale\n }\n \n \n performDefaultLayout(\n {\n paddingLength = 20,\n contentViewMaxWidth = 1000,\n topBarHeight = 65,\n bottomBarMinHeight = 100\n } = {}\n ) {\n \n // View bounds\n const bounds = this.view.bounds\n \n if (this.topBarView) {\n this.topBarView.frame = new UIRectangle(0, 0, topBarHeight, bounds.width)\n }\n \n this.backgroundView.style.top = \"\" + (this.topBarView?.frame.height.integerValue ?? 0) + \"px\"\n this.backgroundView.style.width = \"100%\"\n this.backgroundView.style.height = \"fit-content\"\n this.backgroundView.style.minHeight = \"\" +\n (bounds.height - (this.topBarView?.frame.height ?? 0) - (this.bottomBarView?.frame.height ?? 0)).integerValue + \"px\"\n \n const contentView: UIView = this.contentViewController?.view ?? nil\n \n //var contentViewStyleString = contentView.viewHTMLElement.style.cssText\n \n contentView.style.position = \"relative\"\n contentView.style.bottom = \"0\"\n contentView.style.top = \"0\"\n contentView.style.width = \"100%\"\n contentView.setPaddings(nil, nil, paddingLength, nil)\n \n \n if (contentViewMaxWidth < this.backgroundView.bounds.width) {\n \n contentView.style.marginBottom = \"\" +\n Math.min(\n (this.backgroundView.bounds.width - contentViewMaxWidth) * 0.5,\n paddingLength\n ).integerValue + \"px\"\n contentView.style.marginTop = \"\" +\n Math.min(\n (this.backgroundView.bounds.width - contentViewMaxWidth) * 0.5,\n paddingLength\n ).integerValue + \"px\"\n contentView.style.maxWidth = contentViewMaxWidth + \"px\"\n \n contentView.style.left = \"\" +\n ((this.backgroundView.bounds.width - contentView.bounds.width) * 0.5).integerValue +\n \"px\"\n \n }\n else {\n \n contentView.style.margin = \"\"\n contentView.style.left = \"\"\n contentView.style.maxWidth = \"\"\n \n }\n \n // if (contentViewStyleString != contentView.style.cssText) {\n //\n // contentView.setNeedsLayout()\n //\n // }\n \n \n \n // Triggering immediate layout to ensure that the intrinsicContentHeight calculations work well\n this.contentViewController?._triggerLayoutViewSubviews()\n \n let contentViewControllerViewHeight = contentView.intrinsicContentHeight(\n contentView.bounds.width\n )\n \n const detailsViewControllerViewHeight = FIRST_OR_NIL(this.detailsViewController).view.intrinsicContentHeight(\n contentView.bounds.width)\n if (detailsViewControllerViewHeight > contentViewControllerViewHeight) {\n contentViewControllerViewHeight = detailsViewControllerViewHeight\n }\n \n \n contentView.style.height = \"\" + contentViewControllerViewHeight.integerValue + \"px\"\n //contentView.setNeedsLayout()\n \n if (IS(this.detailsViewController)) {\n \n contentView.style.transform = \"translateX(\" + 0 + \"px)\"\n \n this.detailsViewController.view.frame = this.backgroundView.frame.rectangleWithInset(\n paddingLength\n ).rectangleWithWidth(\n contentView.bounds.width,\n 0.5\n ).rectangleWithHeight(\n Math.max(\n this.detailsViewController.view.intrinsicContentHeight(\n this.detailsViewController.view.bounds.width\n ),\n contentView.bounds.height\n )\n )\n \n }\n else {\n \n contentView.style.transform = \"translateX(\" + 0 + \"px)\"\n \n }\n \n if (this.bottomBarView) {\n this.bottomBarView.frame = this.backgroundView.frame.rectangleWithY(\n this.backgroundView.frame.max.y\n ).rectangleWithHeight(\n Math.max(bottomBarMinHeight, this.bottomBarView.intrinsicContentHeight(this.backgroundView.frame.width))\n )\n }\n \n \n wrapInNil(this._detailsDialogView).setMaxSizes(this.bottomBarView?.frame.max.y ?? 0)\n \n }\n \n \n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,oBAAuB;AACvB,0BAA6B;AAC7B,sBAAuG;AACvG,yBAA4B;AAC5B,qBAAwB;AACxB,oBAAuB;AACvB,8BAAiC;AAuB1B,MAAM,6BAA6B,yCAAiB;AAAA,EAgCvD,YAAY,MAAc;AAEtB,UAAM,IAAI;AA/Bd,0BAAyB,IAAI,qBAAO,KAAK,KAAK,YAAY,gBAAgB,EAAE,qBAAqB;AAAA,MAC7F,OAAO;AAAA,QACH,YAAY,qBAAqB,uBAAQ,WAAW,cAAc,OAAO,uBAAQ,UAAU,cAAc;AAAA,QACzG,gBAAgB;AAAA,QAChB,kBAAkB;AAAA,MACtB;AAAA,IACJ,CAAC;AAID,kCAA+E;AAAA,MAC3E,oBAAoB,KAAK,kCAAkC,wCAAgB;AAAA,IAC/E;AAEA,8BAAmC,IAAI,iCAAa,KAAK,KAAK,YAAY,mBAAmB,EACxF,qBAAqB;AAAA,MAClB,aAAS;AAAA,QAAO,MAAM;AACd,gBAAM,QAAQ,uBAAQ;AACtB,eAAK,uBAAuB,UAAU;AAAA,YAClC,WAAS,MAAM,8BAA8B,MAAM,MAAM,kBAAkB;AAAA,UAC/E;AACA,gBAAM,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"description": "UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework that is used in IOS. In addition, UICore has tools to handle URL based routing, array sorting and filtering and adds a number of other utilities for convenience.",
|
|
5
5
|
"main": "compiledScripts/index.js",
|
|
6
6
|
"types": "compiledScripts/index.d.ts",
|
|
@@ -12,7 +12,9 @@ export interface UIRootViewControllerLazyViewControllerObject<T extends typeof U
|
|
|
12
12
|
instance: InstanceType<T>;
|
|
13
13
|
class: T;
|
|
14
14
|
shouldShow: () => (Promise<boolean> | boolean);
|
|
15
|
-
isInitialized: boolean
|
|
15
|
+
isInitialized: boolean;
|
|
16
|
+
deleteOnUnload: boolean;
|
|
17
|
+
deleteInstance: () => void
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
|
|
@@ -69,38 +71,57 @@ export class UIRootViewController extends UIViewController {
|
|
|
69
71
|
|
|
70
72
|
lazyViewControllerObjectWithClass<T extends typeof UIViewController>(
|
|
71
73
|
classObject: T,
|
|
72
|
-
|
|
74
|
+
options: {
|
|
75
|
+
shouldShow?: () => (Promise<boolean> | boolean),
|
|
76
|
+
deleteOnUnload?: boolean
|
|
77
|
+
} = {}
|
|
73
78
|
): UIRootViewControllerLazyViewControllerObject<T> {
|
|
79
|
+
const shouldShow = options.shouldShow ?? (() => YES)
|
|
80
|
+
const deleteOnUnload = options.deleteOnUnload ?? NO
|
|
81
|
+
|
|
74
82
|
const result: UIRootViewControllerLazyViewControllerObject<T> = {
|
|
75
83
|
class: classObject,
|
|
76
84
|
instance: nil,
|
|
77
85
|
shouldShow: shouldShow,
|
|
78
|
-
isInitialized: NO
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
result.isInitialized = YES
|
|
85
|
-
return new classObject(
|
|
86
|
-
new UIView(classObject.name.replace("ViewController", "View"))
|
|
87
|
-
)
|
|
86
|
+
isInitialized: NO,
|
|
87
|
+
deleteOnUnload: deleteOnUnload,
|
|
88
|
+
deleteInstance: () => {
|
|
89
|
+
if (result.isInitialized) {
|
|
90
|
+
result.isInitialized = NO
|
|
91
|
+
initializeLazyInstance()
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const initializeLazyInstance = () => {
|
|
97
|
+
UIObject.configureWithObject(result, {
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
instance: LAZY_VALUE(
|
|
100
|
+
() => {
|
|
101
|
+
result.isInitialized = YES
|
|
102
|
+
return new classObject(
|
|
103
|
+
new UIView(classObject.name.replace("ViewController", "View"))
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
initializeLazyInstance()
|
|
111
|
+
|
|
91
112
|
return result
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
|
|
95
116
|
override async handleRoute(route: UIRoute) {
|
|
96
|
-
|
|
117
|
+
|
|
97
118
|
await super.handleRoute(route)
|
|
98
|
-
|
|
119
|
+
|
|
99
120
|
UICore.languageService.updateCurrentLanguageKey()
|
|
100
|
-
|
|
121
|
+
|
|
101
122
|
// Show content view
|
|
102
123
|
await this.setContentViewControllerForRoute(route)
|
|
103
|
-
|
|
124
|
+
|
|
104
125
|
await this.setDetailsViewControllerForRoute(route)
|
|
105
126
|
|
|
106
127
|
}
|
|
@@ -113,6 +134,17 @@ export class UIRootViewController extends UIViewController {
|
|
|
113
134
|
),
|
|
114
135
|
this.contentViewControllers.mainViewController
|
|
115
136
|
)
|
|
137
|
+
|
|
138
|
+
// Delete old view controller if it has deleteOnUnload flag set
|
|
139
|
+
if (IS(this._contentViewController) && this._contentViewController !== contentViewControllerObject.instance) {
|
|
140
|
+
const oldViewControllerObject = this.contentViewControllers.allValues.find(
|
|
141
|
+
value => value.isInitialized && value.instance === this._contentViewController
|
|
142
|
+
)
|
|
143
|
+
if (oldViewControllerObject?.deleteOnUnload) {
|
|
144
|
+
oldViewControllerObject.deleteInstance()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
116
148
|
this.contentViewController = contentViewControllerObject.instance
|
|
117
149
|
}
|
|
118
150
|
|
|
@@ -123,12 +155,31 @@ export class UIRootViewController extends UIViewController {
|
|
|
123
155
|
)
|
|
124
156
|
)
|
|
125
157
|
if (IS(route) && IS(this.detailsViewController) && IS_NOT(detailsViewControllerObject)) {
|
|
158
|
+
// Delete old details view controller if it has deleteOnUnload flag set
|
|
159
|
+
const oldViewControllerObject = this.detailsViewControllers.allValues.find(
|
|
160
|
+
value => value.isInitialized && value.instance === this._detailsViewController
|
|
161
|
+
)
|
|
162
|
+
if (oldViewControllerObject?.deleteOnUnload) {
|
|
163
|
+
oldViewControllerObject.deleteInstance()
|
|
164
|
+
}
|
|
165
|
+
|
|
126
166
|
this.detailsViewController = undefined
|
|
127
167
|
this._detailsDialogView.dismiss()
|
|
128
168
|
this.view.setNeedsLayout()
|
|
129
169
|
return
|
|
130
170
|
}
|
|
131
|
-
|
|
171
|
+
|
|
172
|
+
// Delete old details view controller if it has deleteOnUnload flag set and is being replaced
|
|
173
|
+
if (IS(this._detailsViewController) && this._detailsViewController !== detailsViewControllerObject?.instance) {
|
|
174
|
+
const oldViewControllerObject = this.detailsViewControllers.allValues.find(
|
|
175
|
+
value => value.isInitialized && value.instance === this._detailsViewController
|
|
176
|
+
)
|
|
177
|
+
if (oldViewControllerObject?.deleteOnUnload) {
|
|
178
|
+
oldViewControllerObject.deleteInstance()
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this.detailsViewController = detailsViewControllerObject?.instance
|
|
132
183
|
}
|
|
133
184
|
|
|
134
185
|
get contentViewController(): UIViewController | undefined {
|