uicore-ts 1.1.316 → 1.1.321

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.
@@ -193,7 +193,6 @@ const _UIDialogView = class extends import_UIView.UIView {
193
193
  }
194
194
  const bounds = this.bounds;
195
195
  const margin = 20;
196
- this.view.style.position = "relative";
197
196
  this.view.style.zIndex = "" + this.zIndex;
198
197
  this.view.setNeedsLayout();
199
198
  super.layoutSubviews();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIDialogView.ts"],
4
- "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n \n super(elementID, viewHTMLElement)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n }\n }\n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n const unlockScroll = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n }\n }\n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n //this.frame = this.superview.bounds;\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n const bounds = this.bounds\n \n const margin = 20\n \n //this.view.centerInContainer();\n \n this.view.style.position = \"relative\"\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n // this.view.style.maxHeight = \"\" + (bounds.height - margin * 2).integerValue + \"px\";\n // this.view.style.maxWidth = \"\" + (bounds.width - margin * 2).integerValue + \"px\";\n \n \n // var viewIntrinsicRectangle = this.view.intrinsicContentSize();\n // this.view.frame = new UIRectangle((bounds.width - viewIntrinsicRectangle.width)*0.5, )\n \n super.layoutSubviews()\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n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L,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AA1QjC,gBAAAD,KAAAC;AA0QoC,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,WAAC;AAAA,UACjD,qBAAO;AAAA,QACX,IAAI,qBAAO;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAS;AAIf,SAAK,KAAK,MAAM,WAAW;AAE3B,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AASzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AAhSO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
4
+ "sourcesContent": ["import { IS_FIREFOX } from \"./ClientCheckers\"\nimport { UIColor } from \"./UIColor\"\nimport { UICore } from \"./UICore\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { FIRST, IF, IS, nil, NO, YES } from \"./UIObject\"\nimport { UIScrollView } from \"./UIScrollView\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIDialogView<ViewType extends UIView = UIView> extends UIView {\n \n _isAUIDialogView = YES\n _view: ViewType = new UIView() as any\n _appearedAnimated?: boolean\n animationDuration: number = 0.25\n _zIndex: number = 100\n isVisible: boolean = NO\n dismissesOnTapOutside = YES\n \n static _activeDialogCount = 0\n _fillsViewport = NO\n \n constructor(elementID?: string, viewHTMLElement?: HTMLElement) {\n \n \n super(elementID, viewHTMLElement)\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerTap,\n (sender: UIView, event: Event) => {\n \n this.didDetectTapOutside(sender, event)\n \n }\n )\n \n this.backgroundColor = UIColor.colorWithRGBA(0, 10, 25).colorWithAlpha(0.75) //CBColor.primaryContentColor.colorWithAlpha(0.75)\n \n this.zIndex = this._zIndex\n \n }\n \n \n didDetectTapOutside(sender: UIView, event: Event) {\n \n if (event.target == this.viewHTMLElement && this.dismissesOnTapOutside) {\n this.dismiss(this._appearedAnimated)\n }\n \n }\n \n \n set zIndex(zIndex: number) {\n \n this._zIndex = zIndex\n this.style.zIndex = \"\" + zIndex\n \n }\n \n get zIndex() {\n \n return this._zIndex\n \n }\n \n \n set view(view: ViewType) {\n \n this._view?.removeFromSuperview()\n \n this._view = view\n \n this.addSubview(view)\n \n }\n \n \n get view(): ViewType {\n \n return this._view\n \n }\n \n \n override willAppear(animated: boolean = NO) {\n \n if (animated) {\n \n this.style.opacity = \"0\"\n \n }\n \n this.style.height = \"\"\n \n this._frame = nil\n \n }\n \n \n animateAppearing() {\n \n this.style.opacity = \"1\"\n \n }\n \n animateDisappearing() {\n \n this.style.opacity = \"0\"\n \n }\n \n \n showInView(containerView: UIView, animated: boolean) {\n \n this._fillsViewport = containerView.rootView == containerView\n animated = (animated && !IS_FIREFOX)\n \n this._appearedAnimated = animated\n \n this.willAppear(animated)\n \n \n if (this._fillsViewport) {\n UIDialogView._activeDialogCount++\n if (UIDialogView._activeDialogCount >= 1) {\n document.body.style.overflow = \"hidden\"\n }\n }\n \n containerView.addSubview(this)\n this.view.setNeedsLayoutUpToRootView()\n \n if (animated) {\n \n UIView.layoutViewsIfNeeded()\n this.layoutSubviews()\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n () => this.animateAppearing(),\n nil\n )\n \n \n }\n else {\n \n this.setNeedsLayout()\n \n }\n \n this.isVisible = YES\n \n }\n \n \n showInRootView(animated: boolean) {\n \n this.showInView(UICore.main.rootViewController.view, animated)\n \n }\n \n \n dismiss(animated?: boolean) {\n \n if (!this.isVisible) {\n return\n }\n \n animated = (animated && !IS_FIREFOX)\n \n if (animated == undefined) {\n \n animated = this._appearedAnimated\n \n }\n \n const unlockScroll = () => {\n if (this._fillsViewport) {\n UIDialogView._activeDialogCount = Math.max(0, UIDialogView._activeDialogCount - 1)\n if (UIDialogView._activeDialogCount === 0) {\n document.body.style.overflow = \"\"\n }\n }\n }\n \n if (animated) {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this,\n this.animationDuration,\n 0,\n undefined,\n (() => {\n \n this.animateDisappearing()\n \n }).bind(this),\n () => {\n \n if (this.isVisible == NO) {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n }\n )\n \n }\n else {\n \n this.removeFromSuperview()\n unlockScroll()\n \n }\n \n this.isVisible = NO\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UICore.broadcastEventName.WindowDidResize) {\n \n this.setNeedsLayout()\n \n }\n \n }\n \n \n override layoutSubviews() {\n \n \n if (!IS(this.view)) {\n \n return\n \n }\n \n //this.frame = this.superview.bounds;\n \n if (this._fillsViewport) {\n const containerRect = this.superview?.viewHTMLElement?.getBoundingClientRect()\n const topOffset = containerRect ? -containerRect.top / UIView.pageScale : 0\n this.setPosition(0, 0, 0, topOffset, window.innerHeight / UIView.pageScale, \"100%\")\n }\n else {\n this.setPosition(0, 0, 0, 0, 0, \"100%\")\n this.setPosition(\n 0,\n 0,\n 0,\n 0,\n FIRST(\n IF(this.superview?.isKindOfClass(UINativeScrollView))(() => this.superview?.scrollSize.height ?? 0)\n .ELSE_IF(this.superview?.isKindOfClass(UIScrollView))(\n () => this.superview?.scrollSize.height ?? 0)\n .ELSE(() => this.superview?.frame.height ?? 0),\n UIView.pageHeight\n ) / UIView.pageScale,\n \"100%\"\n )\n }\n \n const bounds = this.bounds\n \n const margin = 20\n \n //this.view.centerInContainer();\n \n this.view.style.zIndex = \"\" + this.zIndex\n \n this.view.setNeedsLayout()\n \n // this.view.style.maxHeight = \"\" + (bounds.height - margin * 2).integerValue + \"px\";\n // this.view.style.maxWidth = \"\" + (bounds.width - margin * 2).integerValue + \"px\";\n \n \n // var viewIntrinsicRectangle = this.view.intrinsicContentSize();\n // this.view.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Q/B,kBAAAD,KAAAC;AAyQkC,sBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,WAAW,WAA3B,OAAAC,MAAqC;AAAA;AAAA,UAAC,EAC/C,KAAK,MAAG;AA1QjC,gBAAAD,KAAAC;AA0QoC,oBAAAA,OAAAD,MAAA,KAAK,cAAL,gBAAAA,IAAgB,MAAM,WAAtB,OAAAC,MAAgC;AAAA,WAAC;AAAA,UACjD,qBAAO;AAAA,QACX,IAAI,qBAAO;AAAA,QACX;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,SAAS,KAAK;AAEpB,UAAM,SAAS;AAIf,SAAK,KAAK,MAAM,SAAS,KAAK,KAAK;AAEnC,SAAK,KAAK,eAAe;AASzB,UAAM,eAAe;AAAA,EAEzB;AAGJ;AA9RO,IAAM,eAAN;AAAM,aAUF,qBAAqB;",
6
6
  "names": ["_a", "_b"]
7
7
  }
@@ -83,7 +83,7 @@ class UIRootViewController extends import_UIViewController.UIViewController {
83
83
  var _a, _b, _c;
84
84
  const shouldShow = (_a = options.shouldShow) != null ? _a : () => import_UIObject.YES;
85
85
  const deleteOnUnload = (_b = options.deleteOnUnload) != null ? _b : import_UIObject.NO;
86
- const deleteOnLogout = (_c = options.deleteOnLogout) != null ? _c : import_UIObject.NO;
86
+ const deleteOnLogout = (_c = options.deleteOnLogout) != null ? _c : import_UIObject.YES;
87
87
  const result = {
88
88
  class: classObject,
89
89
  instance: import_UIObject.nil,
@@ -92,8 +92,14 @@ class UIRootViewController extends import_UIViewController.UIViewController {
92
92
  deleteOnUnload,
93
93
  deleteOnLogout,
94
94
  deleteInstance: () => {
95
+ var _a2;
95
96
  if (result.isInitialized) {
96
97
  result.isInitialized = import_UIObject.NO;
98
+ const existingView = (_a2 = result.instance) == null ? void 0 : _a2.view;
99
+ if (existingView) {
100
+ existingView.removeFromSuperview();
101
+ existingView.viewHTMLElement.remove();
102
+ }
97
103
  initializeLazyInstance();
98
104
  }
99
105
  }
@@ -274,10 +280,14 @@ class UIRootViewController extends import_UIViewController.UIViewController {
274
280
  contentView.style.height = "" + contentViewControllerViewHeight.integerValue + "px";
275
281
  if ((0, import_UIObject.IS)(this.detailsViewController)) {
276
282
  contentView.style.transform = "translateX(" + 0 + "px)";
283
+ const detailsWidth = Math.min(
284
+ this.detailsViewController.view.intrinsicContentWidth() || contentView.bounds.width,
285
+ contentView.bounds.width
286
+ );
277
287
  this.detailsViewController.view.frame = this.backgroundView.frame.rectangleWithInset(
278
288
  paddingLength
279
289
  ).rectangleWithWidth(
280
- contentView.bounds.width,
290
+ detailsWidth,
281
291
  0.5
282
292
  ).rectangleWithHeight(
283
293
  Math.max(
@@ -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 deleteOnUnload: boolean;\n deleteOnLogout: 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 deleteOnLogout?: boolean\n } = {}\n ): UIRootViewControllerLazyViewControllerObject<T> {\n const shouldShow = options.shouldShow ?? (() => YES)\n const deleteOnUnload = options.deleteOnUnload ?? NO\n const deleteOnLogout = options.deleteOnLogout ?? NO\n \n const result: UIRootViewControllerLazyViewControllerObject<T> = {\n class: classObject,\n instance: nil,\n shouldShow: shouldShow,\n isInitialized: NO,\n deleteOnUnload: deleteOnUnload,\n deleteOnLogout: deleteOnLogout,\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;AAwB1B,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,MAA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View } 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 deleteOnLogout: 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 deleteOnLogout?: boolean\n } = {}\n ): UIRootViewControllerLazyViewControllerObject<T> {\n const shouldShow = options.shouldShow ?? (() => YES)\n const deleteOnUnload = options.deleteOnUnload ?? NO\n const deleteOnLogout = options.deleteOnLogout ?? YES\n \n const result: UIRootViewControllerLazyViewControllerObject<T> = {\n class: classObject,\n instance: nil,\n shouldShow: shouldShow,\n isInitialized: NO,\n deleteOnUnload: deleteOnUnload,\n deleteOnLogout: deleteOnLogout,\n deleteInstance: () => {\n if (result.isInitialized) {\n result.isInitialized = NO\n // Remove the view's DOM element before resetting the lazy value.\n // UIView reuses existing elements by ID, so if the element remains\n // in the DOM the next construction would attach a new controller\n // to the same stale element, causing duplicate subviews.\n const existingView = result.instance?.view\n if (existingView) {\n existingView.removeFromSuperview()\n existingView.viewHTMLElement.remove()\n }\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 const detailsWidth = Math.min(\n this.detailsViewController.view.intrinsicContentWidth() || contentView.bounds.width,\n contentView.bounds.width\n )\n this.detailsViewController.view.frame = this.backgroundView.frame.rectangleWithInset(\n paddingLength\n ).rectangleWithWidth(\n detailsWidth,\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;AAwB1B,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,MAAM;AAAA,QAChB;AAAA,MACJ;AAAA,IACJ,CAAC;AAEL,kCAAwE,CAAC;AAOrE,SAAK,KAAK,WAAW,KAAK,cAAc;AAAA,EAE5C;AAAA,EAGA,kCACI,aACA,UAII,CAAC,GAC0C;AA/EvD;AAgFQ,UAAM,cAAa,aAAQ,eAAR,YAAuB,MAAM;AAChD,UAAM,kBAAiB,aAAQ,mBAAR,YAA0B;AACjD,UAAM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AO;AAAA,IACvB;AAEA,UAAM,sCAAkC,8BAAa,KAAK,qBAAqB,EAAE,KAAK;AAAA,MAClF,YAAY,OAAO;AAAA,IAAK;AAC5B,QAAI,kCAAkC,iCAAiC;AACnE,wCAAkC;AAAA,IACtC;AAGA,gBAAY,MAAM,SAAS,KAAK,gCAAgC,eAAe;AAG/E,YAAI,oBAAG,KAAK,qBAAqB,GAAG;AAEhC,kBAAY,MAAM,YAAY,gBAAgB,IAAI;AAElD,YAAM,eAAe,KAAK;AAAA,QACtB,KAAK,sBAAsB,KAAK,sBAAsB,KAAK,YAAY,OAAO;AAAA,QAC9E,YAAY,OAAO;AAAA,MACvB;AACA,WAAK,sBAAsB,KAAK,QAAQ,KAAK,eAAe,MAAM;AAAA,QAC9D;AAAA,MACJ,EAAE;AAAA,QACE;AAAA,QACA;AAAA,MACJ,EAAE;AAAA,QACE,KAAK;AAAA,UACD,KAAK,sBAAsB,KAAK;AAAA,YAC5B,KAAK,sBAAsB,KAAK,OAAO;AAAA,UAC3C;AAAA,UACA,YAAY,OAAO;AAAA,QACvB;AAAA,MACJ;AAAA,IAEJ,OACK;AAED,kBAAY,MAAM,YAAY,gBAAgB,IAAI;AAAA,IAEtD;AAEA,QAAI,KAAK,eAAe;AACpB,WAAK,cAAc,QAAQ,KAAK,eAAe,MAAM;AAAA,QACjD,KAAK,eAAe,MAAM,IAAI;AAAA,MAClC,EAAE;AAAA,QACE,KAAK,IAAI,oBAAoB,KAAK,cAAc,uBAAuB,KAAK,eAAe,MAAM,KAAK,CAAC;AAAA,MAC3G;AAAA,IACJ;AAGA,mCAAU,KAAK,kBAAkB,EAAE,aAAY,gBAAK,kBAAL,mBAAoB,MAAM,IAAI,MAA9B,YAAmC,CAAC;AAAA,EAEvF;AAGJ;",
6
+ "names": ["_a"]
7
7
  }
@@ -153,16 +153,16 @@ class UIViewController extends import_UIObject.UIObject {
153
153
  addChildViewControllerInContainer(controller, containerView) {
154
154
  controller = (0, import_UIObject.FIRST_OR_NIL)(controller);
155
155
  containerView = (0, import_UIObject.FIRST_OR_NIL)(containerView);
156
- controller.viewWillAppear();
157
156
  if (!this.hasChildViewController(controller)) {
157
+ controller.viewWillAppear();
158
158
  controller.willMoveToParentViewController(this);
159
159
  this.childViewControllers.push(controller);
160
160
  containerView.addSubview(controller.view);
161
161
  controller.didMoveToParentViewController(this);
162
+ controller.handleRouteRecursively(import_UIRoute.UIRoute.currentRoute);
163
+ controller.didMoveToParentViewController(this);
164
+ controller.viewDidAppear();
162
165
  }
163
- controller.handleRouteRecursively(import_UIRoute.UIRoute.currentRoute);
164
- controller.didMoveToParentViewController(this);
165
- controller.viewDidAppear();
166
166
  }
167
167
  addChildViewControllerInDialogView(controller, dialogView) {
168
168
  controller = (0, import_UIObject.FIRST_OR_NIL)(controller);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIViewController.ts"],
4
- "sourcesContent": ["import { UIDialogView } from \"./UIDialogView\"\nimport { FIRST_OR_NIL, IS, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIViewController extends UIObject {\n \n \n parentViewController?: UIViewController\n childViewControllers: UIViewController[] = []\n static readonly routeComponentName: string\n static readonly ParameterIdentifierName: any\n \n constructor(public view: UIView) {\n \n super()\n \n this.view.viewController = this\n \n }\n \n \n get routeComponent() {\n return UIRoute.currentRoute.componentWithViewController(this.class)\n }\n \n handleRouteRecursively(route: UIRoute) {\n \n this.handleRoute(route)\n \n this.childViewControllers.forEach(controller => {\n \n controller.handleRouteRecursively(route)\n \n })\n \n }\n \n async handleRoute(route: UIRoute) {\n \n \n }\n \n \n async viewWillAppear() {\n \n \n }\n \n \n async viewDidAppear() {\n \n \n }\n \n \n async viewWillDisappear() {\n \n \n }\n \n async viewDidDisappear() {\n \n \n }\n \n \n updateViewConstraints() {\n \n \n }\n \n updateViewStyles() {\n \n \n }\n \n layoutViewSubviews() {\n \n \n }\n \n _triggerLayoutViewSubviews() {\n \n if (this.view.needsLayout) {\n \n this.view.layoutSubviews()\n \n this.viewDidLayoutSubviews()\n \n }\n \n }\n \n viewWillLayoutSubviews() {\n \n this.updateViewConstraints()\n this.updateViewStyles()\n \n }\n \n viewDidLayoutSubviews() {\n \n // this.childViewControllers.forEach(function (controller, index, controllers) {\n \n // controller._layoutViewSubviews();\n \n // })\n \n \n }\n \n \n viewDidReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n \n }\n \n \n get core() {\n return this.view.core\n }\n \n hasChildViewController(viewController: UIViewController) {\n \n // This is for performance reasons\n if (!IS(viewController)) {\n return NO\n }\n \n for (let i = 0; i < this.childViewControllers.length; i++) {\n \n const childViewController = this.childViewControllers[i]\n \n if (childViewController == viewController) {\n return YES\n }\n \n }\n \n return NO\n \n }\n \n addChildViewController(viewController: UIViewController) {\n if (!this.hasChildViewController(viewController)) {\n viewController.willMoveToParentViewController(this)\n this.childViewControllers.push(viewController)\n this.view.addSubview(viewController.view)\n viewController.didMoveToParentViewController(this)\n }\n }\n \n \n removeFromParentViewController() {\n \n this.parentViewController?.removeChildViewController(this)\n \n }\n \n willMoveToParentViewController(parentViewController: UIViewController) {\n \n }\n \n \n didMoveToParentViewController(parentViewController: UIViewController) {\n \n this.parentViewController = parentViewController\n \n }\n \n removeChildViewController(controller: UIViewController) {\n \n controller = FIRST_OR_NIL(controller)\n controller.viewWillDisappear()\n if (IS(controller.parentViewController)) {\n \n const index = controller.parentViewController?.childViewControllers.indexOf(controller) ?? -1\n if (index > -1) {\n controller.parentViewController?.childViewControllers.splice(index, 1)\n controller.parentViewController = undefined\n }\n \n }\n this.childViewControllers.removeElement(controller)\n if (IS(controller.view)) {\n controller.view.removeFromSuperview()\n }\n else {\n var asd = 1\n }\n controller.viewDidDisappear()\n \n }\n \n \n addChildViewControllerInContainer(controller: UIViewController, containerView: UIView) {\n \n controller = FIRST_OR_NIL(controller)\n containerView = FIRST_OR_NIL(containerView)\n controller.viewWillAppear()\n if (!this.hasChildViewController(controller)) {\n controller.willMoveToParentViewController(this)\n this.childViewControllers.push(controller)\n containerView.addSubview(controller.view)\n controller.didMoveToParentViewController(this)\n }\n \n controller.handleRouteRecursively(UIRoute.currentRoute)\n \n controller.didMoveToParentViewController(this)\n controller.viewDidAppear()\n \n \n }\n \n addChildViewControllerInDialogView(controller: UIViewController, dialogView: UIDialogView) {\n \n controller = FIRST_OR_NIL(controller)\n dialogView = FIRST_OR_NIL(dialogView)\n controller.viewWillAppear()\n this.addChildViewController(controller)\n dialogView.view = controller.view\n \n const originalDismissFunction = dialogView.dismiss.bind(dialogView)\n \n dialogView.dismiss = animated => {\n \n originalDismissFunction(animated)\n \n this.removeChildViewController(controller)\n \n }\n \n controller.handleRouteRecursively(UIRoute.currentRoute)\n \n controller.didMoveToParentViewController(this)\n controller.viewDidAppear()\n \n }\n \n \n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAoD;AACpD,qBAAwB;AAIjB,MAAM,yBAAyB,yBAAS;AAAA,EAQ3C,YAAmB,MAAc;AAE7B,UAAM;AAFS;AAJnB,gCAA2C,CAAC;AAQxC,SAAK,KAAK,iBAAiB;AAAA,EAE/B;AAAA,EAGA,IAAI,iBAAiB;AACjB,WAAO,uBAAQ,aAAa,4BAA4B,KAAK,KAAK;AAAA,EACtE;AAAA,EAEA,uBAAuB,OAAgB;AAEnC,SAAK,YAAY,KAAK;AAEtB,SAAK,qBAAqB,QAAQ,gBAAc;AAE5C,iBAAW,uBAAuB,KAAK;AAAA,IAE3C,CAAC;AAAA,EAEL;AAAA,EAEM,YAAY,OAAgB;AAAA;AAAA,IAGlC;AAAA;AAAA,EAGM,iBAAiB;AAAA;AAAA,IAGvB;AAAA;AAAA,EAGM,gBAAgB;AAAA;AAAA,IAGtB;AAAA;AAAA,EAGM,oBAAoB;AAAA;AA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sourcesContent": ["import { UIDialogView } from \"./UIDialogView\"\nimport { FIRST_OR_NIL, IS, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRoute } from \"./UIRoute\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UIViewController extends UIObject {\n \n \n parentViewController?: UIViewController\n childViewControllers: UIViewController[] = []\n static readonly routeComponentName: string\n static readonly ParameterIdentifierName: any\n \n constructor(public view: UIView) {\n \n super()\n \n this.view.viewController = this\n \n }\n \n \n get routeComponent() {\n return UIRoute.currentRoute.componentWithViewController(this.class)\n }\n \n handleRouteRecursively(route: UIRoute) {\n \n this.handleRoute(route)\n \n this.childViewControllers.forEach(controller => {\n \n controller.handleRouteRecursively(route)\n \n })\n \n }\n \n async handleRoute(route: UIRoute) {\n \n \n }\n \n \n async viewWillAppear() {\n \n \n }\n \n \n async viewDidAppear() {\n \n \n }\n \n \n async viewWillDisappear() {\n \n \n }\n \n async viewDidDisappear() {\n \n \n }\n \n \n updateViewConstraints() {\n \n \n }\n \n updateViewStyles() {\n \n \n }\n \n layoutViewSubviews() {\n \n \n }\n \n _triggerLayoutViewSubviews() {\n \n if (this.view.needsLayout) {\n \n this.view.layoutSubviews()\n \n this.viewDidLayoutSubviews()\n \n }\n \n }\n \n viewWillLayoutSubviews() {\n \n this.updateViewConstraints()\n this.updateViewStyles()\n \n }\n \n viewDidLayoutSubviews() {\n \n // this.childViewControllers.forEach(function (controller, index, controllers) {\n \n // controller._layoutViewSubviews();\n \n // })\n \n \n }\n \n \n viewDidReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n \n }\n \n \n get core() {\n return this.view.core\n }\n \n hasChildViewController(viewController: UIViewController) {\n \n // This is for performance reasons\n if (!IS(viewController)) {\n return NO\n }\n \n for (let i = 0; i < this.childViewControllers.length; i++) {\n \n const childViewController = this.childViewControllers[i]\n \n if (childViewController == viewController) {\n return YES\n }\n \n }\n \n return NO\n \n }\n \n addChildViewController(viewController: UIViewController) {\n if (!this.hasChildViewController(viewController)) {\n viewController.willMoveToParentViewController(this)\n this.childViewControllers.push(viewController)\n this.view.addSubview(viewController.view)\n viewController.didMoveToParentViewController(this)\n }\n }\n \n \n removeFromParentViewController() {\n \n this.parentViewController?.removeChildViewController(this)\n \n }\n \n willMoveToParentViewController(parentViewController: UIViewController) {\n \n }\n \n \n didMoveToParentViewController(parentViewController: UIViewController) {\n \n this.parentViewController = parentViewController\n \n }\n \n removeChildViewController(controller: UIViewController) {\n \n controller = FIRST_OR_NIL(controller)\n controller.viewWillDisappear()\n if (IS(controller.parentViewController)) {\n \n const index = controller.parentViewController?.childViewControllers.indexOf(controller) ?? -1\n if (index > -1) {\n controller.parentViewController?.childViewControllers.splice(index, 1)\n controller.parentViewController = undefined\n }\n \n }\n this.childViewControllers.removeElement(controller)\n if (IS(controller.view)) {\n controller.view.removeFromSuperview()\n }\n else {\n var asd = 1\n }\n controller.viewDidDisappear()\n \n }\n \n \n addChildViewControllerInContainer(controller: UIViewController, containerView: UIView) {\n \n controller = FIRST_OR_NIL(controller)\n containerView = FIRST_OR_NIL(containerView)\n \n if (!this.hasChildViewController(controller)) {\n controller.viewWillAppear()\n controller.willMoveToParentViewController(this)\n this.childViewControllers.push(controller)\n containerView.addSubview(controller.view)\n controller.didMoveToParentViewController(this)\n controller.handleRouteRecursively(UIRoute.currentRoute)\n controller.didMoveToParentViewController(this)\n controller.viewDidAppear()\n }\n \n }\n \n addChildViewControllerInDialogView(controller: UIViewController, dialogView: UIDialogView) {\n \n controller = FIRST_OR_NIL(controller)\n dialogView = FIRST_OR_NIL(dialogView)\n controller.viewWillAppear()\n this.addChildViewController(controller)\n dialogView.view = controller.view\n \n const originalDismissFunction = dialogView.dismiss.bind(dialogView)\n \n dialogView.dismiss = animated => {\n \n originalDismissFunction(animated)\n \n this.removeChildViewController(controller)\n \n }\n \n controller.handleRouteRecursively(UIRoute.currentRoute)\n \n controller.didMoveToParentViewController(this)\n controller.viewDidAppear()\n \n }\n \n \n}\n"],
5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GAAG;AAC1C,iBAAW,eAAe;AAC1B,iBAAW,+BAA+B,IAAI;AAC9C,WAAK,qBAAqB,KAAK,UAAU;AACzC,oBAAc,WAAW,WAAW,IAAI;AACxC,iBAAW,8BAA8B,IAAI;AAC7C,iBAAW,uBAAuB,uBAAQ,YAAY;AACtD,iBAAW,8BAA8B,IAAI;AAC7C,iBAAW,cAAc;AAAA,IAC7B;AAAA,EAEJ;AAAA,EAEA,mCAAmC,YAA8B,YAA0B;AAEvF,qBAAa,8BAAa,UAAU;AACpC,qBAAa,8BAAa,UAAU;AACpC,eAAW,eAAe;AAC1B,SAAK,uBAAuB,UAAU;AACtC,eAAW,OAAO,WAAW;AAE7B,UAAM,0BAA0B,WAAW,QAAQ,KAAK,UAAU;AAElE,eAAW,UAAU,cAAY;AAE7B,8BAAwB,QAAQ;AAEhC,WAAK,0BAA0B,UAAU;AAAA,IAE7C;AAEA,eAAW,uBAAuB,uBAAQ,YAAY;AAEtD,eAAW,8BAA8B,IAAI;AAC7C,eAAW,cAAc;AAAA,EAE7B;AAGJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uicore-ts",
3
- "version": "1.1.316",
3
+ "version": "1.1.321",
4
4
  "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",
@@ -277,8 +277,6 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
277
277
 
278
278
  //this.view.centerInContainer();
279
279
 
280
- this.view.style.position = "relative"
281
-
282
280
  this.view.style.zIndex = "" + this.zIndex
283
281
 
284
282
  this.view.setNeedsLayout()
@@ -296,26 +294,3 @@ export class UIDialogView<ViewType extends UIView = UIView> extends UIView {
296
294
 
297
295
 
298
296
  }
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
@@ -80,7 +80,7 @@ export class UIRootViewController extends UIViewController {
80
80
  ): UIRootViewControllerLazyViewControllerObject<T> {
81
81
  const shouldShow = options.shouldShow ?? (() => YES)
82
82
  const deleteOnUnload = options.deleteOnUnload ?? NO
83
- const deleteOnLogout = options.deleteOnLogout ?? NO
83
+ const deleteOnLogout = options.deleteOnLogout ?? YES
84
84
 
85
85
  const result: UIRootViewControllerLazyViewControllerObject<T> = {
86
86
  class: classObject,
@@ -92,6 +92,15 @@ export class UIRootViewController extends UIViewController {
92
92
  deleteInstance: () => {
93
93
  if (result.isInitialized) {
94
94
  result.isInitialized = NO
95
+ // Remove the view's DOM element before resetting the lazy value.
96
+ // UIView reuses existing elements by ID, so if the element remains
97
+ // in the DOM the next construction would attach a new controller
98
+ // to the same stale element, causing duplicate subviews.
99
+ const existingView = result.instance?.view
100
+ if (existingView) {
101
+ existingView.removeFromSuperview()
102
+ existingView.viewHTMLElement.remove()
103
+ }
95
104
  initializeLazyInstance()
96
105
  }
97
106
  }
@@ -348,10 +357,14 @@ export class UIRootViewController extends UIViewController {
348
357
 
349
358
  contentView.style.transform = "translateX(" + 0 + "px)"
350
359
 
360
+ const detailsWidth = Math.min(
361
+ this.detailsViewController.view.intrinsicContentWidth() || contentView.bounds.width,
362
+ contentView.bounds.width
363
+ )
351
364
  this.detailsViewController.view.frame = this.backgroundView.frame.rectangleWithInset(
352
365
  paddingLength
353
366
  ).rectangleWithWidth(
354
- contentView.bounds.width,
367
+ detailsWidth,
355
368
  0.5
356
369
  ).rectangleWithHeight(
357
370
  Math.max(
@@ -199,20 +199,18 @@ export class UIViewController extends UIObject {
199
199
 
200
200
  controller = FIRST_OR_NIL(controller)
201
201
  containerView = FIRST_OR_NIL(containerView)
202
- controller.viewWillAppear()
202
+
203
203
  if (!this.hasChildViewController(controller)) {
204
+ controller.viewWillAppear()
204
205
  controller.willMoveToParentViewController(this)
205
206
  this.childViewControllers.push(controller)
206
207
  containerView.addSubview(controller.view)
207
208
  controller.didMoveToParentViewController(this)
209
+ controller.handleRouteRecursively(UIRoute.currentRoute)
210
+ controller.didMoveToParentViewController(this)
211
+ controller.viewDidAppear()
208
212
  }
209
213
 
210
- controller.handleRouteRecursively(UIRoute.currentRoute)
211
-
212
- controller.didMoveToParentViewController(this)
213
- controller.viewDidAppear()
214
-
215
-
216
214
  }
217
215
 
218
216
  addChildViewControllerInDialogView(controller: UIViewController, dialogView: UIDialogView) {