@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.
Files changed (95) hide show
  1. package/dist/cjs/{column.drag.plugin-0ce0b39a.js → column.drag.plugin-0f367fe1.js} +2 -1
  2. package/dist/cjs/column.drag.plugin-0f367fe1.js.map +1 -0
  3. package/dist/cjs/column.service-b59380a3.js.map +1 -1
  4. package/dist/cjs/{sorting.sign-a1e9d97a.js → grouping.row.renderer-d6119ced.js} +6 -6
  5. package/dist/cjs/grouping.row.renderer-d6119ced.js.map +1 -0
  6. package/dist/cjs/index.cjs.js +7 -6
  7. package/dist/cjs/index.cjs.js.map +1 -1
  8. package/dist/cjs/revo-grid.cjs.entry.js +2 -2
  9. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  10. package/dist/cjs/revogr-data_4.cjs.entry.js +5 -5
  11. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  12. package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -1
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  14. package/dist/collection/components/revoGrid/revo-grid-style.css +109 -197
  15. package/dist/collection/plugins/filter/filter.style.css +12 -25
  16. package/dist/collection/plugins/sorting/sorting.plugin.js +2 -0
  17. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  18. package/dist/collection/store/selection/selection.store.js.map +1 -1
  19. package/dist/esm/{column.drag.plugin-017c4fb3.js → column.drag.plugin-d201beb7.js} +2 -2
  20. package/dist/esm/{column.drag.plugin-017c4fb3.js.map → column.drag.plugin-d201beb7.js.map} +1 -1
  21. package/dist/esm/column.service-f39c0a1d.js.map +1 -1
  22. package/dist/esm/{sorting.sign-c02e3b12.js → grouping.row.renderer-95f32c6b.js} +6 -6
  23. package/dist/esm/grouping.row.renderer-95f32c6b.js.map +1 -0
  24. package/dist/esm/index.js +3 -3
  25. package/dist/esm/revo-grid.entry.js +2 -2
  26. package/dist/esm/revo-grid.entry.js.map +1 -1
  27. package/dist/esm/revogr-data_4.entry.js +1 -1
  28. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  29. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  30. package/dist/revo-grid/app-globals-6b929fd8.js +8 -1
  31. package/dist/revo-grid/app-globals-6b929fd8.js.map +1 -1
  32. package/dist/revo-grid/column.drag.plugin-d201beb7.js +2522 -0
  33. package/dist/revo-grid/column.drag.plugin-d201beb7.js.map +1 -0
  34. package/dist/revo-grid/column.service-f39c0a1d.js +1293 -1
  35. package/dist/revo-grid/column.service-f39c0a1d.js.map +1 -1
  36. package/dist/revo-grid/debounce-b3166f78.js +491 -1
  37. package/dist/revo-grid/debounce-b3166f78.js.map +1 -1
  38. package/dist/revo-grid/dimension.helpers-5567e424.js +3608 -1
  39. package/dist/revo-grid/dimension.helpers-5567e424.js.map +1 -1
  40. package/dist/revo-grid/edit.utils-b59306be.js +13 -1
  41. package/dist/revo-grid/edit.utils-b59306be.js.map +1 -1
  42. package/dist/revo-grid/events-cf0893a3.js +38 -1
  43. package/dist/revo-grid/events-cf0893a3.js.map +1 -1
  44. package/dist/revo-grid/filter.button-84396156.js +34 -1
  45. package/dist/revo-grid/filter.button-84396156.js.map +1 -1
  46. package/dist/revo-grid/grouping.row.renderer-95f32c6b.js +65 -0
  47. package/dist/revo-grid/grouping.row.renderer-95f32c6b.js.map +1 -0
  48. package/dist/revo-grid/header-cell-renderer-31f53644.js +335 -1
  49. package/dist/revo-grid/header-cell-renderer-31f53644.js.map +1 -1
  50. package/dist/revo-grid/index-f6fae858.js +2090 -2
  51. package/dist/revo-grid/index-f6fae858.js.map +1 -1
  52. package/dist/revo-grid/index.esm.js +160 -1
  53. package/dist/revo-grid/index.esm.js.map +1 -1
  54. package/dist/revo-grid/key.utils-3632161b.js +85 -1
  55. package/dist/revo-grid/key.utils-3632161b.js.map +1 -1
  56. package/dist/revo-grid/resize-observer-83c9e167.js +501 -1
  57. package/dist/revo-grid/resize-observer-83c9e167.js.map +1 -1
  58. package/dist/revo-grid/revo-grid.entry.js +1943 -1
  59. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  60. package/dist/revo-grid/revo-grid.esm.js +21 -1
  61. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  62. package/dist/revo-grid/revogr-attribution_7.entry.js +1446 -1
  63. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  64. package/dist/revo-grid/revogr-clipboard_3.entry.js +455 -1
  65. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  66. package/dist/revo-grid/revogr-data_4.entry.js +960 -1
  67. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  68. package/dist/revo-grid/revogr-filter-panel.entry.js +340 -1
  69. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  70. package/dist/revo-grid/text-editor-e47e56c3.js +74 -1
  71. package/dist/revo-grid/text-editor-e47e56c3.js.map +1 -1
  72. package/dist/revo-grid/throttle-dec28f5b.js +229 -1
  73. package/dist/revo-grid/throttle-dec28f5b.js.map +1 -1
  74. package/dist/revo-grid/viewport.helpers-7e7f9dad.js +48 -1
  75. package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -1
  76. package/dist/revo-grid/viewport.store-c18a25a6.js +402 -1
  77. package/dist/revo-grid/viewport.store-c18a25a6.js.map +1 -1
  78. package/dist/types/plugins/sorting/sorting.plugin.d.ts +2 -0
  79. package/dist/types/store/selection/selection.store.d.ts +1 -1
  80. package/hydrate/index.js +7 -7
  81. package/hydrate/index.mjs +7 -7
  82. package/package.json +1 -1
  83. package/standalone/column.service.js.map +1 -1
  84. package/standalone/index.js +1 -1
  85. package/standalone/revo-grid.js +2 -2
  86. package/standalone/revo-grid.js.map +1 -1
  87. package/standalone/revogr-filter-panel.js +1 -1
  88. package/standalone/revogr-filter-panel.js.map +1 -1
  89. package/dist/cjs/column.drag.plugin-0ce0b39a.js.map +0 -1
  90. package/dist/cjs/sorting.sign-a1e9d97a.js.map +0 -1
  91. package/dist/esm/sorting.sign-c02e3b12.js.map +0 -1
  92. package/dist/revo-grid/column.drag.plugin-017c4fb3.js +0 -5
  93. package/dist/revo-grid/column.drag.plugin-017c4fb3.js.map +0 -1
  94. package/dist/revo-grid/sorting.sign-c02e3b12.js +0 -5
  95. package/dist/revo-grid/sorting.sign-c02e3b12.js.map +0 -1
@@ -1,5 +1,1297 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import{a3 as t,a0 as e,a4 as n,Y as s,W as i,w as r,P as o,_ as l,Z as u,a as c,C as f,z as a,b as d}from"./dimension.helpers-5567e424.js";import"./index-f6fae858.js";function h(t,e,n,s){var i=-1,r=t==null?0:t.length;if(s&&r){n=t[++i]}while(++i<r){n=e(n,t[i],i,t)}return n}function p(t){return function(e,n,s){var i=-1,r=Object(e),o=s(e),l=o.length;while(l--){var u=o[t?l:++i];if(n(r[u],u,r)===false){break}}return e}}var v=p();const g=v;function x(e,n){return e&&g(e,n,t)}function m(t,n){return function(s,i){if(s==null){return s}if(!e(s)){return t(s,i)}var r=s.length,o=n?r:-1,l=Object(s);while(n?o--:++o<r){if(i(l[o],o,l)===false){break}}return s}}var y=m(x);const b=y;function O(t,e,n,s,i){i(t,(function(t,i,r){n=s?(s=false,t):e(n,t,i,r)}));return n}function j(t,e,i){var r=s(t)?h:O,o=arguments.length<3;return r(t,n(e),i,o,b)}function w(t){if(typeof t==="undefined"||t===null){return""}return t}function I(t={},e){if(!e){return}if(e.cellParser){return e.cellParser(t,e)}return t[e.prop]}function R(t,e){return w(I(t,e))}function C(t){if(t.pin){return t.pin}return"rgCol"}function A(t){const e={};for(const[n,s]of t.entries()){if(s.size){e[n]=s.size}}return e}function E(t){return!!t.children}function P(t,e=0,n){const s={columns:{rgCol:[],colPinStart:[],colPinEnd:[]},columnByProp:{},columnGrouping:{rgCol:[],colPinStart:[],colPinEnd:[]},maxLevel:e,sort:{}};return j(t,((t,s)=>{if(E(s)){t=M(t,s,P(s.children,e+1,n),e);return t}const i=s.columnType&&(n===null||n===void 0?void 0:n[s.columnType]);const r=Object.assign(Object.assign({},i),s);if(!r.pin){t.columns.rgCol.push(r)}else{t.columns[r.pin].push(r)}if(r.order){t.sort[r.prop]=r}if(!t.columnByProp[r.prop]){t.columnByProp[r.prop]=[]}t.columnByProp[r.prop].push(r);r.beforeSetup&&r.beforeSetup(r);return t}),s)}function M(t,e,n,i=0){const r=Object.assign(Object.assign({},e),{level:i,ids:[]});for(let e in n.columns){const i=e;const o=t.columns[i];const l=n.columns[i];if(s(o)&&s(l)){o.push(...l);if(l.length){t.columnGrouping[i].push(Object.assign(Object.assign({},r),{ids:l.map((t=>t.prop))}))}}}for(let e in n.columnGrouping){const s=e;const i=n.columnGrouping[s];t.columnGrouping[s].push(...i)}t.maxLevel=Math.max(t.maxLevel,n.maxLevel);t.sort=Object.assign(Object.assign({},t.sort),n.sort);t.columnByProp=Object.assign(Object.assign({},t.columnByProp),n.columnByProp);return t}function S(t,e){for(const n of t){if(E(n)){const t=S(n.children,e);if(t){return t}}else if(n.prop===e){return n}}return undefined}function T(t,e){return S(t,e)}function N(){return{range:null,tempRange:null,tempRangeType:null,focus:null,edit:null,lastCell:null,nextFocus:null}}class ${constructor(){this.unsubscribe=[];this.store=i(N());this.store.on("set",((t,e)=>{if(t==="tempRange"&&!e){this.store.set("tempRangeType",null)}}))}onChange(t,e){this.unsubscribe.push(this.store.onChange(t,e))}clearFocus(){r(this.store,{focus:null,range:null,edit:null,tempRange:null})}setFocus(t,e){if(!e){r(this.store,{focus:t})}else{r(this.store,{focus:t,range:V(t,e),edit:null,tempRange:null})}}setNextFocus(t){r(this.store,{nextFocus:t})}setTempArea(t){r(this.store,{tempRange:t===null||t===void 0?void 0:t.area,tempRangeType:t===null||t===void 0?void 0:t.type,edit:null})}clearTemp(){r(this.store,{tempRange:null})}setRangeArea(t){r(this.store,{range:t,edit:null,tempRange:null})}setRange(t,e){const n=V(t,e);this.setRangeArea(n)}setLastCell(t){r(this.store,{lastCell:t})}setEdit(t){const e=this.store.get("focus");if(e&&typeof t==="string"){r(this.store,{edit:{x:e.x,y:e.y,val:t}});return}r(this.store,{edit:null})}dispose(){this.unsubscribe.forEach((t=>t()));this.store.dispose()}}const k=-1;class F{constructor(){this.dirty=false;this.stores={};this.columnStores={};this.rowStores={};this.storesByType={};this.storesXToType={};this.storesYToType={};this.sections=[]}get focusedStore(){var t;for(let e in this.stores){for(let n in this.stores[e]){const s=(t=this.stores[e][n])===null||t===void 0?void 0:t.store.get("focus");if(s){return{entity:this.stores[e][n],cell:s,position:{x:parseInt(n,10),y:parseInt(e,10)}}}}}return null}get edit(){var t;return(t=this.focusedStore)===null||t===void 0?void 0:t.entity.store.get("edit")}get focused(){var t;return(t=this.focusedStore)===null||t===void 0?void 0:t.entity.store.get("focus")}get selectedRange(){var t;return(t=this.focusedStore)===null||t===void 0?void 0:t.entity.store.get("range")}registerSection(t){if(!t){this.sections.length=0;this.dirty=true;return}if(this.sections.indexOf(t)===-1){this.sections.push(t)}}beforeUpdate(){if(this.dirty){for(let t in this.stores){for(let e in this.stores[t]){this.stores[t][e].dispose()}}this.dirty=false}}registerColumn(t,e){if(D(t)){return new $}if(this.columnStores[t]){return this.columnStores[t]}this.columnStores[t]=new $;this.storesByType[e]=t;this.storesXToType[t]=e;return this.columnStores[t]}registerRow(t,e){if(D(t)){return new $}if(this.rowStores[t]){return this.rowStores[t]}this.rowStores[t]=new $;this.storesByType[e]=t;this.storesYToType[t]=e;return this.rowStores[t]}register({x:t,y:e}){var n,s;if(D(t)||D(e)){return new $}if(!this.stores[e]){this.stores[e]={}}if(this.stores[e][t]){return this.stores[e][t]}this.stores[e][t]=new $;(n=this.stores[e][t])===null||n===void 0?void 0:n.onChange("range",(n=>{this.columnStores[t].setRangeArea(n);this.rowStores[e].setRangeArea(n)}));(s=this.stores[e][t])===null||s===void 0?void 0:s.store.on("dispose",(()=>this.destroy(t,e)));return this.stores[e][t]}destroy(t,e){var n,s;(n=this.columnStores[t])===null||n===void 0?void 0:n.dispose();(s=this.rowStores[e])===null||s===void 0?void 0:s.dispose();delete this.rowStores[e];delete this.columnStores[t];if(this.storesXToType[t]){const e=this.storesXToType[t];delete this.storesXToType[t];delete this.storesByType[e]}if(this.storesYToType[e]){const t=this.storesYToType[e];delete this.storesYToType[e];delete this.storesByType[t]}if(this.stores[e]){delete this.stores[e][t]}if(!Object.keys(this.stores[e]||{}).length){delete this.stores[e]}}setEditByCell(t,e){this.focusByCell(t,e,e);this.setEdit("")}beforeNextFocusCell(t){var e;if(!this.focusedStore){return}const n=this.focusedStore.entity.store.get("lastCell");const s=n&&this.getNextStore(t,this.focusedStore.position,n);(e=s===null||s===void 0?void 0:s.store)===null||e===void 0?void 0:e.setNextFocus(Object.assign(Object.assign({},t),s.item))}focusByCell(t,e,n){const s=this.stores[t.y][t.x];this.focus(s,{focus:e,end:n})}focus(t,{focus:e,end:n}){const s=this.getCurrentStorePointer(t);if(!s){return null}const i=t.store.get("lastCell");const r=i&&this.getNextStore(e,s,i);if(r===null||r===void 0?void 0:r.store){const t=Object.assign(Object.assign({},e),r.item);this.focus(r.store,{focus:t,end:t});return null}if(i){e=B(e,i);n=B(n,i)}t.setFocus(e,n);return e}getCurrentStorePointer(t){let e;for(let n in this.stores){for(let s in this.stores[n]){const i=this.stores[n][s];if(i!==t){i.clearFocus()}else{e={x:parseInt(s,10),y:parseInt(n,10)}}}}return e}getNextStore(t,e,n){const s=G(t,n);let i;if(s){Object.entries(s).forEach((([t,n])=>{let r;switch(t){case"x":r=this.getXStores(e.y);break;case"y":r=this.getYStores(e.x);break}if(n>=0){i=r[++e[t]]}else{i=r[--e[t]];const o=i===null||i===void 0?void 0:i.store.get("lastCell");if(o){s[t]=o[t]+n}}}))}return{store:i,item:s}}clearAll(){var t;for(let e in this.stores){for(let n in this.stores[e]){(t=this.stores[e][n])===null||t===void 0?void 0:t.clearFocus()}}}setEdit(t){if(!this.focusedStore){return}this.focusedStore.entity.setEdit(t)}selectAll(){for(let t in this.stores){for(let e in this.stores[t]){const n=this.stores[t][e];if(!n){continue}const s=n.store.get("lastCell");if(s){n.setRange({x:0,y:0},{x:s.x-1,y:s.y-1})}}}}getXStores(t){return this.stores[t]}getYStores(t){const e={};for(let n in this.stores){e[n]=this.stores[n][t]}return e}}function D(t){return t===k}function G(t,e){const n={};let s=["x","y"];for(let e of s){if(t[e]<0){n[e]=t[e];return n}}for(let i of s){if(t[i]>=e[i]){n[i]=t[i]-e[i];return n}}return null}function B(t,e){const n=Object.assign({},t);const s=["x","y"];for(const i of s){if(t[i]<0){n[i]=0}else if(t[i]>=e[i]){n[i]=e[i]-1}}return n}function V(t,e){return t&&e?{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x1:Math.max(t.x,e.x),y1:Math.max(t.y,e.y)}:null}function J(t){return t.x===t.x1&&t.y===t.y1}const L=`${o}-depth`;const z=`${o}-name`;const W=`${o}-id`;const Y=`${o}-value`;const q=`${o}-column`;const H=`${o}-expanded`;const K=`${o}-prop`;const U=`${o}-original-index`;const X=`group-expand`;const Z=`groupexpandclick`;const _="rgRow";function Q(t,e){return t[e]||null}function tt(t,e,n=false){let s=0;const i={source:[],prevExpanded:{},oldNewIndexes:{}};e.forEach((e=>{const r=t[e];if(!n){i.source.push(r);return}if(rt(r)){if(et(r)){i.prevExpanded[r[Y]]=true}}else{i.source.push(r);i.oldNewIndexes[e]=s;s++}}));return i}function et(t={}){return t[H]}function nt({groupedValues:t,parentIds:e,isExpanded:n,itemIndex:s,expandedAll:i,prevExpanded:r,columnProps:o}){const l=e.length;const u=[];let c={};let f={};t.forEach(((t,a)=>{const d=[...e,a];const h=d.join(",");const p=n&&(!!i||!!r[h]);u.push({[z]:a,[L]:l,[W]:JSON.stringify(d),[Y]:h,[H]:p,[K]:o[l],[o[l]]:a});s+=1;if(!p&&l){c[s]=true}if(Array.isArray(t)){t.forEach((t=>{s+=1;if(!p){c[s]=true}f[t[U]]=s}));u.push(...t)}else{const e=nt({groupedValues:t,parentIds:d,isExpanded:p,itemIndex:s,expandedAll:i,prevExpanded:r,columnProps:o});u.push(...e.source);c=Object.assign(Object.assign({},e.trimmed),c);f=Object.assign(Object.assign({},e.oldNewIndexMap),f);s=e.itemIndex}}));return{source:u,oldNewIndexMap:f,trimmed:c,itemIndex:s}}function st(t,e,{prevExpanded:n={},expandedAll:s=false,getGroupValue:i=Q}){const r=new Map;t.forEach(((t,n)=>{const s=e.map((e=>i(t,e)));const o=s.pop();let l=r;s.forEach((t=>{if(!l.has(t)){l.set(t,new Map)}l=l.get(t)}));if(!l.has(o)){const t=[];l.set(o,t)}const u=l.get(o);u.push(Object.assign(Object.assign({},t),{[U]:n}))}));const o=e.length;const{source:l,trimmed:u,oldNewIndexMap:c}=nt({groupedValues:r,parentIds:[],isExpanded:true,itemIndex:-1,expandedAll:s,prevExpanded:n,columnProps:e});return{sourceWithGroups:l,depth:o,trimmed:u,oldNewIndexMap:c}}function it(t){return t===null||t===void 0?void 0:t[z]}function rt(t){return typeof(t===null||t===void 0?void 0:t[z])!=="undefined"}function ot(t){return typeof(t===null||t===void 0?void 0:t[q])!=="undefined"}function lt(t,e){const n=t.length;let s=0;for(;s<n;s++){if(t[s]!==e[s]){return s}}return s}function ut(t){const e=JSON.parse(t);if(!Array.isArray(e)){return null}return e}function ct(t,e,n){const s=ut(n[W]);if(!s){return false}const i=lt(t,s);return e[L]<i}function ft(t,e,n){var s=-1,i=t.length;if(e<0){e=-e>i?0:i+e}n=n>i?i:n;if(n<0){n+=i}i=e>n?0:n-e>>>0;e>>>=0;var r=Array(i);while(++s<i){r[s]=t[s+e]}return r}function at(t,e,n){var s=t==null?0:t.length;if(!s){return[]}if(n&&typeof n!="number"&&l(t,e,n)){e=0;n=s}else{e=e==null?0:u(e);n=n===undefined?s:u(n)}return ft(t,e,n)}function dt(t,e={}){const n=t===null||t===void 0?void 0:t.editor;if(!n){return undefined}if(typeof n==="string"){return e[n]}return n}class ht{get columns(){return c(this.source)}constructor(t,e){this.dataStore=t;this.source=e;this.unsubscribe=[];this.hasGrouping=false;this.unsubscribe.push(e.onChange("source",(t=>this.checkGrouping(t))));this.checkGrouping(e.get("source"));this.type=e.get("type")}checkGrouping(t){for(let e of t){if(ot(e)){this.hasGrouping=true;return}this.hasGrouping=false}}isReadOnly(t,e){var n;const s=(n=this.columns[e])===null||n===void 0?void 0:n.readonly;if(typeof s==="function"){const n=this.rowDataModel(t,e);return s(n)}return!!s}mergeProperties(t,e,n,s){var i,r;const o=Object.assign({},n);o.class=Object.assign(Object.assign({},typeof o.class==="string"?{[o.class]:true}:o.class),{[f]:true,[a]:this.isReadOnly(t,e)});const l=(r=(i=s.column)===null||i===void 0?void 0:i.cellProperties)===null||r===void 0?void 0:r.call(i,s);if(!l){return o}return gt(o,l)}getRowClass(t,e){const n=d(this.dataStore,t)||{};return n[e]||""}getSaveData(t,e,n){const s=this.rowDataModel(t,e);if(typeof n==="undefined"){n=w(s.value)}return Object.assign(Object.assign({},s),{val:n})}rowDataModel(t,e){const n=this.columns[e];const s=n===null||n===void 0?void 0:n.prop;const i=d(this.dataStore,t)||{};const r=this.dataStore.get("type");return{prop:s,model:i,data:this.dataStore.get("source"),column:n,rowIndex:t,colIndex:e,colType:this.type,type:r,value:I(i,n)}}getRangeData(t,e){var n;const s={};const i=t.oldRange.x1-t.oldRange.x+1;const r=t.oldRange.y1-t.oldRange.y+1;const o={};for(let l=t.newRange.y,u=0;l<t.newRange.y1+1;l++,u++){const c=t.oldRange.y+u%r;const f=d(this.dataStore,c)||{};for(let r=t.newRange.x,u=0;r<t.newRange.x1+1;r++,u++){if(l>=t.oldRange.y&&l<=t.oldRange.y1&&r>=t.oldRange.x&&r<=t.oldRange.x1){continue}if(!this.columns[r]){continue}const a=(n=this.columns[r])===null||n===void 0?void 0:n.prop;const d=t.oldRange.x+u%i;const h=e[d].prop;if(!this.isReadOnly(l,r)){if(!s[l]){s[l]={}}s[l][a]=f[h];if(!o[l]){o[l]={}}o[l][a]={colIndex:d,colProp:h,rowIndex:c}}}}return{changed:s,mapping:o}}getTransformedDataToApply(t,e){const n={};const s=e.length;const i=this.columns.length;const r=this.dataStore.get("items").length;let o=t.y;let l=0;for(let u=0;o<r&&u<s;o++,u++){const r=e[u%s];const c=(r===null||r===void 0?void 0:r.length)||0;let f=t.x;for(let t=0;f<i&&t<c;f++,t++){const e=this.columns[f].prop;const s=t%i;if(!this.isReadOnly(o,f)){if(!n[o]){n[o]={}}n[o][e]=r[s]}}l=Math.max(l,f-1)}const u=V(t,{y:o-1,x:l});return{changed:n,range:u}}getRangeStaticData(t,e){const n={};for(let s=t.y,i=0;s<t.y1+1;s++,i++){for(let i=t.x,r=0;i<t.x1+1;i++,r++){if(!this.columns[i]){continue}const t=this.columns[i].prop;if(!this.isReadOnly(s,i)){if(!n[s]){n[s]={}}n[s][t]=e}}}return n}getRangeTransformedToProps(t,e){var n;const s=[];const i=this.dataStore.get("type");for(let r=t.y,o=0;r<t.y1+1;r++,o++){for(let o=t.x,l=0;o<t.x1+1;o++,l++){const t=(n=this.columns[o])===null||n===void 0?void 0:n.prop;s.push({prop:t,rowIndex:r,colIndex:o,model:d(e,r),type:i,colType:this.type})}}return s}copyRangeArray(t,e){const n=[...this.columns];const s=at(n,t.x,t.x1+1).map((t=>t.prop));const i=[];const r={};for(let n=t.y;n<=t.y1;n++){const t=[];r[n]={};for(let i of s){const s=d(e,n);if(!s){continue}const o=s[i];t.push(o);r[n][i]=o}i.push(t)}return{data:i,mapping:r}}destroy(){this.unsubscribe.forEach((t=>t()))}}function pt(t,e){if(typeof t==="function"){return t(e)}return!!t}function vt(t={},e={}){if(typeof t==="string"){t={[t]:true}}if(typeof e==="string"){e={[e]:true}}return Object.assign(Object.assign({},t),e)}function gt(t,e){if(e.className){e.class=vt(e.class,e.className);delete e.className}let n=Object.assign(Object.assign({},e),t);if(e.class){n.class=vt(n.class,e.class)}if(e.style){n.style=Object.assign(Object.assign({},e.style),n.style)}return n}export{C as A,A as B,E as C,P as D,M as E,T as F,L as G,j as H,b as I,gt as J,k as K,F as L,ht as M,dt as N,pt as O,z as P,$ as S,J as a,W as b,B as c,Y as d,q as e,H as f,V as g,K as h,D as i,U as j,X as k,Z as l,_ as m,G as n,tt as o,et as p,st as q,it as r,rt as s,ot as t,lt as u,ut as v,ct as w,w as x,I as y,R as z};
4
+ import { a3 as keys, a0 as isArrayLike, a4 as baseIteratee, Y as isArray, W as createStore, w as setStore, P as GRID_INTERNALS, _ as isIterateeCall, Z as toInteger, a as getVisibleSourceItem, C as CELL_CLASS, z as DISABLED_CLASS, b as getSourceItem } from './dimension.helpers-5567e424.js';
5
+ import './index-f6fae858.js';
6
+
7
+ /**
8
+ * A specialized version of `_.reduce` for arrays without support for
9
+ * iteratee shorthands.
10
+ *
11
+ * @private
12
+ * @param {Array} [array] The array to iterate over.
13
+ * @param {Function} iteratee The function invoked per iteration.
14
+ * @param {*} [accumulator] The initial value.
15
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
16
+ * the initial value.
17
+ * @returns {*} Returns the accumulated value.
18
+ */
19
+ function arrayReduce(array, iteratee, accumulator, initAccum) {
20
+ var index = -1,
21
+ length = array == null ? 0 : array.length;
22
+
23
+ if (initAccum && length) {
24
+ accumulator = array[++index];
25
+ }
26
+ while (++index < length) {
27
+ accumulator = iteratee(accumulator, array[index], index, array);
28
+ }
29
+ return accumulator;
30
+ }
31
+
32
+ /**
33
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
34
+ *
35
+ * @private
36
+ * @param {boolean} [fromRight] Specify iterating from right to left.
37
+ * @returns {Function} Returns the new base function.
38
+ */
39
+ function createBaseFor(fromRight) {
40
+ return function(object, iteratee, keysFunc) {
41
+ var index = -1,
42
+ iterable = Object(object),
43
+ props = keysFunc(object),
44
+ length = props.length;
45
+
46
+ while (length--) {
47
+ var key = props[fromRight ? length : ++index];
48
+ if (iteratee(iterable[key], key, iterable) === false) {
49
+ break;
50
+ }
51
+ }
52
+ return object;
53
+ };
54
+ }
55
+
56
+ /**
57
+ * The base implementation of `baseForOwn` which iterates over `object`
58
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
59
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
60
+ *
61
+ * @private
62
+ * @param {Object} object The object to iterate over.
63
+ * @param {Function} iteratee The function invoked per iteration.
64
+ * @param {Function} keysFunc The function to get the keys of `object`.
65
+ * @returns {Object} Returns `object`.
66
+ */
67
+ var baseFor = createBaseFor();
68
+
69
+ const baseFor$1 = baseFor;
70
+
71
+ /**
72
+ * The base implementation of `_.forOwn` without support for iteratee shorthands.
73
+ *
74
+ * @private
75
+ * @param {Object} object The object to iterate over.
76
+ * @param {Function} iteratee The function invoked per iteration.
77
+ * @returns {Object} Returns `object`.
78
+ */
79
+ function baseForOwn(object, iteratee) {
80
+ return object && baseFor$1(object, iteratee, keys);
81
+ }
82
+
83
+ /**
84
+ * Creates a `baseEach` or `baseEachRight` function.
85
+ *
86
+ * @private
87
+ * @param {Function} eachFunc The function to iterate over a collection.
88
+ * @param {boolean} [fromRight] Specify iterating from right to left.
89
+ * @returns {Function} Returns the new base function.
90
+ */
91
+ function createBaseEach(eachFunc, fromRight) {
92
+ return function(collection, iteratee) {
93
+ if (collection == null) {
94
+ return collection;
95
+ }
96
+ if (!isArrayLike(collection)) {
97
+ return eachFunc(collection, iteratee);
98
+ }
99
+ var length = collection.length,
100
+ index = fromRight ? length : -1,
101
+ iterable = Object(collection);
102
+
103
+ while ((fromRight ? index-- : ++index < length)) {
104
+ if (iteratee(iterable[index], index, iterable) === false) {
105
+ break;
106
+ }
107
+ }
108
+ return collection;
109
+ };
110
+ }
111
+
112
+ /**
113
+ * The base implementation of `_.forEach` without support for iteratee shorthands.
114
+ *
115
+ * @private
116
+ * @param {Array|Object} collection The collection to iterate over.
117
+ * @param {Function} iteratee The function invoked per iteration.
118
+ * @returns {Array|Object} Returns `collection`.
119
+ */
120
+ var baseEach = createBaseEach(baseForOwn);
121
+
122
+ const baseEach$1 = baseEach;
123
+
124
+ /**
125
+ * The base implementation of `_.reduce` and `_.reduceRight`, without support
126
+ * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
127
+ *
128
+ * @private
129
+ * @param {Array|Object} collection The collection to iterate over.
130
+ * @param {Function} iteratee The function invoked per iteration.
131
+ * @param {*} accumulator The initial value.
132
+ * @param {boolean} initAccum Specify using the first or last element of
133
+ * `collection` as the initial value.
134
+ * @param {Function} eachFunc The function to iterate over `collection`.
135
+ * @returns {*} Returns the accumulated value.
136
+ */
137
+ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
138
+ eachFunc(collection, function(value, index, collection) {
139
+ accumulator = initAccum
140
+ ? (initAccum = false, value)
141
+ : iteratee(accumulator, value, index, collection);
142
+ });
143
+ return accumulator;
144
+ }
145
+
146
+ /**
147
+ * Reduces `collection` to a value which is the accumulated result of running
148
+ * each element in `collection` thru `iteratee`, where each successive
149
+ * invocation is supplied the return value of the previous. If `accumulator`
150
+ * is not given, the first element of `collection` is used as the initial
151
+ * value. The iteratee is invoked with four arguments:
152
+ * (accumulator, value, index|key, collection).
153
+ *
154
+ * Many lodash methods are guarded to work as iteratees for methods like
155
+ * `_.reduce`, `_.reduceRight`, and `_.transform`.
156
+ *
157
+ * The guarded methods are:
158
+ * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
159
+ * and `sortBy`
160
+ *
161
+ * @static
162
+ * @memberOf _
163
+ * @since 0.1.0
164
+ * @category Collection
165
+ * @param {Array|Object} collection The collection to iterate over.
166
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
167
+ * @param {*} [accumulator] The initial value.
168
+ * @returns {*} Returns the accumulated value.
169
+ * @see _.reduceRight
170
+ * @example
171
+ *
172
+ * _.reduce([1, 2], function(sum, n) {
173
+ * return sum + n;
174
+ * }, 0);
175
+ * // => 3
176
+ *
177
+ * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
178
+ * (result[value] || (result[value] = [])).push(key);
179
+ * return result;
180
+ * }, {});
181
+ * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
182
+ */
183
+ function reduce(collection, iteratee, accumulator) {
184
+ var func = isArray(collection) ? arrayReduce : baseReduce,
185
+ initAccum = arguments.length < 3;
186
+
187
+ return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach$1);
188
+ }
189
+
190
+ function getCellData(val) {
191
+ if (typeof val === 'undefined' || val === null) {
192
+ return '';
193
+ }
194
+ return val;
195
+ }
196
+ function getCellRaw(model = {}, column) {
197
+ if (!column) {
198
+ return;
199
+ }
200
+ if (column.cellParser) {
201
+ return column.cellParser(model, column);
202
+ }
203
+ return model[column.prop];
204
+ }
205
+ function getCellDataParsed(model, column) {
206
+ return getCellData(getCellRaw(model, column));
207
+ }
208
+ /**
209
+ * Get column type from column data
210
+ */
211
+ function getColumnType(rgCol) {
212
+ if (rgCol.pin) {
213
+ return rgCol.pin;
214
+ }
215
+ return 'rgCol';
216
+ }
217
+ function getColumnSizes(cols) {
218
+ const res = {};
219
+ for (const [i, c] of cols.entries()) {
220
+ if (c.size) {
221
+ res[i] = c.size;
222
+ }
223
+ }
224
+ return res;
225
+ }
226
+ /**
227
+ * Check if column is grouping column
228
+ */
229
+ function isColGrouping(colData) {
230
+ return !!colData.children;
231
+ }
232
+ /**
233
+ * This function is used to create a collection of columns.
234
+ */
235
+ function getColumns(columns, level = 0, types) {
236
+ const collection = {
237
+ // columns as they are in stores per type
238
+ columns: {
239
+ rgCol: [],
240
+ colPinStart: [],
241
+ colPinEnd: [],
242
+ },
243
+ // columns indexed by prop for quick access
244
+ columnByProp: {},
245
+ // column grouping
246
+ columnGrouping: {
247
+ rgCol: [],
248
+ colPinStart: [],
249
+ colPinEnd: [],
250
+ },
251
+ // max depth level for column grouping
252
+ maxLevel: level,
253
+ // sorting
254
+ sort: {},
255
+ };
256
+ return reduce(columns, (res, colData) => {
257
+ // Grouped column
258
+ if (isColGrouping(colData)) {
259
+ res = gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
260
+ return res;
261
+ }
262
+ // Column type
263
+ const columnDefinitionFromType = colData.columnType && (types === null || types === void 0 ? void 0 : types[colData.columnType]);
264
+ // Regular column
265
+ const regularColumn = Object.assign(Object.assign({}, columnDefinitionFromType), colData);
266
+ // Regular column, no Pin
267
+ if (!regularColumn.pin) {
268
+ res.columns.rgCol.push(regularColumn);
269
+ // Pin
270
+ }
271
+ else {
272
+ res.columns[regularColumn.pin].push(regularColumn);
273
+ }
274
+ if (regularColumn.order) {
275
+ res.sort[regularColumn.prop] = regularColumn;
276
+ }
277
+ // it's possible that some columns have same prop, but better to avoid it
278
+ if (!res.columnByProp[regularColumn.prop]) {
279
+ res.columnByProp[regularColumn.prop] = [];
280
+ }
281
+ res.columnByProp[regularColumn.prop].push(regularColumn);
282
+ // trigger setup hook if present
283
+ regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
284
+ return res;
285
+ }, collection);
286
+ }
287
+ function gatherGroup(res, colData, collection, level = 0) {
288
+ // group template
289
+ const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
290
+ // check columns for update
291
+ for (let k in collection.columns) {
292
+ const key = k;
293
+ const resultItem = res.columns[key];
294
+ const collectionItem = collection.columns[key];
295
+ // if column data
296
+ if (isArray(resultItem) && isArray(collectionItem)) {
297
+ // fill columns
298
+ resultItem.push(...collectionItem);
299
+ // fill grouping
300
+ if (collectionItem.length) {
301
+ res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
302
+ }
303
+ }
304
+ }
305
+ // merge column groupings
306
+ for (let k in collection.columnGrouping) {
307
+ const key = k;
308
+ const collectionItem = collection.columnGrouping[key];
309
+ res.columnGrouping[key].push(...collectionItem);
310
+ }
311
+ res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
312
+ res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
313
+ res.columnByProp = Object.assign(Object.assign({}, res.columnByProp), collection.columnByProp);
314
+ return res;
315
+ }
316
+ function findColumn(columns, prop) {
317
+ for (const c of columns) {
318
+ if (isColGrouping(c)) {
319
+ const found = findColumn(c.children, prop);
320
+ if (found) {
321
+ return found;
322
+ }
323
+ }
324
+ else if (c.prop === prop) {
325
+ return c;
326
+ }
327
+ }
328
+ return undefined;
329
+ }
330
+ function getColumnByProp(columns, prop) {
331
+ return findColumn(columns, prop);
332
+ }
333
+
334
+ /**
335
+ * Selection store
336
+ */
337
+ function defaultState() {
338
+ return {
339
+ range: null,
340
+ tempRange: null,
341
+ tempRangeType: null,
342
+ focus: null,
343
+ edit: null,
344
+ lastCell: null,
345
+ nextFocus: null,
346
+ };
347
+ }
348
+ class SelectionStore {
349
+ constructor() {
350
+ this.unsubscribe = [];
351
+ this.store = createStore(defaultState());
352
+ this.store.on('set', (key, newVal) => {
353
+ if (key === 'tempRange' && !newVal) {
354
+ this.store.set('tempRangeType', null);
355
+ }
356
+ });
357
+ }
358
+ onChange(propName, cb) {
359
+ this.unsubscribe.push(this.store.onChange(propName, cb));
360
+ }
361
+ clearFocus() {
362
+ setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
363
+ }
364
+ setFocus(focus, end) {
365
+ if (!end) {
366
+ setStore(this.store, { focus });
367
+ }
368
+ else {
369
+ setStore(this.store, {
370
+ focus,
371
+ range: getRange(focus, end),
372
+ edit: null,
373
+ tempRange: null,
374
+ });
375
+ }
376
+ }
377
+ setNextFocus(focus) {
378
+ setStore(this.store, { nextFocus: focus });
379
+ }
380
+ setTempArea(range) {
381
+ setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
382
+ }
383
+ clearTemp() {
384
+ setStore(this.store, { tempRange: null });
385
+ }
386
+ /** Can be applied from selection change or from simple keyboard change clicks */
387
+ setRangeArea(range) {
388
+ setStore(this.store, { range, edit: null, tempRange: null });
389
+ }
390
+ setRange(start, end) {
391
+ const range = getRange(start, end);
392
+ this.setRangeArea(range);
393
+ }
394
+ setLastCell(lastCell) {
395
+ setStore(this.store, { lastCell });
396
+ }
397
+ setEdit(val) {
398
+ const focus = this.store.get('focus');
399
+ if (focus && typeof val === 'string') {
400
+ setStore(this.store, {
401
+ edit: { x: focus.x, y: focus.y, val },
402
+ });
403
+ return;
404
+ }
405
+ setStore(this.store, { edit: null });
406
+ }
407
+ dispose() {
408
+ this.unsubscribe.forEach(f => f());
409
+ this.store.dispose();
410
+ }
411
+ }
412
+
413
+ const EMPTY_INDEX = -1;
414
+ class SelectionStoreConnector {
415
+ constructor() {
416
+ // dirty flag required to cleanup whole store in case visibility of panels changed
417
+ this.dirty = false;
418
+ this.stores = {};
419
+ this.columnStores = {};
420
+ this.rowStores = {};
421
+ /**
422
+ * Helpers for data conversion
423
+ */
424
+ this.storesByType = {};
425
+ this.storesXToType = {};
426
+ this.storesYToType = {};
427
+ this.sections = [];
428
+ }
429
+ get focusedStore() {
430
+ var _a;
431
+ for (let y in this.stores) {
432
+ for (let x in this.stores[y]) {
433
+ const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
434
+ if (focused) {
435
+ return {
436
+ entity: this.stores[y][x],
437
+ cell: focused,
438
+ position: {
439
+ x: parseInt(x, 10),
440
+ y: parseInt(y, 10),
441
+ },
442
+ };
443
+ }
444
+ }
445
+ }
446
+ return null;
447
+ }
448
+ get edit() {
449
+ var _a;
450
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
451
+ }
452
+ get focused() {
453
+ var _a;
454
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
455
+ }
456
+ get selectedRange() {
457
+ var _a;
458
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
459
+ }
460
+ registerSection(e) {
461
+ if (!e) {
462
+ this.sections.length = 0;
463
+ // some elements removed, rebuild stores
464
+ this.dirty = true;
465
+ return;
466
+ }
467
+ if (this.sections.indexOf(e) === -1) {
468
+ this.sections.push(e);
469
+ }
470
+ }
471
+ // check if require to cleanup all stores
472
+ beforeUpdate() {
473
+ if (this.dirty) {
474
+ for (let y in this.stores) {
475
+ for (let x in this.stores[y]) {
476
+ this.stores[y][x].dispose();
477
+ }
478
+ }
479
+ this.dirty = false;
480
+ }
481
+ }
482
+ registerColumn(x, type) {
483
+ // if hidden just create store but no operations needed
484
+ if (isHiddenStore(x)) {
485
+ return new SelectionStore();
486
+ }
487
+ if (this.columnStores[x]) {
488
+ return this.columnStores[x];
489
+ }
490
+ this.columnStores[x] = new SelectionStore();
491
+ // build cross-linking type to position
492
+ this.storesByType[type] = x;
493
+ this.storesXToType[x] = type;
494
+ return this.columnStores[x];
495
+ }
496
+ registerRow(y, type) {
497
+ // if hidden just create store
498
+ if (isHiddenStore(y)) {
499
+ return new SelectionStore();
500
+ }
501
+ if (this.rowStores[y]) {
502
+ return this.rowStores[y];
503
+ }
504
+ this.rowStores[y] = new SelectionStore();
505
+ // build cross linking type to position
506
+ this.storesByType[type] = y;
507
+ this.storesYToType[y] = type;
508
+ return this.rowStores[y];
509
+ }
510
+ /**
511
+ * Cross store proxy, based on multiple dimensions
512
+ */
513
+ register({ x, y }) {
514
+ var _a, _b;
515
+ // if hidden just create store
516
+ if (isHiddenStore(x) || isHiddenStore(y)) {
517
+ return new SelectionStore();
518
+ }
519
+ if (!this.stores[y]) {
520
+ this.stores[y] = {};
521
+ }
522
+ if (this.stores[y][x]) {
523
+ // Store already registered. Do not register twice
524
+ return this.stores[y][x];
525
+ }
526
+ this.stores[y][x] = new SelectionStore();
527
+ // proxy update, column store trigger only range area
528
+ (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
529
+ this.columnStores[x].setRangeArea(c);
530
+ this.rowStores[y].setRangeArea(c);
531
+ });
532
+ // clean up on remove
533
+ (_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
534
+ return this.stores[y][x];
535
+ }
536
+ destroy(x, y) {
537
+ var _a, _b;
538
+ (_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
539
+ (_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
540
+ delete this.rowStores[y];
541
+ delete this.columnStores[x];
542
+ // clear x cross-link
543
+ if (this.storesXToType[x]) {
544
+ const type = this.storesXToType[x];
545
+ delete this.storesXToType[x];
546
+ delete this.storesByType[type];
547
+ }
548
+ // clear y cross-link
549
+ if (this.storesYToType[y]) {
550
+ const type = this.storesYToType[y];
551
+ delete this.storesYToType[y];
552
+ delete this.storesByType[type];
553
+ }
554
+ if (this.stores[y]) {
555
+ delete this.stores[y][x];
556
+ }
557
+ // clear empty rows
558
+ if (!Object.keys(this.stores[y] || {}).length) {
559
+ delete this.stores[y];
560
+ }
561
+ }
562
+ setEditByCell(storePos, editCell) {
563
+ this.focusByCell(storePos, editCell, editCell);
564
+ this.setEdit('');
565
+ }
566
+ /**
567
+ * Sets the next focus cell before the current one.
568
+ *
569
+ * @param focus - The cell to set as the next focus.
570
+ */
571
+ beforeNextFocusCell(focus) {
572
+ var _a;
573
+ // If there is no focused store, return early.
574
+ if (!this.focusedStore) {
575
+ return;
576
+ }
577
+ // Get the next store based on the current focus and the last cell.
578
+ const lastCell = this.focusedStore.entity.store.get('lastCell');
579
+ const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
580
+ // Set the next focus cell in the store.
581
+ (_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
582
+ }
583
+ focusByCell(storePos, start, end) {
584
+ const store = this.stores[storePos.y][storePos.x];
585
+ this.focus(store, { focus: start, end });
586
+ }
587
+ focus(store, { focus, end }) {
588
+ const currentStorePointer = this.getCurrentStorePointer(store);
589
+ if (!currentStorePointer) {
590
+ return null;
591
+ }
592
+ // check for the focus in nearby store/viewport
593
+ const lastCell = store.store.get('lastCell');
594
+ const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
595
+ // if next store present - update
596
+ if (next === null || next === void 0 ? void 0 : next.store) {
597
+ const item = Object.assign(Object.assign({}, focus), next.item);
598
+ this.focus(next.store, { focus: item, end: item });
599
+ return null;
600
+ }
601
+ if (lastCell) {
602
+ focus = cropCellToMax(focus, lastCell);
603
+ end = cropCellToMax(end, lastCell);
604
+ }
605
+ store.setFocus(focus, end);
606
+ return focus;
607
+ }
608
+ /**
609
+ * Retrieves the current store pointer based on the active store.
610
+ * Clears focus from all stores except the active one.
611
+ */
612
+ getCurrentStorePointer(store) {
613
+ let currentStorePointer;
614
+ // Iterate through all stores
615
+ for (let y in this.stores) {
616
+ for (let x in this.stores[y]) {
617
+ const s = this.stores[y][x];
618
+ // Clear focus from stores other than the active one
619
+ if (s !== store) {
620
+ s.clearFocus();
621
+ }
622
+ else {
623
+ // Update the current store pointer with the active store coordinates
624
+ currentStorePointer = {
625
+ x: parseInt(x, 10),
626
+ y: parseInt(y, 10)
627
+ };
628
+ }
629
+ }
630
+ }
631
+ return currentStorePointer;
632
+ }
633
+ /**
634
+ * Retrieves the next store based on the focus cell and current store pointer.
635
+ * If the next store exists, returns an object with the next store and the item in the new store.
636
+ * If the next store does not exist, returns null.
637
+ */
638
+ getNextStore(focus, currentStorePointer, lastCell) {
639
+ // item in new store
640
+ const nextItem = nextCell(focus, lastCell);
641
+ let nextStore;
642
+ if (nextItem) {
643
+ Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
644
+ let stores;
645
+ switch (type) {
646
+ case 'x':
647
+ // Get the X stores for the current Y coordinate of the current store pointer
648
+ stores = this.getXStores(currentStorePointer.y);
649
+ break;
650
+ case 'y':
651
+ // Get the Y stores for the current X coordinate of the current store pointer
652
+ stores = this.getYStores(currentStorePointer.x);
653
+ break;
654
+ }
655
+ // Get the next store based on the item in the new store
656
+ if (nextItemCoord >= 0) {
657
+ nextStore = stores[++currentStorePointer[type]];
658
+ }
659
+ else {
660
+ nextStore = stores[--currentStorePointer[type]];
661
+ const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
662
+ if (nextLastCell) {
663
+ nextItem[type] = nextLastCell[type] + nextItemCoord;
664
+ }
665
+ }
666
+ });
667
+ }
668
+ return {
669
+ store: nextStore,
670
+ item: nextItem,
671
+ };
672
+ }
673
+ clearAll() {
674
+ var _a;
675
+ for (let y in this.stores) {
676
+ for (let x in this.stores[y]) {
677
+ (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
678
+ }
679
+ }
680
+ }
681
+ setEdit(val) {
682
+ if (!this.focusedStore) {
683
+ return;
684
+ }
685
+ this.focusedStore.entity.setEdit(val);
686
+ }
687
+ /**
688
+ * Select all cells across all stores
689
+ */
690
+ selectAll() {
691
+ for (let y in this.stores) {
692
+ for (let x in this.stores[y]) {
693
+ const store = this.stores[y][x];
694
+ if (!store) {
695
+ continue;
696
+ }
697
+ const lastCell = store.store.get('lastCell');
698
+ if (lastCell) {
699
+ store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
700
+ }
701
+ }
702
+ }
703
+ }
704
+ getXStores(y) {
705
+ return this.stores[y];
706
+ }
707
+ getYStores(x) {
708
+ const stores = {};
709
+ for (let i in this.stores) {
710
+ stores[i] = this.stores[i][x];
711
+ }
712
+ return stores;
713
+ }
714
+ }
715
+
716
+ function isHiddenStore(pos) {
717
+ return pos === EMPTY_INDEX;
718
+ }
719
+ function nextCell(cell, lastCell) {
720
+ const nextItem = {};
721
+ let types = ['x', 'y'];
722
+ // previous item check
723
+ for (let t of types) {
724
+ if (cell[t] < 0) {
725
+ nextItem[t] = cell[t];
726
+ return nextItem;
727
+ }
728
+ }
729
+ // next item check
730
+ for (let t of types) {
731
+ if (cell[t] >= lastCell[t]) {
732
+ nextItem[t] = cell[t] - lastCell[t];
733
+ return nextItem;
734
+ }
735
+ }
736
+ return null;
737
+ }
738
+ function cropCellToMax(cell, lastCell) {
739
+ const croppedCell = Object.assign({}, cell);
740
+ const cellCoordinates = ['x', 'y'];
741
+ for (const coordinate of cellCoordinates) {
742
+ if (cell[coordinate] < 0) {
743
+ croppedCell[coordinate] = 0;
744
+ }
745
+ else if (cell[coordinate] >= lastCell[coordinate]) {
746
+ croppedCell[coordinate] = lastCell[coordinate] - 1;
747
+ }
748
+ }
749
+ return croppedCell;
750
+ }
751
+ function getRange(start, end) {
752
+ return start && end
753
+ ? {
754
+ x: Math.min(start.x, end.x),
755
+ y: Math.min(start.y, end.y),
756
+ x1: Math.max(start.x, end.x),
757
+ y1: Math.max(start.y, end.y),
758
+ }
759
+ : null;
760
+ }
761
+ function isRangeSingleCell(a) {
762
+ return a.x === a.x1 && a.y === a.y1;
763
+ }
764
+
765
+ const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
766
+ const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
767
+ const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
768
+ const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
769
+ const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
770
+ const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
771
+ const GROUP_COLUMN_PROP = `${GRID_INTERNALS}-prop`;
772
+ const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
773
+ const GROUP_EXPAND_BTN = `group-expand`;
774
+ const GROUP_EXPAND_EVENT = `groupexpandclick`;
775
+ const GROUPING_ROW_TYPE = 'rgRow';
776
+
777
+ function getGroupValueDefault(item, prop) {
778
+ return item[prop] || null;
779
+ }
780
+ // get source based on proxy item collection to preserve rgRow order
781
+ function getSource(source, items, withoutGrouping = false) {
782
+ let index = 0;
783
+ const result = {
784
+ source: [],
785
+ prevExpanded: {},
786
+ oldNewIndexes: {},
787
+ };
788
+ // order important here, expected parent is first, then others
789
+ items.forEach(i => {
790
+ const model = source[i];
791
+ if (!withoutGrouping) {
792
+ result.source.push(model);
793
+ return;
794
+ }
795
+ // grouping filter
796
+ if (isGrouping(model)) {
797
+ if (getExpanded(model)) {
798
+ result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
799
+ }
800
+ }
801
+ else {
802
+ result.source.push(model);
803
+ result.oldNewIndexes[i] = index;
804
+ index++;
805
+ }
806
+ });
807
+ return result;
808
+ }
809
+ function getExpanded(model = {}) {
810
+ return model[GROUP_EXPANDED];
811
+ }
812
+ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, expandedAll, prevExpanded, columnProps, }) {
813
+ const depth = parentIds.length;
814
+ const sourceWithGroups = [];
815
+ // collapse all groups in the beginning
816
+ let trimmed = {};
817
+ // index mapping
818
+ let oldNewIndexMap = {};
819
+ groupedValues.forEach((innerGroupedValues, groupId) => {
820
+ const levelIds = [...parentIds, groupId];
821
+ const mergedIds = levelIds.join(',');
822
+ const isGroupExpanded = isExpanded && (!!expandedAll || !!prevExpanded[mergedIds]);
823
+ sourceWithGroups.push({
824
+ [PSEUDO_GROUP_ITEM]: groupId,
825
+ [GROUP_DEPTH]: depth,
826
+ [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
827
+ [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
828
+ [GROUP_EXPANDED]: isGroupExpanded,
829
+ [GROUP_COLUMN_PROP]: columnProps[depth],
830
+ [columnProps[depth]]: groupId,
831
+ });
832
+ itemIndex += 1;
833
+ if (!isGroupExpanded && depth) {
834
+ trimmed[itemIndex] = true;
835
+ }
836
+ if (Array.isArray(innerGroupedValues)) {
837
+ innerGroupedValues.forEach(value => {
838
+ itemIndex += 1;
839
+ if (!isGroupExpanded) {
840
+ trimmed[itemIndex] = true;
841
+ }
842
+ oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
843
+ });
844
+ sourceWithGroups.push(...innerGroupedValues);
845
+ }
846
+ else {
847
+ const children = flattenGroupMaps({
848
+ groupedValues: innerGroupedValues,
849
+ parentIds: levelIds,
850
+ isExpanded: isGroupExpanded,
851
+ itemIndex,
852
+ expandedAll,
853
+ prevExpanded,
854
+ columnProps,
855
+ });
856
+ sourceWithGroups.push(...children.source);
857
+ trimmed = Object.assign(Object.assign({}, children.trimmed), trimmed);
858
+ oldNewIndexMap = Object.assign(Object.assign({}, children.oldNewIndexMap), oldNewIndexMap);
859
+ itemIndex = children.itemIndex;
860
+ }
861
+ });
862
+ return {
863
+ source: sourceWithGroups,
864
+ oldNewIndexMap,
865
+ trimmed,
866
+ itemIndex,
867
+ };
868
+ }
869
+ /**
870
+ * Gather data for grouping
871
+ * @param array - flat data array
872
+ * @param columnProps - ids of groups
873
+ * @param expanded - potentially expanded items if present
874
+ */
875
+ function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
876
+ const groupedItems = new Map();
877
+ array.forEach((item, originalIndex) => {
878
+ const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
879
+ const lastLevelValue = groupLevelValues.pop();
880
+ let currentGroupLevel = groupedItems;
881
+ groupLevelValues.forEach(value => {
882
+ if (!currentGroupLevel.has(value)) {
883
+ currentGroupLevel.set(value, new Map());
884
+ }
885
+ currentGroupLevel = currentGroupLevel.get(value);
886
+ });
887
+ if (!currentGroupLevel.has(lastLevelValue)) {
888
+ const groupItems = [];
889
+ currentGroupLevel.set(lastLevelValue, groupItems);
890
+ }
891
+ const lastLevelItems = currentGroupLevel.get(lastLevelValue);
892
+ lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
893
+ });
894
+ const groupingDepth = columnProps.length;
895
+ const { source: sourceWithGroups, trimmed, oldNewIndexMap } = flattenGroupMaps({
896
+ groupedValues: groupedItems,
897
+ parentIds: [],
898
+ isExpanded: true,
899
+ itemIndex: -1,
900
+ expandedAll,
901
+ prevExpanded,
902
+ columnProps
903
+ });
904
+ return {
905
+ sourceWithGroups, // updates source mirror
906
+ depth: groupingDepth, // largest depth for grouping
907
+ trimmed, // used for expand/collapse grouping values
908
+ oldNewIndexMap, // used for mapping old values to new
909
+ };
910
+ }
911
+ function getGroupingName(rgRow) {
912
+ return rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM];
913
+ }
914
+ function isGrouping(rgRow) {
915
+ return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
916
+ }
917
+ function isGroupingColumn(column) {
918
+ return typeof (column === null || column === void 0 ? void 0 : column[PSEUDO_GROUP_COLUMN]) !== 'undefined';
919
+ }
920
+ function measureEqualDepth(groupA, groupB) {
921
+ const ln = groupA.length;
922
+ let i = 0;
923
+ for (; i < ln; i++) {
924
+ if (groupA[i] !== groupB[i]) {
925
+ return i;
926
+ }
927
+ }
928
+ return i;
929
+ }
930
+ function getParsedGroup(id) {
931
+ const parseGroup = JSON.parse(id);
932
+ // extra precaution and type safeguard
933
+ if (!Array.isArray(parseGroup)) {
934
+ return null;
935
+ }
936
+ return parseGroup;
937
+ }
938
+ // check if items is child of current clicked group
939
+ function isSameGroup(currentGroup, currentModel, nextModel) {
940
+ const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
941
+ if (!nextGroup) {
942
+ return false;
943
+ }
944
+ const depth = measureEqualDepth(currentGroup, nextGroup);
945
+ return currentModel[GROUP_DEPTH] < depth;
946
+ }
947
+
948
+ /**
949
+ * The base implementation of `_.slice` without an iteratee call guard.
950
+ *
951
+ * @private
952
+ * @param {Array} array The array to slice.
953
+ * @param {number} [start=0] The start position.
954
+ * @param {number} [end=array.length] The end position.
955
+ * @returns {Array} Returns the slice of `array`.
956
+ */
957
+ function baseSlice(array, start, end) {
958
+ var index = -1,
959
+ length = array.length;
960
+
961
+ if (start < 0) {
962
+ start = -start > length ? 0 : (length + start);
963
+ }
964
+ end = end > length ? length : end;
965
+ if (end < 0) {
966
+ end += length;
967
+ }
968
+ length = start > end ? 0 : ((end - start) >>> 0);
969
+ start >>>= 0;
970
+
971
+ var result = Array(length);
972
+ while (++index < length) {
973
+ result[index] = array[index + start];
974
+ }
975
+ return result;
976
+ }
977
+
978
+ /**
979
+ * Creates a slice of `array` from `start` up to, but not including, `end`.
980
+ *
981
+ * **Note:** This method is used instead of
982
+ * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
983
+ * returned.
984
+ *
985
+ * @static
986
+ * @memberOf _
987
+ * @since 3.0.0
988
+ * @category Array
989
+ * @param {Array} array The array to slice.
990
+ * @param {number} [start=0] The start position.
991
+ * @param {number} [end=array.length] The end position.
992
+ * @returns {Array} Returns the slice of `array`.
993
+ */
994
+ function slice(array, start, end) {
995
+ var length = array == null ? 0 : array.length;
996
+ if (!length) {
997
+ return [];
998
+ }
999
+ if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
1000
+ start = 0;
1001
+ end = length;
1002
+ }
1003
+ else {
1004
+ start = start == null ? 0 : toInteger(start);
1005
+ end = end === undefined ? length : toInteger(end);
1006
+ }
1007
+ return baseSlice(array, start, end);
1008
+ }
1009
+
1010
+ function getCellEditor(column, editors = {}) {
1011
+ const editor = column === null || column === void 0 ? void 0 : column.editor;
1012
+ if (!editor) {
1013
+ return undefined;
1014
+ }
1015
+ // reference
1016
+ if (typeof editor === 'string') {
1017
+ return editors[editor];
1018
+ }
1019
+ return editor;
1020
+ }
1021
+ class ColumnService {
1022
+ get columns() {
1023
+ return getVisibleSourceItem(this.source);
1024
+ }
1025
+ constructor(dataStore, source) {
1026
+ this.dataStore = dataStore;
1027
+ this.source = source;
1028
+ this.unsubscribe = [];
1029
+ this.hasGrouping = false;
1030
+ this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
1031
+ this.checkGrouping(source.get('source'));
1032
+ this.type = source.get('type');
1033
+ }
1034
+ checkGrouping(cols) {
1035
+ for (let rgCol of cols) {
1036
+ if (isGroupingColumn(rgCol)) {
1037
+ this.hasGrouping = true;
1038
+ return;
1039
+ }
1040
+ this.hasGrouping = false;
1041
+ }
1042
+ }
1043
+ isReadOnly(r, c) {
1044
+ var _a;
1045
+ const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
1046
+ if (typeof readOnly === 'function') {
1047
+ const data = this.rowDataModel(r, c);
1048
+ return readOnly(data);
1049
+ }
1050
+ return !!readOnly;
1051
+ }
1052
+ mergeProperties(r, c, defaultProps, schemaModel) {
1053
+ var _a, _b;
1054
+ const props = Object.assign({}, defaultProps);
1055
+ props.class = Object.assign(Object.assign({}, (typeof props.class === 'string'
1056
+ ? { [props.class]: true }
1057
+ : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
1058
+ const extra = (_b = (_a = schemaModel.column) === null || _a === void 0 ? void 0 : _a.cellProperties) === null || _b === void 0 ? void 0 : _b.call(_a, schemaModel);
1059
+ if (!extra) {
1060
+ return props;
1061
+ }
1062
+ return doPropMerge(props, extra);
1063
+ }
1064
+ getRowClass(r, prop) {
1065
+ const model = getSourceItem(this.dataStore, r) || {};
1066
+ return model[prop] || '';
1067
+ }
1068
+ getSaveData(rowIndex, colIndex, val) {
1069
+ const data = this.rowDataModel(rowIndex, colIndex);
1070
+ if (typeof val === 'undefined') {
1071
+ val = getCellData(data.value);
1072
+ }
1073
+ return Object.assign(Object.assign({}, data), { val });
1074
+ }
1075
+ /**
1076
+ * Get cell data model for given rowIndex and colIndex
1077
+ * Used to pass data to editor/renderer
1078
+ */
1079
+ rowDataModel(rowIndex, colIndex) {
1080
+ const column = this.columns[colIndex];
1081
+ const prop = column === null || column === void 0 ? void 0 : column.prop;
1082
+ const model = getSourceItem(this.dataStore, rowIndex) || {};
1083
+ const type = this.dataStore.get('type');
1084
+ return {
1085
+ prop,
1086
+ model,
1087
+ data: this.dataStore.get('source'),
1088
+ column,
1089
+ rowIndex,
1090
+ colIndex,
1091
+ colType: this.type,
1092
+ type,
1093
+ value: getCellRaw(model, column),
1094
+ };
1095
+ }
1096
+ getRangeData(d, columns) {
1097
+ var _a;
1098
+ const changed = {};
1099
+ // get original length sizes
1100
+ const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
1101
+ const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
1102
+ const mapping = {};
1103
+ // rows
1104
+ for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
1105
+ // copy original data link
1106
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
1107
+ const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
1108
+ // columns
1109
+ for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
1110
+ // check if old range area
1111
+ if (rowIndex >= d.oldRange.y &&
1112
+ rowIndex <= d.oldRange.y1 &&
1113
+ colIndex >= d.oldRange.x &&
1114
+ colIndex <= d.oldRange.x1) {
1115
+ continue;
1116
+ }
1117
+ // requested column beyond range
1118
+ if (!this.columns[colIndex]) {
1119
+ continue;
1120
+ }
1121
+ const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
1122
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
1123
+ const copyColumnProp = columns[copyColIndex].prop;
1124
+ /** if can write */
1125
+ if (!this.isReadOnly(rowIndex, colIndex)) {
1126
+ /** to show before save */
1127
+ if (!changed[rowIndex]) {
1128
+ changed[rowIndex] = {};
1129
+ }
1130
+ changed[rowIndex][prop] = copyRow[copyColumnProp];
1131
+ /** Generate mapping object */
1132
+ if (!mapping[rowIndex]) {
1133
+ mapping[rowIndex] = {};
1134
+ }
1135
+ mapping[rowIndex][prop] = {
1136
+ colIndex: copyColIndex,
1137
+ colProp: copyColumnProp,
1138
+ rowIndex: oldRowIndex,
1139
+ };
1140
+ }
1141
+ }
1142
+ }
1143
+ return {
1144
+ changed,
1145
+ mapping,
1146
+ };
1147
+ }
1148
+ getTransformedDataToApply(start, data) {
1149
+ const changed = {};
1150
+ const copyRowLength = data.length;
1151
+ const colLength = this.columns.length;
1152
+ const rowLength = this.dataStore.get('items').length;
1153
+ // rows
1154
+ let rowIndex = start.y;
1155
+ let maxCol = 0;
1156
+ for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
1157
+ // copy original data link
1158
+ const copyRow = data[i % copyRowLength];
1159
+ const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
1160
+ // columns
1161
+ let colIndex = start.x;
1162
+ for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
1163
+ const p = this.columns[colIndex].prop;
1164
+ const currentCol = j % colLength;
1165
+ /** if can write */
1166
+ if (!this.isReadOnly(rowIndex, colIndex)) {
1167
+ /** to show before save */
1168
+ if (!changed[rowIndex]) {
1169
+ changed[rowIndex] = {};
1170
+ }
1171
+ changed[rowIndex][p] = copyRow[currentCol];
1172
+ }
1173
+ }
1174
+ maxCol = Math.max(maxCol, colIndex - 1);
1175
+ }
1176
+ const range = getRange(start, {
1177
+ y: rowIndex - 1,
1178
+ x: maxCol,
1179
+ });
1180
+ return {
1181
+ changed,
1182
+ range,
1183
+ };
1184
+ }
1185
+ getRangeStaticData(d, value) {
1186
+ const changed = {};
1187
+ // rows
1188
+ for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
1189
+ // columns
1190
+ for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
1191
+ // requested column beyond range
1192
+ if (!this.columns[colIndex]) {
1193
+ continue;
1194
+ }
1195
+ const p = this.columns[colIndex].prop;
1196
+ /** if can write */
1197
+ if (!this.isReadOnly(rowIndex, colIndex)) {
1198
+ /** to show before save */
1199
+ if (!changed[rowIndex]) {
1200
+ changed[rowIndex] = {};
1201
+ }
1202
+ changed[rowIndex][p] = value;
1203
+ }
1204
+ }
1205
+ }
1206
+ return changed;
1207
+ }
1208
+ getRangeTransformedToProps(d, store) {
1209
+ var _a;
1210
+ const area = [];
1211
+ const type = this.dataStore.get('type');
1212
+ // rows
1213
+ for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
1214
+ // columns
1215
+ for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
1216
+ const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
1217
+ area.push({
1218
+ prop,
1219
+ rowIndex,
1220
+ colIndex,
1221
+ model: getSourceItem(store, rowIndex),
1222
+ type,
1223
+ colType: this.type,
1224
+ });
1225
+ }
1226
+ }
1227
+ return area;
1228
+ }
1229
+ copyRangeArray(range, store) {
1230
+ const cols = [...this.columns];
1231
+ const props = slice(cols, range.x, range.x1 + 1).map(v => v.prop);
1232
+ const toCopy = [];
1233
+ const mapping = {};
1234
+ // rows indexes
1235
+ for (let i = range.y; i <= range.y1; i++) {
1236
+ const rgRow = [];
1237
+ mapping[i] = {};
1238
+ // columns indexes
1239
+ for (let prop of props) {
1240
+ const item = getSourceItem(store, i);
1241
+ // if no item - skip
1242
+ if (!item) {
1243
+ continue;
1244
+ }
1245
+ const val = item[prop];
1246
+ rgRow.push(val);
1247
+ mapping[i][prop] = val;
1248
+ }
1249
+ toCopy.push(rgRow);
1250
+ }
1251
+ return {
1252
+ data: toCopy,
1253
+ mapping,
1254
+ };
1255
+ }
1256
+ destroy() {
1257
+ this.unsubscribe.forEach(f => f());
1258
+ }
1259
+ }
1260
+ /**
1261
+ * Checks if the given rowDrag is a service for dragging rows.
1262
+ */
1263
+ function isRowDragService(rowDrag, model) {
1264
+ if (typeof rowDrag === 'function') {
1265
+ return rowDrag(model);
1266
+ }
1267
+ return !!rowDrag;
1268
+ }
1269
+ function mergeClasses(class1 = {}, class2 = {}) {
1270
+ if (typeof class1 === 'string') {
1271
+ class1 = { [class1]: true };
1272
+ }
1273
+ if (typeof class2 === 'string') {
1274
+ class2 = { [class2]: true };
1275
+ }
1276
+ return Object.assign(Object.assign({}, class1), class2);
1277
+ }
1278
+ function doPropMerge(existing, extra) {
1279
+ // if className is provided - remove it from props it messing with stencil
1280
+ if (extra.className) {
1281
+ extra.class = mergeClasses(extra.class, extra.className);
1282
+ delete extra.className;
1283
+ }
1284
+ let props = Object.assign(Object.assign({}, extra), existing);
1285
+ // extend existing props
1286
+ if (extra.class) {
1287
+ props.class = mergeClasses(props.class, extra.class);
1288
+ }
1289
+ if (extra.style) {
1290
+ props.style = Object.assign(Object.assign({}, extra.style), props.style);
1291
+ }
1292
+ return props;
1293
+ }
1294
+
1295
+ export { getColumnType as A, getColumnSizes as B, isColGrouping as C, getColumns as D, gatherGroup as E, getColumnByProp as F, GROUP_DEPTH as G, reduce as H, baseEach$1 as I, doPropMerge as J, EMPTY_INDEX as K, SelectionStoreConnector as L, ColumnService as M, getCellEditor as N, isRowDragService as O, PSEUDO_GROUP_ITEM as P, SelectionStore as S, isRangeSingleCell as a, PSEUDO_GROUP_ITEM_ID as b, cropCellToMax as c, PSEUDO_GROUP_ITEM_VALUE as d, PSEUDO_GROUP_COLUMN as e, GROUP_EXPANDED as f, getRange as g, GROUP_COLUMN_PROP as h, isHiddenStore as i, GROUP_ORIGINAL_INDEX as j, GROUP_EXPAND_BTN as k, GROUP_EXPAND_EVENT as l, GROUPING_ROW_TYPE as m, nextCell as n, getSource as o, getExpanded as p, gatherGrouping as q, getGroupingName as r, isGrouping as s, isGroupingColumn as t, measureEqualDepth as u, getParsedGroup as v, isSameGroup as w, getCellData as x, getCellRaw as y, getCellDataParsed as z };
1296
+
5
1297
  //# sourceMappingURL=column.service-f39c0a1d.js.map