Skip to content

Instantly share code, notes, and snippets.

@theredpea
Created February 28, 2018 02:54
Show Gist options
  • Select an option

  • Save theredpea/e487c3dbac08c7fed68fe56bbe1dcac5 to your computer and use it in GitHub Desktop.

Select an option

Save theredpea/e487c3dbac08c7fed68fe56bbe1dcac5 to your computer and use it in GitHub Desktop.
//Note thinks like:
//selectionsApi.deactivated()
//backendApi.inSelections()
//backendApi.endSelections()
selectValues: function(a, b, c) {
if (this.selectionsEnabled) {
if (!this.backendApi.inSelections()) {
var d = this.$scope
, e = this;
d.selectionsApi.confirm = function() {
d.backendApi.endSelections(!0),
d.selectionsApi.deactivated()
}
,
d.selectionsApi.cancel = function() {
d.backendApi.endSelections(!1),
d.selectionsApi.deactivated()
}
,
d.selectionsApi.deactivate = function() {
this.deactivated()
}
,
d.selectionsApi.clear = function() {
e.clearSelectedValues(e.$element),
d.backendApi.clearSelections(),
d.selectionsApi.selectionsMade = !1,
e.selectedArrays = {}
}
,
this.getSelectionToolbar = function() {
return new f(this.$scope.backendApi,this.$scope.selectionsApi,!1,!1,[],[])
}
,
this.backendApi.beginSelections(),
d.selectionsApi.activated(),
this.selectedArrays = {}
}
if (this.$scope.selectionsApi.selectionsMade = !0,
this.selectedArrays[a] || (this.selectedArrays[a] = []),
c)
for (var g = 0; g < b.length; g++) {
var h = this.selectedArrays[a].indexOf(b[g]);
-1 === h ? this.selectedArrays[a].push(b[g]) : this.selectedArrays[a].splice(h, 1)
}
else
this.selectedArrays[a] = this.selectedArrays[a].concat(b);
this.backendApi.selectValues(a, this.selectedArrays[a], !1)
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment