uicore-ts 1.0.220 → 1.0.225

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.
@@ -65,7 +65,12 @@ export declare class UIObject {
65
65
  configuredWithObject(object: UIInitializerObject<this>): this;
66
66
  static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(configurationTarget: TargetObjectType, object: ConfigurationObjectType): ConfigurationObjectType;
67
67
  static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>): T;
68
+ get methods(): MethodsOnly<Omit<this, "methods">>;
68
69
  performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T;
69
70
  performingFunctionWithSelf(functionToPerform: (self: this) => void): this;
70
71
  performFunctionWithDelay(delay: number, functionToCall: Function): void;
71
72
  }
73
+ declare type MethodsOnly<T> = Pick<T, {
74
+ [K in keyof T]: T[K] extends Function ? K : never;
75
+ }[keyof T]>;
76
+ export {};
@@ -429,6 +429,16 @@ class UIObject {
429
429
  this.configureWithObject(configurationTarget, object);
430
430
  return configurationTarget;
431
431
  }
432
+ get methods() {
433
+ const thisObject = this;
434
+ const result = {};
435
+ thisObject.forEach((value, key) => {
436
+ if (value instanceof Function && key != "methods") {
437
+ result[key] = value.bind(thisObject);
438
+ }
439
+ });
440
+ return result;
441
+ }
432
442
  performFunctionWithSelf(functionToPerform) {
433
443
  return functionToPerform(this);
434
444
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIObject.ts"],
4
- "sourcesContent": ["import { UICoreExtensionValueObject } from \"./UICoreExtensionValueObject\"\nimport { UITimer } from \"./UITimer\"\n\n\nfunction NilFunction() {\n return nil\n}\n\n\n// The nil object avoids unnecessary crashes by allowing you to call any function or access any variable on it, returning nil\nexport var nil: any = new Proxy(Object.assign(NilFunction, { \"class\": null, \"className\": \"Nil\" }), {\n get(target, name) {\n if (name == Symbol.toPrimitive) {\n return function (hint: string) {\n if (hint == \"number\") {\n return 0\n }\n if (hint == \"string\") {\n return \"\"\n }\n return false\n }\n }\n if (name == \"toString\") {\n return function toString() {\n return \"\"\n }\n }\n return NilFunction()\n },\n set() {\n return NilFunction()\n }\n})\n\n\nexport function wrapInNil<T>(object?: T): T {\n let result = FIRST_OR_NIL(object)\n if (object instanceof Object && !(object instanceof Function)) {\n result = new Proxy(object as Object & T, {\n get(target, name) {\n if (name == \"wrapped_nil_target\") {\n return target\n }\n const value = Reflect.get(target, name)\n if (typeof value === \"object\") {\n return wrapInNil(value)\n }\n if (IS_NOT_LIKE_NULL(value)) {\n return value\n }\n return nil\n },\n set(target: Record<string, any> & T, name: string, value: any) {\n if (IS(target)) {\n // @ts-ignore\n target[name] = value\n }\n return YES\n }\n })\n }\n return result\n}\n\n\nexport const YES = true\nexport const NO = false\n\nexport function IS<T>(object: T | undefined | null | false): object is T {\n if (object && object !== nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT(object: any): object is undefined | null | false {\n return !IS(object)\n}\n\nexport function IS_DEFINED<T>(object: T | undefined): object is T {\n if (object != undefined) {\n return YES\n }\n return NO\n}\n\nexport function IS_UNDEFINED(object: any): object is undefined {\n return !IS_DEFINED(object)\n}\n\nexport function IS_NIL(object: any): object is typeof nil {\n if (object === nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT_NIL<T>(object: T | undefined | null): object is T | undefined | null {\n return !IS_NIL(object)\n}\n\n\nexport function IS_LIKE_NULL(object: any): object is undefined | null {\n return (IS_UNDEFINED(object) || IS_NIL(object) || object == null)\n}\n\nexport function IS_NOT_LIKE_NULL<T>(object: T | null | undefined): object is T {\n return !IS_LIKE_NULL(object)\n}\n\n\nexport function IS_AN_EMAIL_ADDRESS(email: string) {\n const re = /\\S+@\\S+\\.\\S+/\n return re.test(email)\n}\n\n\nexport function FIRST_OR_NIL<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || nil\n}\n\nexport function FIRST<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || IF(IS_DEFINED(objects.lastElement))(RETURNER(objects.lastElement))()\n}\n\n\nexport function MAKE_ID(randomPartLength = 15) {\n let result = \"\"\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n for (let i = 0; i < randomPartLength; i++) {\n result = result + characters.charAt(Math.floor(Math.random() * characters.length))\n }\n result = result + Date.now()\n return result\n}\n\n\nexport function RETURNER<T>(value?: T) {\n return (..._objects: any[]) => value\n}\n\n\nexport type UIIFBlockReceiver<T> = (functionToCall: () => any) => UIIFEvaluator<T>;\nexport type UIIFEvaluatorBase<T> = () => T;\n\n\nexport interface UIIFEvaluator<T> extends UIIFEvaluatorBase<T> {\n ELSE_IF: (otherValue: any) => UIIFBlockReceiver<T>;\n ELSE: (functionToCall: () => any) => T;\n}\n\n\nexport function IF<T = any>(value: any): UIIFBlockReceiver<T> {\n \n let thenFunction = nil\n let elseFunction = nil\n \n const result: any = function (functionToCall: () => T) {\n thenFunction = functionToCall\n return result.evaluateConditions\n }\n \n result.evaluateConditions = function () {\n if (IS(value)) {\n return thenFunction()\n }\n return elseFunction()\n }\n \n result.evaluateConditions.ELSE_IF = function (otherValue: any) {\n \n const functionResult = IF(otherValue) as (UIIFBlockReceiver<T> & { evaluateConditions: UIIFEvaluator<T> })\n elseFunction = functionResult.evaluateConditions\n \n const functionResultEvaluateConditionsFunction: any = function () {\n return result.evaluateConditions()\n }\n functionResultEvaluateConditionsFunction.ELSE_IF = functionResult.evaluateConditions.ELSE_IF\n functionResultEvaluateConditionsFunction.ELSE = functionResult.evaluateConditions.ELSE\n \n functionResult.evaluateConditions = functionResultEvaluateConditionsFunction\n \n return functionResult\n \n }\n \n result.evaluateConditions.ELSE = function (functionToCall: () => T) {\n elseFunction = functionToCall\n return result.evaluateConditions()\n }\n \n return result\n}\n\n\nexport class UIFunctionCall<T extends (...args: any) => any> {\n \n isAUIFunctionCallObject = YES\n parameters: Parameters<T>[]\n \n constructor(...parameters: Parameters<T>) {\n this.parameters = parameters\n }\n \n callFunction(functionToCall: T) {\n const parameters = this.parameters\n functionToCall(...parameters)\n }\n \n}\n\n\nexport function CALL<T extends (...args: any) => any>(...objects: Parameters<T>) {\n return new UIFunctionCall<T>(...objects)\n}\n\n\nexport class UIFunctionExtender<T extends (...args: any) => any> {\n \n isAUIFunctionExtenderObject = YES\n extendingFunction: T\n \n constructor(extendingFunction: T) {\n this.extendingFunction = extendingFunction\n }\n \n extendedFunction(functionToExtend: T) {\n const extendingFunction = this.extendingFunction\n \n function extendedFunction(this: any, ...objects: any[]) {\n const boundFunctionToExtend = functionToExtend.bind(this)\n boundFunctionToExtend(...objects)\n const boundExtendingFunction = extendingFunction.bind(this)\n boundExtendingFunction(...objects)\n }\n \n extendedFunction.extendedFunction = functionToExtend\n return extendedFunction\n }\n \n}\n\n\nexport function EXTEND<T extends (...args: any) => any>(extendingFunction: T) {\n return new UIFunctionExtender(extendingFunction)\n}\n\n\nexport class UILazyPropertyValue<T> {\n \n isAUILazyPropertyValueObject = YES\n initFunction: () => T\n \n constructor(initFunction: () => T) {\n this.initFunction = initFunction\n }\n \n setLazyPropertyValue(key: string, target: object) {\n \n let isValueInitialized = NO\n \n // property value\n let _value = nil\n \n const initValue = () => {\n _value = this.initFunction()\n isValueInitialized = YES\n this.initFunction = nil\n }\n \n // @ts-ignore\n if (delete target[key]) {\n \n // Create new property with getter and setter\n Object.defineProperty(target, key, {\n get: function () {\n if (IS_NOT(isValueInitialized)) {\n initValue()\n }\n return _value\n },\n set: function (newValue) {\n _value = newValue\n },\n enumerable: true,\n configurable: true\n })\n \n }\n \n }\n \n}\n\n\nexport function LAZY_VALUE<T>(initFunction: () => T) {\n return new UILazyPropertyValue(initFunction)\n}\n\n\nexport type UIInitializerObject<T> = {\n \n [P in keyof T]?:\n //T[P] extends (infer U)[] ? UIInitializerObject<U>[] :\n T[P] extends (...args: any) => any ? UIFunctionCall<T[P]> | UIFunctionExtender<T[P]> | T[P] :\n T[P] extends object ? UIInitializerObject<T[P]> | UILazyPropertyValue<T[P]> :\n T[P];\n \n}\n\n\nexport class UIObject {\n \n constructor() {\n \n // Do something here if needed\n \n }\n \n public get class(): any {\n return Object.getPrototypeOf(this).constructor\n }\n \n public get superclass(): any {\n return Object.getPrototypeOf(Object.getPrototypeOf(this)).constructor\n }\n \n isKindOfClass(classObject: any) {\n if (this.isMemberOfClass(classObject)) {\n return YES\n }\n for (let superclassObject = this.superclass; IS(superclassObject); superclassObject = superclassObject.superclass) {\n if (superclassObject == classObject) {\n return YES\n }\n }\n return NO\n }\n \n \n isMemberOfClass(classObject: any) {\n return (this.class == classObject)\n }\n \n public static wrapObject<T>(object: T): UIObject & T {\n if (IS_NOT(object)) {\n return nil\n }\n \n if ((object as any) instanceof UIObject) {\n // @ts-ignore\n return object\n }\n \n return Object.assign(new UIObject(), object)\n }\n \n \n valueForKey(key: string) {\n // @ts-ignore\n return this[key]\n }\n \n valueForKeyPath(keyPath: string): any {\n return UIObject.valueForKeyPath(keyPath, this)\n }\n \n static valueForKeyPath(keyPath: string, object: any): any {\n \n if (IS_NOT(keyPath)) {\n return object\n }\n \n const keys = keyPath.split(\".\")\n let currentObject = object\n \n for (let i = 0; i < keys.length; i++) {\n \n const key = keys[i]\n \n if (key.substring(0, 2) == \"[]\") {\n \n // This next object will be an array and the rest of the keys need to be run for each of the elements\n currentObject = currentObject[key.substring(2)]\n \n // CurrentObject is now an array\n \n const remainingKeyPath = keys.slice(i + 1).join(\".\")\n const currentArray = currentObject as unknown as any[]\n currentObject = currentArray.map(subObject => UIObject.valueForKeyPath(remainingKeyPath, subObject))\n \n break\n \n }\n \n currentObject = currentObject[key]\n if (IS_LIKE_NULL(currentObject)) {\n currentObject = nil\n }\n \n }\n \n return currentObject\n \n }\n \n setValueForKeyPath(keyPath: string, value: any, createPath = YES) {\n return UIObject.setValueForKeyPath(keyPath, value, this, createPath)\n }\n \n static setValueForKeyPath(keyPath: string, value: any, currentObject: any, createPath: boolean) {\n \n const keys = keyPath.split(\".\")\n let didSetValue = NO\n \n keys.forEach((key, index, array) => {\n if (index == array.length - 1 && IS_NOT_LIKE_NULL(currentObject)) {\n currentObject[key] = value\n didSetValue = YES\n return\n }\n else if (IS_NOT(currentObject)) {\n return\n }\n \n const currentObjectValue = currentObject[key]\n if (IS_LIKE_NULL(currentObjectValue) && createPath) {\n currentObject[key] = {}\n }\n currentObject = currentObject[key]\n })\n \n return didSetValue\n \n }\n \n \n configureWithObject(object: UIInitializerObject<this>) {\n \n return UIObject.configureWithObject(this, object)\n \n }\n \n configuredWithObject(object: UIInitializerObject<this>): this {\n \n this.configureWithObject(object)\n return this\n \n }\n \n \n static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(\n configurationTarget: TargetObjectType,\n object: ConfigurationObjectType\n ): ConfigurationObjectType {\n \n const isAnObject = (item: any) => (item && typeof item === \"object\" && !Array.isArray(item) && !(item instanceof UICoreExtensionValueObject))\n const isAPureObject = (item: any) => isAnObject(item) && Object.getPrototypeOf(item) === Object.getPrototypeOf({})\n \n function isAClass(funcOrClass: object) {\n if (IS_NOT(funcOrClass)) {\n return NO\n }\n const isFunction = (functionToCheck: object) => (functionToCheck && {}.toString.call(functionToCheck) ===\n \"[object Function]\")\n const propertyNames = Object.getOwnPropertyNames(funcOrClass)\n return (isFunction(funcOrClass) && !propertyNames.includes(\"arguments\") &&\n propertyNames.includes(\"prototype\"))\n }\n \n const result = {} as ConfigurationObjectType\n \n let keyPathsAndValues: { value: any, keyPath: string }[] = []\n \n function prepareKeyPathsAndValues(target: Record<string, any>, source: object, keyPath = \"\") {\n \n if ((isAnObject(target) || isAClass(target)) && isAnObject(source)) {\n \n source.forEach((sourceValue, key) => {\n \n const valueKeyPath = keyPath + \".\" + key\n \n function addValueAndKeyPath(sourceValue: any) {\n keyPathsAndValues.push({\n value: sourceValue,\n keyPath: valueKeyPath.replace(\".\", \"\")\n })\n }\n \n \n if (isAPureObject(sourceValue) || isAClass(sourceValue)) {\n if (!(key in target) || target[key] instanceof Function) {\n addValueAndKeyPath(sourceValue)\n }\n else {\n prepareKeyPathsAndValues(target[key], sourceValue, valueKeyPath)\n }\n }\n else if (sourceValue instanceof UICoreExtensionValueObject) {\n addValueAndKeyPath(sourceValue.value)\n }\n else {\n addValueAndKeyPath(sourceValue)\n }\n \n })\n \n }\n \n }\n \n prepareKeyPathsAndValues(configurationTarget, object)\n \n // Sort based on key path lengths\n keyPathsAndValues = keyPathsAndValues.sort((a, b) => {\n \n const firstKeyPath = (a.keyPath as string).split(\".\").length\n const secondKeyPath = (b.keyPath as string).split(\".\").length\n \n if (firstKeyPath < secondKeyPath) {\n return -1\n }\n if (firstKeyPath > secondKeyPath) {\n return 1\n }\n return 0\n \n })\n \n keyPathsAndValues.forEach((valueAndKeyPath) => {\n \n const keyPath: string = valueAndKeyPath.keyPath\n let value = valueAndKeyPath.value\n \n const getTargetFunction = (bindThis = NO) => {\n let result = (UIObject.valueForKeyPath(keyPath, configurationTarget) as Function)\n if (bindThis) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n result = result.bind(thisObject)\n }\n return result\n }\n \n if (value instanceof UILazyPropertyValue) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n const key = keyPath.substring(indexOfDot + 1)\n value.setLazyPropertyValue(key, thisObject)\n return\n }\n \n if (value instanceof UIFunctionCall) {\n value.callFunction(getTargetFunction(YES))\n return\n }\n \n if (value instanceof UIFunctionExtender) {\n value = value.extendedFunction(getTargetFunction())\n }\n \n UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)\n UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)\n \n })\n \n \n return result\n \n }\n \n static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>) {\n this.configureWithObject(configurationTarget, object)\n return configurationTarget\n }\n \n \n performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {\n return functionToPerform(this)\n }\n \n performingFunctionWithSelf(functionToPerform: (self: this) => void): this {\n functionToPerform(this)\n return this\n }\n \n performFunctionWithDelay(delay: number, functionToCall: Function) {\n \n new UITimer(delay, NO, functionToCall)\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAA2C;AAC3C,qBAAwB;AAGxB,SAAS,cAAc;AACnB,SAAO;AACX;AAIO,IAAI,MAAW,IAAI,MAAM,OAAO,OAAO,aAAa,EAAE,SAAS,MAAM,aAAa,MAAM,CAAC,GAAG;AAAA,EAC/F,IAAI,QAAQ,MAAM;AACd,QAAI,QAAQ,OAAO,aAAa;AAC5B,aAAO,SAAU,MAAc;AAC3B,YAAI,QAAQ,UAAU;AAClB,iBAAO;AAAA,QACX;AACA,YAAI,QAAQ,UAAU;AAClB,iBAAO;AAAA,QACX;AACA,eAAO;AAAA,MACX;AAAA,IACJ;AACA,QAAI,QAAQ,YAAY;AACpB,aAAO,SAAS,WAAW;AACvB,eAAO;AAAA,MACX;AAAA,IACJ;AACA,WAAO,YAAY;AAAA,EACvB;AAAA,EACA,MAAM;AACF,WAAO,YAAY;AAAA,EACvB;AACJ,CAAC;AAGM,SAAS,UAAa,QAAe;AACxC,MAAI,SAAS,aAAa,MAAM;AAChC,MAAI,kBAAkB,UAAU,EAAE,kBAAkB,WAAW;AAC3D,aAAS,IAAI,MAA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AEA,2BAA2B,mBAA+C;AACtE,sBAAkB,IAAI;AACtB,WAAO;AAAA,EACX;AAAA,EAEA,yBAAyB,OAAe,gBAA0B;AAE9D,QAAI,uBAAQ,OAAO,IAAI,cAAc;AAAA,EAEzC;AAGJ;",
4
+ "sourcesContent": ["import { UICoreExtensionValueObject } from \"./UICoreExtensionValueObject\"\nimport { UITimer } from \"./UITimer\"\n\n\nfunction NilFunction() {\n return nil\n}\n\n\n// The nil object avoids unnecessary crashes by allowing you to call any function or access any variable on it, returning nil\nexport var nil: any = new Proxy(Object.assign(NilFunction, { \"class\": null, \"className\": \"Nil\" }), {\n get(target, name) {\n if (name == Symbol.toPrimitive) {\n return function (hint: string) {\n if (hint == \"number\") {\n return 0\n }\n if (hint == \"string\") {\n return \"\"\n }\n return false\n }\n }\n if (name == \"toString\") {\n return function toString() {\n return \"\"\n }\n }\n return NilFunction()\n },\n set() {\n return NilFunction()\n }\n})\n\n\nexport function wrapInNil<T>(object?: T): T {\n let result = FIRST_OR_NIL(object)\n if (object instanceof Object && !(object instanceof Function)) {\n result = new Proxy(object as Object & T, {\n get(target, name) {\n if (name == \"wrapped_nil_target\") {\n return target\n }\n const value = Reflect.get(target, name)\n if (typeof value === \"object\") {\n return wrapInNil(value)\n }\n if (IS_NOT_LIKE_NULL(value)) {\n return value\n }\n return nil\n },\n set(target: Record<string, any> & T, name: string, value: any) {\n if (IS(target)) {\n // @ts-ignore\n target[name] = value\n }\n return YES\n }\n })\n }\n return result\n}\n\n\nexport const YES = true\nexport const NO = false\n\nexport function IS<T>(object: T | undefined | null | false): object is T {\n if (object && object !== nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT(object: any): object is undefined | null | false {\n return !IS(object)\n}\n\nexport function IS_DEFINED<T>(object: T | undefined): object is T {\n if (object != undefined) {\n return YES\n }\n return NO\n}\n\nexport function IS_UNDEFINED(object: any): object is undefined {\n return !IS_DEFINED(object)\n}\n\nexport function IS_NIL(object: any): object is typeof nil {\n if (object === nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT_NIL<T>(object: T | undefined | null): object is T | undefined | null {\n return !IS_NIL(object)\n}\n\n\nexport function IS_LIKE_NULL(object: any): object is undefined | null {\n return (IS_UNDEFINED(object) || IS_NIL(object) || object == null)\n}\n\nexport function IS_NOT_LIKE_NULL<T>(object: T | null | undefined): object is T {\n return !IS_LIKE_NULL(object)\n}\n\n\nexport function IS_AN_EMAIL_ADDRESS(email: string) {\n const re = /\\S+@\\S+\\.\\S+/\n return re.test(email)\n}\n\n\nexport function FIRST_OR_NIL<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || nil\n}\n\nexport function FIRST<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || IF(IS_DEFINED(objects.lastElement))(RETURNER(objects.lastElement))()\n}\n\n\nexport function MAKE_ID(randomPartLength = 15) {\n let result = \"\"\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n for (let i = 0; i < randomPartLength; i++) {\n result = result + characters.charAt(Math.floor(Math.random() * characters.length))\n }\n result = result + Date.now()\n return result\n}\n\n\nexport function RETURNER<T>(value?: T) {\n return (..._objects: any[]) => value\n}\n\n\nexport type UIIFBlockReceiver<T> = (functionToCall: () => any) => UIIFEvaluator<T>;\nexport type UIIFEvaluatorBase<T> = () => T;\n\n\nexport interface UIIFEvaluator<T> extends UIIFEvaluatorBase<T> {\n ELSE_IF: (otherValue: any) => UIIFBlockReceiver<T>;\n ELSE: (functionToCall: () => any) => T;\n}\n\n\nexport function IF<T = any>(value: any): UIIFBlockReceiver<T> {\n \n let thenFunction = nil\n let elseFunction = nil\n \n const result: any = function (functionToCall: () => T) {\n thenFunction = functionToCall\n return result.evaluateConditions\n }\n \n result.evaluateConditions = function () {\n if (IS(value)) {\n return thenFunction()\n }\n return elseFunction()\n }\n \n result.evaluateConditions.ELSE_IF = function (otherValue: any) {\n \n const functionResult = IF(otherValue) as (UIIFBlockReceiver<T> & { evaluateConditions: UIIFEvaluator<T> })\n elseFunction = functionResult.evaluateConditions\n \n const functionResultEvaluateConditionsFunction: any = function () {\n return result.evaluateConditions()\n }\n functionResultEvaluateConditionsFunction.ELSE_IF = functionResult.evaluateConditions.ELSE_IF\n functionResultEvaluateConditionsFunction.ELSE = functionResult.evaluateConditions.ELSE\n \n functionResult.evaluateConditions = functionResultEvaluateConditionsFunction\n \n return functionResult\n \n }\n \n result.evaluateConditions.ELSE = function (functionToCall: () => T) {\n elseFunction = functionToCall\n return result.evaluateConditions()\n }\n \n return result\n}\n\n\nexport class UIFunctionCall<T extends (...args: any) => any> {\n \n isAUIFunctionCallObject = YES\n parameters: Parameters<T>[]\n \n constructor(...parameters: Parameters<T>) {\n this.parameters = parameters\n }\n \n callFunction(functionToCall: T) {\n const parameters = this.parameters\n functionToCall(...parameters)\n }\n \n}\n\n\nexport function CALL<T extends (...args: any) => any>(...objects: Parameters<T>) {\n return new UIFunctionCall<T>(...objects)\n}\n\n\nexport class UIFunctionExtender<T extends (...args: any) => any> {\n \n isAUIFunctionExtenderObject = YES\n extendingFunction: T\n \n constructor(extendingFunction: T) {\n this.extendingFunction = extendingFunction\n }\n \n extendedFunction(functionToExtend: T) {\n const extendingFunction = this.extendingFunction\n \n function extendedFunction(this: any, ...objects: any[]) {\n const boundFunctionToExtend = functionToExtend.bind(this)\n boundFunctionToExtend(...objects)\n const boundExtendingFunction = extendingFunction.bind(this)\n boundExtendingFunction(...objects)\n }\n \n extendedFunction.extendedFunction = functionToExtend\n return extendedFunction\n }\n \n}\n\n\nexport function EXTEND<T extends (...args: any) => any>(extendingFunction: T) {\n return new UIFunctionExtender(extendingFunction)\n}\n\n\nexport class UILazyPropertyValue<T> {\n \n isAUILazyPropertyValueObject = YES\n initFunction: () => T\n \n constructor(initFunction: () => T) {\n this.initFunction = initFunction\n }\n \n setLazyPropertyValue(key: string, target: object) {\n \n let isValueInitialized = NO\n \n // property value\n let _value = nil\n \n const initValue = () => {\n _value = this.initFunction()\n isValueInitialized = YES\n this.initFunction = nil\n }\n \n // @ts-ignore\n if (delete target[key]) {\n \n // Create new property with getter and setter\n Object.defineProperty(target, key, {\n get: function () {\n if (IS_NOT(isValueInitialized)) {\n initValue()\n }\n return _value\n },\n set: function (newValue) {\n _value = newValue\n },\n enumerable: true,\n configurable: true\n })\n \n }\n \n }\n \n}\n\n\nexport function LAZY_VALUE<T>(initFunction: () => T) {\n return new UILazyPropertyValue(initFunction)\n}\n\n\nexport type UIInitializerObject<T> = {\n \n [P in keyof T]?:\n //T[P] extends (infer U)[] ? UIInitializerObject<U>[] :\n T[P] extends (...args: any) => any ? UIFunctionCall<T[P]> | UIFunctionExtender<T[P]> | T[P] :\n T[P] extends object ? UIInitializerObject<T[P]> | UILazyPropertyValue<T[P]> :\n T[P];\n \n}\n\n\nexport class UIObject {\n \n constructor() {\n \n // Do something here if needed\n \n }\n \n public get class(): any {\n return Object.getPrototypeOf(this).constructor\n }\n \n public get superclass(): any {\n return Object.getPrototypeOf(Object.getPrototypeOf(this)).constructor\n }\n \n isKindOfClass(classObject: any) {\n if (this.isMemberOfClass(classObject)) {\n return YES\n }\n for (let superclassObject = this.superclass; IS(superclassObject); superclassObject = superclassObject.superclass) {\n if (superclassObject == classObject) {\n return YES\n }\n }\n return NO\n }\n \n \n isMemberOfClass(classObject: any) {\n return (this.class == classObject)\n }\n \n public static wrapObject<T>(object: T): UIObject & T {\n if (IS_NOT(object)) {\n return nil\n }\n \n if ((object as any) instanceof UIObject) {\n // @ts-ignore\n return object\n }\n \n return Object.assign(new UIObject(), object)\n }\n \n \n valueForKey(key: string) {\n // @ts-ignore\n return this[key]\n }\n \n valueForKeyPath(keyPath: string): any {\n return UIObject.valueForKeyPath(keyPath, this)\n }\n \n static valueForKeyPath(keyPath: string, object: any): any {\n \n if (IS_NOT(keyPath)) {\n return object\n }\n \n const keys = keyPath.split(\".\")\n let currentObject = object\n \n for (let i = 0; i < keys.length; i++) {\n \n const key = keys[i]\n \n if (key.substring(0, 2) == \"[]\") {\n \n // This next object will be an array and the rest of the keys need to be run for each of the elements\n currentObject = currentObject[key.substring(2)]\n \n // CurrentObject is now an array\n \n const remainingKeyPath = keys.slice(i + 1).join(\".\")\n const currentArray = currentObject as unknown as any[]\n currentObject = currentArray.map(subObject => UIObject.valueForKeyPath(remainingKeyPath, subObject))\n \n break\n \n }\n \n currentObject = currentObject[key]\n if (IS_LIKE_NULL(currentObject)) {\n currentObject = nil\n }\n \n }\n \n return currentObject\n \n }\n \n setValueForKeyPath(keyPath: string, value: any, createPath = YES) {\n return UIObject.setValueForKeyPath(keyPath, value, this, createPath)\n }\n \n static setValueForKeyPath(keyPath: string, value: any, currentObject: any, createPath: boolean) {\n \n const keys = keyPath.split(\".\")\n let didSetValue = NO\n \n keys.forEach((key, index, array) => {\n if (index == array.length - 1 && IS_NOT_LIKE_NULL(currentObject)) {\n currentObject[key] = value\n didSetValue = YES\n return\n }\n else if (IS_NOT(currentObject)) {\n return\n }\n \n const currentObjectValue = currentObject[key]\n if (IS_LIKE_NULL(currentObjectValue) && createPath) {\n currentObject[key] = {}\n }\n currentObject = currentObject[key]\n })\n \n return didSetValue\n \n }\n \n \n configureWithObject(object: UIInitializerObject<this>) {\n \n return UIObject.configureWithObject(this, object)\n \n }\n \n configuredWithObject(object: UIInitializerObject<this>): this {\n \n this.configureWithObject(object)\n return this\n \n }\n \n \n static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(\n configurationTarget: TargetObjectType,\n object: ConfigurationObjectType\n ): ConfigurationObjectType {\n \n const isAnObject = (item: any) => (item && typeof item === \"object\" && !Array.isArray(item) && !(item instanceof UICoreExtensionValueObject))\n const isAPureObject = (item: any) => isAnObject(item) && Object.getPrototypeOf(item) === Object.getPrototypeOf({})\n \n function isAClass(funcOrClass: object) {\n if (IS_NOT(funcOrClass)) {\n return NO\n }\n const isFunction = (functionToCheck: object) => (functionToCheck && {}.toString.call(functionToCheck) ===\n \"[object Function]\")\n const propertyNames = Object.getOwnPropertyNames(funcOrClass)\n return (isFunction(funcOrClass) && !propertyNames.includes(\"arguments\") &&\n propertyNames.includes(\"prototype\"))\n }\n \n const result = {} as ConfigurationObjectType\n \n let keyPathsAndValues: { value: any, keyPath: string }[] = []\n \n function prepareKeyPathsAndValues(target: Record<string, any>, source: object, keyPath = \"\") {\n \n if ((isAnObject(target) || isAClass(target)) && isAnObject(source)) {\n \n source.forEach((sourceValue, key) => {\n \n const valueKeyPath = keyPath + \".\" + key\n \n function addValueAndKeyPath(sourceValue: any) {\n keyPathsAndValues.push({\n value: sourceValue,\n keyPath: valueKeyPath.replace(\".\", \"\")\n })\n }\n \n \n if (isAPureObject(sourceValue) || isAClass(sourceValue)) {\n if (!(key in target) || target[key] instanceof Function) {\n addValueAndKeyPath(sourceValue)\n }\n else {\n prepareKeyPathsAndValues(target[key], sourceValue, valueKeyPath)\n }\n }\n else if (sourceValue instanceof UICoreExtensionValueObject) {\n addValueAndKeyPath(sourceValue.value)\n }\n else {\n addValueAndKeyPath(sourceValue)\n }\n \n })\n \n }\n \n }\n \n prepareKeyPathsAndValues(configurationTarget, object)\n \n // Sort based on key path lengths\n keyPathsAndValues = keyPathsAndValues.sort((a, b) => {\n \n const firstKeyPath = (a.keyPath as string).split(\".\").length\n const secondKeyPath = (b.keyPath as string).split(\".\").length\n \n if (firstKeyPath < secondKeyPath) {\n return -1\n }\n if (firstKeyPath > secondKeyPath) {\n return 1\n }\n return 0\n \n })\n \n keyPathsAndValues.forEach((valueAndKeyPath) => {\n \n const keyPath: string = valueAndKeyPath.keyPath\n let value = valueAndKeyPath.value\n \n const getTargetFunction = (bindThis = NO) => {\n let result = (UIObject.valueForKeyPath(keyPath, configurationTarget) as Function)\n if (bindThis) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n result = result.bind(thisObject)\n }\n return result\n }\n \n if (value instanceof UILazyPropertyValue) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n const key = keyPath.substring(indexOfDot + 1)\n value.setLazyPropertyValue(key, thisObject)\n return\n }\n \n if (value instanceof UIFunctionCall) {\n value.callFunction(getTargetFunction(YES))\n return\n }\n \n if (value instanceof UIFunctionExtender) {\n value = value.extendedFunction(getTargetFunction())\n }\n \n UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)\n UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)\n \n })\n \n \n return result\n \n }\n \n static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>) {\n this.configureWithObject(configurationTarget, object)\n return configurationTarget\n }\n \n \n get methods(): MethodsOnly<Omit<this, \"methods\">> {\n const thisObject = this as object\n const result = {} as any\n thisObject.forEach((value, key) => {\n if (value instanceof Function && key != \"methods\") {\n result[key] = value.bind(thisObject)\n }\n })\n return result\n }\n \n \n performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {\n return functionToPerform(this)\n }\n \n performingFunctionWithSelf(functionToPerform: (self: this) => void): this {\n functionToPerform(this)\n return this\n }\n \n performFunctionWithDelay(delay: number, functionToCall: Function) {\n \n new UITimer(delay, NO, functionToCall)\n \n }\n \n \n}\n\ntype MethodsOnly<T> =\n Pick<T, { [K in keyof T]: T[K] extends Function ? K : never }[keyof T]>;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAA2C;AAC3C,qBA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,QAAQ,UAAU,GAAG,UAAU,GAAG,mBAAmB;AACjG,cAAM,MAAM,QAAQ,UAAU,aAAa,CAAC;AAC5C,cAAM,qBAAqB,KAAK,UAAU;AAC1C;AAAA,MACJ;AAEA,UAAI,iBAAiB,gBAAgB;AACjC,cAAM,aAAa,kBAAkB,GAAG,CAAC;AACzC;AAAA,MACJ;AAEA,UAAI,iBAAiB,oBAAoB;AACrC,gBAAQ,MAAM,iBAAiB,kBAAkB,CAAC;AAAA,MACtD;AAEA,eAAS,mBAAmB,SAAS,SAAS,gBAAgB,SAAS,mBAAmB,GAAG,QAAQ,GAAG;AACxG,eAAS,mBAAmB,SAAS,OAAO,qBAAqB,GAAG;AAAA,IAExE,CAAC;AAGD,WAAO;AAAA,EAEX;AAAA,EAEA,OAAO,qBAAuC,qBAAwB,QAAgC;AAClG,SAAK,oBAAoB,qBAAqB,MAAM;AACpD,WAAO;AAAA,EACX;AAAA,EAGA,IAAI,UAA8C;AAC9C,UAAM,aAAa;AACnB,UAAM,SAAS,CAAC;AAChB,eAAW,QAAQ,CAAC,OAAO,QAAQ;AAC/B,UAAI,iBAAiB,YAAY,OAAO,WAAW;AAC/C,eAAO,OAAO,MAAM,KAAK,UAAU;AAAA,MACvC;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA,EAGA,wBAA2B,mBAAyC;AAChE,WAAO,kBAAkB,IAAI;AAAA,EACjC;AAAA,EAEA,2BAA2B,mBAA+C;AACtE,sBAAkB,IAAI;AACtB,WAAO;AAAA,EACX;AAAA,EAEA,yBAAyB,OAAe,gBAA0B;AAE9D,QAAI,uBAAQ,OAAO,IAAI,cAAc;AAAA,EAEzC;AAGJ;",
6
6
  "names": ["sourceValue", "result"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UITableView.ts"],
4
- "sourcesContent": ["import { UIButton } from \"./UIButton\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n \n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n \n _rowIDIndex: number = 0\n \n reloadsOnLanguageChange = YES\n \n sidePadding = 0\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override animationDuration = 0.25\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.viewForRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n // if (index == 0) {\n \n // this._highestValidRowPositionIndex = 0;\n \n // this._rowPositions = [];\n \n // }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n var validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n var previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (var i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n var height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n const firstVisibleY = this.contentOffset.y - this.bounds.height * paddingRatio\n const lastVisibleY = firstVisibleY + this.bounds.height * (1 + paddingRatio)\n \n const numberOfRows = this.numberOfRows()\n \n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n var firstIndex = firstVisibleY / rowHeight\n var lastIndex = lastVisibleY / rowHeight\n \n firstIndex = Math.trunc(firstIndex)\n lastIndex = Math.trunc(lastIndex) + 1\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n var result = []\n for (var i = firstIndex; i < lastIndex + 1; i++) {\n result.push(i)\n }\n return result\n }\n \n var accumulatedHeight = 0\n var result = []\n \n this._calculateAllPositions()\n \n const rowPositions = this._rowPositions\n \n for (var i = 0; i < numberOfRows; i++) {\n \n const height = rowPositions[i].bottomY - rowPositions[i].topY // this.heightForRowWithIndex(i)\n \n accumulatedHeight = accumulatedHeight + height\n if (accumulatedHeight >= firstVisibleY) {\n result.push(i)\n }\n if (accumulatedHeight >= lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n const visibleIndexes = this.indexesForVisibleRows()\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row) => {\n if (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex) {\n \n //row.removeFromSuperview();\n \n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n removedViews.push(row)\n \n }\n else {\n visibleRows.push(row)\n }\n })\n this._visibleRows = visibleRows\n \n visibleIndexes.forEach((rowIndex: number) => {\n \n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n //view._UITableViewRowIndex = rowIndex;\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n \n })\n \n for (let i = 0; i < removedViews.length; i++) {\n \n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n \n //this._persistedData[view._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(view._UITableViewRowIndex, view);\n view.removeFromSuperview()\n \n //this._removedReusableViews[view._UITableViewReusabilityIdentifier].push(view);\n \n }\n \n }\n \n //this.setNeedsLayout();\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (var i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex);\n (row as UIButton).titleLabel.text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree(function (view: UIView) {\n \n view._isPointerValid = NO\n \n })\n \n if (!this._isDrawVisibleRowsScheduled) {\n \n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this.setNeedsLayout()\n \n this._isDrawVisibleRowsScheduled = NO\n \n }.bind(this))\n \n }\n \n }\n \n override wasAddedToViewTree() {\n this.loadData()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n function (this: UITableView) {\n \n this._layoutAllRows()\n \n }.bind(this),\n function (this: UITableView) {\n \n // this._calculateAllPositions()\n // this._layoutAllRows()\n \n }.bind(this)\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n //this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._animateLayoutAllRows()\n \n }.bind(this))\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n // if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n // this._drawVisibleRows();\n \n // this._needsDrawingOfVisibleRowsBeforeLayout = NO;\n \n // }\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n var result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAmC;AACnC,sBAAiC;AAGjC,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,EA+BhD,YAAY,WAAoB;AAE5B,UAAM,SAAS;AA9BnB,kCAAkC;AAClC,wBAAqC,CAAC;AACtC,mCAAgD,CAAC;AAEjD,yBAAyD,CAAC;AAE1D,yCAAwC;AAExC,0BAA0D,CAAC;AAE3D,iCAAiE,CAAC;AAIlE,uBAAsB;AAEtB,mCAA0B;AAE1B,uBAAc;AAEd,0BAAwB,CAAC;AACzB,kDAAyC;AACzC,uCAA8B;AA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Object\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n \n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n \n _rowIDIndex: number = 0\n \n reloadsOnLanguageChange = YES\n \n sidePadding = 0\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override animationDuration = 0.25\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.viewForRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n // if (index == 0) {\n \n // this._highestValidRowPositionIndex = 0;\n \n // this._rowPositions = [];\n \n // }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n var validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n var previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (var i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n var height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n const firstVisibleY = this.contentOffset.y - this.bounds.height * paddingRatio\n const lastVisibleY = firstVisibleY + this.bounds.height * (1 + paddingRatio)\n \n const numberOfRows = this.numberOfRows()\n \n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n var firstIndex = firstVisibleY / rowHeight\n var lastIndex = lastVisibleY / rowHeight\n \n firstIndex = Math.trunc(firstIndex)\n lastIndex = Math.trunc(lastIndex) + 1\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n var result = []\n for (var i = firstIndex; i < lastIndex + 1; i++) {\n result.push(i)\n }\n return result\n }\n \n var accumulatedHeight = 0\n var result = []\n \n this._calculateAllPositions()\n \n const rowPositions = this._rowPositions\n \n for (var i = 0; i < numberOfRows; i++) {\n \n const height = rowPositions[i].bottomY - rowPositions[i].topY // this.heightForRowWithIndex(i)\n \n accumulatedHeight = accumulatedHeight + height\n if (accumulatedHeight >= firstVisibleY) {\n result.push(i)\n }\n if (accumulatedHeight >= lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n const visibleIndexes = this.indexesForVisibleRows()\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row) => {\n if (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex) {\n \n //row.removeFromSuperview();\n \n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n removedViews.push(row)\n \n }\n else {\n visibleRows.push(row)\n }\n })\n this._visibleRows = visibleRows\n \n visibleIndexes.forEach((rowIndex: number) => {\n \n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n //view._UITableViewRowIndex = rowIndex;\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n \n })\n \n for (let i = 0; i < removedViews.length; i++) {\n \n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n \n //this._persistedData[view._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(view._UITableViewRowIndex, view);\n view.removeFromSuperview()\n \n //this._removedReusableViews[view._UITableViewReusabilityIdentifier].push(view);\n \n }\n \n }\n \n //this.setNeedsLayout();\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (var i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex);\n (row as unknown as UIButton).titleLabel.text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree(function (view: UIView) {\n \n view._isPointerValid = NO\n \n })\n \n if (!this._isDrawVisibleRowsScheduled) {\n \n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this.setNeedsLayout()\n \n this._isDrawVisibleRowsScheduled = NO\n \n }.bind(this))\n \n }\n \n }\n \n override wasAddedToViewTree() {\n this.loadData()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n function (this: UITableView) {\n \n this._layoutAllRows()\n \n }.bind(this),\n function (this: UITableView) {\n \n // this._calculateAllPositions()\n // this._layoutAllRows()\n \n }.bind(this)\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n //this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._animateLayoutAllRows()\n \n }.bind(this))\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n // if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n // this._drawVisibleRows();\n \n // this._needsDrawingOfVisibleRowsBeforeLayout = NO;\n \n // }\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n var result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAmC;AACnC,sBAAiC;AAGjC,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,EA+BhD,YAAY,WAAoB;AAE5B,UAAM,SAAS;AA9BnB,kCAAkC;AAClC,wBAAqC,CAAC;AACtC,mCAAgD,CAAC;AAEjD,yBAAyD,CAAC;AAE1D,yCAAwC;AAExC,0BAA0D,CAAC;AAE3D,iCAAiE,CAAC;AAIlE,uBAAsB;AAEtB,mCAA0B;AAE1B,uBAAc;AAEd,0BAAwB,CAAC;AACzB,kDAAyC;AACzC,uCAA8B;AAG9B,SAAS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import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS_LIKE_NULL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: string\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize: number = nil\n _maxFontSize: number = nil\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n \n constructor(elementID?: string, textViewType = UITextView.type.paragraph, viewHTMLElement = null) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n }\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n }\n \n get textAlignment() {\n const result = this.style.textAlign\n return result\n }\n \n set textAlignment(textAlignment: string) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n const result = this._textColor\n return result\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n \n this._text = text\n \n var notificationText = \"\"\n \n if (this.notificationAmount) {\n \n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n \n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n \n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n \n }\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n \n }\n \n \n get fontSize() {\n \n const style = window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n \n }\n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n \n this._automaticFontSizeSelection = YES\n \n \n this._minFontSize = minFontSize\n \n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n \n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n \n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n \n var multiplier = heightMultiplier\n \n if (heightMultiplier > widthMultiplier) {\n \n multiplier = widthMultiplier\n \n \n }\n \n \n const maxFittingFontSize = currentFontSize * multiplier\n \n \n if (maxFittingFontSize > maxFontSize) {\n \n return maxFontSize\n \n }\n \n if (minFontSize > maxFittingFontSize) {\n \n return minFontSize\n \n }\n \n \n return maxFittingFontSize\n \n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA4D;AAC5D,yBAA4B;AAC5B,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAmCnC,YAAY,WAAoB,eAAe,YAAW,KAAK,WAAW,kBAAkB,MAAM;AAE9F,UAAM,WAAW,iBAAiB,YAAY;AAlClD,sBAAsB,YAAW;AAGjC,yBAAgB;AAEhB,sBAAa;AACb,sBAAa;AAEb,+BAAsB;AAEtB,wBAAuB;AACvB,wBAAuB;AAEvB,uCAA8B;AAE9B,wBAAe;AAQf,iCAA+E,IAAI,yBAAS;AAC5F,gCAA8E,IAAI,yBAAS;AAYvF,SAAK,OAAO;AAEZ,SAAK,MAAM,WAAW;AACtB,SAAK,MAAM,eAAe;AAC1B,SAAK,eAAe;AAEpB,SAAK,YAAY,KAAK;AAEtB,SAAK,yBAAyB;AAG9B,QAAI,gBAAgB,YAAW,KAAK,UAAU;AAE1C,WAAK,sBAAsB;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A,EACT,WAAW;AAEf;AAwVJ,WAAW,wBAAwB;",
4
+ "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { FIRST, IS_LIKE_NULL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: string\n \n _isSingleLine = YES\n \n textPrefix = \"\"\n textSuffix = \"\"\n \n _notificationAmount = 0\n \n _minFontSize: number = nil\n _maxFontSize: number = nil\n \n _automaticFontSizeSelection = NO\n \n changesOften = NO\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n \n static _ptToPx: number\n static _pxToPt: number\n _text?: string\n \n \n constructor(elementID?: string, textViewType = UITextView.type.paragraph, viewHTMLElement = null) {\n \n super(elementID, viewHTMLElement, textViewType)\n \n this.text = \"\"\n \n this.style.overflow = \"hidden\"\n this.style.textOverflow = \"ellipsis\"\n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n \n if (textViewType == UITextView.type.textArea) {\n \n this.pausesPointerEvents = YES\n \n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n \n \n }\n \n \n }\n \n \n static _determinePXAndPTRatios() {\n \n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n \n }\n \n \n static type = {\n \n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n \n }\n \n \n static textAlignment = {\n \n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n \n }\n \n get textAlignment() {\n const result = this.style.textAlign\n return result\n }\n \n set textAlignment(textAlignment: string) {\n this._textAlignment = textAlignment\n this.style.textAlign = textAlignment\n }\n \n \n get textColor() {\n const result = this._textColor\n return result\n }\n \n set textColor(color: UIColor) {\n \n this._textColor = color || UITextView.defaultTextColor\n this.style.color = this._textColor.stringValue\n \n }\n \n \n get isSingleLine() {\n \n return this._isSingleLine\n \n }\n \n set isSingleLine(isSingleLine: boolean) {\n \n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n \n this.style.whiteSpace = \"pre\"\n \n return\n \n }\n \n this.style.whiteSpace = \"pre-wrap\"\n \n }\n \n \n get notificationAmount() {\n \n return this._notificationAmount\n \n }\n \n set notificationAmount(notificationAmount: number) {\n \n if (this._notificationAmount == notificationAmount) {\n \n return\n \n }\n \n this._notificationAmount = notificationAmount\n \n this.text = this.text\n \n this.setNeedsLayoutUpToRootView()\n \n this.notificationAmountDidChange(notificationAmount)\n \n }\n \n notificationAmountDidChange(notificationAmount: number) {\n \n \n }\n \n \n get text() {\n \n return (this._text || this.viewHTMLElement.innerHTML)\n \n }\n \n set text(text) {\n \n this._text = text\n \n var notificationText = \"\"\n \n if (this.notificationAmount) {\n \n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n \n }\n \n if (this.viewHTMLElement.innerHTML != this.textPrefix + text + this.textSuffix + notificationText) {\n \n this.viewHTMLElement.innerHTML = this.textPrefix + FIRST(text, \"\") + this.textSuffix + notificationText\n \n }\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this.setNeedsLayout()\n \n }\n \n override set innerHTML(innerHTML: string) {\n \n this.text = innerHTML\n \n }\n \n override get innerHTML() {\n \n return this.viewHTMLElement.innerHTML\n \n }\n \n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n \n this.setInnerHTML(key, defaultString, parameters)\n \n }\n \n \n get fontSize() {\n \n const style = window.getComputedStyle(this.viewHTMLElement, null).fontSize\n \n const result = (parseFloat(style) * UITextView._pxToPt)\n \n return result\n \n }\n \n set fontSize(fontSize: number) {\n \n \n this.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any // MEETOD LUUA!!!!\n \n \n }\n \n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n \n \n this._automaticFontSizeSelection = YES\n \n \n this._minFontSize = minFontSize\n \n this._maxFontSize = maxFontSize\n \n this.setNeedsLayout()\n \n \n }\n \n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n \n minFontSize = FIRST(minFontSize, 1)\n \n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n \n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n \n var multiplier = heightMultiplier\n \n if (heightMultiplier > widthMultiplier) {\n \n multiplier = widthMultiplier\n \n \n }\n \n \n const maxFittingFontSize = currentFontSize * multiplier\n \n \n if (maxFittingFontSize > maxFontSize) {\n \n return maxFontSize\n \n }\n \n if (minFontSize > maxFittingFontSize) {\n \n return minFontSize\n \n }\n \n \n return maxFittingFontSize\n \n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n }\n \n \n override willMoveToSuperview(superview: UIView) {\n \n super.willMoveToSuperview(superview)\n \n }\n \n \n override layoutSubviews() {\n \n super.layoutSubviews()\n \n \n if (this._automaticFontSizeSelection) {\n \n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(0, 0, 1 *\n this.viewHTMLElement.offsetHeight, 1 *\n this.viewHTMLElement.offsetWidth),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicHeightCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentHeight(constrainingWidth)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = (this.viewHTMLElement.innerHTML + \"_csf_\" + this.computedStyle.font).replace(new RegExp(\n \"\\\\.\",\n \"g\"\n ), \"_\") + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n \n // @ts-ignore\n cacheObject = this._intrinsicWidthCache\n \n \n }\n \n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n \n if (IS_LIKE_NULL(result)) {\n \n result = super.intrinsicContentWidth(constrainingHeight)\n \n cacheObject.setValueForKeyPath(keyPath, result)\n \n \n }\n \n \n return result\n \n }\n \n \n override intrinsicContentSize() {\n \n // This works but is slow\n const result = this.intrinsicContentSizeWithConstraints(nil, nil)\n \n return result\n \n }\n \n \n}\n\n\nUITextView._determinePXAndPTRatios()\n\n\n// /**\n// * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\n// * \n// * @param {String} text The text to be rendered.\n// * @param {String} font The css font descriptor that text is to be rendered with (e.g. \"bold 14px verdana\").\n// * \n// * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\n// */\n// function getTextMetrics(text, font) {\n// // re-use canvas object for better performance\n// var canvas = getTextMetrics.canvas || (getTextMetrics.canvas = document.createElement(\"canvas\"));\n// var context = canvas.getContext(\"2d\");\n// context.font = font;\n// var metrics = context.measureText(text);\n// return metrics;\n// }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA4D;AAC5D,yBAA4B;AAC5B,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAmCnC,YAAY,WAAoB,eAAe,YAAW,KAAK,WAAW,kBAAkB,MAAM;AAE9F,UAAM,WAAW,iBAAiB,YAAY;AAlClD,sBAAsB,YAAW;AAGjC,yBAAgB;AAEhB,sBAAa;AACb,sBAAa;AAEb,+BAAsB;AAEtB,wBAAuB;AACvB,wBAAuB;AAEvB,uCAA8B;AAE9B,wBAAe;AAQf,iCAA+E,IAAI,yBAAS;AAC5F,gCAA8E,IAAI,yBAAS;AAYvF,SAAK,OAAO;AAEZ,SAAK,MAAM,WAAW;AACtB,SAAK,MAAM,eAAe;AAC1B,SAAK,eAAe;AAEpB,SAAK,YAAY,KA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AAEb;AAhGS,WAmGF,gBAAgB;AAAA,EAEnB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAEf;AA0VJ,WAAW,wBAAwB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uicore-ts",
3
- "version": "1.0.220",
3
+ "version": "1.0.225",
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",
@@ -229,14 +229,14 @@ export class UIFunctionExtender<T extends (...args: any) => any> {
229
229
 
230
230
  extendedFunction(functionToExtend: T) {
231
231
  const extendingFunction = this.extendingFunction
232
-
232
+
233
233
  function extendedFunction(this: any, ...objects: any[]) {
234
234
  const boundFunctionToExtend = functionToExtend.bind(this)
235
235
  boundFunctionToExtend(...objects)
236
236
  const boundExtendingFunction = extendingFunction.bind(this)
237
237
  boundExtendingFunction(...objects)
238
238
  }
239
-
239
+
240
240
  extendedFunction.extendedFunction = functionToExtend
241
241
  return extendedFunction
242
242
  }
@@ -270,7 +270,7 @@ export class UILazyPropertyValue<T> {
270
270
  isValueInitialized = YES
271
271
  this.initFunction = nil
272
272
  }
273
-
273
+
274
274
  // @ts-ignore
275
275
  if (delete target[key]) {
276
276
 
@@ -315,7 +315,7 @@ export type UIInitializerObject<T> = {
315
315
  export class UIObject {
316
316
 
317
317
  constructor() {
318
-
318
+
319
319
  // Do something here if needed
320
320
 
321
321
  }
@@ -376,7 +376,7 @@ export class UIObject {
376
376
 
377
377
  const keys = keyPath.split(".")
378
378
  let currentObject = object
379
-
379
+
380
380
  for (let i = 0; i < keys.length; i++) {
381
381
 
382
382
  const key = keys[i]
@@ -439,9 +439,9 @@ export class UIObject {
439
439
 
440
440
 
441
441
  configureWithObject(object: UIInitializerObject<this>) {
442
-
442
+
443
443
  return UIObject.configureWithObject(this, object)
444
-
444
+
445
445
  }
446
446
 
447
447
  configuredWithObject(object: UIInitializerObject<this>): this {
@@ -557,14 +557,14 @@ export class UIObject {
557
557
  value.callFunction(getTargetFunction(YES))
558
558
  return
559
559
  }
560
-
560
+
561
561
  if (value instanceof UIFunctionExtender) {
562
562
  value = value.extendedFunction(getTargetFunction())
563
563
  }
564
-
564
+
565
565
  UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)
566
566
  UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)
567
-
567
+
568
568
  })
569
569
 
570
570
 
@@ -578,6 +578,18 @@ export class UIObject {
578
578
  }
579
579
 
580
580
 
581
+ get methods(): MethodsOnly<Omit<this, "methods">> {
582
+ const thisObject = this as object
583
+ const result = {} as any
584
+ thisObject.forEach((value, key) => {
585
+ if (value instanceof Function && key != "methods") {
586
+ result[key] = value.bind(thisObject)
587
+ }
588
+ })
589
+ return result
590
+ }
591
+
592
+
581
593
  performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {
582
594
  return functionToPerform(this)
583
595
  }
@@ -596,6 +608,9 @@ export class UIObject {
596
608
 
597
609
  }
598
610
 
611
+ type MethodsOnly<T> =
612
+ Pick<T, { [K in keyof T]: T[K] extends Function ? K : never }[keyof T]>;
613
+
599
614
 
600
615
 
601
616
 
@@ -460,7 +460,7 @@ export class UITableView extends UINativeScrollView {
460
460
 
461
461
  viewForRowWithIndex(rowIndex: number): UITableViewRowView {
462
462
  const row = this.reusableViewForIdentifier("Row", rowIndex);
463
- (row as UIButton).titleLabel.text = "Row " + rowIndex
463
+ (row as unknown as UIButton).titleLabel.text = "Row " + rowIndex
464
464
  return row
465
465
  }
466
466
 
@@ -383,6 +383,7 @@ export class UITextView extends UIView {
383
383
 
384
384
  if (this.changesOften) {
385
385
 
386
+ // @ts-ignore
386
387
  cacheObject = this._intrinsicHeightCache
387
388
 
388
389
 
@@ -418,6 +419,7 @@ export class UITextView extends UIView {
418
419
 
419
420
  if (this.changesOften) {
420
421
 
422
+ // @ts-ignore
421
423
  cacheObject = this._intrinsicWidthCache
422
424
 
423
425