slick-table 1.1.42 → 1.1.44
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/index.cjs.js +1 -1
- package/dist/index.es.js +16 -16
- package/dist/styles/slick-table.scss +5 -3
- package/dist/types/shared/lib/slickgrid/index.d.ts +1 -1
- package/dist/types/shared/lib/slickgrid/index.d.ts.map +1 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/index.d.ts +0 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/index.d.ts.map +1 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/index.d.ts +1 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/index.d.ts.map +1 -1
- package/dist/types/shared/lib/slickgrid/lib/index.d.ts +1 -1
- package/dist/types/shared/lib/slickgrid/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app/styles/slick-table.scss +5 -3
- package/src/shared/lib/slickgrid/index.ts +0 -1
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts +12 -6
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts +0 -1
- package/src/shared/lib/slickgrid/lib/editors/index.ts +1 -5
- package/src/shared/lib/slickgrid/lib/index.ts +0 -1
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts +0 -16
- package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts.map +0 -1
- package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts +0 -85
package/dist/index.cjs.js
CHANGED
|
@@ -348,7 +348,7 @@ return o.version="2.30.1",r(Mt),o.fn=ye,o.min=Jw,o.max=eC,o.now=tC,o.utc=b,o.uni
|
|
|
348
348
|
Expecting `+ce.join(", ")+", got '"+(this.terminals_[B]||B)+"'":le="Parse error on line "+($+1)+": Unexpected "+(B==q?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(le,{text:H.match,token:this.terminals_[B]||B,line:H.yylineno,loc:A,expected:ce})}if(oe[0]instanceof Array&&oe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ne+", token: "+B);switch(oe[0]){case 1:O.push(B),N.push(H.yytext),F.push(H.yylloc),O.push(oe[1]),B=null,K=H.yyleng,R=H.yytext,$=H.yylineno,A=H.yylloc;break;case 2:if(J=this.productions_[oe[1]][1],j.$=N[N.length-J],j._$={first_line:F[F.length-(J||1)].first_line,last_line:F[F.length-1].last_line,first_column:F[F.length-(J||1)].first_column,last_column:F[F.length-1].last_column},M&&(j._$.range=[F[F.length-(J||1)].range[0],F[F.length-1].range[1]]),se=this.performAction.apply(j,[R,K,$,ae.yy,oe[1],N,F].concat(Y)),typeof se<"u")return se;J&&(O=O.slice(0,-1*J*2),N=N.slice(0,-1*J),F=F.slice(0,-1*J)),O.push(this.productions_[oe[1]][0]),N.push(j.$),F.push(j._$),te=z[O[O.length-2]][O[O.length-1]],O.push(te);break;case 3:return!0}}return!0}},P=function(){return{EOF:1,parseError:function(C,O){if(this.yy.parser)this.yy.parser.parseError(C,O);else throw new Error(C)},setInput:function(S,C){return this.yy=C||this.yy||{},this._input=S,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){const S=this._input[0];return this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S,S.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),S},unput:function(S){const C=S.length,O=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-C),this.offset-=C;const N=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),O.length-1&&(this.yylineno-=O.length-1);const F=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:O?(O.length===N.length?this.yylloc.first_column:0)+N[N.length-O.length].length-O[0].length:this.yylloc.first_column-C},this.options.ranges&&(this.yylloc.range=[F[0],F[0]+this.yyleng-C]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
349
349
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(S){this.unput(this.match.slice(S))},pastInput:function(){const S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},upcomingInput:function(){let S=this.match;return S.length<20&&(S+=this._input.substr(0,20-S.length)),(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){const S=this.pastInput(),C=new Array(S.length+1).join("-");return S+this.upcomingInput()+`
|
|
350
350
|
`+C+"^"},test_match:function(S,C){let O,N,F;if(this.options.backtrack_lexer&&(F={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(F.yylloc.range=this.yylloc.range.slice(0))),N=S[0].match(/(?:\r\n?|\n).*/g),N&&(this.yylineno+=N.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:N?N[N.length-1].length-N[N.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+S[0].length},this.yytext+=S[0],this.match+=S[0],this.matches=S,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(S[0].length),this.matched+=S[0],O=this.performAction.call(this,this.yy,this,C,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),O)return O;if(this._backtrack){for(let z in F)this[z]=F[z];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);let S,C,O,N;this._more||(this.yytext="",this.match="");const F=this._currentRules();for(let z=0;z<F.length;z++)if(O=this._input.match(this.rules[F[z]]),O&&(!C||O[0].length>C[0].length)){if(C=O,N=z,this.options.backtrack_lexer){if(S=this.test_match(O,F[z]),S!==!1)return S;if(this._backtrack){C=!1;continue}else return!1}else if(!this.options.flex)break}return C?(S=this.test_match(C,F[N]),S!==!1?S:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
351
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){const C=this.next();return C||this.lex()},begin:function(C){this.conditionStack.push(C)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},pushState:function(C){this.begin(C)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(C,O,N,F){switch(N){case 0:break;case 1:return 15;case 2:return 8;case 3:return 9;case 4:return 7;case 5:return 6;case 6:return 10;case 7:return 11;case 8:return 12;case 9:return 13;case 10:return 14;case 11:return 17;case 12:return 16;case 13:return 5;case 14:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+(\.[0-9]+)?\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:!)/,/^(?:%)/,/^(?:\()/,/^(?:\))/,/^(?:PI\b)/,/^(?:E\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],inclusive:!0}}}}();v.lexer=P;function k(){this.yy={},this.parse=this.parse.bind(this)}return k.prototype=v,v.Parser=k,new k}();typeof require<"u"&&typeof exports<"u"&&(exports.parser=$r,exports.Parser=$r.Parser,exports.parse=function(){return $r.parse.apply($r,arguments)});const Gv=2;class TF extends Rm{isValueChanged(){const t=RF(this.defaultValue);let n=0;try{n=$r.parse(this.input.value||"0")}catch{return!0}return!n&&!t?!1:n!==t}loadValue(t){const n=Number(t[this.args.column.field]||"0");this.defaultValue=n.toFixed(Gv),this.input.value=this.defaultValue,this.input.defaultValue=this.input.value,this.input.select()}serializeValue(){let t=$r.parse(this.input.value||"0");Rm.AllowEmptyValue?!t&&t!==0&&(t=void 0):t=t||0;const n=this.getDecimalPlaces();return n!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(n))),t}validate(){let t=0;try{if(t=$r.parse(`${this.input.value}`),t===1/0)throw new Error}catch{return{valid:!1,msg:"Please enter a valid number"}}if(this.args.column.validator){const n=this.args.column.validator(t,this.args);if(!n.valid)return n}return{valid:!0,msg:null}}}TF.DefaultDecimalPlaces=Gv;class kF{constructor(){this.currentFocus=-1,this.defaultValue="",this.id="slick-table-autocomplete",this.input=document.createElement("input"),this.keyCaptureList=[Br.UP,Br.DOWN,Br.ENTER]}applyValue(t,n){t[this.args.column.field]=n}closeAllList(){this.list?.remove(),this.list=void 0,this.currentFocus=-1}createList(){this.list=document.createElement("div");const t=document.getElementById("root");if(!t)return;t.appendChild(this.list),this.list.setAttribute("id",this.id);const{top:n,left:o,right:r}=this.args.position,i=this.args.grid.getOptions().rowHeight||25;this.list.style.top=`${n+i}px`,this.list.style.left=`${o}px`,this.list.style.minWidth=`${r-o}px`}destroy(){this.input.removeEventListener("input",this.onInput.bind(this)),this.input.removeEventListener("keydown",this.onKeydown.bind(this)),this.closeAllList(),this.input.remove()}focus(){this.input.focus()}init(){this.navOnLR=this.args.grid.getOptions().editorCellNavOnLRKeys,this.input.setAttribute("type","text"),this.input.classList.add("editor-text"),this.args.container.append(this.input),this.input.addEventListener("input",this.onInput.bind(this)),this.input.addEventListener("keydown",this.onKeydown.bind(this)),this.input.focus(),this.input.select()}isValueChanged(){return!(this.input.value==""&&this.defaultValue==null)&&this.input.value!=this.defaultValue}loadValue(t){this.defaultValue=t[this.args.column.field]||"",this.input.value=this.defaultValue,this.input.defaultValue=this.defaultValue,this.input.focus(),this.input.select()}makeVisible(){if(!this.list)return;const
|
|
351
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){const C=this.next();return C||this.lex()},begin:function(C){this.conditionStack.push(C)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},pushState:function(C){this.begin(C)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(C,O,N,F){switch(N){case 0:break;case 1:return 15;case 2:return 8;case 3:return 9;case 4:return 7;case 5:return 6;case 6:return 10;case 7:return 11;case 8:return 12;case 9:return 13;case 10:return 14;case 11:return 17;case 12:return 16;case 13:return 5;case 14:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+(\.[0-9]+)?\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:!)/,/^(?:%)/,/^(?:\()/,/^(?:\))/,/^(?:PI\b)/,/^(?:E\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],inclusive:!0}}}}();v.lexer=P;function k(){this.yy={},this.parse=this.parse.bind(this)}return k.prototype=v,v.Parser=k,new k}();typeof require<"u"&&typeof exports<"u"&&(exports.parser=$r,exports.Parser=$r.Parser,exports.parse=function(){return $r.parse.apply($r,arguments)});const Gv=2;class TF extends Rm{isValueChanged(){const t=RF(this.defaultValue);let n=0;try{n=$r.parse(this.input.value||"0")}catch{return!0}return!n&&!t?!1:n!==t}loadValue(t){const n=Number(t[this.args.column.field]||"0");this.defaultValue=n.toFixed(Gv),this.input.value=this.defaultValue,this.input.defaultValue=this.input.value,this.input.select()}serializeValue(){let t=$r.parse(this.input.value||"0");Rm.AllowEmptyValue?!t&&t!==0&&(t=void 0):t=t||0;const n=this.getDecimalPlaces();return n!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(n))),t}validate(){let t=0;try{if(t=$r.parse(`${this.input.value}`),t===1/0)throw new Error}catch{return{valid:!1,msg:"Please enter a valid number"}}if(this.args.column.validator){const n=this.args.column.validator(t,this.args);if(!n.valid)return n}return{valid:!0,msg:null}}}TF.DefaultDecimalPlaces=Gv;class kF{constructor(){this.currentFocus=-1,this.defaultValue="",this.id="slick-table-autocomplete",this.input=document.createElement("input"),this.keyCaptureList=[Br.UP,Br.DOWN,Br.ENTER]}applyValue(t,n){t[this.args.column.field]=n}closeAllList(){this.list?.remove(),this.list=void 0,this.currentFocus=-1}createList(){this.list=document.createElement("div");const t=document.getElementById("root");if(!t)return;t.appendChild(this.list),this.list.setAttribute("tabIndex","0"),this.list.setAttribute("id",this.id);const{top:n,left:o,right:r}=this.args.position,i=this.args.grid.getOptions().rowHeight||25;this.list.style.top=`${n+i}px`,this.list.style.left=`${o}px`,this.list.style.minWidth=`${r-o}px`}destroy(){this.input.removeEventListener("input",this.onInput.bind(this)),this.input.removeEventListener("keydown",this.onKeydown.bind(this)),this.closeAllList(),this.input.remove()}focus(){this.input.focus()}init(){this.navOnLR=this.args.grid.getOptions().editorCellNavOnLRKeys,this.input.setAttribute("type","text"),this.input.classList.add("editor-text"),this.args.container.append(this.input),this.input.addEventListener("input",this.onInput.bind(this)),this.input.addEventListener("keydown",this.onKeydown.bind(this)),this.input.addEventListener("blur",({relatedTarget:t})=>{t?.id===this.id?this.focus():this.closeAllList()}),this.input.focus(),this.input.select()}isValueChanged(){return!(this.input.value==""&&this.defaultValue==null)&&this.input.value!=this.defaultValue}loadValue(t){this.defaultValue=t[this.args.column.field]||"",this.input.value=this.defaultValue,this.input.defaultValue=this.defaultValue,this.input.focus(),this.input.select()}makeVisible(){if(!this.list)return;const{bottom:t,left:n,right:o,top:r}=this.list.getBoundingClientRect(),{bottom:i,right:a}=document.body.getBoundingClientRect();if(t>=i){const l=this.args.grid.getOptions().rowHeight||25,d=t-r;this.list.style.top=`${r-d-l}px`}if(o>=a){const{right:l}=this.args.container.getBoundingClientRect(),d=o-l;this.list.style.left=`${n-d}px`}}onKeydown(t){if(t.key===Ar.ArrowLeft){this.navOnLR&&this.args.grid.navigatePrev(),t.stopImmediatePropagation();return}else if(t.key===Ar.ArrowRight){this.navOnLR&&this.args.grid.navigateNext(),t.stopImmediatePropagation();return}if(!this.list)return;const n=this.list.getElementsByTagName("div");t.key===Ar.ArrowDown?(this.currentFocus++,this.setActive(n)):t.key===Ar.ArrowUp?(this.currentFocus--,this.setActive(n)):(t.key===Ar.Enter||t.key===Ar.Tab)&&(t.preventDefault(),n.length===1&&(this.currentFocus=0),this.currentFocus>-1&&n&&n[this.currentFocus].click())}removeActive(t){for(let n=0;n<t.length;n++)t[n].classList.remove("active")}scrollToElement(t){const n=t.parentElement;if(!n)return;const{clientHeight:o,offsetTop:r}=t,{clientHeight:i,scrollTop:a}=n;r>=a+i?n.scrollTop=r-o*1.5:r-o<=a&&(n.scrollTop=r-i)}serializeValue(){return this.input.value}setActive(t){if(!t.length)return;this.removeActive(t),this.currentFocus>=t.length&&(this.currentFocus=0),this.currentFocus<0&&(this.currentFocus=t.length-1);const n=t[this.currentFocus];n.classList.add("active"),this.scrollToElement(n)}validate(){if(this.args.column.validator){const t=this.args.column.validator(this.input.value,this.args);if(!t.valid)return t}return{valid:!0,msg:null}}}var yl={exports:{}};const EF=f0(VN);/*!
|
|
352
352
|
* Pikaday
|
|
353
353
|
*
|
|
354
354
|
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday
|
package/dist/index.es.js
CHANGED
|
@@ -34513,7 +34513,7 @@ class OW {
|
|
|
34513
34513
|
this.list = document.createElement("div");
|
|
34514
34514
|
const t = document.getElementById("root");
|
|
34515
34515
|
if (!t) return;
|
|
34516
|
-
t.appendChild(this.list), this.list.setAttribute("id", this.id);
|
|
34516
|
+
t.appendChild(this.list), this.list.setAttribute("tabIndex", "0"), this.list.setAttribute("id", this.id);
|
|
34517
34517
|
const { top: n, left: o, right: r } = this.args.position, i = this.args.grid.getOptions().rowHeight || 25;
|
|
34518
34518
|
this.list.style.top = `${n + i}px`, this.list.style.left = `${o}px`, this.list.style.minWidth = `${r - o}px`;
|
|
34519
34519
|
}
|
|
@@ -34524,7 +34524,9 @@ class OW {
|
|
|
34524
34524
|
this.input.focus();
|
|
34525
34525
|
}
|
|
34526
34526
|
init() {
|
|
34527
|
-
this.navOnLR = this.args.grid.getOptions().editorCellNavOnLRKeys, this.input.setAttribute("type", "text"), this.input.classList.add("editor-text"), this.args.container.append(this.input), this.input.addEventListener("input", this.onInput.bind(this)), this.input.addEventListener("keydown", this.onKeydown.bind(this)), this.input.
|
|
34527
|
+
this.navOnLR = this.args.grid.getOptions().editorCellNavOnLRKeys, this.input.setAttribute("type", "text"), this.input.classList.add("editor-text"), this.args.container.append(this.input), this.input.addEventListener("input", this.onInput.bind(this)), this.input.addEventListener("keydown", this.onKeydown.bind(this)), this.input.addEventListener("blur", ({ relatedTarget: t }) => {
|
|
34528
|
+
t?.id === this.id ? this.focus() : this.closeAllList();
|
|
34529
|
+
}), this.input.focus(), this.input.select();
|
|
34528
34530
|
}
|
|
34529
34531
|
isValueChanged() {
|
|
34530
34532
|
return !(this.input.value == "" && this.defaultValue == null) && this.input.value != this.defaultValue;
|
|
@@ -34534,21 +34536,19 @@ class OW {
|
|
|
34534
34536
|
}
|
|
34535
34537
|
makeVisible() {
|
|
34536
34538
|
if (!this.list) return;
|
|
34537
|
-
const t = this.args.container.closest(".slick-viewport");
|
|
34538
|
-
if (!t) return;
|
|
34539
34539
|
const {
|
|
34540
|
-
bottom:
|
|
34541
|
-
left:
|
|
34542
|
-
right:
|
|
34543
|
-
top:
|
|
34544
|
-
} = this.list.getBoundingClientRect(), { bottom:
|
|
34545
|
-
if (
|
|
34546
|
-
const
|
|
34547
|
-
this.list.style.top = `${
|
|
34548
|
-
}
|
|
34549
|
-
if (
|
|
34550
|
-
const { right:
|
|
34551
|
-
this.list.style.left = `${
|
|
34540
|
+
bottom: t,
|
|
34541
|
+
left: n,
|
|
34542
|
+
right: o,
|
|
34543
|
+
top: r
|
|
34544
|
+
} = this.list.getBoundingClientRect(), { bottom: i, right: a } = document.body.getBoundingClientRect();
|
|
34545
|
+
if (t >= i) {
|
|
34546
|
+
const l = this.args.grid.getOptions().rowHeight || 25, d = t - r;
|
|
34547
|
+
this.list.style.top = `${r - d - l}px`;
|
|
34548
|
+
}
|
|
34549
|
+
if (o >= a) {
|
|
34550
|
+
const { right: l } = this.args.container.getBoundingClientRect(), d = o - l;
|
|
34551
|
+
this.list.style.left = `${n - d}px`;
|
|
34552
34552
|
}
|
|
34553
34553
|
}
|
|
34554
34554
|
onKeydown(t) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#slick-table-autocomplete {
|
|
2
2
|
background-color: white;
|
|
3
|
-
|
|
4
|
-
position: absolute;
|
|
3
|
+
box-shadow: gray 0 0 5px 1px;
|
|
5
4
|
color: #1E456F;
|
|
6
|
-
box-shadow: gray 0px 0px 5px 1px;
|
|
7
5
|
font-size: 0.75rem;
|
|
6
|
+
max-height: 20em;
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
position: absolute;
|
|
9
|
+
z-index: 1;
|
|
8
10
|
|
|
9
11
|
strong {
|
|
10
12
|
color: rgb(0, 123, 255)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Autocomplete, ColumnSorter, DateFormatter, DateValidator, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber,
|
|
1
|
+
export { Autocomplete, ColumnSorter, DateFormatter, DateValidator, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, EmptyStringValidator, FORMATTER_NUMBER, LengthValidator, PercentFormatter, StringFormatter, TotalCalculator, formatterCheckMark, formatterGroupTotals, getFormatterNumber, columnSorter, commitCurrentEdit, copySelectedRows, deleteRows, getDisplayedRows, getLastRow, getNextId, getUpdates, highlightCell, highlightColumns, hotKeysCopy, hotKeysDelete, hotKeysRedo, hotKeysUndo, isDeletionDangerous, onCellChange, onRowCountChanged, onRowsChanged, openContextMenu, printerCheckMark, selectedRows, useHotKeys, useListenIfTablesWereEdited, useUpdateTotal, wereEdited, } from './lib';
|
|
2
2
|
export { ColumnPicker, DownloadManager, DecoratorEndingDate, DecoratorFilter, DecoratorColumnFilter, DecoratorPeriod, DefaultHotKeys, DefaultPrinter, DeletedRowsFilter, Filter, HotKeysDecorator, PreventCopying, RedoUndoOnly, SlickTable, WithConfirmationOfDeletion, WithSummary, WithoutHotKeys, eventContextMenu, eventHeaderContextMenu, eventSummary, } from './model';
|
|
3
3
|
export { SlickgridTable, WithTableStyles, columnCheckboxSelector, columnIsEdited, eventOpenColumnFilters, handleHeaderButtons, headerButtons, openColumnFilter, } from './ui';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/lib/slickgrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/lib/slickgrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,2BAA2B,EAC3B,cAAc,EACd,UAAU,GACV,MAAM,OAAO,CAAC;AACf,OAAO,EACN,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,eAAe,EACf,sBAAsB,EAGtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,8BAAsB,YAAa,YAAW,MAAM;IACnD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,EAAE,SAA8B;IAC1C,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAmC;IAC7D,cAAc,EAAE,MAAM,EAAE,CAA6C;IAC5E,SAAS,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE5B,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAGvC,YAAY,IAAI,IAAI;IAKpB,UAAU;
|
|
1
|
+
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,eAAe,EACf,sBAAsB,EAGtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,8BAAsB,YAAa,YAAW,MAAM;IACnD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,EAAE,SAA8B;IAC1C,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAmC;IAC7D,cAAc,EAAE,MAAM,EAAE,CAA6C;IAC5E,SAAS,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE5B,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAGvC,YAAY,IAAI,IAAI;IAKpB,UAAU;IAaV,OAAO,IAAI,IAAI;IAMf,KAAK,IAAI,IAAI;IAGb,IAAI,IAAI,IAAI;IAkBZ,cAAc,IAAI,OAAO;IAMzB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAOhC,WAAW,IAAI,IAAI;IAqBnB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IACzC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IACpC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IA8BrC,YAAY,CAAC,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAKvD,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAW5C,cAAc,IAAI,MAAM;IAGxB,SAAS,CAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IASvD,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAC1C,QAAQ,IAAI,sBAAsB;CAelC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EditorAmount } from './EditorAmount';
|
|
2
|
-
export { Autocomplete, EditorAutocomplete
|
|
2
|
+
export { Autocomplete, EditorAutocomplete } from './Autocomplete';
|
|
3
3
|
export { EditorDate } from './EditorDate';
|
|
4
4
|
export { EditorSelectString } from './EditorSelectString';
|
|
5
5
|
export { EditorSelectNumber } from './EditorSelectNumber';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/lib/slickgrid/lib/editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/lib/slickgrid/lib/editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -3,7 +3,7 @@ export { openContextMenu } from './contextMenu';
|
|
|
3
3
|
export { openHeaderContextMenu } from './header-context-menu';
|
|
4
4
|
export { useHotKeys, useListenIfTablesWereEdited, useResizeCanvas, useUpdateTotal, } from './hooks';
|
|
5
5
|
export { hotKeysCopy, hotKeysDelete, hotKeysOpenSummary, hotKeysRedo, hotKeysReverse, hotKeysUndo, nothingToCopy, positionToPaste, } from './hotKeys';
|
|
6
|
-
export { Autocomplete, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber,
|
|
6
|
+
export { Autocomplete, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, } from './editors';
|
|
7
7
|
export { FORMATTER_NUMBER, DateFormatter, formatterCheckMark, getFormatterNumber, PercentFormatter, StringFormatter, } from './formatters';
|
|
8
8
|
export { commitCurrentEdit, copySelectedRows, deleteRows, getActiveRowId, getDisplayedRows, getLastRow, getNextId, isDeletionDangerous, wereEdited, } from './functions';
|
|
9
9
|
export { formatterGroupTotals } from './grouping';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/lib/slickgrid/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,UAAU,EACV,2BAA2B,EAC3B,eAAe,EACf,cAAc,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/lib/slickgrid/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,UAAU,EACV,2BAA2B,EAC3B,eAAe,EACf,cAAc,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACN,aAAa,EACb,oBAAoB,EACpB,eAAe,GACf,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#slick-table-autocomplete {
|
|
2
2
|
background-color: white;
|
|
3
|
-
|
|
4
|
-
position: absolute;
|
|
3
|
+
box-shadow: gray 0 0 5px 1px;
|
|
5
4
|
color: #1E456F;
|
|
6
|
-
box-shadow: gray 0px 0px 5px 1px;
|
|
7
5
|
font-size: 0.75rem;
|
|
6
|
+
max-height: 20em;
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
position: absolute;
|
|
9
|
+
z-index: 1;
|
|
8
10
|
|
|
9
11
|
strong {
|
|
10
12
|
color: rgb(0, 123, 255)
|
|
@@ -32,6 +32,7 @@ export abstract class Autocomplete implements Editor {
|
|
|
32
32
|
const container = document.getElementById("root");
|
|
33
33
|
if (!container) return;
|
|
34
34
|
container.appendChild(this.list);
|
|
35
|
+
this.list.setAttribute("tabIndex", "0"); // this.input.addEventListener("blur", ...) doesn't work without it
|
|
35
36
|
this.list.setAttribute("id", this.id);
|
|
36
37
|
const { top, left, right } = this.args.position as ElementPosition;
|
|
37
38
|
const rowHeight = this.args.grid.getOptions().rowHeight || 25;
|
|
@@ -56,6 +57,13 @@ export abstract class Autocomplete implements Editor {
|
|
|
56
57
|
|
|
57
58
|
this.input.addEventListener("input", this.onInput.bind(this));
|
|
58
59
|
this.input.addEventListener("keydown", this.onKeydown.bind(this));
|
|
60
|
+
this.input.addEventListener("blur", ({ relatedTarget }) => {
|
|
61
|
+
if ((relatedTarget as HTMLDivElement | null)?.id === this.id) {
|
|
62
|
+
this.focus();
|
|
63
|
+
} else {
|
|
64
|
+
this.closeAllList();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
59
67
|
this.input.focus();
|
|
60
68
|
this.input.select();
|
|
61
69
|
}
|
|
@@ -74,22 +82,20 @@ export abstract class Autocomplete implements Editor {
|
|
|
74
82
|
}
|
|
75
83
|
makeVisible(): void {
|
|
76
84
|
if (!this.list) return;
|
|
77
|
-
const canvas = this.args.container.closest(".slick-viewport");
|
|
78
|
-
if (!canvas) return;
|
|
79
85
|
const {
|
|
80
86
|
bottom: listBottom,
|
|
81
87
|
left: listLeft,
|
|
82
88
|
right: listRight,
|
|
83
89
|
top: listTop,
|
|
84
90
|
} = this.list.getBoundingClientRect();
|
|
85
|
-
const { bottom:
|
|
86
|
-
|
|
87
|
-
if (listBottom >=
|
|
91
|
+
const { bottom: bodyBottom, right: bodyRight } =
|
|
92
|
+
document.body.getBoundingClientRect();
|
|
93
|
+
if (listBottom >= bodyBottom) {
|
|
88
94
|
const rowHeight = this.args.grid.getOptions().rowHeight || 25;
|
|
89
95
|
const listHeight = listBottom - listTop;
|
|
90
96
|
this.list.style.top = `${listTop - listHeight - rowHeight}px`;
|
|
91
97
|
}
|
|
92
|
-
if (listRight >=
|
|
98
|
+
if (listRight >= bodyRight) {
|
|
93
99
|
const { right: cellRight } = this.args.container.getBoundingClientRect();
|
|
94
100
|
const exceeding = listRight - cellRight;
|
|
95
101
|
this.list.style.left = `${listLeft - exceeding}px`;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export { EditorAmount } from "./EditorAmount";
|
|
2
|
-
export {
|
|
3
|
-
Autocomplete,
|
|
4
|
-
EditorAutocomplete,
|
|
5
|
-
EditorSelectWithSearch,
|
|
6
|
-
} from "./Autocomplete";
|
|
2
|
+
export { Autocomplete, EditorAutocomplete } from "./Autocomplete";
|
|
7
3
|
export { EditorDate } from "./EditorDate";
|
|
8
4
|
export { EditorSelectString } from "./EditorSelectString";
|
|
9
5
|
export { EditorSelectNumber } from "./EditorSelectNumber";
|
package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Column, EditorArguments, GridOption } from 'slickgrid';
|
|
2
|
-
import { ISlickRow } from '../../../../../model/types';
|
|
3
|
-
import { Autocomplete } from './Autocomplete';
|
|
4
|
-
export declare class EditorSelectWithSearch<TData = any, C extends Column<TData> = Column<TData>, O extends GridOption<C> = GridOption<C>> extends Autocomplete {
|
|
5
|
-
args: EditorArguments<TData, C, O>;
|
|
6
|
-
protected hash: Record<string, string>;
|
|
7
|
-
protected reversedHash: Record<string, string>;
|
|
8
|
-
constructor(args: EditorArguments<TData, C, O>);
|
|
9
|
-
applyValue(item: any, state: any): void;
|
|
10
|
-
isValueChanged(): boolean;
|
|
11
|
-
loadValue(item: ISlickRow): void;
|
|
12
|
-
onInput(event: Event): void;
|
|
13
|
-
onClick(event: MouseEvent): void;
|
|
14
|
-
showOptions(search: string): void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=EditorSelectWithSearch.d.ts.map
|
package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSelectWithSearch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAW,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,sBAAsB,CAClC,KAAK,GAAG,GAAG,EACX,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACvC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CACtC,SAAQ,YAAY;IAIF,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAHrD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAE5B,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAmBrD,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAIvC,cAAc,IAAI,OAAO;IAUzB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAQhC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK3B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAKhC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAkBjC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { Column, EditorArguments, GridOption } from "slickgrid";
|
|
2
|
-
|
|
3
|
-
import { escapeSpecialChar } from "shared/lib/regexp";
|
|
4
|
-
import { IColumn, ISlickRow } from "shared/model/types";
|
|
5
|
-
|
|
6
|
-
import { Autocomplete } from "./Autocomplete";
|
|
7
|
-
|
|
8
|
-
export class EditorSelectWithSearch<
|
|
9
|
-
TData = any,
|
|
10
|
-
C extends Column<TData> = Column<TData>,
|
|
11
|
-
O extends GridOption<C> = GridOption<C>,
|
|
12
|
-
> extends Autocomplete {
|
|
13
|
-
protected hash: Record<string, string>;
|
|
14
|
-
protected reversedHash: Record<string, string>;
|
|
15
|
-
|
|
16
|
-
constructor(public args: EditorArguments<TData, C, O>) {
|
|
17
|
-
super();
|
|
18
|
-
const column: IColumn = this.args.column;
|
|
19
|
-
this.hash = column.selectOptions as Record<string, string>;
|
|
20
|
-
this.reversedHash = Object.entries(this.hash).reduce(
|
|
21
|
-
(acc: Record<string, string>, [key, value]) => {
|
|
22
|
-
acc[value] = key;
|
|
23
|
-
return acc;
|
|
24
|
-
},
|
|
25
|
-
{},
|
|
26
|
-
);
|
|
27
|
-
this.init();
|
|
28
|
-
const item = this.args.item;
|
|
29
|
-
const initialValue = item[column.field];
|
|
30
|
-
if (!initialValue) {
|
|
31
|
-
this.showOptions("");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
applyValue(item: any, state: any): void {
|
|
36
|
-
item[this.args.column.field] = this.reversedHash[state];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
isValueChanged(): boolean {
|
|
40
|
-
if (!this.reversedHash[this.input.value]) {
|
|
41
|
-
this.input.value = this.defaultValue;
|
|
42
|
-
}
|
|
43
|
-
return (
|
|
44
|
-
!(this.input.value == "" && this.defaultValue == null) &&
|
|
45
|
-
this.input.value != this.defaultValue
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
loadValue(item: ISlickRow): void {
|
|
50
|
-
this.defaultValue = this.hash[item[this.args.column.id]] || "";
|
|
51
|
-
this.input.value = this.defaultValue;
|
|
52
|
-
this.input.defaultValue = this.defaultValue;
|
|
53
|
-
this.input.focus();
|
|
54
|
-
this.input.select();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onInput(event: Event): void {
|
|
58
|
-
this.closeAllList();
|
|
59
|
-
this.currentFocus = -1;
|
|
60
|
-
this.showOptions((event.target as HTMLInputElement).value);
|
|
61
|
-
}
|
|
62
|
-
onClick(event: MouseEvent): void {
|
|
63
|
-
const div = (event.target as HTMLElement).closest("div") as HTMLDivElement;
|
|
64
|
-
this.input.value = this.hash[div.getElementsByTagName("input")[0].value];
|
|
65
|
-
this.closeAllList();
|
|
66
|
-
}
|
|
67
|
-
showOptions(search: string): void {
|
|
68
|
-
this.createList();
|
|
69
|
-
Object.entries(this.hash).forEach(([key, value]) => {
|
|
70
|
-
const hasOverlap = value.match(
|
|
71
|
-
new RegExp(escapeSpecialChar(search), "i"),
|
|
72
|
-
);
|
|
73
|
-
if (hasOverlap) {
|
|
74
|
-
const overlap = hasOverlap[0];
|
|
75
|
-
const listItem = document.createElement("div");
|
|
76
|
-
listItem.innerHTML = `${value.replaceAll(overlap, `<strong>${overlap}</strong>`)}`;
|
|
77
|
-
// insert an input field that will hold the current array item's value
|
|
78
|
-
listItem.innerHTML += `<input type="hidden" value="${key}">`;
|
|
79
|
-
listItem.addEventListener("click", this.onClick.bind(this));
|
|
80
|
-
this.list?.appendChild(listItem);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
this.makeVisible();
|
|
84
|
-
}
|
|
85
|
-
}
|