@revolist/revogrid 4.12.12 → 4.13.2
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.
- package/dist/cjs/{column.drag.plugin-0ce0b39a.js → column.drag.plugin-0f367fe1.js} +2 -1
- package/dist/cjs/column.drag.plugin-0f367fe1.js.map +1 -0
- package/dist/cjs/column.service-b59380a3.js.map +1 -1
- package/dist/cjs/{sorting.sign-a1e9d97a.js → grouping.row.renderer-d6119ced.js} +6 -6
- package/dist/cjs/grouping.row.renderer-d6119ced.js.map +1 -0
- package/dist/cjs/index.cjs.js +7 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +2 -2
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +5 -5
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +109 -197
- package/dist/collection/plugins/filter/filter.style.css +12 -25
- package/dist/collection/plugins/sorting/sorting.plugin.js +2 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
- package/dist/collection/store/selection/selection.store.js.map +1 -1
- package/dist/esm/{column.drag.plugin-017c4fb3.js → column.drag.plugin-d201beb7.js} +2 -2
- package/dist/esm/{column.drag.plugin-017c4fb3.js.map → column.drag.plugin-d201beb7.js.map} +1 -1
- package/dist/esm/column.service-f39c0a1d.js.map +1 -1
- package/dist/esm/{sorting.sign-c02e3b12.js → grouping.row.renderer-95f32c6b.js} +6 -6
- package/dist/esm/grouping.row.renderer-95f32c6b.js.map +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/revo-grid.entry.js +2 -2
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +1 -1
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/app-globals-6b929fd8.js +8 -1
- package/dist/revo-grid/app-globals-6b929fd8.js.map +1 -1
- package/dist/revo-grid/column.drag.plugin-d201beb7.js +2522 -0
- package/dist/revo-grid/column.drag.plugin-d201beb7.js.map +1 -0
- package/dist/revo-grid/column.service-f39c0a1d.js +1293 -1
- package/dist/revo-grid/column.service-f39c0a1d.js.map +1 -1
- package/dist/revo-grid/debounce-b3166f78.js +491 -1
- package/dist/revo-grid/debounce-b3166f78.js.map +1 -1
- package/dist/revo-grid/dimension.helpers-5567e424.js +3608 -1
- package/dist/revo-grid/dimension.helpers-5567e424.js.map +1 -1
- package/dist/revo-grid/edit.utils-b59306be.js +13 -1
- package/dist/revo-grid/edit.utils-b59306be.js.map +1 -1
- package/dist/revo-grid/events-cf0893a3.js +38 -1
- package/dist/revo-grid/events-cf0893a3.js.map +1 -1
- package/dist/revo-grid/filter.button-84396156.js +34 -1
- package/dist/revo-grid/filter.button-84396156.js.map +1 -1
- package/dist/revo-grid/grouping.row.renderer-95f32c6b.js +65 -0
- package/dist/revo-grid/grouping.row.renderer-95f32c6b.js.map +1 -0
- package/dist/revo-grid/header-cell-renderer-31f53644.js +335 -1
- package/dist/revo-grid/header-cell-renderer-31f53644.js.map +1 -1
- package/dist/revo-grid/index-f6fae858.js +2090 -2
- package/dist/revo-grid/index-f6fae858.js.map +1 -1
- package/dist/revo-grid/index.esm.js +160 -1
- package/dist/revo-grid/index.esm.js.map +1 -1
- package/dist/revo-grid/key.utils-3632161b.js +85 -1
- package/dist/revo-grid/key.utils-3632161b.js.map +1 -1
- package/dist/revo-grid/resize-observer-83c9e167.js +501 -1
- package/dist/revo-grid/resize-observer-83c9e167.js.map +1 -1
- package/dist/revo-grid/revo-grid.entry.js +1943 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.esm.js +21 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +1446 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +455 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +960 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +340 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/text-editor-e47e56c3.js +74 -1
- package/dist/revo-grid/text-editor-e47e56c3.js.map +1 -1
- package/dist/revo-grid/throttle-dec28f5b.js +229 -1
- package/dist/revo-grid/throttle-dec28f5b.js.map +1 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js +48 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -1
- package/dist/revo-grid/viewport.store-c18a25a6.js +402 -1
- package/dist/revo-grid/viewport.store-c18a25a6.js.map +1 -1
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +2 -0
- package/dist/types/store/selection/selection.store.d.ts +1 -1
- package/hydrate/index.js +7 -7
- package/hydrate/index.mjs +7 -7
- package/package.json +1 -1
- package/standalone/column.service.js.map +1 -1
- package/standalone/index.js +1 -1
- package/standalone/revo-grid.js +2 -2
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/dist/cjs/column.drag.plugin-0ce0b39a.js.map +0 -1
- package/dist/cjs/sorting.sign-a1e9d97a.js.map +0 -1
- package/dist/esm/sorting.sign-c02e3b12.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-017c4fb3.js +0 -5
- package/dist/revo-grid/column.drag.plugin-017c4fb3.js.map +0 -1
- package/dist/revo-grid/sorting.sign-c02e3b12.js +0 -5
- package/dist/revo-grid/sorting.sign-c02e3b12.js.map +0 -1
|
@@ -1,5 +1,1450 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,h as e,H as i,c as s,a as o}from"./index-f6fae858.js";import{b as r,j as n,k as l,J as a,U as h,u as c,R as d,L as u,K as g,S as p,D as f,A as v,o as b,T as L}from"./dimension.helpers-5567e424.js";import{g as C,v as x}from"./events-cf0893a3.js";import{g as w,M as m,x as y,N as k,a as E}from"./column.service-f39c0a1d.js";import{i as j}from"./edit.utils-b59306be.js";import{c as S,d as O,f as z,h as R,g as F,j as D,k as T}from"./key.utils-3632161b.js";import{d as M}from"./debounce-b3166f78.js";import{V as A,f as U}from"./viewport.store-c18a25a6.js";import{H as $}from"./viewport.helpers-7e7f9dad.js";import{L as _,a as B,g as P,t as Z}from"./throttle-dec28f5b.js";const H=class{constructor(e){t(this,e)}render(){return e(i,{key:"3d66475a019010c24b6c610ccc047e01c35178f9"},e("a",{key:"777afddffef0309a697b9c14ee73c0001ac22b71",href:"https://rv-grid.com/guide/attribution",target:"_blank",rel:"noopener noreferrer",title:"Made with ❤️ by Revolist OU Team",class:"value"},"RevoGrid"))}};const W=class{constructor(e){t(this,e);this.nodes=[];this.update=1}async refresh(){this.update*=-1}render(){var t;return(t=this.nodes)===null||t===void 0?void 0:t.map((t=>{if(typeof t==="function"){const i={};const s=()=>[t({refresh:()=>{var t;return(t=i.refresh)===null||t===void 0?void 0:t.call(i)}})];return e("revogr-extra",{nodes:s(),ref:t=>{if(t){i.refresh=()=>{t.nodes=s()}}}})}return t}))}};function I(t,e){const i={};for(let s in t){const t=parseInt(s,10);i[t]=r(e,t)}return i}function K(t,e){if(t.defaultPrevented){return null}const i=C(t,"clientX");const s=C(t,"clientY");if(i===null||s===null){return null}const o=X({x:i,y:s},e);if(Y(o,e.lastCell)){return null}return o}function X({x:t,y:e},{el:i,rows:s,cols:o}){const{top:r,left:l,height:a,width:h}=i.getBoundingClientRect();let c=e-r;let d=t-l;if(c>=a){c=a-1}if(d>=h){d=h-1}const u=n(s,c);const g=n(o,d);if(g.itemIndex<0){g.itemIndex=0}if(u.itemIndex<0){u.itemIndex=0}return{x:g.itemIndex,y:u.itemIndex}}function N(t,e,i,s=false){const o=(i,o=0)=>{const r={x:t.x,y:t.y};const n=s?{x:t.x1,y:t.y1}:r;const l=n[i]>e[i]?n:r;l[i]+=o;return{start:r,end:n}};if(i.x){return o("x",i["x"])}if(i.y){return o("y",i["y"])}return null}function Y({x:t,y:e},i){return t>=i.x||e>=i.y}function G({x:t,y:e}){return t<0||e<0}function J(t){return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function V({x:t,y:e,x1:i,y1:s},o,r){const n=l(o,e).start;const a=l(r,t).start;const h=l(o,s).end;const c=l(r,i).end;return{left:a,right:c,top:n,bottom:h,width:c-a,height:h-n}}const q=".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-focus.focused-cell{box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset;position:absolute;pointer-events:none;z-index:9;display:block !important}";const Q=q;const tt=class{constructor(e){t(this,e);this.beforeFocusRender=s(this,"beforefocusrender",7);this.beforeScrollIntoView=s(this,"beforescrollintoview",7);this.afterFocus=s(this,"afterfocus",7);this.activeFocus=null;this.colType=undefined;this.rowType=undefined;this.selectionStore=undefined;this.dimensionRow=undefined;this.dimensionCol=undefined;this.dataStore=undefined;this.colData=undefined;this.focusTemplate=null}componentDidRender(){var t,e;const i=this.selectionStore.get("focus");if(((t=this.activeFocus)===null||t===void 0?void 0:t.x)===(i===null||i===void 0?void 0:i.x)&&((e=this.activeFocus)===null||e===void 0?void 0:e.y)===(i===null||i===void 0?void 0:i.y)){return}this.activeFocus=i;if(i&&this.el){const t=this.beforeScrollIntoView.emit({el:this.el});if(!t.defaultPrevented){this.el.scrollIntoView({block:"nearest",inline:"nearest"})}const e=r(this.dataStore,i.y);const s=r(this.colData,i.x);this.afterFocus.emit({model:e,column:s,rowType:this.rowType,colType:this.colType,rowIndex:i.y,colIndex:i.x})}}render(){var t;const s=this.selectionStore.get("edit");if(s){return}const o=this.selectionStore.get("focus");if(!o){return}const r=this.beforeFocusRender.emit({range:Object.assign(Object.assign({},o),{x1:o.x,y1:o.y}),rowType:this.rowType,colType:this.colType,rowDimension:Object.assign({},this.dimensionRow.state),colDimension:Object.assign({},this.dimensionCol.state)});if(r.defaultPrevented){return e("slot",null)}const{detail:n}=r;const l=V(n.range,r.detail.rowDimension,r.detail.colDimension);const h=J(l);const c=(t=this.focusTemplate)===null||t===void 0?void 0:t.call(this,e,n);const d={class:{[a]:true},style:h};return e(i,Object.assign({},d),e("slot",null),c)}get el(){return o(this)}};tt.style=Q;const et=[h.TAB,h.ARROW_UP,h.ARROW_DOWN,h.ARROW_LEFT,h.ARROW_RIGHT];class it{constructor(t){this.sv=t}async keyDown(t,e,i,{range:s,focus:o}){if(i){switch(t.code){case h.ESCAPE:this.sv.cancel();break;case h.TAB:this.keyChangeSelection(t,e);break}return}if(s&&S(t.code)){this.sv.clearCell();return}if(!o){return}if(O(t.code)){this.keyChangeSelection(t,e);return}if(z(t.key)){this.sv.change();return}if(R(t)){return}if(F(t)){return}if(D(t)){this.sv.internalPaste();return}if(T(t)){if(e){this.selectAll(t)}return}if(t.key.length===1){this.sv.change(t.key);return}if(await this.keyChangeSelection(t,e)){return}}selectAll(t){const e=this.sv.selectionStore.get("range");const i=this.sv.selectionStore.get("focus");if(!e||!i){return}t.preventDefault();this.sv.selectAll()}async keyChangeSelection(t,e){const i=this.changeDirectionKey(t,e);if(!i){return false}await c(d+30);const s=this.sv.selectionStore.get("range");const o=this.sv.selectionStore.get("focus");return this.keyPositionChange(i.changes,s,o,i.isMulti)}keyPositionChange(t,e,i,s=false){if(!e||!i){return false}const o=N(e,i,t,s);if(!o){return false}const r=this.sv.getData();if(s){if(Y(o.end,r.lastCell)||G(o.start)){return false}const t=w(o.start,o.end);return this.sv.range(t)}return this.sv.focus(o.start,t,Y(o.start,r.lastCell)?1:G(o.start)?-1:0)}changeDirectionKey(t,e){const i=e&&t.shiftKey;if(et.includes(t.code)){t.preventDefault()}if(t.shiftKey){switch(t.code){case h.TAB:return{changes:{x:-1},isMulti:false}}}switch(t.code){case h.ARROW_UP:return{changes:{y:-1},isMulti:i};case h.ARROW_DOWN:return{changes:{y:1},isMulti:i};case h.ARROW_LEFT:return{changes:{x:-1},isMulti:i};case h.TAB:case h.ARROW_RIGHT:return{changes:{x:1},isMulti:i}}}}class st{constructor(t){this.sv=t;this.autoFillType=null;this.autoFillInitial=null;this.autoFillStart=null;this.autoFillLast=null}renderAutofill(t,i){let s;if(t){s=V(t,this.sv.dimensionRow.state,this.sv.dimensionCol.state)}else{s=V(Object.assign(Object.assign({},i),{x1:i.x,y1:i.y}),this.sv.dimensionRow.state,this.sv.dimensionCol.state)}return e("div",{class:{[u]:true,[g]:true},style:{left:`${s.right}px`,top:`${s.bottom}px`},onMouseDown:t=>this.autoFillHandler(t),onTouchStart:t=>this.autoFillHandler(t)})}autoFillHandler(t,e="AutoFill"){let i=null;if(t.target instanceof Element){i=t.target}if(!i){return}this.selectionStart(i,this.sv.getData(),e);t.preventDefault()}get isAutoFill(){return!!this.autoFillType}selectionMouseMove(t){if(!this.onMouseMoveAutofill){this.onMouseMoveAutofill=M(((t,e)=>this.doAutofillMouseMove(t,e)),5)}if(this.isAutoFill){this.onMouseMoveAutofill(t,this.sv.getData())}}getFocus(t,e){if(!t&&e){t={x:e.x,y:e.y}}return t||null}doAutofillMouseMove(t,e){if(!this.autoFillInitial){return}const i=C(t,"clientX",g);const s=C(t,"clientY",g);if(i===null||s===null){return}const o=X({x:i,y:s},e);if(!this.autoFillLast){if(!this.autoFillLast){this.autoFillLast=this.autoFillStart}}if(Y(o,e.lastCell)){return}this.autoFillLast=o;const r=o.x===this.autoFillInitial.x&&o.y===this.autoFillInitial.y;if(r){this.sv.setTempRange(null)}else{const t=w(this.autoFillInitial,this.autoFillLast);this.sv.setTempRange({area:t,type:this.autoFillType})}}selectionStart(t,e,i="Selection"){const{top:s,left:o}=t.getBoundingClientRect();this.autoFillInitial=this.getFocus(e.focus,e.range);this.autoFillType=i;this.autoFillStart=X({x:o,y:s},e)}clearAutoFillSelection(t,e){if(this.autoFillInitial){this.autoFillInitial=this.getFocus(t,e);if(this.autoFillType==="AutoFill"){const t=w(this.autoFillInitial,this.autoFillLast);if(t){const{defaultPrevented:i,detail:{range:s}}=this.sv.clearRangeDataApply({range:t});if(!i&&e){this.applyRangeWithData(s,e)}else{this.sv.setTempRange(null)}}}else{this.applyRangeOnly(this.autoFillInitial,this.autoFillLast)}}this.resetAutoFillState()}resetAutoFillState(){this.autoFillType=null;this.autoFillInitial=null;this.autoFillLast=null;this.autoFillStart=null}onRangeApply(t,e,i){this.sv.rangeDataApply({data:t,models:I(t,this.sv.dataStore),type:this.sv.dataStore.get("type"),oldRange:i,newRange:e});this.sv.setRange(e)}applyRangeWithData(t,e){const i={type:this.sv.dataStore.get("type"),colType:this.sv.columnService.type,newData:{},mapping:{},newRange:t,oldRange:e};const{mapping:s,changed:o}=this.sv.columnService.getRangeData(i,this.sv.columnService.columns);i.newData=o;i.mapping=s;let r=this.sv.selectionChanged(i);if(r.defaultPrevented){this.sv.setTempRange(null);return}r=this.sv.rangeCopy(i);if(r.defaultPrevented){this.sv.setRange(t);return}this.onRangeApply(i.newData,t,e)}applyRangeOnly(t,e){if(!t||!e){return}const i=w(t,e);this.sv.setRange(i)}}const ot=".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-overlay-selection{display:block;position:relative;width:100%}revogr-overlay-selection .autofill-handle{position:absolute;width:14px;height:14px;margin-left:-13px;margin-top:-13px;z-index:10;cursor:crosshair}revogr-overlay-selection .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:10px;height:10px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection.mobile .autofill-handle{position:absolute;width:30px;height:30px;margin-left:-29px;margin-top:-29px;z-index:10;cursor:crosshair}revogr-overlay-selection.mobile .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:12px;height:12px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9;box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset}revogr-overlay-selection .selection-border-range .range-handlers{height:100%;background-color:transparent;width:75%;max-width:50px;min-width:20px;left:50%;transform:translateX(-50%);position:absolute}revogr-overlay-selection .selection-border-range .range-handlers>span{pointer-events:auto;height:20px;width:20px;position:absolute;left:50%;transform:translateX(-50%)}revogr-overlay-selection .selection-border-range .range-handlers>span:before,revogr-overlay-selection .selection-border-range .range-handlers>span:after{position:absolute;border-radius:5px;width:15px;height:5px;left:50%;transform:translateX(-50%);background-color:rgba(0, 0, 0, 0.2)}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child{top:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child:before{content:\"\";top:0}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child{bottom:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child:after{content:\"\";bottom:0}revogr-overlay-selection revogr-edit{z-index:10}";const rt=ot;const nt=class{constructor(e){t(this,e);this.beforeCopyRegion=s(this,"beforecopyregion",7);this.beforeRegionPaste=s(this,"beforepasteregion",7);this.cellEditApply=s(this,"celleditapply",7);this.beforeFocusCell=s(this,"beforecellfocusinit",7);this.beforeNextViewportFocus=s(this,"beforenextvpfocus",7);this.setEdit=s(this,"setedit",7);this.beforeApplyRange=s(this,"beforeapplyrange",7);this.beforeSetRange=s(this,"beforesetrange",7);this.setRange=s(this,"setrange",7);this.beforeEditRender=s(this,"beforeeditrender",7);this.selectAll=s(this,"selectall",7);this.cancelEdit=s(this,"canceledit",7);this.setTempRange=s(this,"settemprange",7);this.beforeSetTempRange=s(this,"beforesettemprange",7);this.applyFocus=s(this,"applyfocus",7);this.focusCell=s(this,"focuscell",7);this.beforeRangeDataApply=s(this,"beforerangedataapply",7);this.selectionChange=s(this,"selectionchangeinit",7);this.beforeRangeCopyApply=s(this,"beforerangecopyapply",7);this.rangeEditApply=s(this,"rangeeditapply",7);this.rangeClipboardCopy=s(this,"clipboardrangecopy",7);this.rangeClipboardPaste=s(this,"clipboardrangepaste",7);this.beforeKeyDown=s(this,"beforekeydown",7);this.beforeKeyUp=s(this,"beforekeyup",7);this.beforeCellSave=s(this,"beforecellsave",7);this.keyboardService=null;this.autoFillService=null;this.unsubscribeSelectionStore=[];this.readonly=undefined;this.range=undefined;this.canDrag=undefined;this.useClipboard=undefined;this.selectionStore=undefined;this.dimensionRow=undefined;this.dimensionCol=undefined;this.dataStore=undefined;this.colData=undefined;this.lastCell=undefined;this.editors=undefined;this.applyChangesOnClose=false;this.additionalData=undefined;this.isMobileDevice=undefined}onMouseMove(t){var e;if(this.selectionStore.get("focus")){(e=this.autoFillService)===null||e===void 0?void 0:e.selectionMouseMove(t)}}onMouseUp(){var t;(t=this.autoFillService)===null||t===void 0?void 0:t.clearAutoFillSelection(this.selectionStore.get("focus"),this.selectionStore.get("range"))}onCellDrag(t){var e;(e=this.orderEditor)===null||e===void 0?void 0:e.dragStart(t.detail)}onKeyUp(t){this.beforeKeyUp.emit(Object.assign({original:t},this.getData()))}onKeyDown(t){var e;const i=this.beforeKeyDown.emit(Object.assign({original:t},this.getData()));if(t.defaultPrevented||i.defaultPrevented){return}(e=this.keyboardService)===null||e===void 0?void 0:e.keyDown(t,this.range,!!this.selectionStore.get("edit"),{focus:this.selectionStore.get("focus"),range:this.selectionStore.get("range")})}selectionServiceSet(t){this.unsubscribeSelectionStore.forEach((t=>t()));this.unsubscribeSelectionStore.length=0;this.unsubscribeSelectionStore.push(t.onChange("nextFocus",(t=>t&&this.doFocus(t,t))));this.keyboardService=new it({selectionStore:t,range:t=>!!t&&this.triggerRangeEvent(t),focus:(t,e,i)=>{if(i){this.beforeNextViewportFocus.emit(t);return false}else{return this.doFocus(t,t,e)}},change:t=>{if(this.readonly){return}this.doEdit(t)},cancel:async()=>{var t;await((t=this.revogrEdit)===null||t===void 0?void 0:t.cancelChanges());this.closeEdit()},clearCell:()=>!this.readonly&&this.clearCell(),internalPaste:()=>!this.readonly&&this.beforeRegionPaste.emit(),getData:()=>this.getData(),selectAll:()=>this.selectAll.emit()});this.createAutoFillService()}createAutoFillService(){this.autoFillService=new st({dimensionRow:this.dimensionRow,dimensionCol:this.dimensionCol,columnService:this.columnService,dataStore:this.dataStore,clearRangeDataApply:t=>this.beforeRangeDataApply.emit(Object.assign(Object.assign(Object.assign({},t),this.types),{rowDimension:Object.assign({},this.dimensionRow.state),colDimension:Object.assign({},this.dimensionCol.state)})),setTempRange:t=>{const e=this.beforeSetTempRange.emit(Object.assign(Object.assign({tempRange:t},this.getData()),this.types));if(e.defaultPrevented){return null}return this.setTempRange.emit(e.detail.tempRange)},selectionChanged:t=>this.selectionChange.emit(t),rangeCopy:t=>this.beforeRangeCopyApply.emit(t),rangeDataApply:t=>this.rangeEditApply.emit(t),setRange:t=>!!t&&this.triggerRangeEvent(t),getData:()=>this.getData()})}columnServiceSet(){var t;(t=this.columnService)===null||t===void 0?void 0:t.destroy();this.columnService=new m(this.dataStore,this.colData);this.createAutoFillService()}connectedCallback(){this.columnServiceSet();this.selectionServiceSet(this.selectionStore)}disconnectedCallback(){var t;this.unsubscribeSelectionStore.forEach((t=>t()));this.unsubscribeSelectionStore.length=0;(t=this.columnService)===null||t===void 0?void 0:t.destroy()}async componentWillRender(){var t,e;const i=this.selectionStore.get("edit");if(!i){await((e=(t=this.revogrEdit)===null||t===void 0?void 0:t.beforeDisconnect)===null||e===void 0?void 0:e.call(t))}}renderRange(t){const i=V(t,this.dimensionRow.state,this.dimensionCol.state);const s=J(i);return[e("div",{class:p,style:s},this.isMobileDevice&&e("div",{class:"range-handlers"},e("span",{class:g}),e("span",{class:g})))]}renderEditor(){const t=this.selectionStore.get("edit");if(this.readonly||!t){return null}const i=t.val||y(this.columnService.rowDataModel(t.y,t.x).value);const s=Object.assign(Object.assign({},t),this.columnService.getSaveData(t.y,t.x,i));const o=this.beforeEditRender.emit(Object.assign(Object.assign({range:Object.assign(Object.assign({},t),{x1:t.x,y1:t.y})},this.types),{rowDimension:Object.assign({},this.dimensionRow.state),colDimension:Object.assign({},this.dimensionCol.state)}));if(o.defaultPrevented){return null}const r=V(o.detail.range,o.detail.rowDimension,o.detail.colDimension);const n=J(r);return e("revogr-edit",{style:n,ref:t=>this.revogrEdit=t,additionalData:this.additionalData,editCell:s,saveOnClose:this.applyChangesOnClose,column:this.columnService.rowDataModel(t.y,t.x),editor:k(this.columnService.columns[t.x],this.editors)})}render(){var t;const s=[];const o=this.renderEditor();if(o){s.push(o)}else{const i=this.selectionStore.get("range");const o=this.selectionStore.get("focus");if((i||o)&&this.useClipboard){s.push(e("revogr-clipboard",{readonly:this.readonly,onCopyregion:t=>this.onCopy(t.detail),onClearregion:()=>!this.readonly&&this.clearCell(),ref:t=>this.clipboard=t,onPasteregion:t=>this.onPaste(t.detail)}))}if(i){s.push(...this.renderRange(i))}if(o&&!this.readonly&&this.range){s.push((t=this.autoFillService)===null||t===void 0?void 0:t.renderAutofill(i,o))}if(this.canDrag){s.push(e("revogr-order-editor",{ref:t=>this.orderEditor=t,dataStore:this.dataStore,dimensionRow:this.dimensionRow,dimensionCol:this.dimensionCol,parent:this.element,rowType:this.types.rowType,onRowdragstartinit:t=>this.rowDragStart(t)}))}}return e(i,{key:"4beb16eb1cfe23899d054adbd52b46120aad5ba6",class:{mobile:this.isMobileDevice},onDblClick:t=>this.onElementDblClick(t),onMouseDown:t=>this.onElementMouseDown(t),onTouchStart:t=>this.onElementMouseDown(t,true),onCloseedit:t=>this.closeEdit(t),onCelledit:t=>{const e=this.beforeCellSave.emit(t.detail);if(!e.defaultPrevented){this.cellEdit(e.detail)}if(!e.detail.preventFocus){this.focusNext()}}},s,e("slot",{key:"693c50627eb52b9902d9fe5ddd0c09fd2a3ee562",name:"data"}))}doFocus(t,e,i){const{defaultPrevented:s}=this.beforeFocusCell.emit(this.columnService.getSaveData(t.y,t.x));if(s){return false}const o=Object.assign(Object.assign({range:Object.assign(Object.assign({},t),{x1:e.x,y1:e.y}),next:i},this.types),{rowDimension:Object.assign({},this.dimensionRow.state),colDimension:Object.assign({},this.dimensionCol.state)});const r=this.applyFocus.emit(o);if(r.defaultPrevented){return false}const{range:n}=r.detail;return!this.focusCell.emit(Object.assign({focus:{x:n.x,y:n.y},end:{x:n.x1,y:n.y1}},r.detail)).defaultPrevented}triggerRangeEvent(t){const e=this.types.rowType;const i=this.beforeApplyRange.emit(Object.assign(Object.assign({range:Object.assign({},t)},this.types),{rowDimension:Object.assign({},this.dimensionRow.state),colDimension:Object.assign({},this.dimensionCol.state)}));if(i.defaultPrevented){return false}const s=this.columnService.getRangeTransformedToProps(i.detail.range,this.dataStore);let o=this.beforeSetRange.emit(s);if(o.defaultPrevented){return false}o=this.setRange.emit(Object.assign(Object.assign({},i.detail.range),{type:e}));if(o.defaultPrevented){return false}return!o.defaultPrevented}onElementDblClick(t){if(t.defaultPrevented){return}const e=this.getData();const i=K(t,e);if(!i){return}this.doEdit()}onElementMouseDown(t,e=false){var i;const s=t.target;if(j(s)||t.defaultPrevented){return}const o=this.getData();const r=K(t,o);if(!r){return}this.focus(r,this.range&&t.shiftKey);if(this.range){s&&((i=this.autoFillService)===null||i===void 0?void 0:i.selectionStart(s,this.getData()));if(!e){t.preventDefault()}else if(x(t.touches[0],g)){t.preventDefault()}}}doEdit(t=""){var e;if(this.canEdit()){const i=this.selectionStore.get("focus");if(!i){return}const s=this.columnService.getSaveData(i.y,i.x);(e=this.setEdit)===null||e===void 0?void 0:e.emit(Object.assign(Object.assign({},s),{val:t}))}}async closeEdit(t){this.cancelEdit.emit();if(t===null||t===void 0?void 0:t.detail){await this.focusNext()}}cellEdit(t){const e=this.columnService.getSaveData(t.rgRow,t.rgCol,t.val);this.cellEditApply.emit(e)}getRegion(){const t=this.selectionStore.get("focus");let e=this.selectionStore.get("range");if(!e){e=w(t,t)}return e}onCopy(t){var e;const i=this.getRegion();const s=this.beforeCopyRegion.emit(i);if(s.defaultPrevented){return false}let o;if(i){const{data:t,mapping:e}=this.columnService.copyRangeArray(i,this.dataStore);const s=this.rangeClipboardCopy.emit(Object.assign({range:i,data:t,mapping:e},this.types));if(!s.defaultPrevented){o=s.detail.data}}(e=this.clipboard)===null||e===void 0?void 0:e.doCopy(t,o);return true}onPaste(t){var e;const i=this.selectionStore.get("focus");const s=this.selectionStore.get("edit")!==null;if(!i||s){return}let{changed:o,range:r}=this.columnService.getTransformedDataToApply(i,t);const{defaultPrevented:n}=this.rangeClipboardPaste.emit(Object.assign({data:o,models:I(o,this.dataStore),range:r},this.types));if(n){return}(e=this.autoFillService)===null||e===void 0?void 0:e.onRangeApply(o,r,r)}async focusNext(){var t;const e=await((t=this.keyboardService)===null||t===void 0?void 0:t.keyChangeSelection(new KeyboardEvent("keydown",{code:h.ARROW_DOWN}),this.range));if(!e){this.closeEdit()}}clearCell(){var t;const e=this.selectionStore.get("range");if(e&&!E(e)){const i=this.columnService.getRangeStaticData(e,"");(t=this.autoFillService)===null||t===void 0?void 0:t.onRangeApply(i,e,e)}else if(this.canEdit()){const t=this.selectionStore.get("focus");if(!t){return}const e=this.columnService.getSaveData(t.y,t.x);this.cellEdit({rgRow:t.y,rgCol:t.x,val:"",type:e.type,prop:e.prop})}}rowDragStart({detail:t}){t.text=y(this.columnService.rowDataModel(t.cell.y,t.cell.x).value)}canEdit(){var t;if(this.readonly){return false}const e=this.selectionStore.get("focus");return e&&!((t=this.columnService)===null||t===void 0?void 0:t.isReadOnly(e.y,e.x))}get edited(){return this.selectionStore.get("edit")}focus(t,e=false){if(!t)return false;const i=t;const s=this.selectionStore.get("focus");if(e&&s){const t=w(s,i);if(t){return this.triggerRangeEvent(t)}}return this.doFocus(t,i)}get types(){return{rowType:this.dataStore.get("type"),colType:this.columnService.type}}getData(){return{el:this.element,rows:this.dimensionRow.state,cols:this.dimensionCol.state,lastCell:this.lastCell,focus:this.selectionStore.get("focus"),range:this.selectionStore.get("range"),edit:this.selectionStore.get("edit")}}get element(){return o(this)}static get watchers(){return{selectionStore:["selectionServiceSet"],dimensionRow:["createAutoFillService"],dimensionCol:["createAutoFillService"],dataStore:["columnServiceSet"],colData:["columnServiceSet"]}}};nt.style=rt;const lt=t=>(e,{rowIndex:i})=>t+i;const at=class{constructor(e){t(this,e);this.scrollViewport=s(this,"scrollview",3);this.elementToScroll=s(this,"ref",3);this.height=undefined;this.dataPorts=undefined;this.headerProp=undefined;this.rowClass=undefined;this.resize=undefined;this.rowHeaderColumn=undefined;this.additionalData=undefined;this.jobsBeforeRender=[]}render(){const t=[];const s=new A("colPinStart");let o=1;for(let i of this.dataPorts){const r=i.dataStore.get("items").length;const n=new f(i.type,Object.assign({},i.dataStore.state));const l=new f("colPinStart");const a=Object.assign({cellTemplate:lt(o)},this.rowHeaderColumn);l.updateData([a]);t.push(e("revogr-data",Object.assign({},i,{colType:"rowHeaders",jobsBeforeRender:this.jobsBeforeRender,rowClass:this.rowClass,dataStore:n.store,colData:l.store,viewportCol:s.store,readonly:true,range:false})));o+=r}const r=U(o,this.rowHeaderColumn);s.setViewport({realCount:1,virtualSize:0,items:[{size:r,start:0,end:r,itemIndex:0}]});const n={contentHeight:this.height,contentWidth:0,style:{minWidth:`${r}px`},colType:"rowHeaders",ref:t=>this.elementToScroll.emit(t),onScrollviewport:t=>this.scrollViewport.emit(t.detail)};const l=Object.assign(Object.assign({},this.headerProp),{colData:typeof this.rowHeaderColumn==="object"?[this.rowHeaderColumn]:[],viewportCol:s.store,canResize:false,type:v,slot:$});return e(i,{class:{[v]:true},key:v},e("revogr-viewport-scroll",Object.assign({key:"addb87ab3406b5691cecf810119582bda3a4b4a2"},n,{"row-header":true}),e("revogr-header",Object.assign({key:"8621e76b132e7d1507794b515b40f525577413e2"},l)),t))}};class ht{constructor(t){this.element=t;this.autohideScrollTimeout=0}setScrollSize(t){if(!t){this.element.setAttribute("autohide","true")}else{this.element.removeAttribute("autohide")}}checkScroll({scrollSize:t,contentSize:e,virtualSize:i}){const s=e>i;const o=!t&&s;if(o){this.element.setAttribute("visible","true");this.autohideScrollTimeout=this.show(this.element,this.autohideScrollTimeout)}}show(t,e){clearTimeout(e);return Number(setTimeout((()=>{t===null||t===void 0?void 0:t.removeAttribute("visible")}),1e3))}clear(){clearTimeout(this.autohideScrollTimeout)}}const ct=".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-scroll-virtual[autohide]{position:absolute;z-index:100 !important}revogr-scroll-virtual[autohide].vertical{top:0;right:0}revogr-scroll-virtual[autohide].vertical[visible]{min-width:20px !important}revogr-scroll-virtual[autohide].horizontal{bottom:0;left:0}revogr-scroll-virtual[autohide].horizontal[visible]{min-height:20px !important}revogr-scroll-virtual.vertical{overflow-y:auto;overflow-x:hidden;height:100%}revogr-scroll-virtual.vertical>div{width:1px}revogr-scroll-virtual.horizontal{overflow-x:auto;overflow-y:hidden;width:100%}revogr-scroll-virtual.horizontal>div{height:1px}";const dt=ct;const ut=class{constructor(e){t(this,e);this.scrollVirtual=s(this,"scrollvirtual",7);this.scrollSize=0;this.dimension="rgRow";this.viewportStore=undefined;this.dimensionStore=undefined}async setScroll(t){var e;if(this.dimension!==t.dimension){return}this.localScrollTimer.latestScrollUpdate(t.dimension);(e=this.localScrollService)===null||e===void 0?void 0:e.setScroll(t);if(t.coordinate){this.autohideScrollPlugin.checkScroll({scrollSize:this.scrollSize,contentSize:this.dimensionStore.get("realSize"),virtualSize:this.viewportStore.get("virtualSize")})}}async changeScroll(t){if(t.delta){switch(t.dimension){case"rgCol":t.coordinate=this.element.scrollLeft+t.delta;break;case"rgRow":t.coordinate=this.element.scrollTop+t.delta;break}this.setScroll(t)}return t}set size(t){this.autohideScrollPlugin.setScrollSize(t);if(this.dimension==="rgRow"){this.element.style.minWidth=`${t}px`;return}this.element.style.minHeight=`${t}px`}get size(){if(this.dimension==="rgRow"){return this.element.clientHeight}return this.element.clientWidth}connectedCallback(){this.autohideScrollPlugin=new ht(this.element);this.localScrollTimer=new _("ontouchstart"in document.documentElement?0:10);this.localScrollService=new B({runScroll:t=>this.scrollVirtual.emit(t),applyScroll:t=>{this.localScrollTimer.setCoordinate(t);const e=t.dimension==="rgRow"?"scrollTop":"scrollLeft";this.element[e]=t.coordinate}})}disconnectedCallback(){this.autohideScrollPlugin.clear()}componentWillLoad(){this.scrollSize=b(document)}componentDidRender(){const t=this.dimension==="rgRow"?"scrollHeight":"scrollWidth";const e=this.scrollSize;const i=this.element[t]>this.size+e;this.size=i?this.scrollSize:0;let s=0;if(this.dimension==="rgRow"){s=this.element.scrollWidth>this.element.clientWidth?e:0}else{s=this.element.scrollHeight>this.element.clientHeight?e:0}const o=this.size+s;this.localScrollService.setParams({contentSize:this.dimensionStore.get("realSize"),clientSize:o,virtualSize:this.viewportStore.get("clientSize")},this.dimension)}onScroll(t){var e;if(!(t.target instanceof Element)){return}const i=t.target;let s="scrollLeft";if(this.dimension==="rgRow"){s="scrollTop"}if(this.localScrollTimer.isReady(this.dimension,i[s]||0)){(e=this.localScrollService)===null||e===void 0?void 0:e.scroll(i[s]||0,this.dimension)}}render(){const t=this.dimension==="rgRow"?"height":"width";const s=P(this.dimensionStore.get("realSize"),this.size,this.viewportStore.get("clientSize"));return e(i,{key:"7789bd408d3e154836bcd2aed4ebaa1663e7f968",onScroll:t=>this.onScroll(t)},e("div",{key:"40549da97df3a580ad2ddef13fe7b4dbe6df54bc",style:{[t]:`${s}px`}}))}get element(){return o(this)}};ut.style=dt;const gt=".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}.temp-bg-range{display:block !important;position:absolute;pointer-events:none;z-index:9;border:1px solid rgb(255, 94, 0);box-sizing:border-box}.temp-bg-range.Selection{border:1px dashed gray}.temp-bg-range>div{width:1px;height:1px;position:absolute}.temp-bg-range>div.top{top:-1px}.temp-bg-range>div.bottom{bottom:-1px}.temp-bg-range>div.left{left:-1px}.temp-bg-range>div.right{right:-1px}";const pt=gt;const ft=class{constructor(e){t(this,e);this.onChange=Z((t=>this.doChange(t)),300);this.selectionStore=undefined;this.dimensionRow=undefined;this.dimensionCol=undefined}doChange(t){t===null||t===void 0?void 0:t.scrollIntoView({block:"nearest",inline:"nearest"})}componentDidRender(){if(this.el){this.onChange(this.el)}}render(){const t=this.selectionStore.get("tempRange");const s=this.selectionStore.get("tempRangeType");if(!t){return}let o="bottom";let r="right";const n=this.getRange();if(!n){return}if(t.y<n.y){o="top"}if(t.x<n.x){r="left"}const l=`${r} ${o}`;const a=V(t,this.dimensionRow.state,this.dimensionCol.state);const h=J(a);const c={class:{[L]:true,[s||""]:true},style:h,hidden:false};return e(i,Object.assign({},c),e("div",{class:l,ref:t=>this.el=t}))}getRange(){const t=this.selectionStore.get("range");if(t){return t}const e=this.selectionStore.get("focus");if(!e){return null}return Object.assign(Object.assign({},e),{x1:e.x,y1:e.y})}};ft.style=pt;export{H as revogr_attribution,W as revogr_extra,tt as revogr_focus,nt as revogr_overlay_selection,at as revogr_row_headers,ut as revogr_scroll_virtual,ft as revogr_temp_range};
|
|
4
|
+
import { r as registerInstance, h, H as Host, c as createEvent, a as getElement } from './index-f6fae858.js';
|
|
5
|
+
import { b as getSourceItem, j as getItemByPosition, k as getItemByIndex, J as FOCUS_CLASS, U as codesLetter, u as timeout, R as RESIZE_INTERVAL, L as CELL_HANDLER_CLASS, K as MOBILE_CLASS, S as SELECTION_BORDER_CLASS, D as DataStore, A as ROW_HEADER_TYPE, o as getScrollbarSize, T as TMP_SELECTION_BG_CLASS } from './dimension.helpers-5567e424.js';
|
|
6
|
+
import { g as getPropertyFromEvent, v as verifyTouchTarget } from './events-cf0893a3.js';
|
|
7
|
+
import { g as getRange, M as ColumnService, x as getCellData, N as getCellEditor, a as isRangeSingleCell } from './column.service-f39c0a1d.js';
|
|
8
|
+
import { i as isEditInput } from './edit.utils-b59306be.js';
|
|
9
|
+
import { c as isClear, d as isTab, f as isEnterKeyValue, h as isCopy, g as isCut, j as isPaste, k as isAll } from './key.utils-3632161b.js';
|
|
10
|
+
import { d as debounce } from './debounce-b3166f78.js';
|
|
11
|
+
import { V as ViewportStore, f as calculateRowHeaderSize } from './viewport.store-c18a25a6.js';
|
|
12
|
+
import { H as HEADER_SLOT } from './viewport.helpers-7e7f9dad.js';
|
|
13
|
+
import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-dec28f5b.js';
|
|
14
|
+
|
|
15
|
+
const Attribution = class {
|
|
16
|
+
constructor(hostRef) {
|
|
17
|
+
registerInstance(this, hostRef);
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
return (h(Host, { key: '3d66475a019010c24b6c610ccc047e01c35178f9' }, h("a", { key: '777afddffef0309a697b9c14ee73c0001ac22b71', href: "https://rv-grid.com/guide/attribution", target: "_blank", rel: "noopener noreferrer", title: "Made with \u2764\uFE0F by Revolist OU Team", class: "value" }, "RevoGrid")));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const RevoGridExtra = class {
|
|
25
|
+
constructor(hostRef) {
|
|
26
|
+
registerInstance(this, hostRef);
|
|
27
|
+
this.nodes = [];
|
|
28
|
+
this.update = 1;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Refreshes the extra component. Useful if you want to manually
|
|
32
|
+
* force the component to re-render.
|
|
33
|
+
*/
|
|
34
|
+
async refresh() {
|
|
35
|
+
this.update *= -1;
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = this.nodes) === null || _a === void 0 ? void 0 : _a.map(node => {
|
|
40
|
+
// Check if node is a function or a stencil component
|
|
41
|
+
// If function wrap it in a stencil component with the refresh function
|
|
42
|
+
if (typeof node === 'function') {
|
|
43
|
+
const config = {};
|
|
44
|
+
const getNodes = () => [node({ refresh: () => { var _a; return (_a = config.refresh) === null || _a === void 0 ? void 0 : _a.call(config); } })];
|
|
45
|
+
return (h("revogr-extra", { nodes: getNodes(), ref: (el) => {
|
|
46
|
+
if (el) {
|
|
47
|
+
// Update exclusively for current node
|
|
48
|
+
config.refresh = () => {
|
|
49
|
+
el.nodes = getNodes();
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
} }));
|
|
53
|
+
}
|
|
54
|
+
return node;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function collectModelsOfRange(data, store) {
|
|
60
|
+
const models = {};
|
|
61
|
+
for (let i in data) {
|
|
62
|
+
const rowIndex = parseInt(i, 10);
|
|
63
|
+
models[rowIndex] = getSourceItem(store, rowIndex);
|
|
64
|
+
}
|
|
65
|
+
return models;
|
|
66
|
+
}
|
|
67
|
+
function getFocusCellBasedOnEvent(e, data) {
|
|
68
|
+
// If event default is prevented, return
|
|
69
|
+
if (e.defaultPrevented) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
// Get coordinates from event object
|
|
73
|
+
const x = getPropertyFromEvent(e, 'clientX');
|
|
74
|
+
const y = getPropertyFromEvent(e, 'clientY');
|
|
75
|
+
// If coordinates are not available, return
|
|
76
|
+
if (x === null || y === null) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
// Get current cell based on coordinates and data
|
|
80
|
+
const focusCell = getCurrentCell({ x, y }, data);
|
|
81
|
+
// If current cell is not available, return
|
|
82
|
+
if (isAfterLast(focusCell, data.lastCell)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return focusCell;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Calculate cell based on x, y position
|
|
89
|
+
*/
|
|
90
|
+
function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
91
|
+
// Get the bounding rectangle of the element
|
|
92
|
+
const { top, left, height, width } = el.getBoundingClientRect();
|
|
93
|
+
// Calculate the cell position relative to the element
|
|
94
|
+
let cellY = y - top;
|
|
95
|
+
let cellX = x - left;
|
|
96
|
+
// Limit the cell position to the element height
|
|
97
|
+
if (cellY >= height) {
|
|
98
|
+
cellY = height - 1;
|
|
99
|
+
}
|
|
100
|
+
// Limit the cell position to the element width
|
|
101
|
+
if (cellX >= width) {
|
|
102
|
+
cellX = width - 1;
|
|
103
|
+
}
|
|
104
|
+
// Get the row and column items based on the cell position
|
|
105
|
+
const rgRow = getItemByPosition(rows, cellY);
|
|
106
|
+
const rgCol = getItemByPosition(cols, cellX);
|
|
107
|
+
// Set the row and column index to 0 if they are before the first item
|
|
108
|
+
if (rgCol.itemIndex < 0) {
|
|
109
|
+
rgCol.itemIndex = 0;
|
|
110
|
+
}
|
|
111
|
+
if (rgRow.itemIndex < 0) {
|
|
112
|
+
rgRow.itemIndex = 0;
|
|
113
|
+
}
|
|
114
|
+
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
115
|
+
}
|
|
116
|
+
function getCoordinate(range, focus, changes, isMulti = false) {
|
|
117
|
+
const updateCoordinate = (c, pos = 0) => {
|
|
118
|
+
const start = { x: range.x, y: range.y };
|
|
119
|
+
const end = isMulti ? { x: range.x1, y: range.y1 } : start;
|
|
120
|
+
const point = end[c] > focus[c] ? end : start;
|
|
121
|
+
point[c] += pos;
|
|
122
|
+
return { start, end };
|
|
123
|
+
};
|
|
124
|
+
if (changes.x) {
|
|
125
|
+
return updateCoordinate('x', changes['x']);
|
|
126
|
+
}
|
|
127
|
+
if (changes.y) {
|
|
128
|
+
return updateCoordinate('y', changes['y']);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if the x coordinate of the cell position is after or equal to the x coordinate of the last cell position
|
|
134
|
+
* or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
|
|
135
|
+
*/
|
|
136
|
+
function isAfterLast({ x, y }, lastCell) {
|
|
137
|
+
return x >= lastCell.x || y >= lastCell.y;
|
|
138
|
+
}
|
|
139
|
+
/** check if out of range */
|
|
140
|
+
function isBeforeFirst({ x, y }) {
|
|
141
|
+
return x < 0 || y < 0;
|
|
142
|
+
}
|
|
143
|
+
/** Compare cells, only 1 coordinate difference is possible */
|
|
144
|
+
// export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
145
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
146
|
+
// for (let k of c) {
|
|
147
|
+
// if (initial[k] !== last[k]) {
|
|
148
|
+
// return { [k]: 1 };
|
|
149
|
+
// }
|
|
150
|
+
// }
|
|
151
|
+
// return null;
|
|
152
|
+
// }
|
|
153
|
+
// export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
154
|
+
// const cell: Partial<Cell> = {};
|
|
155
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
156
|
+
// for (let k of c) {
|
|
157
|
+
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
158
|
+
// }
|
|
159
|
+
// if (cell.x > cell.y) {
|
|
160
|
+
// return { x: 1 };
|
|
161
|
+
// }
|
|
162
|
+
// if (cell.y > cell.x) {
|
|
163
|
+
// return { y: 1 };
|
|
164
|
+
// }
|
|
165
|
+
// return null;
|
|
166
|
+
// }
|
|
167
|
+
function styleByCellProps(styles) {
|
|
168
|
+
return {
|
|
169
|
+
left: `${styles.left}px`,
|
|
170
|
+
top: `${styles.top}px`,
|
|
171
|
+
width: `${styles.width}px`,
|
|
172
|
+
height: `${styles.height}px`,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
176
|
+
const top = getItemByIndex(dimensionRow, y).start;
|
|
177
|
+
const left = getItemByIndex(dimensionCol, x).start;
|
|
178
|
+
const bottom = getItemByIndex(dimensionRow, y1).end;
|
|
179
|
+
const right = getItemByIndex(dimensionCol, x1).end;
|
|
180
|
+
return {
|
|
181
|
+
left,
|
|
182
|
+
right,
|
|
183
|
+
top,
|
|
184
|
+
bottom,
|
|
185
|
+
width: right - left,
|
|
186
|
+
height: bottom - top,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const revogrFocusStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-focus.focused-cell{box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset;position:absolute;pointer-events:none;z-index:9;display:block !important}";
|
|
191
|
+
const RevogrFocusStyle0 = revogrFocusStyleCss;
|
|
192
|
+
|
|
193
|
+
const RevogrFocus$1 = class {
|
|
194
|
+
constructor(hostRef) {
|
|
195
|
+
registerInstance(this, hostRef);
|
|
196
|
+
this.beforeFocusRender = createEvent(this, "beforefocusrender", 7);
|
|
197
|
+
this.beforeScrollIntoView = createEvent(this, "beforescrollintoview", 7);
|
|
198
|
+
this.afterFocus = createEvent(this, "afterfocus", 7);
|
|
199
|
+
this.activeFocus = null;
|
|
200
|
+
this.colType = undefined;
|
|
201
|
+
this.rowType = undefined;
|
|
202
|
+
this.selectionStore = undefined;
|
|
203
|
+
this.dimensionRow = undefined;
|
|
204
|
+
this.dimensionCol = undefined;
|
|
205
|
+
this.dataStore = undefined;
|
|
206
|
+
this.colData = undefined;
|
|
207
|
+
this.focusTemplate = null;
|
|
208
|
+
}
|
|
209
|
+
componentDidRender() {
|
|
210
|
+
var _a, _b;
|
|
211
|
+
const currentFocus = this.selectionStore.get('focus');
|
|
212
|
+
if (((_a = this.activeFocus) === null || _a === void 0 ? void 0 : _a.x) === (currentFocus === null || currentFocus === void 0 ? void 0 : currentFocus.x) &&
|
|
213
|
+
((_b = this.activeFocus) === null || _b === void 0 ? void 0 : _b.y) === (currentFocus === null || currentFocus === void 0 ? void 0 : currentFocus.y)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
this.activeFocus = currentFocus;
|
|
217
|
+
if (currentFocus && this.el) {
|
|
218
|
+
const beforeScrollIn = this.beforeScrollIntoView.emit({ el: this.el });
|
|
219
|
+
if (!beforeScrollIn.defaultPrevented) {
|
|
220
|
+
this.el.scrollIntoView({
|
|
221
|
+
block: 'nearest',
|
|
222
|
+
inline: 'nearest',
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const model = getSourceItem(this.dataStore, currentFocus.y);
|
|
226
|
+
const column = getSourceItem(this.colData, currentFocus.x);
|
|
227
|
+
this.afterFocus.emit({
|
|
228
|
+
model,
|
|
229
|
+
column,
|
|
230
|
+
rowType: this.rowType,
|
|
231
|
+
colType: this.colType,
|
|
232
|
+
rowIndex: currentFocus.y,
|
|
233
|
+
colIndex: currentFocus.x,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
render() {
|
|
238
|
+
var _a;
|
|
239
|
+
const editCell = this.selectionStore.get('edit');
|
|
240
|
+
if (editCell) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const focusCell = this.selectionStore.get('focus');
|
|
244
|
+
if (!focusCell) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const event = this.beforeFocusRender.emit({
|
|
248
|
+
range: Object.assign(Object.assign({}, focusCell), { x1: focusCell.x, y1: focusCell.y }),
|
|
249
|
+
rowType: this.rowType,
|
|
250
|
+
colType: this.colType,
|
|
251
|
+
rowDimension: Object.assign({}, this.dimensionRow.state),
|
|
252
|
+
colDimension: Object.assign({}, this.dimensionCol.state),
|
|
253
|
+
});
|
|
254
|
+
if (event.defaultPrevented) {
|
|
255
|
+
return h("slot", null);
|
|
256
|
+
}
|
|
257
|
+
const { detail } = event;
|
|
258
|
+
const cell = getCell(detail.range, event.detail.rowDimension, event.detail.colDimension);
|
|
259
|
+
const styles = styleByCellProps(cell);
|
|
260
|
+
const extra = (_a = this.focusTemplate) === null || _a === void 0 ? void 0 : _a.call(this, h, detail);
|
|
261
|
+
const props = {
|
|
262
|
+
class: { [FOCUS_CLASS]: true },
|
|
263
|
+
style: styles,
|
|
264
|
+
};
|
|
265
|
+
return (h(Host, Object.assign({}, props), h("slot", null), extra));
|
|
266
|
+
}
|
|
267
|
+
get el() { return getElement(this); }
|
|
268
|
+
};
|
|
269
|
+
RevogrFocus$1.style = RevogrFocusStyle0;
|
|
270
|
+
|
|
271
|
+
const DIRECTION_CODES = [
|
|
272
|
+
codesLetter.TAB,
|
|
273
|
+
codesLetter.ARROW_UP,
|
|
274
|
+
codesLetter.ARROW_DOWN,
|
|
275
|
+
codesLetter.ARROW_LEFT,
|
|
276
|
+
codesLetter.ARROW_RIGHT,
|
|
277
|
+
];
|
|
278
|
+
class KeyboardService {
|
|
279
|
+
constructor(sv) {
|
|
280
|
+
this.sv = sv;
|
|
281
|
+
}
|
|
282
|
+
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
283
|
+
// IF EDIT MODE
|
|
284
|
+
if (isEditMode) {
|
|
285
|
+
switch (e.code) {
|
|
286
|
+
case codesLetter.ESCAPE:
|
|
287
|
+
this.sv.cancel();
|
|
288
|
+
break;
|
|
289
|
+
case codesLetter.TAB:
|
|
290
|
+
this.keyChangeSelection(e, canRange);
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// IF NOT EDIT MODE
|
|
296
|
+
// pressed clear key
|
|
297
|
+
if (range && isClear(e.code)) {
|
|
298
|
+
this.sv.clearCell();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
// below works with focus only
|
|
302
|
+
if (!focus) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
// tab key means same as arrow right
|
|
306
|
+
if (isTab(e.code)) {
|
|
307
|
+
this.keyChangeSelection(e, canRange);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
// pressed enter
|
|
311
|
+
if (isEnterKeyValue(e.key)) {
|
|
312
|
+
this.sv.change();
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
// copy operation
|
|
316
|
+
if (isCopy(e)) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
// cut operation
|
|
320
|
+
if (isCut(e)) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
// paste operation
|
|
324
|
+
if (isPaste(e)) {
|
|
325
|
+
this.sv.internalPaste();
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
// select all
|
|
329
|
+
if (isAll(e)) {
|
|
330
|
+
if (canRange) {
|
|
331
|
+
this.selectAll(e);
|
|
332
|
+
}
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
// pressed letter key
|
|
336
|
+
if (e.key.length === 1) {
|
|
337
|
+
this.sv.change(e.key);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
// pressed arrow, change selection position
|
|
341
|
+
if (await this.keyChangeSelection(e, canRange)) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
selectAll(e) {
|
|
346
|
+
const range = this.sv.selectionStore.get('range');
|
|
347
|
+
const focus = this.sv.selectionStore.get('focus');
|
|
348
|
+
// if no range or focus - do nothing
|
|
349
|
+
if (!range || !focus) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
e.preventDefault();
|
|
353
|
+
this.sv.selectAll();
|
|
354
|
+
}
|
|
355
|
+
async keyChangeSelection(e, canRange) {
|
|
356
|
+
const data = this.changeDirectionKey(e, canRange);
|
|
357
|
+
if (!data) {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
// this interval needed for several cases
|
|
361
|
+
// grid could be resized before next click
|
|
362
|
+
// at this case to avoid screen jump we use this interval
|
|
363
|
+
await timeout(RESIZE_INTERVAL + 30);
|
|
364
|
+
const range = this.sv.selectionStore.get('range');
|
|
365
|
+
const focus = this.sv.selectionStore.get('focus');
|
|
366
|
+
return this.keyPositionChange(data.changes, range, focus, data.isMulti);
|
|
367
|
+
}
|
|
368
|
+
keyPositionChange(changes, range, focus, isMulti = false) {
|
|
369
|
+
if (!range || !focus) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
const data = getCoordinate(range, focus, changes, isMulti);
|
|
373
|
+
if (!data) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const eData = this.sv.getData();
|
|
377
|
+
if (isMulti) {
|
|
378
|
+
if (isAfterLast(data.end, eData.lastCell) || isBeforeFirst(data.start)) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
const range = getRange(data.start, data.end);
|
|
382
|
+
return this.sv.range(range);
|
|
383
|
+
}
|
|
384
|
+
return this.sv.focus(data.start, changes, isAfterLast(data.start, eData.lastCell)
|
|
385
|
+
? 1
|
|
386
|
+
: isBeforeFirst(data.start)
|
|
387
|
+
? -1
|
|
388
|
+
: 0);
|
|
389
|
+
}
|
|
390
|
+
/** Monitor key direction changes */
|
|
391
|
+
changeDirectionKey(e, canRange) {
|
|
392
|
+
const isMulti = canRange && e.shiftKey;
|
|
393
|
+
if (DIRECTION_CODES.includes(e.code)) {
|
|
394
|
+
e.preventDefault();
|
|
395
|
+
}
|
|
396
|
+
if (e.shiftKey) {
|
|
397
|
+
switch (e.code) {
|
|
398
|
+
case codesLetter.TAB:
|
|
399
|
+
return { changes: { x: -1 }, isMulti: false };
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
switch (e.code) {
|
|
403
|
+
case codesLetter.ARROW_UP:
|
|
404
|
+
return { changes: { y: -1 }, isMulti };
|
|
405
|
+
case codesLetter.ARROW_DOWN:
|
|
406
|
+
return { changes: { y: 1 }, isMulti };
|
|
407
|
+
case codesLetter.ARROW_LEFT:
|
|
408
|
+
return { changes: { x: -1 }, isMulti };
|
|
409
|
+
case codesLetter.TAB:
|
|
410
|
+
case codesLetter.ARROW_RIGHT:
|
|
411
|
+
return { changes: { x: 1 }, isMulti };
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
class AutoFillService {
|
|
417
|
+
constructor(sv) {
|
|
418
|
+
this.sv = sv;
|
|
419
|
+
this.autoFillType = null;
|
|
420
|
+
this.autoFillInitial = null;
|
|
421
|
+
this.autoFillStart = null;
|
|
422
|
+
this.autoFillLast = null;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Render autofill box
|
|
426
|
+
* @param range
|
|
427
|
+
* @param selectionFocus
|
|
428
|
+
*/
|
|
429
|
+
renderAutofill(range, selectionFocus) {
|
|
430
|
+
let handlerStyle;
|
|
431
|
+
if (range) {
|
|
432
|
+
handlerStyle = getCell(range, this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
handlerStyle = getCell(Object.assign(Object.assign({}, selectionFocus), { x1: selectionFocus.x, y1: selectionFocus.y }), this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
436
|
+
}
|
|
437
|
+
return (h("div", { class: {
|
|
438
|
+
[CELL_HANDLER_CLASS]: true,
|
|
439
|
+
[MOBILE_CLASS]: true,
|
|
440
|
+
}, style: {
|
|
441
|
+
left: `${handlerStyle.right}px`,
|
|
442
|
+
top: `${handlerStyle.bottom}px`,
|
|
443
|
+
}, onMouseDown: (e) => this.autoFillHandler(e), onTouchStart: (e) => this.autoFillHandler(e) }));
|
|
444
|
+
}
|
|
445
|
+
autoFillHandler(e, type = "AutoFill" /* AutoFillType.autoFill */) {
|
|
446
|
+
let target = null;
|
|
447
|
+
if (e.target instanceof Element) {
|
|
448
|
+
target = e.target;
|
|
449
|
+
}
|
|
450
|
+
if (!target) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
this.selectionStart(target, this.sv.getData(), type);
|
|
454
|
+
e.preventDefault();
|
|
455
|
+
}
|
|
456
|
+
get isAutoFill() {
|
|
457
|
+
return !!this.autoFillType;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Process mouse move events
|
|
461
|
+
*/
|
|
462
|
+
selectionMouseMove(e) {
|
|
463
|
+
// initiate mouse move debounce if not present
|
|
464
|
+
if (!this.onMouseMoveAutofill) {
|
|
465
|
+
this.onMouseMoveAutofill = debounce((e, data) => this.doAutofillMouseMove(e, data), 5);
|
|
466
|
+
}
|
|
467
|
+
if (this.isAutoFill) {
|
|
468
|
+
this.onMouseMoveAutofill(e, this.sv.getData());
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
getFocus(focus, range) {
|
|
472
|
+
// there was an issue that it was taking last cell from range but focus was out
|
|
473
|
+
if (!focus && range) {
|
|
474
|
+
focus = { x: range.x, y: range.y };
|
|
475
|
+
}
|
|
476
|
+
return focus || null;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Autofill logic:
|
|
480
|
+
* on mouse move apply based on previous direction (if present)
|
|
481
|
+
*/
|
|
482
|
+
doAutofillMouseMove(event, data) {
|
|
483
|
+
// if no initial - not started
|
|
484
|
+
if (!this.autoFillInitial) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const x = getPropertyFromEvent(event, 'clientX', MOBILE_CLASS);
|
|
488
|
+
const y = getPropertyFromEvent(event, 'clientY', MOBILE_CLASS);
|
|
489
|
+
// skip touch
|
|
490
|
+
if (x === null || y === null) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const current = getCurrentCell({ x, y }, data);
|
|
494
|
+
// first time or direction equal to start(same as first time)
|
|
495
|
+
if (!this.autoFillLast) {
|
|
496
|
+
if (!this.autoFillLast) {
|
|
497
|
+
this.autoFillLast = this.autoFillStart;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// check if not the latest, if latest - do nothing
|
|
501
|
+
if (isAfterLast(current, data.lastCell)) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
this.autoFillLast = current;
|
|
505
|
+
const isSame = current.x === this.autoFillInitial.x &&
|
|
506
|
+
current.y === this.autoFillInitial.y;
|
|
507
|
+
// if same as initial - clear
|
|
508
|
+
if (isSame) {
|
|
509
|
+
this.sv.setTempRange(null);
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
const area = getRange(this.autoFillInitial, this.autoFillLast);
|
|
513
|
+
this.sv.setTempRange({
|
|
514
|
+
area,
|
|
515
|
+
type: this.autoFillType,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Range selection started
|
|
521
|
+
* Mode @param type:
|
|
522
|
+
* Can be triggered from MouseDown selection on element
|
|
523
|
+
* Or can be triggered on corner square drag
|
|
524
|
+
*/
|
|
525
|
+
selectionStart(target, data, type = "Selection" /* AutoFillType.selection */) {
|
|
526
|
+
/** Get cell by autofill element */
|
|
527
|
+
const { top, left } = target.getBoundingClientRect();
|
|
528
|
+
this.autoFillInitial = this.getFocus(data.focus, data.range);
|
|
529
|
+
this.autoFillType = type;
|
|
530
|
+
this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Clear current range selection on mouse up and mouse leave events
|
|
534
|
+
*/
|
|
535
|
+
clearAutoFillSelection(focus, oldRange) {
|
|
536
|
+
// If autofill was active, apply autofill values
|
|
537
|
+
if (this.autoFillInitial) {
|
|
538
|
+
// Fetch latest focus
|
|
539
|
+
this.autoFillInitial = this.getFocus(focus, oldRange);
|
|
540
|
+
// Apply range data if autofill mode is active
|
|
541
|
+
if (this.autoFillType === "AutoFill" /* AutoFillType.autoFill */) {
|
|
542
|
+
const range = getRange(this.autoFillInitial, this.autoFillLast);
|
|
543
|
+
// If range is present, apply data
|
|
544
|
+
if (range) {
|
|
545
|
+
const { defaultPrevented: stopApply, detail: { range: newRange }, } = this.sv.clearRangeDataApply({
|
|
546
|
+
range,
|
|
547
|
+
});
|
|
548
|
+
// If data apply was not prevented, apply new range
|
|
549
|
+
if (!stopApply && oldRange) {
|
|
550
|
+
this.applyRangeWithData(newRange, oldRange);
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
// If data apply was prevented, clear temporary range
|
|
554
|
+
this.sv.setTempRange(null);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
// If not autofill mode, apply range only
|
|
560
|
+
this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
// Reset autofill state
|
|
564
|
+
this.resetAutoFillState();
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Reset autofill state
|
|
568
|
+
*/
|
|
569
|
+
resetAutoFillState() {
|
|
570
|
+
this.autoFillType = null;
|
|
571
|
+
this.autoFillInitial = null;
|
|
572
|
+
this.autoFillLast = null;
|
|
573
|
+
this.autoFillStart = null;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Trigger range apply events and handle responses
|
|
577
|
+
*/
|
|
578
|
+
onRangeApply(newData, newRange, oldRange) {
|
|
579
|
+
this.sv.rangeDataApply({
|
|
580
|
+
data: newData,
|
|
581
|
+
models: collectModelsOfRange(newData, this.sv.dataStore),
|
|
582
|
+
type: this.sv.dataStore.get('type'),
|
|
583
|
+
oldRange,
|
|
584
|
+
newRange
|
|
585
|
+
});
|
|
586
|
+
this.sv.setRange(newRange);
|
|
587
|
+
}
|
|
588
|
+
/** Apply range and copy data during range application */
|
|
589
|
+
applyRangeWithData(newRange, rangeToCopy) {
|
|
590
|
+
const rangeData = {
|
|
591
|
+
type: this.sv.dataStore.get('type'),
|
|
592
|
+
colType: this.sv.columnService.type,
|
|
593
|
+
newData: {},
|
|
594
|
+
mapping: {},
|
|
595
|
+
newRange,
|
|
596
|
+
oldRange: rangeToCopy,
|
|
597
|
+
};
|
|
598
|
+
const { mapping, changed } = this.sv.columnService.getRangeData(rangeData, this.sv.columnService.columns);
|
|
599
|
+
rangeData.newData = changed;
|
|
600
|
+
rangeData.mapping = mapping;
|
|
601
|
+
let e = this.sv.selectionChanged(rangeData);
|
|
602
|
+
// if default prevented - clear range
|
|
603
|
+
if (e.defaultPrevented) {
|
|
604
|
+
this.sv.setTempRange(null);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
e = this.sv.rangeCopy(rangeData);
|
|
608
|
+
if (e.defaultPrevented) {
|
|
609
|
+
this.sv.setRange(newRange);
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
this.onRangeApply(rangeData.newData, newRange, rangeToCopy);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Update range selection only,
|
|
616
|
+
* no data change (mouse selection)
|
|
617
|
+
*/
|
|
618
|
+
applyRangeOnly(start, end) {
|
|
619
|
+
// no changes to apply
|
|
620
|
+
if (!start || !end) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const newRange = getRange(start, end);
|
|
624
|
+
this.sv.setRange(newRange);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
const revogrOverlayStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-overlay-selection{display:block;position:relative;width:100%}revogr-overlay-selection .autofill-handle{position:absolute;width:14px;height:14px;margin-left:-13px;margin-top:-13px;z-index:10;cursor:crosshair}revogr-overlay-selection .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:10px;height:10px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection.mobile .autofill-handle{position:absolute;width:30px;height:30px;margin-left:-29px;margin-top:-29px;z-index:10;cursor:crosshair}revogr-overlay-selection.mobile .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:12px;height:12px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9;box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset}revogr-overlay-selection .selection-border-range .range-handlers{height:100%;background-color:transparent;width:75%;max-width:50px;min-width:20px;left:50%;transform:translateX(-50%);position:absolute}revogr-overlay-selection .selection-border-range .range-handlers>span{pointer-events:auto;height:20px;width:20px;position:absolute;left:50%;transform:translateX(-50%)}revogr-overlay-selection .selection-border-range .range-handlers>span:before,revogr-overlay-selection .selection-border-range .range-handlers>span:after{position:absolute;border-radius:5px;width:15px;height:5px;left:50%;transform:translateX(-50%);background-color:rgba(0, 0, 0, 0.2)}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child{top:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child:before{content:\"\";top:0}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child{bottom:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child:after{content:\"\";bottom:0}revogr-overlay-selection revogr-edit{z-index:10}";
|
|
629
|
+
const RevogrOverlaySelectionStyle0 = revogrOverlayStyleCss;
|
|
630
|
+
|
|
631
|
+
const OverlaySelection = class {
|
|
632
|
+
constructor(hostRef) {
|
|
633
|
+
registerInstance(this, hostRef);
|
|
634
|
+
this.beforeCopyRegion = createEvent(this, "beforecopyregion", 7);
|
|
635
|
+
this.beforeRegionPaste = createEvent(this, "beforepasteregion", 7);
|
|
636
|
+
this.cellEditApply = createEvent(this, "celleditapply", 7);
|
|
637
|
+
this.beforeFocusCell = createEvent(this, "beforecellfocusinit", 7);
|
|
638
|
+
this.beforeNextViewportFocus = createEvent(this, "beforenextvpfocus", 7);
|
|
639
|
+
this.setEdit = createEvent(this, "setedit", 7);
|
|
640
|
+
this.beforeApplyRange = createEvent(this, "beforeapplyrange", 7);
|
|
641
|
+
this.beforeSetRange = createEvent(this, "beforesetrange", 7);
|
|
642
|
+
this.setRange = createEvent(this, "setrange", 7);
|
|
643
|
+
this.beforeEditRender = createEvent(this, "beforeeditrender", 7);
|
|
644
|
+
this.selectAll = createEvent(this, "selectall", 7);
|
|
645
|
+
this.cancelEdit = createEvent(this, "canceledit", 7);
|
|
646
|
+
this.setTempRange = createEvent(this, "settemprange", 7);
|
|
647
|
+
this.beforeSetTempRange = createEvent(this, "beforesettemprange", 7);
|
|
648
|
+
this.applyFocus = createEvent(this, "applyfocus", 7);
|
|
649
|
+
this.focusCell = createEvent(this, "focuscell", 7);
|
|
650
|
+
this.beforeRangeDataApply = createEvent(this, "beforerangedataapply", 7);
|
|
651
|
+
this.selectionChange = createEvent(this, "selectionchangeinit", 7);
|
|
652
|
+
this.beforeRangeCopyApply = createEvent(this, "beforerangecopyapply", 7);
|
|
653
|
+
this.rangeEditApply = createEvent(this, "rangeeditapply", 7);
|
|
654
|
+
this.rangeClipboardCopy = createEvent(this, "clipboardrangecopy", 7);
|
|
655
|
+
this.rangeClipboardPaste = createEvent(this, "clipboardrangepaste", 7);
|
|
656
|
+
this.beforeKeyDown = createEvent(this, "beforekeydown", 7);
|
|
657
|
+
this.beforeKeyUp = createEvent(this, "beforekeyup", 7);
|
|
658
|
+
this.beforeCellSave = createEvent(this, "beforecellsave", 7);
|
|
659
|
+
this.keyboardService = null;
|
|
660
|
+
this.autoFillService = null;
|
|
661
|
+
this.unsubscribeSelectionStore = [];
|
|
662
|
+
this.readonly = undefined;
|
|
663
|
+
this.range = undefined;
|
|
664
|
+
this.canDrag = undefined;
|
|
665
|
+
this.useClipboard = undefined;
|
|
666
|
+
this.selectionStore = undefined;
|
|
667
|
+
this.dimensionRow = undefined;
|
|
668
|
+
this.dimensionCol = undefined;
|
|
669
|
+
this.dataStore = undefined;
|
|
670
|
+
this.colData = undefined;
|
|
671
|
+
this.lastCell = undefined;
|
|
672
|
+
this.editors = undefined;
|
|
673
|
+
this.applyChangesOnClose = false;
|
|
674
|
+
this.additionalData = undefined;
|
|
675
|
+
this.isMobileDevice = undefined;
|
|
676
|
+
}
|
|
677
|
+
// #endregion
|
|
678
|
+
// #region Listeners
|
|
679
|
+
onMouseMove(e) {
|
|
680
|
+
var _a;
|
|
681
|
+
if (this.selectionStore.get('focus')) {
|
|
682
|
+
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.selectionMouseMove(e);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Action finished inside the document.
|
|
687
|
+
* Pointer left document, clear any active operation.
|
|
688
|
+
*/
|
|
689
|
+
onMouseUp() {
|
|
690
|
+
var _a;
|
|
691
|
+
// Clear autofill selection
|
|
692
|
+
// when pointer left document,
|
|
693
|
+
// clear any active operation.
|
|
694
|
+
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.clearAutoFillSelection(this.selectionStore.get('focus'), this.selectionStore.get('range'));
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Row drag started.
|
|
698
|
+
* This event is fired when drag action started on cell.
|
|
699
|
+
*/
|
|
700
|
+
onCellDrag(e) {
|
|
701
|
+
var _a;
|
|
702
|
+
// Invoke drag start on order editor.
|
|
703
|
+
(_a = this.orderEditor) === null || _a === void 0 ? void 0 : _a.dragStart(e.detail);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Get keyboard down from element.
|
|
707
|
+
* This event is fired when keyboard key is released.
|
|
708
|
+
*/
|
|
709
|
+
onKeyUp(e) {
|
|
710
|
+
// Emit before key up event.
|
|
711
|
+
this.beforeKeyUp.emit(Object.assign({ original: e }, this.getData()));
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Get keyboard down from element.
|
|
715
|
+
* This event is fired when keyboard key is pressed.
|
|
716
|
+
*/
|
|
717
|
+
onKeyDown(e) {
|
|
718
|
+
var _a;
|
|
719
|
+
// Emit before key down event and check if default prevention is set.
|
|
720
|
+
const proxy = this.beforeKeyDown.emit(Object.assign({ original: e }, this.getData()));
|
|
721
|
+
if (e.defaultPrevented || proxy.defaultPrevented) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
// Invoke key down on keyboard service.
|
|
725
|
+
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range, !!this.selectionStore.get('edit'), {
|
|
726
|
+
focus: this.selectionStore.get('focus'),
|
|
727
|
+
range: this.selectionStore.get('range'),
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
// #endregion
|
|
731
|
+
/**
|
|
732
|
+
* Selection & Keyboard
|
|
733
|
+
*/
|
|
734
|
+
selectionServiceSet(selectionStore) {
|
|
735
|
+
// clear subscriptions
|
|
736
|
+
this.unsubscribeSelectionStore.forEach(v => v());
|
|
737
|
+
this.unsubscribeSelectionStore.length = 0;
|
|
738
|
+
this.unsubscribeSelectionStore.push(selectionStore.onChange('nextFocus', v => v && this.doFocus(v, v)));
|
|
739
|
+
this.keyboardService = new KeyboardService({
|
|
740
|
+
selectionStore,
|
|
741
|
+
range: r => !!r && this.triggerRangeEvent(r),
|
|
742
|
+
focus: (f, changes, focusNextViewport) => {
|
|
743
|
+
if (focusNextViewport) {
|
|
744
|
+
this.beforeNextViewportFocus.emit(f);
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
return this.doFocus(f, f, changes);
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
change: val => {
|
|
752
|
+
if (this.readonly) {
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
this.doEdit(val);
|
|
756
|
+
},
|
|
757
|
+
cancel: async () => {
|
|
758
|
+
var _a;
|
|
759
|
+
await ((_a = this.revogrEdit) === null || _a === void 0 ? void 0 : _a.cancelChanges());
|
|
760
|
+
this.closeEdit();
|
|
761
|
+
},
|
|
762
|
+
clearCell: () => !this.readonly && this.clearCell(),
|
|
763
|
+
internalPaste: () => !this.readonly && this.beforeRegionPaste.emit(),
|
|
764
|
+
getData: () => this.getData(),
|
|
765
|
+
selectAll: () => this.selectAll.emit(),
|
|
766
|
+
});
|
|
767
|
+
this.createAutoFillService();
|
|
768
|
+
}
|
|
769
|
+
/** Autofill */
|
|
770
|
+
createAutoFillService() {
|
|
771
|
+
this.autoFillService = new AutoFillService({
|
|
772
|
+
dimensionRow: this.dimensionRow,
|
|
773
|
+
dimensionCol: this.dimensionCol,
|
|
774
|
+
columnService: this.columnService,
|
|
775
|
+
dataStore: this.dataStore,
|
|
776
|
+
clearRangeDataApply: e => this.beforeRangeDataApply.emit(Object.assign(Object.assign(Object.assign({}, e), this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) })),
|
|
777
|
+
setTempRange: e => {
|
|
778
|
+
const tempRangeEvent = this.beforeSetTempRange.emit(Object.assign(Object.assign({ tempRange: e }, this.getData()), this.types));
|
|
779
|
+
if (tempRangeEvent.defaultPrevented) {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
return this.setTempRange.emit(tempRangeEvent.detail.tempRange);
|
|
783
|
+
},
|
|
784
|
+
selectionChanged: e => this.selectionChange.emit(e),
|
|
785
|
+
rangeCopy: e => this.beforeRangeCopyApply.emit(e),
|
|
786
|
+
rangeDataApply: e => this.rangeEditApply.emit(e),
|
|
787
|
+
setRange: e => !!e && this.triggerRangeEvent(e),
|
|
788
|
+
getData: () => this.getData(),
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
/** Columns */
|
|
792
|
+
columnServiceSet() {
|
|
793
|
+
var _a;
|
|
794
|
+
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
795
|
+
this.columnService = new ColumnService(this.dataStore, this.colData);
|
|
796
|
+
this.createAutoFillService();
|
|
797
|
+
}
|
|
798
|
+
connectedCallback() {
|
|
799
|
+
this.columnServiceSet();
|
|
800
|
+
this.selectionServiceSet(this.selectionStore);
|
|
801
|
+
}
|
|
802
|
+
disconnectedCallback() {
|
|
803
|
+
var _a;
|
|
804
|
+
// clear subscriptions
|
|
805
|
+
this.unsubscribeSelectionStore.forEach(v => v());
|
|
806
|
+
this.unsubscribeSelectionStore.length = 0;
|
|
807
|
+
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
808
|
+
}
|
|
809
|
+
async componentWillRender() {
|
|
810
|
+
var _a, _b;
|
|
811
|
+
const editCell = this.selectionStore.get('edit');
|
|
812
|
+
if (!editCell) {
|
|
813
|
+
await ((_b = (_a = this.revogrEdit) === null || _a === void 0 ? void 0 : _a.beforeDisconnect) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
renderRange(range) {
|
|
817
|
+
const cell = getCell(range, this.dimensionRow.state, this.dimensionCol.state);
|
|
818
|
+
const styles = styleByCellProps(cell);
|
|
819
|
+
return [
|
|
820
|
+
h("div", { class: SELECTION_BORDER_CLASS, style: styles }, this.isMobileDevice && (h("div", { class: "range-handlers" }, h("span", { class: MOBILE_CLASS }), h("span", { class: MOBILE_CLASS })))),
|
|
821
|
+
];
|
|
822
|
+
}
|
|
823
|
+
renderEditor() {
|
|
824
|
+
// Check if edit access
|
|
825
|
+
const editCell = this.selectionStore.get('edit');
|
|
826
|
+
// Readonly or Editor closed
|
|
827
|
+
if (this.readonly || !editCell) {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
const enteredOrModelValue = editCell.val ||
|
|
831
|
+
getCellData(this.columnService.rowDataModel(editCell.y, editCell.x).value);
|
|
832
|
+
const editable = Object.assign(Object.assign({}, editCell), this.columnService.getSaveData(editCell.y, editCell.x, enteredOrModelValue));
|
|
833
|
+
const renderEvent = this.beforeEditRender.emit(Object.assign(Object.assign({ range: Object.assign(Object.assign({}, editCell), { x1: editCell.x, y1: editCell.y }) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
|
|
834
|
+
// Render prevented
|
|
835
|
+
if (renderEvent.defaultPrevented) {
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
const cell = getCell(renderEvent.detail.range, renderEvent.detail.rowDimension, renderEvent.detail.colDimension);
|
|
839
|
+
const styles = styleByCellProps(cell);
|
|
840
|
+
return (h("revogr-edit", { style: styles, ref: el => (this.revogrEdit = el), additionalData: this.additionalData, editCell: editable, saveOnClose: this.applyChangesOnClose, column: this.columnService.rowDataModel(editCell.y, editCell.x), editor: getCellEditor(this.columnService.columns[editCell.x], this.editors) }));
|
|
841
|
+
}
|
|
842
|
+
render() {
|
|
843
|
+
var _a;
|
|
844
|
+
const nodes = [];
|
|
845
|
+
const editCell = this.renderEditor();
|
|
846
|
+
// Editor
|
|
847
|
+
if (editCell) {
|
|
848
|
+
nodes.push(editCell);
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
const range = this.selectionStore.get('range');
|
|
852
|
+
const focus = this.selectionStore.get('focus');
|
|
853
|
+
// Clipboard
|
|
854
|
+
if ((range || focus) && this.useClipboard) {
|
|
855
|
+
nodes.push(h("revogr-clipboard", { readonly: this.readonly, onCopyregion: e => this.onCopy(e.detail), onClearregion: () => !this.readonly && this.clearCell(), ref: e => (this.clipboard = e), onPasteregion: e => this.onPaste(e.detail) }));
|
|
856
|
+
}
|
|
857
|
+
// Range
|
|
858
|
+
if (range) {
|
|
859
|
+
nodes.push(...this.renderRange(range));
|
|
860
|
+
}
|
|
861
|
+
// Autofill
|
|
862
|
+
if (focus && !this.readonly && this.range) {
|
|
863
|
+
nodes.push((_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.renderAutofill(range, focus));
|
|
864
|
+
}
|
|
865
|
+
// Order
|
|
866
|
+
if (this.canDrag) {
|
|
867
|
+
nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return (h(Host, { key: '4beb16eb1cfe23899d054adbd52b46120aad5ba6', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e), onCelledit: (e) => {
|
|
871
|
+
const saveEv = this.beforeCellSave.emit(e.detail);
|
|
872
|
+
if (!saveEv.defaultPrevented) {
|
|
873
|
+
this.cellEdit(saveEv.detail);
|
|
874
|
+
}
|
|
875
|
+
// if not clear navigate to next cell after edit
|
|
876
|
+
if (!saveEv.detail.preventFocus) {
|
|
877
|
+
this.focusNext();
|
|
878
|
+
}
|
|
879
|
+
} }, nodes, h("slot", { key: '693c50627eb52b9902d9fe5ddd0c09fd2a3ee562', name: "data" })));
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Executes the focus operation on the specified range of cells.
|
|
883
|
+
*/
|
|
884
|
+
doFocus(focus, end, changes) {
|
|
885
|
+
// 1. Trigger beforeFocus event
|
|
886
|
+
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
887
|
+
if (defaultPrevented) {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
|
|
891
|
+
// 2. Trigger apply focus event
|
|
892
|
+
const applyEvent = this.applyFocus.emit(evData);
|
|
893
|
+
if (applyEvent.defaultPrevented) {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
const { range } = applyEvent.detail;
|
|
897
|
+
// 3. Trigger focus event
|
|
898
|
+
return !this.focusCell.emit(Object.assign({ focus: {
|
|
899
|
+
x: range.x,
|
|
900
|
+
y: range.y,
|
|
901
|
+
}, end: {
|
|
902
|
+
x: range.x1,
|
|
903
|
+
y: range.y1,
|
|
904
|
+
} }, applyEvent.detail)).defaultPrevented;
|
|
905
|
+
}
|
|
906
|
+
triggerRangeEvent(range) {
|
|
907
|
+
const type = this.types.rowType;
|
|
908
|
+
// 1. Apply range
|
|
909
|
+
const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
|
|
910
|
+
if (applyEvent.defaultPrevented) {
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
const data = this.columnService.getRangeTransformedToProps(applyEvent.detail.range, this.dataStore);
|
|
914
|
+
// 2. Before set range
|
|
915
|
+
let e = this.beforeSetRange.emit(data);
|
|
916
|
+
if (e.defaultPrevented) {
|
|
917
|
+
return false;
|
|
918
|
+
}
|
|
919
|
+
// 3. Set range
|
|
920
|
+
e = this.setRange.emit(Object.assign(Object.assign({}, applyEvent.detail.range), { type }));
|
|
921
|
+
if (e.defaultPrevented) {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
return !e.defaultPrevented;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Open Editor on DblClick
|
|
928
|
+
*/
|
|
929
|
+
onElementDblClick(e) {
|
|
930
|
+
// DblClick prevented outside - Editor will not open
|
|
931
|
+
if (e.defaultPrevented) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
// Get data from the component
|
|
935
|
+
const data = this.getData();
|
|
936
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
937
|
+
if (!focusCell) {
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
this.doEdit();
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Handle mouse down event on Host element
|
|
944
|
+
*/
|
|
945
|
+
onElementMouseDown(e, touch = false) {
|
|
946
|
+
var _a;
|
|
947
|
+
// Get the target element from the event object
|
|
948
|
+
const targetElement = e.target;
|
|
949
|
+
// Ignore focus if clicked input
|
|
950
|
+
if (isEditInput(targetElement) || e.defaultPrevented) {
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
// Get data from the component
|
|
954
|
+
const data = this.getData();
|
|
955
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
956
|
+
if (!focusCell) {
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
// Set focus on the current cell
|
|
960
|
+
this.focus(focusCell, this.range && e.shiftKey);
|
|
961
|
+
// Initiate autofill selection
|
|
962
|
+
if (this.range) {
|
|
963
|
+
targetElement &&
|
|
964
|
+
((_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.selectionStart(targetElement, this.getData()));
|
|
965
|
+
// Prevent default behavior for mouse events,
|
|
966
|
+
// but only if target element is not a mobile input
|
|
967
|
+
if (!touch) {
|
|
968
|
+
e.preventDefault();
|
|
969
|
+
}
|
|
970
|
+
else if (verifyTouchTarget(e.touches[0], MOBILE_CLASS)) {
|
|
971
|
+
// Prevent default behavior for touch events
|
|
972
|
+
// if target element is a mobile input
|
|
973
|
+
e.preventDefault();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Start cell editing
|
|
979
|
+
*/
|
|
980
|
+
doEdit(val = '') {
|
|
981
|
+
var _a;
|
|
982
|
+
if (this.canEdit()) {
|
|
983
|
+
const focus = this.selectionStore.get('focus');
|
|
984
|
+
if (!focus) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
const data = this.columnService.getSaveData(focus.y, focus.x);
|
|
988
|
+
(_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Close editor event triggered
|
|
993
|
+
* @param details - if it requires focus next
|
|
994
|
+
*/
|
|
995
|
+
async closeEdit(e) {
|
|
996
|
+
this.cancelEdit.emit();
|
|
997
|
+
if (e === null || e === void 0 ? void 0 : e.detail) {
|
|
998
|
+
await this.focusNext();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Edit finished.
|
|
1003
|
+
* Close Editor and save.
|
|
1004
|
+
*/
|
|
1005
|
+
cellEdit(e) {
|
|
1006
|
+
const dataToSave = this.columnService.getSaveData(e.rgRow, e.rgCol, e.val);
|
|
1007
|
+
this.cellEditApply.emit(dataToSave);
|
|
1008
|
+
}
|
|
1009
|
+
getRegion() {
|
|
1010
|
+
const focus = this.selectionStore.get('focus');
|
|
1011
|
+
let range = this.selectionStore.get('range');
|
|
1012
|
+
if (!range) {
|
|
1013
|
+
range = getRange(focus, focus);
|
|
1014
|
+
}
|
|
1015
|
+
return range;
|
|
1016
|
+
}
|
|
1017
|
+
onCopy(e) {
|
|
1018
|
+
var _a;
|
|
1019
|
+
const range = this.getRegion();
|
|
1020
|
+
const canCopyEvent = this.beforeCopyRegion.emit(range);
|
|
1021
|
+
if (canCopyEvent.defaultPrevented) {
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
let rangeData;
|
|
1025
|
+
if (range) {
|
|
1026
|
+
const { data, mapping } = this.columnService.copyRangeArray(range, this.dataStore);
|
|
1027
|
+
const event = this.rangeClipboardCopy.emit(Object.assign({ range,
|
|
1028
|
+
data,
|
|
1029
|
+
mapping }, this.types));
|
|
1030
|
+
if (!event.defaultPrevented) {
|
|
1031
|
+
rangeData = event.detail.data;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
(_a = this.clipboard) === null || _a === void 0 ? void 0 : _a.doCopy(e, rangeData);
|
|
1035
|
+
return true;
|
|
1036
|
+
}
|
|
1037
|
+
onPaste(data) {
|
|
1038
|
+
var _a;
|
|
1039
|
+
const focus = this.selectionStore.get('focus');
|
|
1040
|
+
const isEditing = this.selectionStore.get('edit') !== null;
|
|
1041
|
+
if (!focus || isEditing) {
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
let { changed, range } = this.columnService.getTransformedDataToApply(focus, data);
|
|
1045
|
+
const { defaultPrevented: canPaste } = this.rangeClipboardPaste.emit(Object.assign({ data: changed, models: collectModelsOfRange(changed, this.dataStore), range }, this.types));
|
|
1046
|
+
if (canPaste) {
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.onRangeApply(changed, range, range);
|
|
1050
|
+
}
|
|
1051
|
+
async focusNext() {
|
|
1052
|
+
var _a;
|
|
1053
|
+
const canFocus = await ((_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyChangeSelection(new KeyboardEvent('keydown', {
|
|
1054
|
+
code: codesLetter.ARROW_DOWN,
|
|
1055
|
+
}), this.range));
|
|
1056
|
+
if (!canFocus) {
|
|
1057
|
+
this.closeEdit();
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
clearCell() {
|
|
1061
|
+
var _a;
|
|
1062
|
+
const range = this.selectionStore.get('range');
|
|
1063
|
+
if (range && !isRangeSingleCell(range)) {
|
|
1064
|
+
const data = this.columnService.getRangeStaticData(range, '');
|
|
1065
|
+
(_a = this.autoFillService) === null || _a === void 0 ? void 0 : _a.onRangeApply(data, range, range);
|
|
1066
|
+
}
|
|
1067
|
+
else if (this.canEdit()) {
|
|
1068
|
+
const focused = this.selectionStore.get('focus');
|
|
1069
|
+
if (!focused) {
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
const cell = this.columnService.getSaveData(focused.y, focused.x);
|
|
1073
|
+
this.cellEdit({
|
|
1074
|
+
rgRow: focused.y,
|
|
1075
|
+
rgCol: focused.x,
|
|
1076
|
+
val: '',
|
|
1077
|
+
type: cell.type,
|
|
1078
|
+
prop: cell.prop,
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
rowDragStart({ detail }) {
|
|
1083
|
+
detail.text = getCellData(this.columnService.rowDataModel(detail.cell.y, detail.cell.x).value);
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Verify if edit allowed.
|
|
1087
|
+
*/
|
|
1088
|
+
canEdit() {
|
|
1089
|
+
var _a;
|
|
1090
|
+
if (this.readonly) {
|
|
1091
|
+
return false;
|
|
1092
|
+
}
|
|
1093
|
+
const focus = this.selectionStore.get('focus');
|
|
1094
|
+
return focus && !((_a = this.columnService) === null || _a === void 0 ? void 0 : _a.isReadOnly(focus.y, focus.x));
|
|
1095
|
+
}
|
|
1096
|
+
get edited() {
|
|
1097
|
+
return this.selectionStore.get('edit');
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Sets the focus on a cell and optionally edits a range.
|
|
1101
|
+
*/
|
|
1102
|
+
focus(cell, isRangeEdit = false) {
|
|
1103
|
+
if (!cell)
|
|
1104
|
+
return false;
|
|
1105
|
+
const end = cell;
|
|
1106
|
+
const start = this.selectionStore.get('focus');
|
|
1107
|
+
if (isRangeEdit && start) {
|
|
1108
|
+
const range = getRange(start, end);
|
|
1109
|
+
if (range) {
|
|
1110
|
+
return this.triggerRangeEvent(range);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return this.doFocus(cell, end);
|
|
1114
|
+
}
|
|
1115
|
+
get types() {
|
|
1116
|
+
return {
|
|
1117
|
+
rowType: this.dataStore.get('type'),
|
|
1118
|
+
colType: this.columnService.type,
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Collect data
|
|
1123
|
+
*/
|
|
1124
|
+
getData() {
|
|
1125
|
+
return {
|
|
1126
|
+
el: this.element,
|
|
1127
|
+
rows: this.dimensionRow.state,
|
|
1128
|
+
cols: this.dimensionCol.state,
|
|
1129
|
+
lastCell: this.lastCell,
|
|
1130
|
+
focus: this.selectionStore.get('focus'),
|
|
1131
|
+
range: this.selectionStore.get('range'),
|
|
1132
|
+
edit: this.selectionStore.get('edit'),
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
get element() { return getElement(this); }
|
|
1136
|
+
static get watchers() { return {
|
|
1137
|
+
"selectionStore": ["selectionServiceSet"],
|
|
1138
|
+
"dimensionRow": ["createAutoFillService"],
|
|
1139
|
+
"dimensionCol": ["createAutoFillService"],
|
|
1140
|
+
"dataStore": ["columnServiceSet"],
|
|
1141
|
+
"colData": ["columnServiceSet"]
|
|
1142
|
+
}; }
|
|
1143
|
+
};
|
|
1144
|
+
OverlaySelection.style = RevogrOverlaySelectionStyle0;
|
|
1145
|
+
|
|
1146
|
+
const RowHeaderRender = s => (__, { rowIndex: i }) => s + i;
|
|
1147
|
+
|
|
1148
|
+
const RevogrRowHeaders = class {
|
|
1149
|
+
constructor(hostRef) {
|
|
1150
|
+
registerInstance(this, hostRef);
|
|
1151
|
+
this.scrollViewport = createEvent(this, "scrollview", 3);
|
|
1152
|
+
this.elementToScroll = createEvent(this, "ref", 3);
|
|
1153
|
+
this.height = undefined;
|
|
1154
|
+
this.dataPorts = undefined;
|
|
1155
|
+
this.headerProp = undefined;
|
|
1156
|
+
this.rowClass = undefined;
|
|
1157
|
+
this.resize = undefined;
|
|
1158
|
+
this.rowHeaderColumn = undefined;
|
|
1159
|
+
this.additionalData = undefined;
|
|
1160
|
+
this.jobsBeforeRender = [];
|
|
1161
|
+
}
|
|
1162
|
+
render() {
|
|
1163
|
+
const dataViews = [];
|
|
1164
|
+
const viewport = new ViewportStore('colPinStart');
|
|
1165
|
+
/** render viewports rows */
|
|
1166
|
+
let totalLength = 1;
|
|
1167
|
+
// todo: this part could be optimized to avoid to often re-render dataPorts can be cached
|
|
1168
|
+
for (let data of this.dataPorts) {
|
|
1169
|
+
const itemCount = data.dataStore.get('items').length;
|
|
1170
|
+
// initiate row data
|
|
1171
|
+
const dataStore = new DataStore(data.type, Object.assign({}, data.dataStore.state));
|
|
1172
|
+
// initiate column data
|
|
1173
|
+
const colData = new DataStore('colPinStart');
|
|
1174
|
+
const column = Object.assign({ cellTemplate: RowHeaderRender(totalLength) }, this.rowHeaderColumn);
|
|
1175
|
+
colData.updateData([column]);
|
|
1176
|
+
dataViews.push(h("revogr-data", Object.assign({}, data, { colType: "rowHeaders", jobsBeforeRender: this.jobsBeforeRender, rowClass: this.rowClass, dataStore: dataStore.store, colData: colData.store, viewportCol: viewport.store, readonly: true, range: false })));
|
|
1177
|
+
totalLength += itemCount;
|
|
1178
|
+
}
|
|
1179
|
+
const colSize = calculateRowHeaderSize(totalLength, this.rowHeaderColumn);
|
|
1180
|
+
viewport.setViewport({
|
|
1181
|
+
realCount: 1,
|
|
1182
|
+
virtualSize: 0,
|
|
1183
|
+
items: [
|
|
1184
|
+
{
|
|
1185
|
+
size: colSize,
|
|
1186
|
+
start: 0,
|
|
1187
|
+
end: colSize,
|
|
1188
|
+
itemIndex: 0,
|
|
1189
|
+
},
|
|
1190
|
+
],
|
|
1191
|
+
});
|
|
1192
|
+
const viewportScroll = {
|
|
1193
|
+
contentHeight: this.height,
|
|
1194
|
+
contentWidth: 0,
|
|
1195
|
+
style: { minWidth: `${colSize}px` },
|
|
1196
|
+
colType: 'rowHeaders',
|
|
1197
|
+
ref: (el) => this.elementToScroll.emit(el),
|
|
1198
|
+
onScrollviewport: (e) => this.scrollViewport.emit(e.detail),
|
|
1199
|
+
};
|
|
1200
|
+
const viewportHeader = Object.assign(Object.assign({}, this.headerProp), { colData: typeof this.rowHeaderColumn === 'object' ? [this.rowHeaderColumn] : [], viewportCol: viewport.store, canResize: false, type: ROW_HEADER_TYPE,
|
|
1201
|
+
// parent,
|
|
1202
|
+
slot: HEADER_SLOT });
|
|
1203
|
+
return (h(Host, { class: { [ROW_HEADER_TYPE]: true }, key: ROW_HEADER_TYPE }, h("revogr-viewport-scroll", Object.assign({ key: 'addb87ab3406b5691cecf810119582bda3a4b4a2' }, viewportScroll, { "row-header": true }), h("revogr-header", Object.assign({ key: '8621e76b132e7d1507794b515b40f525577413e2' }, viewportHeader)), dataViews)));
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Autohide scroll for MacOS when scroll is visible only for 1 sec
|
|
1209
|
+
*/
|
|
1210
|
+
class AutohideScrollPlugin {
|
|
1211
|
+
constructor(element) {
|
|
1212
|
+
this.element = element;
|
|
1213
|
+
this.autohideScrollTimeout = 0;
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* When scroll size updates set it up for autohide
|
|
1217
|
+
*/
|
|
1218
|
+
setScrollSize(s) {
|
|
1219
|
+
if (!s) {
|
|
1220
|
+
this.element.setAttribute('autohide', 'true');
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
this.element.removeAttribute('autohide');
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* On each scroll check if it's time to show
|
|
1228
|
+
*/
|
|
1229
|
+
checkScroll({ scrollSize, contentSize, virtualSize, }) {
|
|
1230
|
+
const hasScroll = contentSize > virtualSize;
|
|
1231
|
+
const isHidden = !scrollSize && hasScroll;
|
|
1232
|
+
if (isHidden) {
|
|
1233
|
+
this.element.setAttribute('visible', 'true');
|
|
1234
|
+
this.autohideScrollTimeout = this.show(this.element, this.autohideScrollTimeout);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
show(element, timeout) {
|
|
1238
|
+
clearTimeout(timeout);
|
|
1239
|
+
return Number(setTimeout(() => {
|
|
1240
|
+
element === null || element === void 0 ? void 0 : element.removeAttribute('visible');
|
|
1241
|
+
}, 1000));
|
|
1242
|
+
}
|
|
1243
|
+
clear() {
|
|
1244
|
+
clearTimeout(this.autohideScrollTimeout);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
const revogrScrollStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}revogr-scroll-virtual[autohide]{position:absolute;z-index:100 !important}revogr-scroll-virtual[autohide].vertical{top:0;right:0}revogr-scroll-virtual[autohide].vertical[visible]{min-width:20px !important}revogr-scroll-virtual[autohide].horizontal{bottom:0;left:0}revogr-scroll-virtual[autohide].horizontal[visible]{min-height:20px !important}revogr-scroll-virtual.vertical{overflow-y:auto;overflow-x:hidden;height:100%}revogr-scroll-virtual.vertical>div{width:1px}revogr-scroll-virtual.horizontal{overflow-x:auto;overflow-y:hidden;width:100%}revogr-scroll-virtual.horizontal>div{height:1px}";
|
|
1249
|
+
const RevogrScrollVirtualStyle0 = revogrScrollStyleCss;
|
|
1250
|
+
|
|
1251
|
+
const RevogrScrollVirtual = class {
|
|
1252
|
+
constructor(hostRef) {
|
|
1253
|
+
registerInstance(this, hostRef);
|
|
1254
|
+
this.scrollVirtual = createEvent(this, "scrollvirtual", 7);
|
|
1255
|
+
this.scrollSize = 0;
|
|
1256
|
+
this.dimension = 'rgRow';
|
|
1257
|
+
this.viewportStore = undefined;
|
|
1258
|
+
this.dimensionStore = undefined;
|
|
1259
|
+
}
|
|
1260
|
+
async setScroll(e) {
|
|
1261
|
+
var _a;
|
|
1262
|
+
if (this.dimension !== e.dimension) {
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
this.localScrollTimer.latestScrollUpdate(e.dimension);
|
|
1266
|
+
(_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.setScroll(e);
|
|
1267
|
+
if (e.coordinate) {
|
|
1268
|
+
this.autohideScrollPlugin.checkScroll({
|
|
1269
|
+
scrollSize: this.scrollSize,
|
|
1270
|
+
contentSize: this.dimensionStore.get('realSize'),
|
|
1271
|
+
virtualSize: this.viewportStore.get('virtualSize'),
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Update if `delta` exists in case we don't know current position or if it's external change
|
|
1277
|
+
*/
|
|
1278
|
+
async changeScroll(e) {
|
|
1279
|
+
if (e.delta) {
|
|
1280
|
+
switch (e.dimension) {
|
|
1281
|
+
case 'rgCol':
|
|
1282
|
+
e.coordinate = this.element.scrollLeft + e.delta;
|
|
1283
|
+
break;
|
|
1284
|
+
case 'rgRow':
|
|
1285
|
+
e.coordinate = this.element.scrollTop + e.delta;
|
|
1286
|
+
break;
|
|
1287
|
+
}
|
|
1288
|
+
this.setScroll(e);
|
|
1289
|
+
}
|
|
1290
|
+
return e;
|
|
1291
|
+
}
|
|
1292
|
+
set size(s) {
|
|
1293
|
+
this.autohideScrollPlugin.setScrollSize(s);
|
|
1294
|
+
if (this.dimension === 'rgRow') {
|
|
1295
|
+
this.element.style.minWidth = `${s}px`;
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
this.element.style.minHeight = `${s}px`;
|
|
1299
|
+
}
|
|
1300
|
+
get size() {
|
|
1301
|
+
if (this.dimension === 'rgRow') {
|
|
1302
|
+
return this.element.clientHeight;
|
|
1303
|
+
}
|
|
1304
|
+
return this.element.clientWidth;
|
|
1305
|
+
}
|
|
1306
|
+
connectedCallback() {
|
|
1307
|
+
this.autohideScrollPlugin = new AutohideScrollPlugin(this.element);
|
|
1308
|
+
this.localScrollTimer = new LocalScrollTimer('ontouchstart' in document.documentElement ? 0 : 10);
|
|
1309
|
+
this.localScrollService = new LocalScrollService({
|
|
1310
|
+
runScroll: e => this.scrollVirtual.emit(e),
|
|
1311
|
+
applyScroll: e => {
|
|
1312
|
+
this.localScrollTimer.setCoordinate(e);
|
|
1313
|
+
const type = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
1314
|
+
// this will trigger on scroll event
|
|
1315
|
+
this.element[type] = e.coordinate;
|
|
1316
|
+
},
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
disconnectedCallback() {
|
|
1320
|
+
this.autohideScrollPlugin.clear();
|
|
1321
|
+
}
|
|
1322
|
+
componentWillLoad() {
|
|
1323
|
+
this.scrollSize = getScrollbarSize(document);
|
|
1324
|
+
}
|
|
1325
|
+
componentDidRender() {
|
|
1326
|
+
const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
|
|
1327
|
+
// Get scrollbar size once during component initialization
|
|
1328
|
+
const scrollbarSize = this.scrollSize;
|
|
1329
|
+
// Calculate if content exceeds viewport size
|
|
1330
|
+
// Add scrollbar size to the comparison to account for other dimension's scrollbar
|
|
1331
|
+
const hasScroll = this.element[type] > this.size + scrollbarSize;
|
|
1332
|
+
// Set scroll size based on whether scroll is needed
|
|
1333
|
+
this.size = hasScroll ? this.scrollSize : 0;
|
|
1334
|
+
let additionalScrollbarSize = 0;
|
|
1335
|
+
if (this.dimension === 'rgRow') {
|
|
1336
|
+
additionalScrollbarSize =
|
|
1337
|
+
this.element.scrollWidth > this.element.clientWidth
|
|
1338
|
+
? scrollbarSize
|
|
1339
|
+
: 0;
|
|
1340
|
+
}
|
|
1341
|
+
else {
|
|
1342
|
+
additionalScrollbarSize =
|
|
1343
|
+
this.element.scrollHeight > this.element.clientHeight
|
|
1344
|
+
? scrollbarSize
|
|
1345
|
+
: 0;
|
|
1346
|
+
}
|
|
1347
|
+
const clientSize = this.size + additionalScrollbarSize;
|
|
1348
|
+
this.localScrollService.setParams({
|
|
1349
|
+
contentSize: this.dimensionStore.get('realSize'),
|
|
1350
|
+
// Add scrollbar size to clientSize if other dimension has scroll
|
|
1351
|
+
clientSize,
|
|
1352
|
+
virtualSize: this.viewportStore.get('clientSize'),
|
|
1353
|
+
}, this.dimension);
|
|
1354
|
+
}
|
|
1355
|
+
onScroll(e) {
|
|
1356
|
+
var _a;
|
|
1357
|
+
if (!(e.target instanceof Element)) {
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
const target = e.target;
|
|
1361
|
+
let type = 'scrollLeft';
|
|
1362
|
+
if (this.dimension === 'rgRow') {
|
|
1363
|
+
type = 'scrollTop';
|
|
1364
|
+
}
|
|
1365
|
+
// apply after throttling
|
|
1366
|
+
if (this.localScrollTimer.isReady(this.dimension, target[type] || 0)) {
|
|
1367
|
+
(_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(target[type] || 0, this.dimension);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
render() {
|
|
1371
|
+
const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
|
|
1372
|
+
const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize'));
|
|
1373
|
+
return (h(Host, { key: '7789bd408d3e154836bcd2aed4ebaa1663e7f968', onScroll: (e) => this.onScroll(e) }, h("div", { key: '40549da97df3a580ad2ddef13fe7b4dbe6df54bc', style: {
|
|
1374
|
+
[sizeType]: `${size}px`,
|
|
1375
|
+
} })));
|
|
1376
|
+
}
|
|
1377
|
+
get element() { return getElement(this); }
|
|
1378
|
+
};
|
|
1379
|
+
RevogrScrollVirtual.style = RevogrScrollVirtualStyle0;
|
|
1380
|
+
|
|
1381
|
+
const revogrTempRangeStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#4545ff;height:32px;line-height:32px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037}.revo-button.red{background-color:#E0662E}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.outline{border:1px solid #dbdbdb;line-height:30px;background:none;color:#000;box-shadow:none}revo-grid[theme^=dark] .revo-button.outline{border:1px solid #404040;color:#d8d8d8}.temp-bg-range{display:block !important;position:absolute;pointer-events:none;z-index:9;border:1px solid rgb(255, 94, 0);box-sizing:border-box}.temp-bg-range.Selection{border:1px dashed gray}.temp-bg-range>div{width:1px;height:1px;position:absolute}.temp-bg-range>div.top{top:-1px}.temp-bg-range>div.bottom{bottom:-1px}.temp-bg-range>div.left{left:-1px}.temp-bg-range>div.right{right:-1px}";
|
|
1382
|
+
const RevogrTempRangeStyle0 = revogrTempRangeStyleCss;
|
|
1383
|
+
|
|
1384
|
+
const RevogrFocus = class {
|
|
1385
|
+
constructor(hostRef) {
|
|
1386
|
+
registerInstance(this, hostRef);
|
|
1387
|
+
this.onChange = throttle((e) => this.doChange(e), 300);
|
|
1388
|
+
this.selectionStore = undefined;
|
|
1389
|
+
this.dimensionRow = undefined;
|
|
1390
|
+
this.dimensionCol = undefined;
|
|
1391
|
+
}
|
|
1392
|
+
doChange(e) {
|
|
1393
|
+
e === null || e === void 0 ? void 0 : e.scrollIntoView({
|
|
1394
|
+
block: 'nearest',
|
|
1395
|
+
inline: 'nearest',
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
componentDidRender() {
|
|
1399
|
+
if (this.el) {
|
|
1400
|
+
this.onChange(this.el);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
render() {
|
|
1404
|
+
const data = this.selectionStore.get('tempRange');
|
|
1405
|
+
const type = this.selectionStore.get('tempRangeType');
|
|
1406
|
+
if (!data) {
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
let directionY = 'bottom';
|
|
1410
|
+
let derectionX = 'right';
|
|
1411
|
+
const range = this.getRange();
|
|
1412
|
+
if (!range) {
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
if (data.y < range.y) {
|
|
1416
|
+
directionY = 'top';
|
|
1417
|
+
}
|
|
1418
|
+
if (data.x < range.x) {
|
|
1419
|
+
derectionX = 'left';
|
|
1420
|
+
}
|
|
1421
|
+
const directionClass = `${derectionX} ${directionY}`;
|
|
1422
|
+
const cell = getCell(data, this.dimensionRow.state, this.dimensionCol.state);
|
|
1423
|
+
const styles = styleByCellProps(cell);
|
|
1424
|
+
const props = {
|
|
1425
|
+
class: {
|
|
1426
|
+
[TMP_SELECTION_BG_CLASS]: true,
|
|
1427
|
+
[type || '']: true,
|
|
1428
|
+
},
|
|
1429
|
+
style: styles,
|
|
1430
|
+
hidden: false
|
|
1431
|
+
};
|
|
1432
|
+
return (h(Host, Object.assign({}, props), h("div", { class: directionClass, ref: (e) => (this.el = e) })));
|
|
1433
|
+
}
|
|
1434
|
+
getRange() {
|
|
1435
|
+
const range = this.selectionStore.get('range');
|
|
1436
|
+
if (range) {
|
|
1437
|
+
return range;
|
|
1438
|
+
}
|
|
1439
|
+
const focus = this.selectionStore.get('focus');
|
|
1440
|
+
if (!focus) {
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
return Object.assign(Object.assign({}, focus), { x1: focus.x, y1: focus.y });
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
RevogrFocus.style = RevogrTempRangeStyle0;
|
|
1447
|
+
|
|
1448
|
+
export { Attribution as revogr_attribution, RevoGridExtra as revogr_extra, RevogrFocus$1 as revogr_focus, OverlaySelection as revogr_overlay_selection, RevogrRowHeaders as revogr_row_headers, RevogrScrollVirtual as revogr_scroll_virtual, RevogrFocus as revogr_temp_range };
|
|
1449
|
+
|
|
5
1450
|
//# sourceMappingURL=revogr-attribution_7.entry.js.map
|