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OAAO,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,mCAAa,GAApB,UAAqB,MAAiC;QAErD,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE;YACnE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,UAAC,GAAG,EAAE,KAAK;gBAC7C,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBAC1B,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE;wBACjC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;qBAC3D;yBACI,IAAI,KAAK,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE;wBAC7C,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;qBAC3C;iBACD;YACF,CAAC,CAAC,CAAC;SACH;QAED,iBAAM,aAAa,YAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACO,gCAAU,GAApB,UAAqB,KAAa;QACjC,OAAO,KAAK,IAAI,kBAAkB,IAAI,iBAAM,IAAI,YAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAEF,kBAAC;AAAD,CAAC,AAzRD,CAAuC,UAAU,GAyRhD;;AAED;;;;;GAKG;AACH,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC","sourcesContent":["/**\r\n * Module contains functionality related to [[Sprite]] states.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { BaseObject } from \"./Base\";\r\nimport { registry } from \"./Registry\";\r\nimport { Adapter } from \"./utils/Adapter\";\r\nimport { List, ListDisposer } from \"./utils/List\";\r\nimport { Filter } from \"./rendering/filters/Filter\";\r\nimport { Sprite } from \"./Sprite\";\r\n\r\nimport { toColor } from \"./utils/Color\";\r\nimport { percent } from \"./utils/Percent\";\r\nimport * as $utils from \"./utils/Utils\";\r\nimport * as $ease from \"./utils/Ease\";\r\nimport * as $object from \"./utils/Object\";\r\nimport * as $type from \"./utils/Type\";\r\n\r\n/**\r\n * Defines a state for [[Sprite]].\r\n *\r\n * A \"state\" is a special object that has all the same properties as the\r\n * [[Sprite]] of the same type, and which can be used to quickly apply a set\r\n * of property values. (set state)\r\n *\r\n * When [[Sprite]] (or any object that extends Sprite) is created it creates a\r\n * \"default\" state. You can modify the \"default\" state so that when the Sprite\r\n * returns to default state certain properties are added.\r\n *\r\n * Default state can be accessed using Sprite's `defaultState` getter.\r\n *\r\n * ```TypeScript\r\n * sprite.defaultState.properties.fillOpacity = 0.5;\r\n * ```\r\n * ```JavaScript\r\n * sprite.defaultState.properties.fillOpacity = 0.5;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"defaultState\": {\r\n * \"properties\": {\r\n * \"fillOpacity\": 0.5\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * If Sprite is \"hoverable\", it automatically adds a \"hover\" state, which is\r\n * applied when it has a cursor over it.\r\n *\r\n * ```TypeScript\r\n * let hoverstate = sprite.states.create(\"hover\");\r\n * hoverstate.properties.fillOpacity = 1;\r\n * ```\r\n * ```JavaScript\r\n * var hoverstate = sprite.states.create(\"hover\");\r\n * hoverstate.properties.fillOpacity = 1;\r\n * ```\r\n * ```JSON\r\n * {\r\n * // ...\r\n * \"states\": {\r\n * \"hover\": {\r\n * \"properties\": {\r\n * \"fillOpacity\": 0.5\r\n * }\r\n * }\r\n * }\r\n * }\r\n * ```\r\n *\r\n * The above will automatically apply \"hover\" state when the Sprite is hovered,\r\n * thus will set its `fillOpacity` property to 1, and will reset it to 0.5 when\r\n * it's no longer hovered.\r\n *\r\n * Every object that inherits from [[Sprite]] can and will add their own\r\n * properties to the available list.\r\n *\r\n * User can create their own states, and apply them as needed:\r\n *\r\n * ```TypeScript\r\n * let myCustomState = sprite.states.create(\"mystate\");\r\n * myCustomState.properties.fillOpacity = 0.5;\r\n * myCustomState.properties.strokeOpacity = 0.8;\r\n * sprite.setState(\"mystate\");\r\n * ```\r\n * ```JavaScript\r\n * var myCustomState = sprite.states.create(\"mystate\");\r\n * myCustomState.properties.fillOpacity = 0.5;\r\n * myCustomState.properties.strokeOpacity = 0.8;\r\n * sprite.setState(\"mystate\");\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/states/}\r\n * @important\r\n */\r\nexport class SpriteState<P, A> extends BaseObject {\r\n\r\n\t/**\r\n\t * Defines property types.\r\n\t */\r\n\tpublic _properties!: P;\r\n\r\n\t/**\r\n\t * Defines adapter types.\r\n\t */\r\n\tpublic _adapter!: A;\r\n\r\n\t/**\r\n\t * Title of the state, i.e. \"default\", \"hidden\", etc.\r\n\t */\r\n\tpublic name: string;\r\n\r\n\t/**\r\n\t * Reference to [[Sprite]] element this State is for.\r\n\t */\r\n\tpublic sprite: $type.Optional<Sprite>;\r\n\r\n\t/**\r\n\t * @ignore\r\n\t */\r\n\tpublic _adapterO: Adapter<this, A>;\r\n\r\n\t/**\r\n\t * Holds Adapter.\r\n\t */\r\n\tpublic get adapter(): Adapter<this, A> {\r\n\t\tif (!this._adapterO) {\r\n\t\t\tthis._adapterO = new Adapter<this, A>(this);\r\n\r\n\t\t\t// Decorate adapter with events so that we can apply its settings whenever\r\n\t\t\t// it is modified\r\n\t\t\tthis._adapterO.events.on(\"inserted\", (ev: any) => {\r\n\t\t\t\t(<any>this)[ev.newValue.key] = (<any>this)[ev.newValue.key];\r\n\t\t\t}, undefined, false);\r\n\t\t\tthis._adapterO.events.on(\"removed\", (ev: any) => {\r\n\t\t\t\t(<any>this)[ev.newValue.key] = (<any>this)[ev.newValue.key];\r\n\t\t\t}, undefined, false);\r\n\t\t}\r\n\t\treturn this._adapterO;\r\n\t}\r\n\r\n\t/**\r\n\t * Duration of the transition to this state. 0 means instantenous transition.\r\n\t * Any number means the [[Sprite]] will transit smoothly to this state,\r\n\t * animating all animatable properties.\r\n\t *\r\n\t * @default 0\r\n\t * @see {@link https://www.amcharts.com/docs/v4/concepts/animations/} for more info about animations\r\n\t */\r\n\tpublic transitionDuration: number = 0;\r\n\r\n\t/**\r\n\t * Easing function to use when transitioning to this state.\r\n\t *\r\n\t * @default cubicOut\r\n\t * @see {@link Ease}\r\n\t * @see {@link https://www.amcharts.com/docs/v4/concepts/animations/} for more info about animations\r\n\t */\r\n\tpublic transitionEasing: (value: number) => number = $ease.cubicOut;\r\n\r\n\t/**\r\n\t * Collection of properties and their values that should be applied to [[Sprite]]\r\n\t * when switching to this State.\r\n\t *\r\n\t * The property values set on a [[SpriteState]] will override the ones set\r\n\t * directly on a [[Sprite]].\r\n\t */\r\n\tpublic properties: P = <P>{};\r\n\r\n\t/**\r\n\t * A collection of key/value pairs that can be used to bind specific Sprite\r\n\t * properties to [[DataItem]].\r\n\t *\r\n\t * For example: `fill` property can be bound to `myCustomColor` field in\r\n\t * DataItem. The Sprite will automatically get the value for `fill` from its\r\n\t * DataItem.\r\n\t *\r\n\t * SpriteState-specific binding will override binding set directly on\r\n\t * [[Sprite]]. I.e. you can make Sprite use different fill color on hover by\r\n\t * adding a `fill` binding to a different DataItem key for Sprite's \"hover\"\r\n\t * state object.\r\n\t *\r\n\t * @see {@link Sprite}\r\n\t */\r\n\tpublic propertyFields: { [index in keyof this[\"_properties\"]]?: string } = {};\r\n\t//public propertyFields: Dictionary<keyof this[\"_properties\"], string> = new Dictionary<keyof this[\"_properties\"], string>();;\r\n\r\n\t/**\r\n\t * A list of [[Filter]] elements to be applied to the relative [[Sprite]]\r\n\t * when switching to this State.\r\n\t *\r\n\t * @param {List}\r\n\t */\r\n\tpublic filters = new List<Filter>();\r\n\r\n\t/**\r\n\t * Identifies if this object is a \"template\" and should not be treated as\r\n\t * real object that is drawn or actually used in the chart.\r\n\t */\r\n\tpublic isTemplate: boolean = false;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\t// Init\r\n\t\tsuper();\r\n\t\tthis.className = \"SpriteState\";\r\n\r\n\t\t// Make filter list disposable\r\n\t\tthis._disposers.push(new ListDisposer(this.filters));\r\n\r\n\t\t// Apply theme\r\n\t\tthis.applyTheme();\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Returns [[Sprite]] element's property value.\r\n\t *\r\n\t * Will check if there are any bindings with [[DataItem]] and if there are\r\n\t * any method callbacks set up for the specific property.\r\n\t *\r\n\t * @param propertyName Property name\r\n\t * @return Property value\r\n\t */\r\n\tpublic getPropertyValue<Key extends keyof P>(propertyName: Key): P[Key] {\r\n\t\tlet propValue: any = this.properties[propertyName];\r\n\t\tlet sprite: $type.Optional<Sprite> = this.sprite;\r\n\r\n\t\tif (sprite) {\r\n\t\t\tlet fieldName: string = this.propertyFields[propertyName];\r\n\r\n\t\t\tif ($type.hasValue(fieldName)) {\r\n\t\t\t\tif (sprite.dataItem) {\r\n\t\t\t\t\tpropValue = (<any>sprite.dataItem.dataContext)[fieldName];\r\n\t\t\t\t}\r\n\t\t\t\tif(propValue == undefined){\r\n\t\t\t\t\tpropValue = \"__unset\"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Apply adapters\r\n\t\t\t// If the value itself is undefined, we're going to pass in Sprite's\r\n\t\t\t// value to adapters\r\n\t\t\t// @todo get rid of <any>\r\n\t\t\tif (!$type.hasValue(propValue)) {\r\n\t\t\t\tlet spriteValue = sprite.getPropertyValue(<any>propertyName);\r\n\t\t\t\tif (this._adapterO) {\r\n\t\t\t\t\tpropValue = this._adapterO.apply(<any>propertyName, spriteValue);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tpropValue = spriteValue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (propValue == spriteValue) {\r\n\t\t\t\t\tpropValue = undefined;\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (this._adapterO) {\r\n\t\t\t\t\tpropValue = this._adapterO.apply(<any>propertyName, propValue)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t/*let method = this.propertyMethods.getKey(propertyName);\r\n\t\t\tif (method) {\r\n\t\t\t\tpropValue = method(sprite, propertyName);\r\n\t\t\t}*/\r\n\r\n\t\t}\r\n\r\n\t\treturn propValue;\r\n\t}\r\n\r\n\t/**\r\n\t * Copies all property and style values from another [[SpriteState]] object.\r\n\t *\r\n\t * @param source Source [[SpriteState]]\r\n\t */\r\n\tpublic copyFrom(source: this) {\r\n\t\tif (source && source != this) {\r\n\t\t\tthis.transitionDuration = source.transitionDuration;\r\n\t\t\tthis.transitionEasing = source.transitionEasing;\r\n\r\n\t\t\t$utils.copyProperties(source.properties, this.properties);\r\n\t\t\t$utils.copyProperties(source.propertyFields, this.propertyFields);\r\n\t\t\tthis.filters.copyFrom(source.filters);\r\n\t\t\tif(source._adapterO){\r\n\t\t\t\tthis.adapter.copyFrom(source._adapterO);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns all values that should be applied by the SpriteState.\r\n\t *\r\n\t * It takes adapters into account.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t * @return Properties\r\n\t * @todo Add adapter values\r\n\t * @todo proper type this[\"_properties\"]\r\n\t */\r\n\tpublic get allValues(): P {\r\n\r\n\t\t// Init return value\r\n\t\tlet res: P = <P>{};\r\n\r\n\t\t// Apply adapters to all values\r\n\t\t$object.each(this.properties, (prop, value) => {\r\n\t\t\tres[prop] = this.getPropertyValue(prop);\r\n\t\t});\r\n\r\n\t\t// Cycle through all adapters and add values for missing properties\r\n\t\tif(this._adapterO){\r\n\t\t\tlet keys = this._adapterO.keys();\r\n\r\n\t\t\t$object.each(keys, (_x, prop) => {\r\n\t\t\t\tlet value = this.getPropertyValue<any>(prop);\r\n\t\t\t\t(<any>res)[prop] = value;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Cycle through all property fileds and add values for missing properties\r\n\t\tlet propertyFields = this.propertyFields;\r\n\r\n\t\t$object.each(propertyFields, (prop) => {\r\n\t\t\tlet value = this.getPropertyValue<any>(prop);\r\n\t\t\t(<any>res)[prop] = value;\r\n\t\t});\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\t/**\r\n\t * Resets the State to initial state - no values or Filters applied.\r\n\t */\r\n\tpublic reset(): void {\r\n\t\tthis.properties = <P>{};\r\n\t\tthis.filters.clear();\r\n\t}\r\n\r\n\t/**\r\n\t * Processes JSON-based config before it is applied to the object.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t * @param config Config\r\n\t */\r\n\tpublic processConfig(config?: { [index: string]: any }): void {\r\n\r\n\t\tif ($type.hasValue(config) && $type.hasValue(config[\"properties\"])) {\r\n\t\t\t$object.each(config[\"properties\"], (key, value) => {\r\n\t\t\t\tif ($type.isString(value)) {\r\n\t\t\t\t\tif (value.match(/^[0-9.\\-]+\\%$/)) {\r\n\t\t\t\t\t\tconfig[\"properties\"][key] = percent($type.toNumber(value));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (value.match(/^\\#[0-9abcdef]{3,}$/i)) {\r\n\t\t\t\t\t\tconfig[\"properties\"][key] = toColor(value);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tsuper.processConfig(config);\r\n\t}\r\n\r\n\t/**\r\n\t * Adds easing functions to \"function\" fields.\r\n\t *\r\n\t * @param field Field name\r\n\t * @return Assign as function?\r\n\t */\r\n\tprotected asFunction(field: string): boolean {\r\n\t\treturn field == \"transitionEasing\" || super.asIs(field);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"SpriteState\"] = SpriteState;\r\n"]}
\No newline at end of file