Your IP : 172.70.178.33


Current Path : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/cnt/dist/
Upload File :
Current File : /var/www/element/data/www/revenuestory.ru/bitrix/js/ui/cnt/dist/cnt.bundle.js.map

{"version":3,"file":"cnt.bundle.js","sources":["../src/cnt-color.js","../src/cnt-size.js","../src/cnt.js"],"sourcesContent":["/**\n * @namespace {BX.UI}\n */\nexport default class CounterColor\n{\n\tstatic DANGER = \"ui-counter-danger\";\n\tstatic WARNING = \"ui-counter-warning\";\n\tstatic SUCCESS = \"ui-counter-success\";\n\tstatic PRIMARY = \"ui-counter-primary\";\n\tstatic GRAY = \"ui-counter-gray\";\n\tstatic LIGHT = \"ui-counter-light\";\n\tstatic WHITE = \"ui-counter-white\";\n\tstatic DARK = \"ui-counter-dark\";\n\tstatic THEME = \"ui-counter-theme\";\n}\n","/**\n * @namespace {BX.UI}\n */\nexport default class CounterSize\n{\n\tstatic SMALL = \"ui-counter-sm\";\n\tstatic LARGE = \"ui-counter-lg\";\n\tstatic MEDIUM = \"ui-counter-md\";\n}\n","// @flow\n\nimport {Dom, Tag, Type} from 'main.core';\nimport CounterColor from './cnt-color';\nimport CounterSize from './cnt-size';\n\ntype CounterOptions = {\n\tvalue: number;\n\tmaxValue: number;\n\tcolor: CounterColor;\n\tborder: boolean;\n\tsize: string;\n};\n\nexport default class Counter\n{\n\tstatic Color = CounterColor;\n\tstatic Size = CounterSize;\n\n\tconstructor(options: CounterOptions)\n\t{\n\t\tthis.options = Type.isPlainObject(options) ? options : {};\n\n\t\tthis.container = null;\n\t\tthis.counterContainer = null;\n\t\tthis.animate = Type.isBoolean(this.options.animate) ? this.options.animate : false;\n\t\tthis.value = Type.isNumber(this.options.value) ? this.options.value : 0;\n\t\tthis.maxValue = Type.isNumber(this.options.maxValue) ? this.options.maxValue : 99;\n\t\tthis.size = Type.isString(this.options.size) ? this.options.size : BX.UI.Counter.Size.MEDIUM;\n\t\tthis.color = Type.isString(this.options.color) ? this.options.color : BX.UI.Counter.Color.PRIMARY;\n\t\tthis.border = Type.isBoolean(this.options.border) ? this.options.border : false;\n\t}\n\n\t//region Parameters\n\tsetValue(value: number): this\n\t{\n\t\tif (Type.isNumber(value))\n\t\t{\n\t\t\tthis.value = (value < 0) ? 0 : value;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tgetValue(): number\n\t{\n\t\tif (this.value <= this.maxValue)\n\t\t{\n\t\t\treturn this.value;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn this.maxValue + \"+\";\n\t\t}\n\t}\n\n\tsetMaxValue(value: number): this\n\t{\n\t\tif (Type.isNumber(value))\n\t\t{\n\t\t\tthis.value = (value < 0) ? 0 : value;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tgetMaxValue(): number\n\t{\n\t\treturn this.maxValue;\n\t}\n\n\tisBorder(): boolean\n\t{\n\t\treturn this.border;\n\t}\n\n\tsetColor(color: CounterColor): this\n\t{\n\t\tif (Type.isStringFilled(color))\n\t\t{\n\t\t\tif (this.container === null)\n\t\t\t{\n\t\t\t\tthis.createContainer();\n\t\t\t}\n\n\t\t\tDom.removeClass(this.container, this.color);\n\t\t\tthis.color = color;\n\t\t\tDom.addClass(this.container, this.color);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tsetSize(size: CounterSize): this\n\t{\n\t\tif (Type.isStringFilled(size))\n\t\t{\n\t\t\tBX.removeClass(this.container, this.size);\n\t\t\tthis.size = size;\n\t\t\tBX.addClass(this.container, this.size);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tsetAnimate(animate: boolean): this\n\t{\n\t\tif (Type.isBoolean(animate))\n\t\t{\n\t\t\tthis.animate = animate;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tsetBorder(border: boolean): this\n\t{\n\t\tif (!Type.isBoolean(border))\n\t\t{\n\t\t\tconsole.warn('Parameter \"border\" is not boolean');\n\t\t\treturn this;\n\t\t}\n\n\t\tthis.border = border;\n\t\tconst borderedCounterClassname = this.#getBorderClassname(border);\n\n\t\tif (border)\n\t\t{\n\t\t\tDom.addClass(this.container, borderedCounterClassname);\n\t\t} else\n\t\t{\n\t\t\tDom.removeClass(this.container, borderedCounterClassname);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t#getBorderClassname(border: boolean): string\n\t{\n\t\tif (border)\n\t\t{\n\t\t\treturn 'ui-counter-border';\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn '';\n\t\t}\n\t}\n\n\t//endregion\n\n\t// region Counter\n\tupdate(value)\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.createContainer();\n\t\t}\n\n\t\tif (this.animate == true)\n\t\t{\n\t\t\tthis.updateAnimated(value);\n\t\t}\n\t\telse if (this.animate == false)\n\t\t{\n\t\t\tthis.setValue(value);\n\t\t\tDom.adjust(this.counterContainer, {\n\t\t\t\ttext: this.getValue()\n\t\t\t});\n\t\t}\n\n\t}\n\n\tupdateAnimated(value)\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.createContainer();\n\t\t}\n\n\t\tif (value > this.value && this.value < this.maxValue)\n\t\t{\n\t\t\tDom.addClass(this.counterContainer, \"ui-counter-plus\");\n\t\t}\n\t\telse if (value < this.value && this.value < this.maxValue)\n\t\t{\n\t\t\tDom.addClass(this.counterContainer, \"ui-counter-minus\");\n\t\t}\n\n\t\tsetTimeout(function ()\n\t\t\t{\n\t\t\t\tthis.setValue(value);\n\t\t\t\tDom.adjust(this.counterContainer, {\n\t\t\t\t\ttext: this.getValue()\n\t\t\t\t});\n\t\t\t}.bind(this),\n\t\t\t250);\n\n\t\tsetTimeout(function ()\n\t\t\t{\n\t\t\t\tDom.removeClass(this.counterContainer, \"ui-counter-plus\");\n\t\t\t\tDom.removeClass(this.counterContainer, \"ui-counter-minus\");\n\t\t\t}.bind(this),\n\t\t\t500);\n\t}\n\n\tshow()\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.createContainer();\n\t\t}\n\n\t\tDom.addClass(this.container, \"ui-counter-show\");\n\t\tDom.removeClass(this.container, \"ui-counter-hide\");\n\t}\n\n\thide()\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.createContainer();\n\t\t}\n\n\t\tDom.addClass(this.container, \"ui-counter-hide\");\n\t\tDom.removeClass(this.container, \"ui-counter-show\");\n\t}\n\n\tgetCounterContainer()\n\t{\n\t\tif (this.counterContainer === null)\n\t\t{\n\t\t\tthis.counterContainer = Tag.render`\n\t\t\t\t<div class=\"ui-counter-inner\">${this.getValue()}</div>\n\t\t\t`;\n\t\t}\n\n\t\treturn this.counterContainer;\n\t}\n\n\tcreateContainer(): HTMLElement\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.container = Tag.render`\n\t\t\t\t<div class=\"ui-counter\">${this.getCounterContainer()}</div>\n\t\t\t`;\n\n\t\t\tthis.setSize(this.size);\n\t\t\tthis.setColor(this.color);\n\t\t\tthis.setBorder(this.border);\n\t\t}\n\n\t\treturn this.container;\n\t}\n\n\t//endregion\n\n\tgetContainer(): Element\n\t{\n\t\tif (this.container === null)\n\t\t{\n\t\t\tthis.createContainer();\n\t\t}\n\n\t\treturn this.container;\n\t}\n\n\trenderTo(node: HTMLElement): HTMLElement | null\n\t{\n\t\tif (Type.isDomNode(node))\n\t\t{\n\t\t\treturn node.appendChild(this.getContainer());\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tdestroy(): void\n\t{\n\t\tDom.remove(this.container);\n\t\tthis.container = null;\n\t\tthis.finished = false;\n\t\tthis.textAfterContainer = null;\n\t\tthis.textBeforeContainer = null;\n\t\tthis.bar = null;\n\t\tthis.svg = null;\n\n\t\tfor (const property in this)\n\t\t{\n\t\t\tif (this.hasOwnProperty(property))\n\t\t\t{\n\t\t\t\tdelete this[property];\n\t\t\t}\n\t\t}\n\n\t\tObject.setPrototypeOf(this, null);\n\t}\n}\n"],"names":["CounterColor","CounterSize","Counter","options","Type","isPlainObject","container","counterContainer","animate","isBoolean","value","isNumber","maxValue","size","isString","BX","UI","Size","MEDIUM","color","Color","PRIMARY","border","isStringFilled","createContainer","Dom","removeClass","addClass","console","warn","borderedCounterClassname","updateAnimated","setValue","adjust","text","getValue","setTimeout","bind","Tag","render","getCounterContainer","setSize","setColor","setBorder","node","isDomNode","appendChild","getContainer","remove","finished","textAfterContainer","textBeforeContainer","bar","svg","property","hasOwnProperty","Object","setPrototypeOf"],"mappings":";;;;CAAA;CACA;CACA;KACqBA;;;;6BAAAA,wBAEJ;6BAFIA,yBAGH;6BAHGA,yBAIH;6BAJGA,yBAKH;6BALGA,sBAMN;6BANMA,uBAOL;6BAPKA,uBAQL;6BARKA,sBASN;6BATMA,uBAUL;;CCbhB;CACA;CACA;KACqBC;;;;6BAAAA,sBAEL;6BAFKA,sBAGL;6BAHKA,uBAIJ;;;;;;;;;;;;KCOIC;CAKpB,mBAAYC,OAAZ,EACA;CAAA;;CAAA;;CACC,SAAKA,OAAL,GAAeC,cAAI,CAACC,aAAL,CAAmBF,OAAnB,IAA8BA,OAA9B,GAAwC,EAAvD;CAEA,SAAKG,SAAL,GAAiB,IAAjB;CACA,SAAKC,gBAAL,GAAwB,IAAxB;CACA,SAAKC,OAAL,GAAeJ,cAAI,CAACK,SAAL,CAAe,KAAKN,OAAL,CAAaK,OAA5B,IAAuC,KAAKL,OAAL,CAAaK,OAApD,GAA8D,KAA7E;CACA,SAAKE,KAAL,GAAaN,cAAI,CAACO,QAAL,CAAc,KAAKR,OAAL,CAAaO,KAA3B,IAAoC,KAAKP,OAAL,CAAaO,KAAjD,GAAyD,CAAtE;CACA,SAAKE,QAAL,GAAgBR,cAAI,CAACO,QAAL,CAAc,KAAKR,OAAL,CAAaS,QAA3B,IAAuC,KAAKT,OAAL,CAAaS,QAApD,GAA+D,EAA/E;CACA,SAAKC,IAAL,GAAYT,cAAI,CAACU,QAAL,CAAc,KAAKX,OAAL,CAAaU,IAA3B,IAAmC,KAAKV,OAAL,CAAaU,IAAhD,GAAuDE,EAAE,CAACC,EAAH,CAAMd,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