initial commit with charts and assistant chat
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[319],{91445:(e,t,i)=>{i.d(t,{createTextStyleDefinition:()=>S});var o=i(11542),s=i(95804),r=i(95338),n=i(91682);const l=new s.TranslatedString("change {toolName} text visibility",o.t(null,void 0,i(56634))),a=new s.TranslatedString("change {toolName} text color",o.t(null,void 0,i(64500))),c=new s.TranslatedString("change {toolName} text font size",o.t(null,void 0,i(21781))),h=new s.TranslatedString("change {toolName} text font bold",o.t(null,void 0,i(24701))),d=new s.TranslatedString("change {toolName} text font italic",o.t(null,void 0,i(42694))),u=new s.TranslatedString("change {toolName} text",o.t(null,void 0,i(66668))),p=new s.TranslatedString("change {toolName} labels alignment vertical",o.t(null,void 0,i(31689))),g=new s.TranslatedString("change {toolName} labels alignment horizontal",o.t(null,void 0,i(88277))),_=new s.TranslatedString("change {toolName} labels direction",o.t(null,void 0,i(61160))),m=new s.TranslatedString("change {toolName} text background visibility",o.t(null,void 0,i(31133))),f=new s.TranslatedString("change {toolName} text background color",o.t(null,void 0,i(22231))),x=new s.TranslatedString("change {toolName} text border visibility",o.t(null,void 0,i(58704))),b=new s.TranslatedString("change {toolName} text border width",o.t(null,void 0,i(35423))),T=new s.TranslatedString("change {toolName} text border color",o.t(null,void 0,i(36666))),C=new s.TranslatedString("change {toolName} text wrap",o.t(null,void 0,i(39587))),y=o.t(null,void 0,i(79468)),v=o.t(null,void 0,i(38408)),P=o.t(null,void 0,i(7560)),w=o.t(null,void 0,i(6060));function S(e,t,i,o){const s={},S={id:`${(0,n.removeSpaces)(i.originalText())}Text`,title:o.customTitles&&o.customTitles.text||"",placeholder:o.placeholder??w};if(void 0===t.showText||o.hideTextCheckbox||(s.checked=(0,r.convertToDefinitionProperty)(e,t.showText,l.format({toolName:i}))),void 0!==t.textColor&&(s.color=(0,r.getColorDefinitionProperty)(e,t.textColor,t.transparency||null,a.format({toolName:i}))),void 0!==t.fontSize&&(s.size=(0,r.convertToDefinitionProperty)(e,t.fontSize,c.format({toolName:i}))),void 0!==t.bold&&(s.bold=(0,r.convertToDefinitionProperty)(e,t.bold,h.format({toolName:i}))),void 0!==t.italic&&(s.italic=(0,r.convertToDefinitionProperty)(e,t.italic,d.format({toolName:i}))),void 0!==t.text){const n=u.format({toolName:i});s.text=(0,r.convertToDefinitionProperty)(e,t.text,n,void 0),S.isEditable=Boolean(o.isEditable),S.isMultiLine=Boolean(o.isMultiLine)}if(void 0!==t.vertLabelsAlign&&(s.alignmentVertical=(0,r.convertToDefinitionProperty)(e,t.vertLabelsAlign,p.format({toolName:i})),S.alignmentVerticalItems=o.alignmentVerticalItems),void 0!==t.horzLabelsAlign&&(s.alignmentHorizontal=(0,r.convertToDefinitionProperty)(e,t.horzLabelsAlign,g.format({toolName:i})),S.alignmentHorizontalItems=o.alignmentHorizontalItems),void 0!==t.textOrientation&&(s.orientation=(0,r.convertToDefinitionProperty)(e,t.textOrientation,_.format({toolName:i}))),
|
||||
void 0!==t.backgroundVisible&&(s.backgroundVisible=(0,r.convertToDefinitionProperty)(e,t.backgroundVisible,m.format({toolName:i}))),void 0!==t.backgroundColor){let o=null;void 0!==t.backgroundTransparency&&(o=t.backgroundTransparency),s.backgroundColor=(0,r.getColorDefinitionProperty)(e,t.backgroundColor,o,f.format({toolName:i}))}return void 0===t.backgroundVisible&&void 0===t.backgroundColor||(S.backgroundTitle=o.customTitles&&o.customTitles.backgroundTitle||y),void 0!==t.borderVisible&&(s.borderVisible=(0,r.convertToDefinitionProperty)(e,t.borderVisible,x.format({toolName:i}))),void 0!==t.borderWidth&&(s.borderWidth=(0,r.convertToDefinitionProperty)(e,t.borderWidth,b.format({toolName:i}))),void 0!==t.borderColor&&(s.borderColor=(0,r.getColorDefinitionProperty)(e,t.borderColor,null,T.format({toolName:i}))),void 0===t.borderVisible&&void 0===t.borderColor&&void 0===t.borderWidth||(S.borderTitle=o.customTitles&&o.customTitles.borderTitle||v),void 0!==t.wrap&&(s.wrap=(0,r.convertToDefinitionProperty)(e,t.wrap,C.format({toolName:i})),S.wrapTitle=o.customTitles&&o.customTitles.wrapTitle||P),(0,r.createTextPropertyDefinition)(s,S)}},56689:(e,t,i)=>{i.r(t),i.d(t,{FibTimezoneDefinitionsViewModel:()=>V,availableAlignmentHorizontalItems:()=>S,availableAlignmentVerticalItems:()=>w});var o=i(50151),s=i(11542),r=i(95804),n=i(95338),l=i(14472),a=i(50605),c=i(22613),h=i(91682),d=i(44005);const u=new r.TranslatedString("change {title} level {index} line visibility",s.t(null,void 0,i(51403))),p=new r.TranslatedString("change {title} level {index} line color",s.t(null,void 0,i(664))),g=new r.TranslatedString("change {title} level {index} line width",s.t(null,void 0,i(97870))),_=new r.TranslatedString("change {title} level {index} line style",s.t(null,void 0,i(64707))),m=new r.TranslatedString("change {title} level {index} line coeff",s.t(null,void 0,i(27154))),f=new r.TranslatedString("change {title} all lines color",s.t(null,void 0,i(59577))),x=new r.TranslatedString("change {title} background visibility",s.t(null,void 0,i(30839))),b=new r.TranslatedString("change {title} background transparency",s.t(null,void 0,i(13783))),T=new r.TranslatedString("change {title} labels visibility",s.t(null,void 0,i(93340))),C=new r.TranslatedString("change {title} labels alignment",s.t(null,void 0,i(58312))),y=s.t(null,void 0,i(28683)),v=s.t(null,void 0,i(79468)),P=s.t(null,void 0,i(5119)),w=[{id:a.VerticalAlign.Bottom,value:a.VerticalAlign.Top,title:s.t(null,void 0,i(97118))},{id:a.VerticalAlign.Middle,value:a.VerticalAlign.Middle,title:s.t(null,void 0,i(68833))},{id:a.VerticalAlign.Top,value:a.VerticalAlign.Bottom,title:s.t(null,void 0,i(27567))}],S=[{id:a.HorizontalAlign.Left,value:a.HorizontalAlign.Left,title:s.t(null,void 0,i(11626))},{id:a.HorizontalAlign.Center,value:a.HorizontalAlign.Center,title:s.t(null,void 0,i(24197))},{id:a.HorizontalAlign.Right,value:a.HorizontalAlign.Right,title:s.t(null,void 0,i(50421))}];class V extends l.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){
|
||||
const e=[],t=this._source.properties().childs(),i=this._source.name(),s=(0,h.removeSpaces)(i),l=new r.TranslatedString(i,this._source.translatedType()),a=this._source.levelsCount();for(let i=1;i<=a;i++){const o=t[`level${i}`].childs(),r=(0,n.createLeveledLinePropertyDefinition)({checked:(0,n.convertToDefinitionProperty)(this._propertyApplier,o.visible,u.format({title:l,index:i})),color:(0,n.getColorDefinitionProperty)(this._propertyApplier,o.color,null,p.format({title:l,index:i})),width:(0,n.convertToDefinitionProperty)(this._propertyApplier,o.linewidth,g.format({title:l,index:i})),style:(0,n.convertToDefinitionProperty)(this._propertyApplier,o.linestyle,_.format({title:l,index:i})),level:(0,n.convertToDefinitionProperty)(this._propertyApplier,o.coeff,m.format({title:l,index:i}))},{id:`${s}LineLevel${i}`});e.push(r)}const V=(0,n.createColorPropertyDefinition)({color:(0,n.getColorDefinitionProperty)(this._propertyApplier,new d.CollectibleColorPropertyUndoWrapper((0,o.ensureNotNull)(this._source.lineColorsProperty()),this._propertyApplier,null),null,f.format({title:l}),!0)},{id:`${s}AllLineColor`,title:y});e.push(V);const D=(0,n.createTransparencyPropertyDefinition)({checked:(0,n.convertToDefinitionProperty)(this._propertyApplier,t.fillBackground,x.format({title:l})),transparency:(0,n.convertToDefinitionProperty)(this._propertyApplier,t.transparency,b.format({title:l}))},{id:`${s}Background`,title:v});e.push(D);const A=(0,n.createTwoOptionsPropertyDefinition)({checked:(0,n.convertToDefinitionProperty)(this._propertyApplier,t.showLabels,T.format({title:l})),option1:(0,n.convertToDefinitionProperty)(this._propertyApplier,t.horzLabelsAlign,C.format({title:l})),option2:(0,n.convertToDefinitionProperty)(this._propertyApplier,t.vertLabelsAlign,C.format({title:l}))},{id:`${s}Labels`,title:P,optionsItems1:new c.WatchedValue(S),optionsItems2:new c.WatchedValue(w)});return e.push(A),{definitions:e}}}},14472:(e,t,i)=>{i.r(t),i.d(t,{LineDataSourceDefinitionsViewModel:()=>T,LineDataSourceTabTypes:()=>o,pointPriceBarTitle:()=>b});var o,s=i(50151),r=i(11542),n=i(95804),l=(i(40167),i(95338)),a=i(60567),c=i(22613),h=i(73863),d=i(97578),u=i(81634),p=i(36313);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(o||(o={}));const g=r.t(null,void 0,i(40091)),_=r.t(null,void 0,i(78930)),m=r.t(null,void 0,i(92516)),f=r.t(null,void 0,i(70320)),x=r.t(null,void 0,i(21429)),b=r.t(null,{context:"linetool point"},i(80166));class T{constructor(e,t){this._yCoordinateStepWV=null,this._propertyPages=[],this._source=t,this._undoModel=e,this._ownerSource=(0,s.ensureNotNull)(this._source.ownerSource()),this._propertyApplier=new u.PropertyApplierWithoutSavingChart((()=>e)),this._createPropertyRages()}destroy(){null!==this._yCoordinateStepWV&&(this._source.ownerSourceChanged().unsubscribeAll(this),this._ownerSource.priceStepChanged().unsubscribeAll(this)),this._source.pointAdded().unsubscribeAll(this),this._propertyPages.forEach((e=>{(0,l.destroyDefinitions)(e.definitions.value())}))}
|
||||
propertyPages(){return Promise.resolve(this._propertyPages)}_createPropertyRages(){this._propertyPages=[];const e=this._createInputsPropertyPage();null!==e&&this._propertyPages.push(e);const t=this._createStylePropertyPage();null!==t&&this._propertyPages.push(t);const i=this._createTextPropertyPage();null!==i&&this._propertyPages.push(i);const o=this._createCoordinatesPropertyPage();null!==o&&(o.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(o));const s=this._createVisibilitiesPropertyPage();this._propertyPages.push(s)}_createVisibilitiesPropertyPage(){const e=this._source.properties().childs().intervalsVisibilities.childs();return(0,a.createPropertyPage)((0,h.getIntervalsVisibilitiesPropertiesDefinitions)(this._propertyApplier,e,new n.TranslatedString(this._source.name(),this._source.title(p.TitleDisplayTarget.StatusLine,!0))),"visibility",g)}_createCoordinatesPropertyPage(){const e=this._coordinatesPropertyDefinitions();return null!==e?(e.definitions.length<this._source.pointsCount()&&this._source.pointAdded().subscribe(this,this._updateCoordinatesPropertyDefinitons),(0,a.createPropertyPage)(e,"coordinates",_)):null}_getYCoordinateStepWV(){return null===this._yCoordinateStepWV&&(this._yCoordinateStepWV=new c.WatchedValue(function(e){if(null!==e){const t=e.priceStep();if(null!==t)return t}return 1}(this._source.ownerSource())),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep())),this._source.ownerSourceChanged().subscribe(this,(()=>{this._ownerSource.priceStepChanged().unsubscribeAll(this),this._ownerSource=(0,s.ensureNotNull)(this._source.ownerSource()),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep()))}))),this._yCoordinateStepWV}_coordinatesPropertyDefinitions(){const e=this._source.points(),t=this._source.pointsProperty().childs().points,i=[],o=this._getYCoordinateStepWV();return e.forEach(((e,s)=>{const r=t[s].childs();r&&i.push((0,d.getCoordinatesPropertiesDefinitions)(this._propertyApplier,r,e,o,b.format({count:(s+1).toString()}),this._source.name()))})),{definitions:i}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"style",m):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"text",f):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"inputs",x):null}_inputsPropertyDefinitions(){return null}_updateYCoordinateStep(){const e=this._ownerSource.priceStep();this._getYCoordinateStepWV().setValue(e||1)}_updateCoordinatesPropertyDefinitons(){const e=this._coordinatesPropertyDefinitions();if(null!==e){(0,s.ensureDefined)(this._propertyPages.find((e=>"coordinates"===e.id))).definitions.setValue(e.definitions),this._source.points().length===this._source.pointsCount()&&this._source.pointAdded().unsubscribeAll(this)}}}},44005:(e,t,i)=>{i.d(t,{
|
||||
CollectibleColorPropertyDirectWrapper:()=>l,CollectibleColorPropertyUndoWrapper:()=>n});var o=i(50151),s=i(43337);class r extends s.Property{constructor(e){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=e}destroy(){this._baseProperty.destroy(),super.destroy()}value(){const e=this._baseProperty.value();return"mixed"===e?"":e}visible(){return this._baseProperty.visible()}setValue(e){this._isProcess=!0,this._baseProperty.setValue(""===e?"mixed":e,void 0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((e=>{e.method.call(e.obj,this,"")}))}subscribe(e,t){const i=i=>{this._isProcess||t.call(e,this,"")},o={obj:e,method:t,callback:i};this._listenersMappers.push(o),this._baseProperty.subscribe(e,i)}unsubscribe(e,t){const i=(0,o.ensureDefined)(this._listenersMappers.find((i=>i.obj===e&&i.method===t))?.callback);this._baseProperty.unsubscribe(e,i)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}class n extends r{constructor(e,t,i){super(e),this._propertyApplier=t,this._undoText=i}_applyValue(e,t){this._propertyApplier.setProperty(e,t,this._undoText)}}class l extends r{_applyValue(e,t){e.setValue(t)}}},31558:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>o});const o=["symbolStateVersion","zOrderVersion","frozen","title","interval","symbol","currencyId","unitId","visible","intervalsVisibilities.ticks","intervalsVisibilities.seconds","intervalsVisibilities.secondsFrom","intervalsVisibilities.secondsTo","intervalsVisibilities.minutes","intervalsVisibilities.minutesFrom","intervalsVisibilities.minutesTo","intervalsVisibilities.hours","intervalsVisibilities.hoursFrom","intervalsVisibilities.hoursTo","intervalsVisibilities.days","intervalsVisibilities.daysFrom","intervalsVisibilities.daysTo","intervalsVisibilities.weeks","intervalsVisibilities.weeksFrom","intervalsVisibilities.weeksTo","intervalsVisibilities.months","intervalsVisibilities.monthsFrom","intervalsVisibilities.monthsTo","intervalsVisibilities.ranges"];var s,r,n;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(s||(s={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"}(r||(r={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(n||(n={}))},88636:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>l});var o=i(90054),s=i(16738),r=i(50151),n=i(78176);class l extends n.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,r.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,n.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,n.extractState)((0,s.default)((0,o.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},53768:(e,t,i)=>{i.r(t),i.d(t,{LineToolTable:()=>Oe})
|
||||
;var o=i(50151),s=i(10555),r=i(89880),n=i(18712),l=i(41414),a=i(63117),c=i(49156),h=i(24633),d=i(78176),u=i(70031),p=i(50605),g=i(37293),_=i(88636),m=i(31558),f=i(43337),x=i(65045),b=i(33350),T=i(57658),C=i(49251),y=i(84617);class v{constructor(e){this._textWidthCache=new T.TextWidthCache(1e3),this.setFont(e)}setFont(e){this._fontSize=e,this._font=(0,C.makeFont)(e,y.CHART_FONT_FAMILY)}font(){return this._font}textWidthCache(){return this._textWidthCache}getSymbolWidth(){return(0,b.measureText)("0",this._font,this._textWidthCache).width}getSymbolHeight(){return this._fontSize}}var P=i(4753);function w(e,t){return Math.max(e-16-2,t.getSymbolWidth())}function S(e,t,i){const o=(0,P.wordWrap)(e,i.font(),i.textWidthCache(),!0,t).length,s=i.getSymbolHeight();return o*s+(o-1)*(s*(1.3-1))+16+2}function V(e){return e.getSymbolHeight()+16+1}function D(e){return e.getSymbolWidth()+16+2}function A(e,t,i,o){let s=0;for(let e=0;e<i;e++)s+=t[e];const r=t[i];return[Math.round((e+s)*o),Math.round((e+s+r)*o)]}const{colorWhite:I,colorColdGray200:R,colorColdGray650:W,colorColdGray900:H}=c.colors,E={intervalsVisibilities:{...g.intervalsVisibilitiesDefaults},fontSize:14,horzAlign:p.HorizontalAlign.Left,anchored:!1},L=new Map([[h.StdTheme.Light,{backgroundColor:I,borderColor:R,textColor:H}],[h.StdTheme.Dark,{backgroundColor:H,borderColor:W,textColor:R}]]),z=(0,d.extractThemedColors)((0,o.ensureDefined)(L.get(h.StdTheme.Light)),(0,o.ensureDefined)(L.get(h.StdTheme.Dark))),N=(0,d.extractAllPropertiesKeys)((0,o.ensureDefined)(L.get(h.StdTheme.Light))),M=(0,d.extractAllPropertiesKeys)(E),k=[...new Set([...N,...M,"rowsCount","colsCount","cells.*","columnWidths.*","rowHeights.*"])],B=[...new Set([...k,...m.commonLineToolPropertiesStateKeys])];class F extends _.LineDataSourceProperty{constructor(e){if(super(e),this._tableTextCache=new v(14),!e.state){const e=3,t=3,i=[];for(let o=0;o<e;o++)i.push(new Array(t).fill(""));const o=new Array(t).fill(120),s=new Array(e).fill(0);this.recreateCellsPropsByState({rowsCount:e,colsCount:t,cells:i,columnWidths:o,rowHeights:s})}this.addChild("linesColors",new x.LineToolColorsProperty([(0,o.ensureDefined)(this.child("borderColor"))])),this.addChild("textsColors",new x.LineToolColorsProperty([(0,o.ensureDefined)(this.child("textColor"))])),this.addChild("backgroundsColors",new x.LineToolColorsProperty([(0,o.ensureDefined)(this.child("backgroundColor"))])),this.addChild("editableText",new f.Property(""))}recreateCellsPropsByState(e){const{cells:t,colsCount:i,rowsCount:o,columnWidths:s,rowHeights:r}=e;this.removeProperty("rowsCount"),this.removeProperty("colsCount"),this.removeProperty("cells"),this.removeProperty("columnWidths"),this.removeProperty("rowHeights"),this.addChild("rowsCount",new f.Property(o)),this.addChild("colsCount",new f.Property(i)),this.addChild("cells",new f.Property(t)),this.addChild("columnWidths",new f.Property(s)),this.addChild("rowHeights",new f.Property(r)),this.childs().rowsCount.fireChanged(),this.childs().colsCount.fireChanged(),this.childs().cells.fireChanged(),
|
||||
this.childs().columnWidths.fireChanged(),this.childs().rowHeights.fireChanged()}setTableTextCache(e){this._tableTextCache=e}columnWidthValues(){const{colsCount:e,columnWidths:t}=this.childs(),i=t.childs();return Array.from({length:e.value()},((e,t)=>i[t].value()))}rowHeightValues(){const{rowsCount:e,rowHeights:t}=this.childs(),i=t.childs();return Array.from({length:e.value()},((e,t)=>i[t].value()))}setColumnWidthValues(e){const t=this.childs(),i=t.colsCount.value(),o=D(this._tableTextCache);for(let s=0;s<i;s++)t.columnWidths.childs()[s].setValue(Math.max(e[s],o))}setRowHeightValues(e){const t=this.childs(),i=t.rowsCount.value(),o=V(this._tableTextCache);for(let s=0;s<i;s++)t.rowHeights.childs()[s].setValue(Math.max(e[s],o))}cellsValues(){const{rowsCount:e,colsCount:t,cells:i}=this.childs(),o=i.childs();return Array.from({length:e.value()},((e,i)=>Array.from({length:t.value()},((e,t)=>o[i].childs()[t].value()))))}static create(e,t){return new this({defaultName:"linetooltable",factoryDefaultsSupplier:()=>(0,u.factoryDefaultsForCurrentTheme)(E,L),nonThemedDefaultsKeys:M,themedDefaultsKeys:N,allStateKeys:B,themedColors:z,replaceThemedColorsOnThemeChange:!0,state:t,theme:e,templateKeys:k})}}var O,K=i(39612),U=i(2383),$=i(94602),Y=i(2268),G=i(52859),j=i(43838),X=i(32563),q=i(24961);!function(e){e[e.TopLeft=0]="TopLeft",e[e.BottomLeft=1]="BottomLeft",e[e.TopRight=2]="TopRight",e[e.BottomRight=3]="BottomRight",e[e.ResizeVirtualAnchorBase=1024]="ResizeVirtualAnchorBase"}(O||(O={}));var J,Q=i(6453),Z=i(4539),ee=i(10307),te=i(58221),ie=i(4148);function oe(e){if(e<O.ResizeVirtualAnchorBase)return{row:null,column:null};const t=e-O.ResizeVirtualAnchorBase,i=Math.floor(t/O.ResizeVirtualAnchorBase),o=t%O.ResizeVirtualAnchorBase;return{row:0===i?null:i-1,column:0===o?null:o-1}}function se(e){return null===e.row&&null===e.column?null:O.ResizeVirtualAnchorBase+(null===e.row?0:e.row+1)*O.ResizeVirtualAnchorBase+(null===e.column?0:e.column+1)}!function(e){e[e.EdgeHighlightWidth=7]="EdgeHighlightWidth"}(J||(J={}));const re=c.colors.colorTvBlue500Alpha20,ne=c.colors.colorTvBlue500;class le extends ee.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._cellsHitTestData=[]}setData(e){this._data=e}setCellsHitTestData(e){this._cellsHitTestData=e}hitTest(e,t){if(!this._data)return null;const{horizontalPixelRatio:i,verticalPixelRatio:r}=t,{activeEdge:n,changeSize:l,changeOnlyActiveEdge:a,cells:c}=this._data,{x:h,y:d}=c.topLeft,{x:u,y:p}=c.bottomRight,g=d/r,_=h/i,m=p/r,f=u/i;{let t=null,h=null;const d=(0,Z.interactionTolerance)().line;for(const i of c.cells){const{bottom:o,rowIndex:n}=i[0],l=o/r;if(t=(0,Q.pointInBox)(e,(0,s.box)((0,s.point)(_,l-d),(0,s.point)(f,l+d)))?n:null,null!==t)break}for(const t of c.cells[0]){const{right:o,columnIndex:r}=t,n=o/i;if(h=(0,Q.pointInBox)(e,(0,s.box)((0,s.point)(n-d,g),(0,s.point)(n+d,m)))?r:null,null!==h)break}if(l&&(null!==h||null!==t)){const e={row:t,column:h
|
||||
},i=null!==h&&null!==t?j.PaneCursorType.Default:null!==h?j.PaneCursorType.HorizontalResize:j.PaneCursorType.VerticalResize;return new U.HitTestResult(a&&h!==n.column&&t!==n.row?U.HitTarget.MovePoint:U.HitTarget.ChangePoint,{cursorType:i,activeItem:e,pointIndex:(0,o.ensureNotNull)(se(e)),nonDiscreteIndex:!0})}}for(const t of c.cells)for(const o of t){const{left:t,right:n,top:l,bottom:a,rowIndex:c,columnIndex:h}=o,d=l/r,u=t/i,p=a/r,g=n/i;if((0,Q.pointInBox)(e,(0,s.box)((0,s.point)(u,d),(0,s.point)(g,p))))return new U.HitTestResult(U.HitTarget.MovePoint,{...this._cellsHitTestData[c]?.[h],activeItem:{rowIndex:c,columnIndex:h}})}return(0,Q.pointInBox)(e,(0,s.box)((0,s.point)(_,g),(0,s.point)(f,m)))?new U.HitTestResult(U.HitTarget.MovePoint):null}_drawImpl(e){if(null===this._data)return;const t=e.context,i=this._data;!function(e,t){e.fillStyle=t.backgroundColor;const{x:i,y:o}=t.cells.topLeft,{x:s,y:r}=t.cells.bottomRight;e.fillRect(i,o,s-i,r-o)}(t,i),function(e,t){const i=(0,Z.roundToMax)(1*e.horizontalPixelRatio),o=(0,Z.roundToMax)(1*e.verticalPixelRatio),s=e.context;s.fillStyle=t.borderColor;const[r,n]=t.editableCell||[-1,-1];let[l,a]=t.selectableCell||[-1,-1];r===l&&n===a&&(l=-1,a=-1);for(const c of t.cells.cells)for(const h of c){const{left:c,right:d,top:u,bottom:p,columnIndex:g,rowIndex:_}=h;if(0===_&&s.fillRect(c,u,d-c,o),0===g&&s.fillRect(c,u,i,p-u),s.fillRect(c,p,d-c,o),s.fillRect(d,u,i,p-u),r===_&&n===g||l===_&&a===g){const r=(0,Z.roundToMax)(2*e.horizontalPixelRatio),n=(0,Z.roundToMax)(2*e.verticalPixelRatio);s.fillStyle=ne,[[c+i,u+o,d-c-i,n],[c+i,p-n,d-c-i,n],[c+i,u+o,r,p-u-o],[d-r,u+o,r,p-u-o]].forEach((([e,t,i,o])=>{s.fillRect(e,t,i,o)})),s.fillStyle=t.borderColor}}}(e,i),function(e,t,i){if(null===t.activeEdge.row&&null===t.activeEdge.column)return;const o=Math.max(1,Math.round(7*i.horizontalPixelRatio));if(e.strokeStyle=re,e.lineWidth=o,null!==t.activeEdge.column){const i=t.cells.cells[0][t.activeEdge.column];(0,te.drawVerticalLine)(e,i.right,t.cells.topLeft.y,t.cells.bottomRight.y)}if(null!==t.activeEdge.row){const i=t.cells.cells[t.activeEdge.row][0];(0,te.drawHorizontalLine)(e,i.bottom,t.cells.topLeft.x,t.cells.bottomRight.x)}}(t,i,e)}}class ae extends Y.InplaceTextLineSourcePaneView{constructor(e,t,i,o,r){super(e,t,o,r),this._renderer=new $.CompositeRenderer,this._cellsTextRenderers=[],this._lastRenderingInfo=null,this._tryActivateEditMode=(e,t)=>{this.closeTextEditor(),this._source.setInplaceEditableCellIndexes(e),super._tryActivateEditMode(e,t)},this._anchorClickHandler=()=>{this._source.setInplaceEditableCellIndexes([-1,-1])},this._tableTextCache=i,this._anchorPoints=Array.from({length:4},((e,t)=>({point:(0,s.point)(NaN,NaN),pointIndex:t,cursorType:t===O.TopLeft||t===O.BottomRight?j.PaneCursorType.DiagonalNwSeResize:j.PaneCursorType.DiagonalNeSwResize,hitTarget:U.HitTarget.ChangePoint,nonDiscreteIndex:t===O.TopRight||t===O.BottomRight}))),this._tableRenderer=new le,this._source.setAdditionalCursorData((()=>{const e=this._getTextEditableRenderer();return e?{
|
||||
color:this._source.editableTextStyle().cursorColor,...e.getTextInfo()}:{color:this._source.editableTextStyle().cursorColor,lineSpacing:0,lineHeight:0}}),(e=>{const t=this._getTextEditableRenderer();return t?t.positionToCoordinate(e):{x:0,y:0,lineNumber:0}}))}renderer(e){return this._lastRenderingInfo=e,this._invalidated&&this._updateImpl(e),this._renderer}lastRenderingInfo(){return this._lastRenderingInfo}_updateImpl(e){super._updateImpl(e),this._renderer.clear();const t=this._source.priceScale();if(!t||t.isEmpty())return;if(!this._points||this._source.isFixed()&&void 0===this._source.fixedPoint())return;const i=this._source.isFixed()?[(0,o.ensureDefined)(this._source.fixedPoint())]:this._points;if(i.length<1)return;const[r]=i,n=this._source.properties(),l=n.childs(),a=(0,K.lastMouseOrTouchEventInfo)().isTouch;let c={column:null,row:null};if((a?this._source.model().selection().dataSources()[0]:this._source.model().hoveredSource())===this._source){const e=X.mobiletouch?this._source.model().lastSelectedHittestData():this._source.model().lastHittestData(),t=e?.activeItem;(function(e){return(0,ie.isObject)(e)&&"row"in e&&"column"in e})(t)&&(c=t)}const h={columnWidths:this._source.columnWidths(),rowHeights:this._source.rowHeights(),texts:n.cellsValues(),leftTop:r,borderColor:l.borderColor.value(),backgroundColor:l.backgroundColor.value(),textColor:l.textColor.value(),fontSize:l.fontSize.value(),horzAlign:l.horzAlign.value()};this._updateTextRenderers(e,h);const d=this._rawPrecalculatedData(h,e);this._tableRenderer.setData({...h,editableCell:this._getTextEditableCellIndexes(),selectableCell:this._getSelectableCellIndexes(),cells:d,activeEdge:c,changeSize:this._model.selection().isSelected(this._source),changeOnlyActiveEdge:a}),this._setTextRendererPositions(d,e),this._renderer.append(this._tableRenderer),this._cellsTextRenderers.forEach((e=>e.forEach((e=>this._renderer.append(e)))));const{x:u,y:p}=d.topLeft,{x:g,y:_}=d.bottomRight,{horizontalPixelRatio:m,verticalPixelRatio:f}=e,x=u/m,b=p/f,T=g/m,C=_/f,y=this._source.isFixed();this._anchorPoints[O.TopLeft].point=(0,s.point)(x,b),this._anchorPoints[O.TopLeft].nonDiscreteIndex=y,this._anchorPoints[O.BottomLeft].point=(0,s.point)(x,C),this._anchorPoints[O.BottomLeft].nonDiscreteIndex=y,this._anchorPoints[O.TopRight].point=(0,s.point)(T,b),this._anchorPoints[O.BottomRight].point=(0,s.point)(T,C),this._renderer.append(this.createLineAnchor({points:this._anchorPoints,clickHandler:this._anchorClickHandler},0)),this._model.selection().isSelected(this._source)||(this.closeTextEditor(),this._source.setInplaceEditableCellIndexes([-1,-1]))}_activateEditMode(e){super._activateEditMode(e);const t=this._getTextEditableRenderer();null!==t&&(t.setCursorType(this._textCursorType()),this._updateInplaceText(t.getTextInfo()))}_textColorForCell([e,t]){const i=this._source.properties().childs().textColor.value();let o;return o=this._isEditableCell([e,t])?this._text():this._source.cellText(e,t),o?i:(0,G.generateColor)(i,50,!0)}_isEditableCell([e,t]){const i=this._getTextEditableCellIndexes()
|
||||
;return i[0]===e&&i[1]===t}_updateTextRenderers(e,t){if(t)if(this._cellsTextRenderers.length!==t.texts.length||this._cellsTextRenderers[0].length!==t.texts[0].length){const e=[],i=[];for(let o=0;o<t.texts.length;o++){const s=t.texts[o],r=[],n=[];for(let e=0;e<s.length;e++){const i=(0,Y.inplaceEditHandlers)(this._tryActivateEditMode.bind(this,[o,e]));n.push(i),r.push(new q.LineToolTextRenderer({text:s[e],font:y.CHART_FONT_FAMILY,fontSize:t.fontSize,lineHeight:1.3,color:this._textColorForCell([o,e]),horzAlign:t.horzAlign,vertAlign:p.VerticalAlign.Top,wordWrapWidth:w(t.columnWidths[e],this._tableTextCache),offsetX:1,offsetY:1,boxPadding:8},new U.HitTestResult(U.HitTarget.MovePoint,i)))}e.push(r),i.push(n)}this._cellsTextRenderers=e,this._tableRenderer.setCellsHitTestData(i)}else{const{height:i,width:s}=e.mediaSize,r=this._getTextEditableRenderer();t.texts.forEach(((e,n)=>{e.forEach(((e,l)=>{const a=this._cellsTextRenderers[n][l];let c={...(0,o.ensureNotNull)(a.data()),text:e,selectionHighlight:void 0,fontSize:t.fontSize,color:this._textColorForCell([n,l]),horzTextAlign:t.horzAlign,horzAlign:t.horzAlign,wordWrapWidth:w(t.columnWidths[l],this._tableTextCache),boxPadding:8};r===a&&(c={...c,...this._inplaceTextHighlight(),text:this._text()},a.isOutOfScreen(s,i)?this.closeTextEditor():this._updateInplaceText(a.getTextInfo())),a.setData(c),a.setCursorType(this._textCursorType())}))}))}}_setTextRendererPositions(e,t){const i=this._source.properties().childs().horzAlign.value(),{horizontalPixelRatio:o,verticalPixelRatio:r}=t;this._cellsTextRenderers.forEach(((t,n)=>{t.forEach(((t,l)=>{const{left:a,right:c,top:h,bottom:d}=e.cells[n][l];t.setPoint((0,s.point)((a+("right"===i?c-a:"center"===i?(c-a)/2:0))/o,h/r));const u=t.data();null!==u&&t.setData({...u,boxWidth:(c-a)/o-1,boxHeight:Math.max((d-h)/r,t.measure().height)})}))}))}_rawPrecalculatedData(e,t){const i=this._cellsTextRenderers.map(((t,i)=>Math.max(...t.map((e=>e.measure().height)),e.rowHeights[i]))),o=e.columnWidths.map(((i,o)=>A(e.leftTop.x,e.columnWidths,o,t.horizontalPixelRatio))),r=i.map(((o,s)=>A(e.leftTop.y,i,s,t.verticalPixelRatio))),n=i.map(((t,i)=>e.columnWidths.map(((t,s)=>{const[n,l]=o[s],[a,c]=r[i];return{left:n,right:l,top:a,bottom:c,columnIndex:s,rowIndex:i,text:e.texts[i][s]}}))));return{topLeft:(0,s.point)(o[0][0],r[0][0]),bottomRight:(0,s.point)(o[o.length-1][1],r[r.length-1][1]),cells:n}}_getTextEditableCellIndexes(){return this._isTextEditMode()?this._getSelectableCellIndexes():[-1,-1]}_getSelectableCellIndexes(){return this._source.inplaceEditableCellIndexes()}_getTextEditableRenderer(){const[e,t]=this._getTextEditableCellIndexes();return-1===e&&-1===t?null:this._cellsTextRenderers[e]?.[t]}}var ce=i(11542),he=i(95804),de=i(91445),ue=i(14472),pe=i(95338),ge=i(91682),_e=i(22613),me=i(56689)
|
||||
;const fe=new he.TranslatedString("change {title} background color",ce.t(null,void 0,i(49765))),xe=new he.TranslatedString("change {title} border color",ce.t(null,void 0,i(69437))),be=new he.TranslatedString("change {title} texts alignment",ce.t(null,void 0,i(71665))),Te=ce.t(null,void 0,i(79468)),Ce=ce.t(null,void 0,i(38408)),ye=ce.t(null,void 0,i(70320)),ve=ce.t(null,void 0,i(25485));class Pe extends ue.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=this._source.properties().childs(),t=this._source.name(),i=(0,ge.removeSpaces)(t),o=new he.TranslatedString(t,this._source.translatedType());return{definitions:[(0,pe.createColorPropertyDefinition)({color:(0,pe.getColorDefinitionProperty)(this._propertyApplier,e.backgroundColor,null,fe.format({title:o}))},{id:`${i}BackgroundColor`,title:Te}),(0,pe.createColorPropertyDefinition)({color:(0,pe.getColorDefinitionProperty)(this._propertyApplier,e.borderColor,null,xe.format({title:o}))},{id:`${i}BorderColor`,title:Ce}),(0,de.createTextStyleDefinition)(this._propertyApplier,{textColor:e.textColor,fontSize:e.fontSize},o,{isEditable:!0,isMultiLine:!0,customTitles:{text:ye}}),(0,pe.createOptionsPropertyDefinition)({option:(0,pe.convertToDefinitionProperty)(this._propertyApplier,e.horzAlign,be.format({title:o}))},{id:`${i}TextAlignment`,title:ve,options:new _e.WatchedValue(me.availableAlignmentHorizontalItems)})]}}}var we=i(12217),Se=i(40472),Ve=i(33065);class De extends a.InplaceTextUndoCommand{constructor(e,t,i,o,s){super(e,t,i,o),this._cellIndexes=[-1,-1],this._cellIndexes=s}_textProperty(e){const[t,i]=this._cellIndexes;return(0,o.assert)(-1!==t,"rowIndex shouldn't be -1"),(0,o.assert)(-1!==i,"columnIndex shouldn't be -1"),e.properties().childs().cells.childs()[t].childs()[i]}}var Ae=i(72270),Ie=i(13896);const Re=new he.TranslatedString("add column to right",r.t(null,void 0,i(48499))),We=new he.TranslatedString("add row below",r.t(null,void 0,i(48407))),He=new he.TranslatedString("remove column",r.t(null,void 0,i(16829))),Ee=new he.TranslatedString("remove row",r.t(null,void 0,i(4553)));class Le extends Ae.UndoCommand{constructor(e,t,i,o){super(o,!0,!Ie.lineToolsDoNotAffectChartInvalidation),this._sourceId=t.id(),this._model=e,this._operationType=i;const{rowsCount:s,colsCount:r}=t.properties().state();this._rowsCountPropsState=s,this._colsCountPropsState=r,this._columnWidthsPropsState=t.properties().columnWidthValues(),this._rowHeightsPropsState=t.properties().rowHeightValues(),this._cellsPropsState=t.properties().cellsValues(),this._inplaceEditCellIndexes=t.inplaceEditableCellIndexes()}undo(){const e=this._source();e.properties().recreateCellsPropsByState({cells:this._cellsPropsState,colsCount:this._colsCountPropsState,rowsCount:this._rowsCountPropsState,columnWidths:this._columnWidthsPropsState,rowHeights:this._rowHeightsPropsState}),e.setInplaceEditableCellIndexes(this._inplaceEditCellIndexes,!0)}_source(){return(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId))}}class ze extends Le{constructor(e,t,i){super(e,t,i,1===i?Re:We)}redo(){
|
||||
this._source().insertCells(this._operationType,this._inplaceEditCellIndexes)}}class Ne extends Le{constructor(e,t,i){super(e,t,i,1===i?He:Ee)}redo(){this._source().removeCells(this._operationType,this._inplaceEditCellIndexes)}}function Me(e,t,i){let o=(0,we.sum)(e);const s=(0,we.sum)(t);let r=Math.max(i,s);if(o===r)return[...e];if(r<o)for(let i=0;i<e.length;i++)e[i]===t[i]&&(o-=e[i],r-=e[i]);const n=r/o,l=e.map(((e,i)=>Math.max(t[i],e*n)));return(0,we.sum)(l)>r+.01?Me(l,t,i):l}const ke=new he.TranslatedString("change the column width",r.t(null,void 0,i(26391))),Be=new he.TranslatedString("change the row height",r.t(null,void 0,i(21863))),Fe=new he.TranslatedString("resize the cell",r.t(null,void 0,i(24849)));class Oe extends a.InplaceTextLineDataSource{constructor(e,t,i,o){const s=t??Oe.createProperties(e.backgroundTheme().spawnOwnership());super(e,s,i,o),this._hasEditableCoordinates=new _e.WatchedValue(!1),this._widthsSnapshot=null,this._inplaceEditCellIndexes=[-1,-1],this._tablePaneView=null,this._contextMenu=null,this._tableTextCache=new v(this._properties.childs().fontSize.value()),this._properties.childs().fontSize.subscribe(this,(e=>{this._tableTextCache.setFont(e.value()),this._properties.setColumnWidthValues(this._properties.columnWidthValues()),this.updateAllViews((0,Se.sourceChangeEvent)(this.id())),this._model.updateSource(this)})),this._properties.setTableTextCache(this._tableTextCache),this._tablePaneView=new ae(this,e,this._tableTextCache,this._openTextEditor.bind(this),this._closeTextEditor.bind(this)),this._setPaneViews([this._tablePaneView]),this.setInplaceEditableCellIndexes([-1,-1],!0),s.childs().anchored.subscribe(this,this._onAnchoredChange.bind(this))}destroy(){this._properties.childs().fontSize.unsubscribeAll(this),this._contextMenu?.then((e=>e.hide())),super.destroy()}pointsCount(){return 1}name(){return"Table"}isFixed(){return this._properties.childs().anchored.value()}anchorable(){return!0}properties(){return this._properties}template(){return this._properties.template()}snapTo45DegreesAvailable(){return!1}getPoint(e){const t=this._topLeftPoint();if(e===O.TopLeft)return t;const i=this.pointToScreenPoint(t);let o=null;if(i){const e=this.columnWidths(),t=this.rowHeights(),r=i.add((0,s.point)((0,we.sum)(e),(0,we.sum)(t)));o=this.screenPointToPoint(r)}if(!o)return null;switch(e){case O.TopRight:return{...t,index:o.index};case O.BottomRight:return{...o};case O.BottomLeft:return{...t,price:o.price}}return null}inplaceEditableCellIndexes(){return this._inplaceEditCellIndexes}setInplaceEditableCellIndexes(e,t=!1){const[i,o]=this._inplaceEditCellIndexes,[s,r]=e;if(!t&&i===s&&o===r)return;this._destroyEditableTextSubscriptions?.();const n=this.properties().childs().editableText,l={};if(-1!==s&&-1!==r){const e=this.properties().childs().cells.childs()[s].childs()[r];n.setValue(e.value()),n.subscribe(l,(()=>e.setValue(n.value()))),e.subscribe(l,(()=>n.setValue(e.value()))),this._destroyEditableTextSubscriptions=()=>{n.unsubscribeAll(l),e.unsubscribeAll(l)}}this._inplaceEditCellIndexes=[s,r],
|
||||
this._editableText.setValue(n.value()),this.updateAllViews((0,Se.sourceChangeEvent)(this.id())),this._model.updateSource(this)}switchActiveCell(e=!1){let[t,i]=this._inplaceEditCellIndexes;if(-1===t&&-1===i)return!1;const{colsCount:o,rowsCount:s}=this.properties().state(),r=o*s,n=(t*o+i+(e?r-1:1))%r;return t=Math.floor(n/o)%s,i=n%o,this._saveEditedText(),this.setInplaceEditableCellIndexes([t,i],!0),!0}insertCells(e,t){const i=this.properties().state();let{rowsCount:o,colsCount:s}=i;const r=this.properties().cellsValues(),n=this.properties().columnWidthValues(),l=this.properties().rowHeightValues();let[a,c]=t??this._inplaceEditCellIndexes,h=!1;switch(-1===a&&-1===c&&(h=!0,a=o-1,c=s-1),e){case 0:const e=a+1,t=new Array(s).fill("");e>=o?r.push(t):r.splice(e,0,t),l.splice(e,0,0),o++;break;case 1:const i=c+1;for(const e of r)e.splice(i,0,"");n.splice(i,0,120),s++}this._properties.recreateCellsPropsByState({rowsCount:o,colsCount:s,columnWidths:n,rowHeights:l,cells:r}),this.setInplaceEditableCellIndexes(h?[-1,-1]:[a,c],!0)}isRemoveCellsAvailable(e){const t=this._properties.cellsValues();return(0!==e||1!==t.length)&&(1!==e||1!==t[0].length)}removeCells(e,t){const[i,o]=t??this._inplaceEditCellIndexes;if(-1===i&&-1===o)return;let{rowsCount:s,colsCount:r}=this.properties().state();const n=this.properties().cellsValues(),l=this.properties().columnWidthValues(),a=this.properties().rowHeightValues();switch(e){case 0:n.splice(i,1),a.splice(i,1),s--;break;case 1:for(const e of n)e.splice(o,1);l.splice(o,1),r--}this._properties.recreateCellsPropsByState({rowsCount:s,colsCount:r,columnWidths:l,rowHeights:a,cells:n});const c=Math.min(i,s-1),h=Math.min(o,r-1);this.setInplaceEditableCellIndexes([c,h],!0)}async additionalActions(e,t="Default"){let o=[];return"Default"===t&&(o=(await Promise.all([i.e(1629),i.e(620)]).then(i.bind(i,4714))).tableActions(this,e)),{actions:o,placement:"BeforeAll"}}editableTextProperties(){return{text:this.properties().childs().editableText,textColor:this.properties().childs().textColor}}cellText(e,t){return this.properties().childs().cells.childs()[e].childs()[t].value()}changePointUndoText(e){const{row:t,column:i}=oe(e);return null===t&&null===i?l.changePointUndoText:null===t?ke:null===i?Be:Fe}startChanging(e,t){this.isFixed()&&this.restoreFixedPoint();const[i,s]=this.columnWidths(!0),[r,n]=this.rowHeights(!0),l=(0,we.sum)(i),a=(0,we.sum)(r),c=(0,we.sum)(n);e??=O.TopLeft;const h=this._topLeftPoint(),d=(0,o.ensureNotNull)(this.priceScale()),u=(0,o.ensure)(this.ownerSource()?.firstValue()),p=d.priceToCoordinate(h.price,u),g=d.coordinateToPrice(p+a,u),_=this._model.timeScale().indexToCoordinate(h.index),m=this._model.timeScale().coordinateToFloatIndex(_+l);switch(e){case O.BottomLeft:t={index:h.index,price:g};break;case O.TopRight:t={index:m,price:h.price};break;case O.BottomRight:t={index:m,price:g};break;default:t={...h}}this._widthsSnapshot={columnWidths:i,columnMinWidths:s,rowHeights:r,rowMinHeights:n,minTotalHeight:c,totalWidth:l,totalHeight:a,startPoint:{...t},topLeftPoint:h},super.startChanging(e,t)}
|
||||
setPoint(e,t,i,r){const n=this._model.timeScale(),l=(0,o.ensureNotNull)(this.priceScale()),a=(0,o.ensure)(this.ownerSource()?.firstValue()),c=this._model.mainSeries().interval(),h=(0,o.ensureNotNull)(this._widthsSnapshot),d=(0,o.ensureNotNull)(this.pointToScreenPoint(h.startPoint));let u=(0,o.ensureNotNull)(this.pointToScreenPoint(t));const{totalWidth:p,totalHeight:g,columnWidths:_,columnMinWidths:m,rowHeights:f,rowMinHeights:x}=h,b=this._topLeftPoint(),T=(0,o.ensureNotNull)(this.pointToScreenPoint(b)),C=e===O.TopLeft||e===O.BottomLeft,y=e===O.TopLeft||e===O.TopRight,v=d.add((0,s.point)(C?p:-p,y?g:-g)),P=D(this._tableTextCache);let{x:A,y:I}=u;if(!r){const e=P*h.columnWidths.length,t=h.minTotalHeight;A=C?Math.min(u.x,v.x-e):Math.max(u.x,v.x+e),I=y?Math.min(u.y,v.y-t):Math.max(u.y,v.y+t),u=(0,s.point)(A,I)}const R=this.isFixed(),W=C&&!R?Math.floor(n.coordinateToFloatIndex(A)):n.coordinateToFloatIndex(A);A=n.indexToCoordinate(W);const H=l.coordinateToPrice(I,a),E=d.x-A,L=d.y-I;switch(e){case O.TopLeft:R?this.addFixedPoint(u):this._setPoint(0,{...t,price:H,index:W,interval:c}),r||(this._properties.setColumnWidthValues(this._correctColumnWidths(Me(_,m,p+E),h)),this._properties.setRowHeightValues(Me(f,x,g+L)));break;case O.BottomLeft:R?this.addFixedPoint((0,s.point)(u.x,T.y)):this._setPoint(0,{...t,index:W,price:b.price,interval:c}),r||(this._properties.setColumnWidthValues(this._correctColumnWidths(Me(_,m,p+E),h)),this._properties.setRowHeightValues(Me(f,x,g-L)));break;case O.TopRight:R?this.addFixedPoint((0,s.point)(T.x,u.y)):this._setPoint(0,{...t,price:H,index:b.index,interval:c}),r||(this._properties.setColumnWidthValues(Me(_,m,p-E)),this._properties.setRowHeightValues(Me(f,x,g+L)));break;case O.BottomRight:r||(this._properties.setColumnWidthValues(Me(_,m,p-E)),this._properties.setRowHeightValues(Me(f,x,g-L)))}if(e>=O.ResizeVirtualAnchorBase){const{column:t,row:i}=oe(e);if(null!==t){const e=(0,we.sum)(_.slice(0,t))+T.x,i=Math.max(P,u.x-e),o=_.map(((e,o)=>o===t?i:e));this._properties.setColumnWidthValues(o)}if(null!==i){const e=(0,we.sum)(f.slice(0,i))+T.y;let t=V(this._tableTextCache);for(let e=0;e<_.length;e++)t=Math.max(t,S(this.cellText(i,e),w(_[e],this._tableTextCache),this._tableTextCache));const o=Math.max(t,u.y-e),s=f.map(((e,t)=>t===i?o:e));this._properties.setRowHeightValues(s)}}else;}columnWidths(e){const t=this._properties.columnWidthValues();if(!e)return t;const i=D(this._tableTextCache),o=t.map((e=>i));return[t,o]}rowHeights(e){const t=this.properties().rowHeightValues(),i=this.columnWidths(),o=[],s=t.map(((t,s)=>{let r=V(this._tableTextCache),n=Math.max(t,r);for(let e=0;e<this.properties().childs().colsCount.value();e++){const t=S(this.cellText(s,e),w(i[e],this._tableTextCache),this._tableTextCache);n=Math.max(n,t),r=Math.max(r,t)}return e&&o.push(r),n}));return e?[s,o]:s}endChanging(e,t,i){return this._widthsSnapshot=null,super.endChanging(e,t,i)}async onContextMenu(e){
|
||||
null===this._contextMenu&&(this._contextMenu=Promise.all([i.e(1629),i.e(620)]).then(i.bind(i,91974)).then((t=>t.showTableContextMenu(this,(()=>{this._contextMenu=null}),e))))}insertCellsUndoCommand(e){return new ze(this.model(),this,e)}removeCellsUndoCommand(e){return this.isRemoveCellsAvailable(e)?new Ne(this.model(),this,e):null}static createProperties(e,t){const i=F.create(e,t);return this._configureProperties(i),i}_closeTextEditor(e){super._closeTextEditor(),0===e&&(this._inplaceEditCellIndexes=[-1,-1])}_changeEditableTextUndoCommand(e,t){return new De(this._model,this,e,t,(0,o.ensureNotNull)(this._inplaceEditCellIndexes))}async _getPropertyDefinitionsViewModelClass(){return Pe}_createDataSourceBackgroundColorWV(){return(0,n.convertPropertyToWatchedValue)(this.properties().childs().backgroundColor).ownership()}static _addCollectedProperties(e){}_topLeftPoint(){return this.isFixed()?(0,o.ensureNotNull)(this.screenPointToPoint((0,o.ensureDefined)(this._fixedPoint),!0)):this._points[0]}_correctColumnWidths(e,t){const i=(this._tablePaneView?.lastRenderingInfo()??Ve.dpr1PixelRatioInfo).horizontalPixelRatio,s=(0,o.ensureNotNull)(this.pointToScreenPoint(t.topLeftPoint)).x,[,r]=A(s,t.columnWidths,t.columnMinWidths.length-1,i),n=(0,o.ensureNotNull)(this.pointToScreenPoint(this._topLeftPoint())).x,l=(0,we.sum)(e),a=r/i-n;return e[e.length-1]+=a-l,e}}},24961:(e,t,i)=>{i.d(t,{LineToolTextRenderer:()=>s});var o=i(4753);class s extends o.TextRenderer{getTextInfo(){const e=this._getInternalData(),t=this.fontStyle(),i=this._getFontInfo();return{...e,lineHeight:this.lineHeight(),lineSpacing:this.lineSpacing(),font:t,fontSize:i.fontSize,centerRotation:this.centerTextRotation()??void 0}}setCursorType(e){this._hitTest.data()?.cursorType!==e&&this._hitTest.mergeData({cursorType:e})}}},70031:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>a});var o=i(16738),s=i(90054),r=i(50151),n=i(45345),l=i(24633);function a(e,t){const i=n.watchedTheme.value()??l.StdTheme.Light,a=(0,s.default)(e);return(0,o.default)(a,(0,r.ensureDefined)(t.get(i))),a}}}]);
|
||||
Reference in New Issue
Block a user