@grapecity-software/spread-sheets-hyperlink 18.2.4 → 19.0.0

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * SpreadJS Library 18.2.4
3
+ * SpreadJS Library 19.0.0
4
4
  *
5
5
  * Copyright(c) GrapeCity Software inc. All rights reserved.
6
6
  *
@@ -9,4 +9,4 @@
9
9
  * https://www.grapecity.com.cn/developer/spreadjs
10
10
  *
11
11
  */
12
- !function(e){var t;"object"==typeof module&&"object"==typeof module.exports?(t=require("@grapecity-software/spread-common"),require("@grapecity-software/spread-calc-engine"),require("@grapecity-software/spread-sheets-core"),require("@grapecity-software/spread-sheets-calc-engine"),module.exports=e(t)):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-common","@grapecity-software/spread-calc-engine","@grapecity-software/spread-sheets-core","@grapecity-software/spread-sheets-calc-engine"],e):"object"==typeof exports?(t=require("@grapecity-software/spread-common"),require("@grapecity-software/spread-calc-engine"),require("@grapecity-software/spread-sheets-core"),require("@grapecity-software/spread-sheets-calc-engine"),exports.Spread=e(t)):e(GC)}((function(e){!function(){"use strict";var t,n={"./dist/plugins/hyperlink/hyperlink.js":function(e,t,n){var r,i,o,a,u,s,c,f,l,p,h,d,v,w,y,g,k,m,b,M,x,C,j,z,H,_,O,q,A,S,U,L,N,P,T,$,E,F,G,R,V,I,W,B,D,J,K,Q,X,Y=this&&this.qKr||(Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Z(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Z;function ee(e,t,n,r){return p(r)&&(r=3),!p(e.getHyperlink(t,n,r))}function te(){var e=u(N);return c(e).css(b,M).css(x,0).css(H,2).css(_,"1px #c0c0c0 solid").css("box-shadow","1px 2px 5px rgba(0,0,0,0.4)").css(O,S).css(A,L).css(C,"9pt Arial"),e}function ne(e,t,n){var r,i,o,a,u,s,f;n&&(i=(r=e&&e.qc()).getElementsByClassName(P)[0],o=!1,p(i)&&((i=te()).className=P,r.insertBefore(i,w),o=!0),a=c(i),!o&&a.isVisible()||(a.text(n),s=(u=e.rt.it()).left+t.x,f=u.top+t.y+20,a.css(z,f).css(j,s),a.show()))}function re(e){var t=e&&e.qc(),n=t.getElementsByClassName(P)[0];p(n)||c(n).hide()}function ie(e,t){p(t)||(t.drawUnderline&&(p(e.textDecoration)?e.textDecoration=1:0!==e.textDecoration&&1&~e.textDecoration&&(e.textDecoration+=1)),t.isVisited?t.visitedLinkColor===w?e.foreColor="rgba(0,0,0,0)":t.visitedLinkColor===v?e.foreColor=$:e.foreColor=t.visitedLinkColor:p(t.linkColor)?(t.linkColor!==v||!e.foreColor&&e.foreColor!==w)&&(e.foreColor=T):e.foreColor=t.linkColor)}function oe(e){if(e&&e.cellType){var t=e.cellType.typeName;if(!X[t])return!0}return!1}function ae(e,t,n,r,i,o,a){var u=0,s=0,c=e.width,f=e.height,l=ue(a);return l&&(c-=l),u=o=o||0,1===r?u=(c-t)/2:2===r?u=c-t-o:5===r&&(u=(c-t)/2),1===i?s=(f-n)/2:2===i&&(s=f-n),l&&(u+=l),{x:e.x+u,y:e.y+s}}function ue(e){var t={context:e,value:0};return l.et(e.sheet,"getOutlineColumnOffset",t),t.value}function se(e,t){var n=ke(t),r=e-3-n;return 5===t.hAlign&&(r-=n),r-=1}function ce(e,t,n,i){var o=se(t,n),a=r.q.Q3e(e);return 1===a.length&&0===a[0].prefixSpaceCount?y(0,r.q.Wt(a[0].word,i,!0)):o}function fe(e,t,n,i){var o=a(t),u=5===n.hAlign?ce(e,i,n,t):y(0,r.q.Wt(e,t,!0)),s=e.split(/\r\n|\r|\n/).length*o;return{x:0,y:0,width:u,height:s}}function le(e,t,n,i){return new r.Rect(e,t,n-e,i-t)}function pe(e,t,n,r,i){var o=e.x,a=e.y,u=e.x+e.width,s=e.y+e.height;switch(r){case"right":if(t>=o&&t<u)return le(Math.min(t,o+i),a,u,s);if(t>u)return le(Math.min(t,o+i),a,Math.min(t,u+i),s);break;case"left":if(t>=o&&t<u)return le(o,a,Math.max(t,u-i),s);if(t<o)return le(Math.max(t,o-i),a,Math.max(t,u-i),s);break;case"down":if(n>=a&&n<s)return le(o,Math.min(n,a+i),u,s);if(n>s)return le(o,Math.min(n,a+i),u,Math.min(n,s+i));break;case"up":if(n>=a&&n<s)return le(o,a,u,Math.max(n,s-i));if(n<a)return le(o,Math.max(n,a-i),u,Math.max(n,s-i))}return e}function he(e,t,n,r,i){var o,a,u=0;for(o=t;o<n;o++)(i?e.getRowVisible(o,r):e.getColumnVisible(o,r))&&(a=i?e.getRowHeight(o,r):e.getColumnWidth(o,r))>0&&(u+=a);return u}function de(e,t,n,r,i){var o,a,u,s,c,f=t.Fi(),l=t.frozenRowCount(),p=t.frozenColumnCount(),h=t.frozenTrailingRowCount(),d=t.frozenTrailingColumnCount(),v=t.getRowCount(),w=t.getColumnCount(),y=v-h,g=w-d,k=t.getViewportTopRow(1),m=t.getViewportBottomRow(1),b=t.getViewportLeftColumn(1),M=t.getViewportRightColumn(1),x=(null===(o=t.Cb)||void 0===o?void 0:o.D7(n,r,i))||t.Ut.getSpan(n,r,i);return!x||x.rowCount<=1&&x.colCount<=1||(a=x.row+x.rowCount-1,u=x.col+x.colCount-1,s=2===i?f.B1(1):f.c9(1,1),c=1===i?f.L1(1):f.c9(1,1),x&&(x.row<l&&a>=l&&l<k&&(e=pe(e,s.x,s.y,"up",he(t,l,k,i,!0))),x.row<y&&a>=y&&y>m&&(e=pe(e,s.x,s.y,"down",he(t,m,y,i,!0))),x.col<p&&u>=p&&p<b&&(e=pe(e,c.x,c.y,"left",he(t,p,b,i,!1))),x.col<g&&u>=g&&g>M&&(e=pe(e,c.x,c.y,"right",he(t,M,g,i,!1))))),e}function ve(e,t,n,i){var o,u,s,c,f=a(t),l=e.split(/\r\n|\r|\n/),p=0;for(o=0;o<l.length;o++)u=l[o],s=5===n.hAlign?ce(u,i,n,t):y(0,r.q.Wt(u,t,!0)),p=Math.max(p,s);return{x:0,y:0,width:p,height:c=l.length*f}}function we(e,t,n,r,i,o){var a=ve(e,n,t,r.width),u=ae(r,a.width,a.height,t.hAlign,t.vAlign,i,o);return a.x=u.x,a.y=u.y,de(a,o.sheet,o.row,o.col,o.sheetArea)}function ye(e,t,n,r,i,o){var a=fe(e,n,t,r.width),u=ae(r,a.width,a.height,t.hAlign,t.vAlign,i,o);return a.x=u.x,a.y=u.y,a}function ge(e,t,n,i,o,a){var u,c,f,l,h,d,v,w,y,k,m,b,M,x,C,j,z,H,_,O,q,A,S,U,L,N,P,T,$,E=o.sheet,F=E.Dn;if(p(n))return!1;if(n.textOrientation)return!0;if(f=E.getValue(o.row,o.col,o.sheetArea),a||(a=E.getText(o.row,o.col,o.sheetArea)),!a)return!1;if(l=n&&n.font?n.font:F.Nn(),l=F._n(l),h=[a],d=ke(n),v=null!==(u=E.outlineColumn.Tme)&&void 0!==u?u:0,(n.wordWrap||5===n.hAlign)&&(w=i.width-3-d-v,5===n.hAlign&&(w-=d),a=(h=r.q.un(a,w,l)).join("\r\n")),3===(y=n.hAlign)&&(y=s(y,f,n.formatter||n._autoFormatter),n.hAlign=y),k=o.row,m=o.col,b=o.sheetArea,M=(null===(c=E.Cb)||void 0===c?void 0:c.D7(k,m,b))||E.Ut.getSpan(k,m,b),x=E.frozenColumnCount(),C=E.frozenRowCount(),j=E.getRowCount()-E.frozenTrailingRowCount(),z=E.getColumnCount()-E.frozenTrailingColumnCount(),M&&(q=M.row+M.rowCount-1,A=M.col+M.colCount-1,_=M.row<C&&q>=C||M.row<j&&q>=j,H=M.col<x&&A>=x||M.col<z&&A>=z,p(b)||3===b?O=H||_:2===b?O=_:1===b&&(O=H)),O)return(S=we(a,n,l,i,d,o)).x<=e&&e<S.x+S.width&&S.y<=t&&t<S.y+S.height;for(U=(S=ye(a,n,l,i,d,o)).y,L=0;L<h.length;L++)if(P=(N=ye(h[L],n,l,i,d,o)).x,T=g(P+N.width,i.x+i.width),U=g(($=U)+N.height,i.y+i.height),P<=e&&e<T&&$<=t&&t<U)return!0;return!1}function ke(e){return 8*(e.textIndent||0)}function me(e,t){var n,r,i=e.replace(/:\/*/,"://");return i.endsWith("://")||(i=i.replace(/\/+$/,"")),n=i.endsWith("/")?"":"/",r=t.replace(/^\/+/,""),"".concat(i).concat(n).concat(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.HyperlinkTargetType=void 0,r=n("Core"),i=n("Common"),o=n("SheetsCalc"),a=r.mt.vt,u=r.mt.En,s=r.mt.gt,c=r.GC$,f=r.Commands.ActionBase,l=r.CellTypes.Base,p=i.Common.lt.ht,h=i.Common.lt.tv,d=i.Common.zf.TY,v=void 0,w=null,y=Math.max,g=Math.min,k=window.open,m=i.Common.zf.fJ,b="position",M="absolute",x="margin",C="font",j="left",z="top",H="padding",_="border",O="box-sizing",q="pointer",A="background-color",S="content-box",U="default",L="white",N="div",P="gc-spread-hyperlink-tooltip",T="hyperlink",$="followedHyperlink",E="hyperlink",F="openUrl",G="generateHyperlink",R=/^sjs:\/\/\w+[\!]\w+([\:]\w+)?/,V=/^(mailto:\/\/)?([a-z0-9_\-\.\!\#$%&'*\+/=?^`{|}~])+\@([a-z0-9\-])+\.([a-z0-9\-]){2,63}(\?subject=.+)?$/gi,I=/(((ht|f)tp(s?)):\/\/(?:www\.|(?!www))[a-z0-9][a-z0-9-]+[a-z0-9]\.[^\s]{2,}|www\.[a-z0-9][a-z0-9-]+[a-z0-9]\.[^\s]{2,}|((ht|f)tp(s?)):\/\/(?:www\.|(?!www))[a-z0-9]+\.[^\s]{2,}|www\.[a-z0-9]+\.[^\s]{2,})/gi,function(e){e[e.blank=0]="blank",e[e.self=1]="self",e[e.parent=2]="parent",e[e.top=3]="top"}(W=t.HyperlinkTargetType||(t.HyperlinkTargetType={})),r.GC$.extend(r.Y8.prototype,{getHyperlink:function(e,t,n){var i,o,a;return p(n)&&(n=3),i=this,o={row:e,col:t,sheetArea:n,isLinkGet:!1,hyperlink:v},r.Y8.et(this,"getHyperlink",o),o.isLinkGet?o.hyperlink:(a=i.W_(n).J_(e,t))&&!p(a.hyperlink)?a.hyperlink:w},setHyperlink:function(e,t,n,r){var i,o,a,u,s,c,f,l=this;if(p(r)&&(r=3),(i=n&&n.url)&&i.match(I)&&i.match(I).length>0?m(i,o="www.")&&(n.url="http://"+i):i&&i.match(V)&&i.match(V).length>0&&(m(i,a="mailto:")||(n.url=a+i)),u=l.P8>0?[["sheetModels",r],v]:v,s=l.W_(r).J_(e,t,!0,u?u[0]:v),p(s))u&&(u.length=0);else{if(c=s.hyperlink,p(n)){if(p(s.hyperlink))return;s.hyperlink=null,delete s.hyperlink}else for(f in s.hyperlink={url:"",linkColor:v,visitedLinkColor:v,tooltip:"",target:0,drawUnderline:!0,isVisited:!1,command:""},s.hyperlink)n[f]!==v&&(s.hyperlink[f]=n[f]);l.Mf.$Dr({type:"setRange",row:e,col:t,sheetArea:r,data:s.hyperlink,setType:"hyperlink",oldValue:c}),u&&(u[0].push("hyperlink"),u[1]=c,u[2]=s.hyperlink)}u&&u.length>0&&l.G8.push(u)}}),r.GC$.extend(r.Worksheet.prototype,{getHyperlink:function(e,t,n){var r,i;return 0===n?w:(p(n)&&(n=3),i=(r=this).Ut,h(i.getHyperlink(e,t,n)))},setHyperlink:function(e,t,n,r){var i,o,a,u;0!==r&&(p(r)&&(r=3),a=(o=(i=this).Ut).getRowCount(r),u=o.getColumnCount(r),e<0||e>=a||t<0||t>=u||(o.do("setHyperlink",e,t,n,r),this.zw()))}}),B=function(e){function t(t,n){return e.call(this,t,n)||this}return Y(t,e),t.prototype.execute=function(){var e,t,n,a,u,s,c,f,l,h,v,w,y,g,b,M,x=this,C=x.Mf,j=!1,z=C.parent,H=C,_=x.tT.url;if(p(_))return j;if(n=x.tT.target||0,a="sjs://",(u=null===(t=null===(e=z.docProps)||void 0===e?void 0:e.appDocProps)||void 0===t?void 0:t.hyperlinkBase)!==a||_.startsWith(u)||(_=u+_),0===_.indexOf(a)||"#"===_[0]){if(s=a.length,c="#"===_[0]?_.substr(1):_.substr(s),f=void 0,(f=(0,o.formulaToRanges)(C,c,0,0,!0))&&0===f.length&&(f=(0,o.formulaToRanges)(C,c,0,0,!1,!0)),f&&f.length>0){if(l=f[0].sheetName,h=f[0].ranges[0],l!==C.name()&&z.getSheetFromName(l).visible()===r.SheetTabVisible.visible){if(w={oldSheet:H,newSheet:v=z.getSheetFromName(l),cancel:!1},z.ki(r.Events.ActiveSheetChanging,w),w.cancel)return;z.setActiveSheet(l),y=z.getActiveSheetIndex(),z.w2.Tg(y),H!==(C=z.getActiveSheet())&&z.ki(r.Events.ActiveSheetChanged,{oldSheet:H,newSheet:C})}z.getSheetFromName(l).visible()===r.SheetTabVisible.visible&&(C.OA(h.row,h.col),C.setSelection(h.row,h.col,h.rowCount,h.colCount))}}else p(_)||(g="mailto:",_.match(I)&&_.match(I).length>0?m(_,b="www.")&&(_="http://"+_):_.match(V)&&_.match(V).length>0?m(_,g)||(_=g+_):u&&(_=me(u,_)),m(_,g)&&i.Common.zf.DU(_,"?")>1&&(M=_.split("?"),_=M[0]+"?"+M.slice(1).join("%3F")),k(d(_),["_blank","_self","_parent","_top"][n]));return j},t}(f),r.Commands[F]={canUndo:!1,execute:function(e,t,n){return r.Commands.zA(e,B,t,n)}},D=function(e){function t(t,n){return e.call(this,t,n)||this}return Y(t,e),t.prototype.execute=function(){var e,t,n=this,i=n.Mf,o=n.tT,a=o.url,u=o.row,s=o.col,c=o.sheetArea;if(null===a)e=null;else{if("string"!=typeof a)return!1;if((!(t=a.match(I))||t.length<1)&&(!(t=a.match(V))||t.length<1)&&(t=a.match(R)),!(t&&t.length>0&&0===a.indexOf(t[0])&&a.length===t[0].length))return!1;e={url:a,linkColor:T,visitedLinkColor:$}}return r.Commands.startTransaction(this.Mf.getParent(),this.tT),i.suspendPaint(),i.suspendEvent(),i.setHyperlink(u,s,e,c),i.resumeEvent(),i.resumePaint(),r.Commands.endTransaction(this.Mf.getParent(),this.tT),!0},t.prototype.undo=function(){var e,t=this,n=t.Mf;return n.suspendPaint(),n.suspendEvent(),e=r.Commands.TI(n.name()),n.Ut.undo(this.tT[e]),n.resumeEvent(),n.resumePaint(),!0},t}(f),r.Commands[G]={canUndo:!0,execute:function(e,t,n){return r.Commands.zA(e,D,t,n)}},J={init:function(){this.commandManager().register(F,r.Commands[F]),this.commandManager().register(G,r.Commands[G])}},r.Workbook.ch(E,J),K={setHyperlinkWhenEditing:function(e){var t=e.url,n=e.row,r=e.col,i=e.sheetArea,o=this,a=o.getParent();a.options.allowAutoCreateHyperlink&&a.commandManager().execute({cmd:G,sheetName:o.name(),url:t,row:n,col:r,sheetArea:i})}},r.Worksheet.ch(E,K),Q={applyHyperlinkStyle:function(e){var t=e.sheet,n=e.row,r=e.col,i=e.style,o=t.getHyperlink(n,r,e.sheetArea);!oe(i)&&ie(i,o)},getCellTextHitInfo:function(e){var t,n,r,i,o,a,u,s,c,f,l,h,d,v,w,y,g=e.context.sheetArea,k=e.cellStyle,m=e.context,b=m.sheet,M=m.row,x=m.col;ee(b,M,x,g)&&!oe(k)&&((n=e.cellRect)&&(r=b.C0(M),i=b.S0(x),o=b.Fi(),a=void 0,u=null===(t=b.Cb)||void 0===t?void 0:t.D7(M,x,g),s=void 0,c=void 0,f=b.frozenColumnCount(),l=b.frozenRowCount(),h=b.getRowCount()-b.frozenTrailingRowCount(),d=b.getColumnCount()-b.frozenTrailingColumnCount(),u&&(v=u.row+u.rowCount-1,w=u.col+u.colCount-1,c=u.row<l&&v>=l||u.row<h&&v>=h,s=u.col<f&&w>=f||u.col<d&&w>=d),b.getSpan(M,x,g)||!p(g)&&3!==g||u&&(c||s)?2!==g||u&&c?1!==g||u&&s||(a=o.L1(i)):a=o.B1(r):a=o.c9(r,i),a&&(n=n.getIntersectRect(a))),p(g)&&3!==g||!k||!n||(y=b.getText(M,x,g),e.paddingHitInfo={row:M,col:x,x:e.x,y:e.y,sheetArea:g,sheet:b,isFocusAware:!0,isReservedLocation:ge(e.x,e.y,k,n,m,y)}))},processMouseUpOnCellPadding:function(e){var t,n,i,o,a,u,s=e.sheet,c=e.cellStyle,f=e.row,l=e.col,h=e.sheetArea;s&&!s.isEditing()&&ee(s,f,l,h)&&!oe(c)&&e.isReservedLocation&&(t=s.Dg(),re(s),t&&(t.style.cursor=U),(n=s.Ut.getHyperlink(f,l,h)).isVisited=!0,i=n.command,p(i)||""===i||i===F?s.getParent().commandManager().execute({cmd:F,sheetName:s.name(),url:n.url,target:n.target}):"string"==typeof i?s.getParent().commandManager().execute({cmd:i,row:f,col:l,sheetName:s.name(),sheetArea:h}):"function"==typeof i&&i.call(w,s,f,l,h),o=s.getColumnCount(),a=new r.Range(f,-1,1,o),(u=s.j1(a,e.sheetArea)).y-=2,u.height+=4,s.repaint(u))},processMouseMoveOnCellPadding:function(e){var t,n,r=e.row,i=e.col,o=e.sheet,a=e.cellStyle,u=e.sheetArea;ee(o,r,i,u)&&!oe(a)&&(!o||o.isEditing()&&o.getActiveRowIndex()===r&&o.getActiveColumnIndex()===i||(t=o.Dg(),n=o.getHyperlink(r,i,u),e.isReservedLocation?t&&(ne(o,e,n.tooltip),t.style.cursor=q):(re(o),t&&(t.style.cursor=U))))},processMouseLeaveOnCellPadding:function(e){var t,n=e.sheet,r=e.row,i=e.col,o=e.sheetArea;re(n),ee(n,r,i,o)&&n&&(t=n.Dg())&&(t.style.cursor=U)},onUpdateContainer:function(e){var t=e.cellStyle,n=e.context.row,r=e.context.col,i=e.context.sheet.getHyperlink(n,r);!oe(t)&&ie(t,i)}},l.ch(E,Q),X={0:!0,1:!0,2:!0,3:!0,4:!0}},Common:function(t){t.exports=e.Spread},Core:function(t){t.exports=e.Spread.Sheets},SheetsCalc:function(t){t.exports=e.Spread.Sheets.CalcEngine}},r={};function i(e){var t,o=r[e];return void 0!==o?o.exports:(t=r[e]={exports:{}},n[e].call(t.exports,t,t.exports,i),t.exports)}t=i("./dist/plugins/hyperlink/hyperlink.js"),(((e=void 0===e?{}:e).Spread=e.Spread||{}).Sheets=e.Spread.Sheets||{}).Hyperlink=t}()}));
12
+ !function(e){var t;"object"==typeof module&&"object"==typeof module.exports?(t=require("@grapecity-software/spread-common"),require("@grapecity-software/spread-calc-engine"),require("@grapecity-software/spread-sheets-core"),require("@grapecity-software/spread-sheets-calc-engine"),module.exports=e(t)):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-common","@grapecity-software/spread-calc-engine","@grapecity-software/spread-sheets-core","@grapecity-software/spread-sheets-calc-engine"],e):"object"==typeof exports?(t=require("@grapecity-software/spread-common"),require("@grapecity-software/spread-calc-engine"),require("@grapecity-software/spread-sheets-core"),require("@grapecity-software/spread-sheets-calc-engine"),exports.Spread=e(t)):e(GC)}((function(e){!function(){"use strict";var t,n={234:function(t){t.exports=e.Spread},376:function(t){t.exports=e.Spread.Sheets},498:function(e,t,n){var r,i,o,a,u,s,c,f,l,p,h,d,v,w,g,y,k,m,b,M,x,z,C,H,_,j,O,q,A,S,U,L,N,P,T,$,E,F,G,R,V,I,W,B,D,J,K,Q,X,Y=this&&this.vJr||(Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Z(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Z;function ee(e,t,n,r){return p(r)&&(r=3),!p(e.getHyperlink(t,n,r))}function te(){var e=u(N);return c(e).css(b,M).css(x,0).css(_,2).css(j,"1px #c0c0c0 solid").css("box-shadow","1px 2px 5px rgba(0,0,0,0.4)").css(O,S).css(A,L).css(z,"9pt Arial"),e}function ne(e,t,n){var r,i,o,a,u,s,f;n&&(i=(r=e&&e.qc()).getElementsByClassName(P)[0],o=!1,p(i)&&((i=te()).className=P,r.insertBefore(i,w),o=!0),a=c(i),!o&&a.isVisible()||(a.text(n),s=(u=e.rt.it()).left+t.x,f=u.top+t.y+20,a.css(H,f).css(C,s),a.show()))}function re(e){var t=e&&e.qc(),n=t.getElementsByClassName(P)[0];p(n)||c(n).hide()}function ie(e,t){p(t)||(t.drawUnderline&&(p(e.textDecoration)?e.textDecoration=1:0!==e.textDecoration&&1&~e.textDecoration&&(e.textDecoration+=1)),t.isVisited?t.visitedLinkColor===w?e.foreColor="rgba(0,0,0,0)":t.visitedLinkColor===v?e.foreColor=$:e.foreColor=t.visitedLinkColor:p(t.linkColor)?(t.linkColor!==v||!e.foreColor&&e.foreColor!==w)&&(e.foreColor=T):e.foreColor=t.linkColor)}function oe(e){if(e&&e.cellType){var t=e.cellType.typeName;if(!X[t])return!0}return!1}function ae(e,t,n,r,i,o,a){var u=0,s=0,c=e.width,f=e.height,l=ue(a);return l&&(c-=l),u=o=o||0,1===r?u=(c-t)/2:2===r?u=c-t-o:5===r&&(u=(c-t)/2),1===i?s=(f-n)/2:2===i&&(s=f-n),l&&(u+=l),{x:e.x+u,y:e.y+s}}function ue(e){var t={context:e,value:0};return l.et(e.sheet,"getOutlineColumnOffset",t),t.value}function se(e,t){var n=ke(t),r=e-3-n;return 5===t.hAlign&&(r-=n),r-=1}function ce(e,t,n,i){var o=se(t,n),a=r.q.Q3e(e);return 1===a.length&&0===a[0].prefixSpaceCount?g(0,r.q.Wt(a[0].word,i,!0)):o}function fe(e,t,n,i){var o=a(t),u=5===n.hAlign?ce(e,i,n,t):g(0,r.q.Wt(e,t,!0)),s=e.split(/\r\n|\r|\n/).length*o;return{x:0,y:0,width:u,height:s}}function le(e,t,n,i){return new r.Rect(e,t,n-e,i-t)}function pe(e,t,n,r,i){var o=e.x,a=e.y,u=e.x+e.width,s=e.y+e.height;switch(r){case"right":if(t>=o&&t<u)return le(Math.min(t,o+i),a,u,s);if(t>u)return le(Math.min(t,o+i),a,Math.min(t,u+i),s);break;case"left":if(t>=o&&t<u)return le(o,a,Math.max(t,u-i),s);if(t<o)return le(Math.max(t,o-i),a,Math.max(t,u-i),s);break;case"down":if(n>=a&&n<s)return le(o,Math.min(n,a+i),u,s);if(n>s)return le(o,Math.min(n,a+i),u,Math.min(n,s+i));break;case"up":if(n>=a&&n<s)return le(o,a,u,Math.max(n,s-i));if(n<a)return le(o,Math.max(n,a-i),u,Math.max(n,s-i))}return e}function he(e,t,n,r,i){var o,a,u=0;for(o=t;o<n;o++)(i?e.getRowVisible(o,r):e.getColumnVisible(o,r))&&(a=i?e.getRowHeight(o,r):e.getColumnWidth(o,r))>0&&(u+=a);return u}function de(e,t,n,r,i){var o,a,u,s,c,f=t.Fi(),l=t.frozenRowCount(),p=t.frozenColumnCount(),h=t.frozenTrailingRowCount(),d=t.frozenTrailingColumnCount(),v=t.getRowCount(),w=t.getColumnCount(),g=v-h,y=w-d,k=t.getViewportTopRow(1),m=t.getViewportBottomRow(1),b=t.getViewportLeftColumn(1),M=t.getViewportRightColumn(1),x=(null===(o=t.Cb)||void 0===o?void 0:o.D7(n,r,i))||t.Ut.getSpan(n,r,i);return!x||x.rowCount<=1&&x.colCount<=1||(a=x.row+x.rowCount-1,u=x.col+x.colCount-1,s=2===i?f.B1(1):f.c9(1,1),c=1===i?f.L1(1):f.c9(1,1),x&&(x.row<l&&a>=l&&l<k&&(e=pe(e,s.x,s.y,"up",he(t,l,k,i,!0))),x.row<g&&a>=g&&g>m&&(e=pe(e,s.x,s.y,"down",he(t,m,g,i,!0))),x.col<p&&u>=p&&p<b&&(e=pe(e,c.x,c.y,"left",he(t,p,b,i,!1))),x.col<y&&u>=y&&y>M&&(e=pe(e,c.x,c.y,"right",he(t,M,y,i,!1))))),e}function ve(e,t,n,i){var o,u,s,c,f=a(t),l=e.split(/\r\n|\r|\n/),p=0;for(o=0;o<l.length;o++)u=l[o],s=5===n.hAlign?ce(u,i,n,t):g(0,r.q.Wt(u,t,!0)),p=Math.max(p,s);return{x:0,y:0,width:p,height:c=l.length*f}}function we(e,t,n,r,i,o){var a=ve(e,n,t,r.width),u=ae(r,a.width,a.height,t.hAlign,t.vAlign,i,o);return a.x=u.x,a.y=u.y,de(a,o.sheet,o.row,o.col,o.sheetArea)}function ge(e,t,n,r,i,o){var a=fe(e,n,t,r.width),u=ae(r,a.width,a.height,t.hAlign,t.vAlign,i,o);return a.x=u.x,a.y=u.y,a}function ye(e,t,n,i,o,a){var u,c,f,l,h,d,v,w,g,k,m,b,M,x,z,C,H,_,j,O,q,A,S,U,L,N,P,T,$,E=o.sheet,F=E.Dn;if(p(n))return!1;if(n.textOrientation)return!0;if(f=E.getValue(o.row,o.col,o.sheetArea),a||(a=E.getText(o.row,o.col,o.sheetArea)),!a)return!1;if(l=n&&n.font?n.font:F.Nn(),l=F._n(l),h=[a],d=ke(n),v=null!==(u=E.outlineColumn.Tme)&&void 0!==u?u:0,(n.wordWrap||5===n.hAlign)&&(w=i.width-3-d-v,5===n.hAlign&&(w-=d),a=(h=r.q.un(a,w,l)).join("\r\n")),3===(g=n.hAlign)&&(g=s(g,f,n.formatter||n._autoFormatter),n.hAlign=g),k=o.row,m=o.col,b=o.sheetArea,M=(null===(c=E.Cb)||void 0===c?void 0:c.D7(k,m,b))||E.Ut.getSpan(k,m,b),x=E.frozenColumnCount(),z=E.frozenRowCount(),C=E.getRowCount()-E.frozenTrailingRowCount(),H=E.getColumnCount()-E.frozenTrailingColumnCount(),M&&(q=M.row+M.rowCount-1,A=M.col+M.colCount-1,j=M.row<z&&q>=z||M.row<C&&q>=C,_=M.col<x&&A>=x||M.col<H&&A>=H,p(b)||3===b?O=_||j:2===b?O=j:1===b&&(O=_)),O)return(S=we(a,n,l,i,d,o)).x<=e&&e<S.x+S.width&&S.y<=t&&t<S.y+S.height;for(U=(S=ge(a,n,l,i,d,o)).y,L=0;L<h.length;L++)if(P=(N=ge(h[L],n,l,i,d,o)).x,T=y(P+N.width,i.x+i.width),U=y(($=U)+N.height,i.y+i.height),P<=e&&e<T&&$<=t&&t<U)return!0;return!1}function ke(e){return 8*(e.textIndent||0)}function me(e,t){var n,r,i=e.replace(/:\/*/,"://");return i.endsWith("://")||(i=i.replace(/\/+$/,"")),n=i.endsWith("/")?"":"/",r=t.replace(/^\/+/,""),"".concat(i).concat(n).concat(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.HyperlinkTargetType=void 0,r=n(376),i=n(234),o=n(789),a=r.mt.vt,u=r.mt.En,s=r.mt.gt,c=r.GC$,f=r.Commands.ActionBase,l=r.CellTypes.Base,p=i.Common.lt.ht,h=i.Common.lt.tv,d=i.Common.zf.TY,v=void 0,w=null,g=Math.max,y=Math.min,k=window.open,m=i.Common.zf.fJ,b="position",M="absolute",x="margin",z="font",C="left",H="top",_="padding",j="border",O="box-sizing",q="pointer",A="background-color",S="content-box",U="default",L="white",N="div",P="gc-spread-hyperlink-tooltip",T="hyperlink",$="followedHyperlink",E="hyperlink",F="openUrl",G="generateHyperlink",R=/^sjs:\/\/\w+[\!]\w+([\:]\w+)?/,V=/^(mailto:\/\/)?([a-z0-9_\-\.\!\#$%&'*\+/=?^`{|}~])+\@([a-z0-9\-])+\.([a-z0-9\-]){2,63}(\?subject=.+)?$/gi,I=/(((ht|f)tp(s?)):\/\/(?:www\.|(?!www))[a-z0-9][a-z0-9-]+[a-z0-9]\.[^\s]{2,}|www\.[a-z0-9][a-z0-9-]+[a-z0-9]\.[^\s]{2,}|((ht|f)tp(s?)):\/\/(?:www\.|(?!www))[a-z0-9]+\.[^\s]{2,}|www\.[a-z0-9]+\.[^\s]{2,})/gi,function(e){e[e.blank=0]="blank",e[e.self=1]="self",e[e.parent=2]="parent",e[e.top=3]="top"}(W=t.HyperlinkTargetType||(t.HyperlinkTargetType={})),r.GC$.extend(r.Y8.prototype,{getHyperlink:function(e,t,n){var i,o,a;return p(n)&&(n=3),i=this,o={row:e,col:t,sheetArea:n,isLinkGet:!1,hyperlink:v},r.Y8.et(this,"getHyperlink",o),o.isLinkGet?o.hyperlink:(a=i.W_(n).J_(e,t))&&!p(a.hyperlink)?a.hyperlink:w},setHyperlink:function(e,t,n,r){var i,o,a,u,s,c,f,l=this;if(p(r)&&(r=3),(i=n&&n.url)&&i.match(I)&&i.match(I).length>0?m(i,o="www.")&&(n.url="http://"+i):i&&i.match(V)&&i.match(V).length>0&&(m(i,a="mailto:")||(n.url=a+i)),u=l.P8>0?[["sheetModels",r],v]:v,s=l.W_(r).J_(e,t,!0,u?u[0]:v),p(s))u&&(u.length=0);else{if(c=s.hyperlink,p(n)){if(p(s.hyperlink))return;s.hyperlink=null,delete s.hyperlink}else for(f in s.hyperlink={url:"",linkColor:v,visitedLinkColor:v,tooltip:"",target:0,drawUnderline:!0,isVisited:!1,command:""},s.hyperlink)n[f]!==v&&(s.hyperlink[f]=n[f]);l.Mf.$Dr({type:"setRange",row:e,col:t,sheetArea:r,data:s.hyperlink,setType:"hyperlink",oldValue:c}),u&&(u[0].push("hyperlink"),u[1]=c,u[2]=s.hyperlink)}u&&u.length>0&&l.G8.push(u)}}),r.GC$.extend(r.Worksheet.prototype,{getHyperlink:function(e,t,n){var r,i;return 0===n?w:(p(n)&&(n=3),i=(r=this).Ut,h(i.getHyperlink(e,t,n)))},setHyperlink:function(e,t,n,r){var i,o,a,u;0!==r&&(p(r)&&(r=3),a=(o=(i=this).Ut).getRowCount(r),u=o.getColumnCount(r),e<0||e>=a||t<0||t>=u||(o.do("setHyperlink",e,t,n,r),this.zw()))}}),B=function(e){function t(t,n){return e.call(this,t,n)||this}return Y(t,e),t.prototype.execute=function(){var e,t,n,a,u,s,c,f,l,h,v,w,g,y,b,M,x=this,z=x.Mf,C=!1,H=z.parent,_=z,j=x.tT.url;if(p(j))return C;if(n=x.tT.target||0,a="sjs://",(u=null===(t=null===(e=H.docProps)||void 0===e?void 0:e.appDocProps)||void 0===t?void 0:t.hyperlinkBase)!==a||j.startsWith(u)||(j=u+j),0===j.indexOf(a)||"#"===j[0]){if(s=a.length,c="#"===j[0]?j.substr(1):j.substr(s),f=void 0,(f=(0,o.formulaToRanges)(z,c,0,0,!0))&&0===f.length&&(f=(0,o.formulaToRanges)(z,c,0,0,!1,!0)),f&&f.length>0){if(l=f[0].sheetName,h=f[0].ranges[0],l!==z.name()&&H.getSheetFromName(l).visible()===r.SheetTabVisible.visible){if(w={oldSheet:_,newSheet:v=H.getSheetFromName(l),cancel:!1},H.ki(r.Events.ActiveSheetChanging,w),w.cancel)return;H.setActiveSheet(l),g=H.getActiveSheetIndex(),H.w2.Tg(g),_!==(z=H.getActiveSheet())&&H.ki(r.Events.ActiveSheetChanged,{oldSheet:_,newSheet:z})}H.getSheetFromName(l).visible()===r.SheetTabVisible.visible&&(z.OA(h.row,h.col),z.setSelection(h.row,h.col,h.rowCount,h.colCount))}}else p(j)||(y="mailto:",j.match(I)&&j.match(I).length>0?m(j,b="www.")&&(j="http://"+j):j.match(V)&&j.match(V).length>0?m(j,y)||(j=y+j):u&&(j=me(u,j)),m(j,y)&&i.Common.zf.DU(j,"?")>1&&(M=j.split("?"),j=M[0]+"?"+M.slice(1).join("%3F")),k(d(j),["_blank","_self","_parent","_top"][n]));return C},t}(f),r.Commands[F]={canUndo:!1,execute:function(e,t,n){return r.Commands.zA(e,B,t,n)}},D=function(e){function t(t,n){return e.call(this,t,n)||this}return Y(t,e),t.prototype.execute=function(){var e,t,n=this,i=n.Mf,o=n.tT,a=o.url,u=o.row,s=o.col,c=o.sheetArea;if(null===a)e=null;else{if("string"!=typeof a)return!1;if((!(t=a.match(I))||t.length<1)&&(!(t=a.match(V))||t.length<1)&&(t=a.match(R)),!(t&&t.length>0&&0===a.indexOf(t[0])&&a.length===t[0].length))return!1;e={url:a,linkColor:T,visitedLinkColor:$}}return r.Commands.startTransaction(this.Mf.getParent(),this.tT),i.suspendPaint(),i.suspendEvent(),i.setHyperlink(u,s,e,c),i.resumeEvent(),i.resumePaint(),r.Commands.endTransaction(this.Mf.getParent(),this.tT),!0},t.prototype.undo=function(){var e,t=this,n=t.Mf;return n.suspendPaint(),n.suspendEvent(),e=r.Commands.TI(n.name()),n.Ut.undo(this.tT[e]),n.resumeEvent(),n.resumePaint(),!0},t}(f),r.Commands[G]={canUndo:!0,execute:function(e,t,n){return r.Commands.zA(e,D,t,n)}},J={init:function(){this.commandManager().register(F,r.Commands[F]),this.commandManager().register(G,r.Commands[G])}},r.Workbook.ch(E,J),K={setHyperlinkWhenEditing:function(e){var t=e.url,n=e.row,r=e.col,i=e.sheetArea,o=this,a=o.getParent();a.options.allowAutoCreateHyperlink&&a.commandManager().execute({cmd:G,sheetName:o.name(),url:t,row:n,col:r,sheetArea:i})}},r.Worksheet.ch(E,K),Q={applyHyperlinkStyle:function(e){var t=e.sheet,n=e.row,r=e.col,i=e.style,o=t.getHyperlink(n,r,e.sheetArea);!oe(i)&&ie(i,o)},getCellTextHitInfo:function(e){var t,n,r,i,o,a,u,s,c,f,l,h,d,v,w,g,y=e.context.sheetArea,k=e.cellStyle,m=e.context,b=m.sheet,M=m.row,x=m.col;ee(b,M,x,y)&&!oe(k)&&((n=e.cellRect)&&(r=b.C0(M),i=b.S0(x),o=b.Fi(),a=void 0,u=null===(t=b.Cb)||void 0===t?void 0:t.D7(M,x,y),s=void 0,c=void 0,f=b.frozenColumnCount(),l=b.frozenRowCount(),h=b.getRowCount()-b.frozenTrailingRowCount(),d=b.getColumnCount()-b.frozenTrailingColumnCount(),u&&(v=u.row+u.rowCount-1,w=u.col+u.colCount-1,c=u.row<l&&v>=l||u.row<h&&v>=h,s=u.col<f&&w>=f||u.col<d&&w>=d),b.getSpan(M,x,y)||!p(y)&&3!==y||u&&(c||s)?2!==y||u&&c?1!==y||u&&s||(a=o.L1(i)):a=o.B1(r):a=o.c9(r,i),a&&(n=n.getIntersectRect(a))),p(y)&&3!==y||!k||!n||(g=b.getText(M,x,y),e.paddingHitInfo={row:M,col:x,x:e.x,y:e.y,sheetArea:y,sheet:b,isFocusAware:!0,isReservedLocation:ye(e.x,e.y,k,n,m,g)}))},processMouseUpOnCellPadding:function(e){var t,n,i,o,a,u,s=e.sheet,c=e.cellStyle,f=e.row,l=e.col,h=e.sheetArea;s&&!s.isEditing()&&ee(s,f,l,h)&&!oe(c)&&e.isReservedLocation&&(t=s.Dg(),re(s),t&&(t.style.cursor=U),(n=s.Ut.getHyperlink(f,l,h)).isVisited=!0,i=n.command,p(i)||""===i||i===F?s.getParent().commandManager().execute({cmd:F,sheetName:s.name(),url:n.url,target:n.target}):"string"==typeof i?s.getParent().commandManager().execute({cmd:i,row:f,col:l,sheetName:s.name(),sheetArea:h}):"function"==typeof i&&i.call(w,s,f,l,h),o=s.getColumnCount(),a=new r.Range(f,-1,1,o),(u=s.j1(a,e.sheetArea)).y-=2,u.height+=4,s.repaint(u))},processMouseMoveOnCellPadding:function(e){var t,n,r=e.row,i=e.col,o=e.sheet,a=e.cellStyle,u=e.sheetArea;ee(o,r,i,u)&&!oe(a)&&(!o||o.isEditing()&&o.getActiveRowIndex()===r&&o.getActiveColumnIndex()===i||(t=o.Dg(),n=o.getHyperlink(r,i,u),e.isReservedLocation?t&&(ne(o,e,n.tooltip),t.style.cursor=q):(re(o),t&&(t.style.cursor=U))))},processMouseLeaveOnCellPadding:function(e){var t,n=e.sheet,r=e.row,i=e.col,o=e.sheetArea;re(n),ee(n,r,i,o)&&n&&(t=n.Dg())&&(t.style.cursor=U)},onUpdateContainer:function(e){var t=e.cellStyle,n=e.context.row,r=e.context.col,i=e.context.sheet.getHyperlink(n,r);!oe(t)&&ie(t,i)}},l.ch(E,Q),X={0:!0,1:!0,2:!0,3:!0,4:!0}},789:function(t){t.exports=e.Spread.Sheets.CalcEngine}},r={};function i(e){var t,o=r[e];return void 0!==o?o.exports:(t=r[e]={exports:{}},n[e].call(t.exports,t,t.exports,i),t.exports)}t=i(498),(((e=void 0===e?{}:e).Spread=e.Spread||{}).Sheets=e.Spread.Sheets||{}).Hyperlink=t}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapecity-software/spread-sheets-hyperlink",
3
- "version": "18.2.4",
3
+ "version": "19.0.0",
4
4
  "main": "index.js",
5
5
  "description":"SpreadJS sheets hyperlink module",
6
6
  "scripts": {},
@@ -16,10 +16,10 @@
16
16
  "spreadjs"
17
17
  ],
18
18
  "dependencies": {
19
- "@grapecity-software/spread-common": "18.2.4",
20
- "@grapecity-software/spread-calc-engine": "18.2.4",
21
- "@grapecity-software/spread-sheets-core": "18.2.4",
22
- "@grapecity-software/spread-sheets-calc-engine": "18.2.4"
19
+ "@grapecity-software/spread-common": "19.0.0",
20
+ "@grapecity-software/spread-calc-engine": "19.0.0",
21
+ "@grapecity-software/spread-sheets-core": "19.0.0",
22
+ "@grapecity-software/spread-sheets-calc-engine": "19.0.0"
23
23
  },
24
24
  "author": {
25
25
  "email": "info.xa@grapecity.com",