tabulator-rails 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '069d63fb31245f7182ba1ac53eea81d3a6bf8cc5'
4
- data.tar.gz: 9cbcdb9f0c24429499cc31537982a01f70c99a6f
3
+ metadata.gz: e7cec85b2f75a1523ce7e192596bb6c8da162f53
4
+ data.tar.gz: e0e8a903e31068ac5efd448e58d88bad467eacb1
5
5
  SHA512:
6
- metadata.gz: 07c6ff37357cd9b8a83a5baa0f32f23df0a431aa2c17f1b6601d2b1b0f4d281c785c2592a7d262168d7e92d18d67d632eed7d83333a268c3de016be863719772
7
- data.tar.gz: 4479205847bf629a1ff5eb3498856f83305804fc600b97effc0a03c11bd1144d61dae9f611acf551035a7cbcbfd88832de60dfee20a2aebc8910c06bbc621839
6
+ metadata.gz: 28c9c0e0a15d311712ea3cda97fbfd53b77620aacd66d59430d4238c4f23f00b683257ec252d7ec78e646d9f3a011f4396bbb359522c47c483c314d8303b6a5b
7
+ data.tar.gz: eee3c6b73e6c25d76c136d5405b61b6fa6be13162f89df9b8f16e86a96ae54595a4d57f3809d34b526db3735c3eb691bd5ce44af87b4b16d0d6e5115d2dd253b
@@ -1,93 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tabulator-rails (0.1.1)
4
+ tabulator-rails (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (5.1.4)
10
- actionview (= 5.1.4)
11
- activesupport (= 5.1.4)
12
- rack (~> 2.0)
13
- rack-test (>= 0.6.3)
14
- rails-dom-testing (~> 2.0)
15
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
16
- actionview (5.1.4)
17
- activesupport (= 5.1.4)
18
- builder (~> 3.1)
19
- erubi (~> 1.4)
20
- rails-dom-testing (~> 2.0)
21
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
22
- activesupport (5.1.4)
23
- concurrent-ruby (~> 1.0, >= 1.0.2)
24
- i18n (~> 0.7)
25
- minitest (~> 5.1)
26
- tzinfo (~> 1.1)
27
- builder (3.2.3)
28
- concurrent-ruby (1.0.5)
29
- crass (1.0.3)
30
- diff-lcs (1.3)
31
- erubi (1.7.0)
32
- i18n (0.9.1)
33
- concurrent-ruby (~> 1.0)
34
- jquery-rails (4.3.1)
35
- rails-dom-testing (>= 1, < 3)
36
- railties (>= 4.2.0)
37
- thor (>= 0.14, < 2.0)
38
- jquery-ui-rails (6.0.1)
39
- railties (>= 3.2.16)
40
- loofah (2.1.1)
41
- crass (~> 1.0.2)
42
- nokogiri (>= 1.5.9)
43
- method_source (0.9.0)
44
- mini_portile2 (2.3.0)
45
- minitest (5.11.1)
46
- nokogiri (1.8.1)
47
- mini_portile2 (~> 2.3.0)
48
- rack (2.0.3)
49
- rack-test (0.8.2)
50
- rack (>= 1.0, < 3)
51
- rails-dom-testing (2.0.3)
52
- activesupport (>= 4.2.0)
53
- nokogiri (>= 1.6)
54
- rails-html-sanitizer (1.0.3)
55
- loofah (~> 2.0)
56
- railties (5.1.4)
57
- actionpack (= 5.1.4)
58
- activesupport (= 5.1.4)
59
- method_source
60
- rake (>= 0.8.7)
61
- thor (>= 0.18.1, < 2.0)
62
9
  rake (10.5.0)
63
- rspec (3.7.0)
64
- rspec-core (~> 3.7.0)
65
- rspec-expectations (~> 3.7.0)
66
- rspec-mocks (~> 3.7.0)
67
- rspec-core (3.7.1)
68
- rspec-support (~> 3.7.0)
69
- rspec-expectations (3.7.0)
70
- diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.7.0)
72
- rspec-mocks (3.7.0)
73
- diff-lcs (>= 1.2.0, < 2.0)
74
- rspec-support (~> 3.7.0)
75
- rspec-support (3.7.0)
76
- thor (0.20.0)
77
- thread_safe (0.3.6)
78
- tzinfo (1.2.4)
79
- thread_safe (~> 0.1)
80
10
 
81
11
  PLATFORMS
82
12
  ruby
83
13
 
84
14
  DEPENDENCIES
85
15
  bundler (~> 1.16)
86
- jquery-rails
87
- jquery-ui-rails
88
16
  rake (~> 10.0)
89
- rspec (~> 3.0)
90
17
  tabulator-rails!
91
18
 
92
19
  BUNDLED WITH
93
- 1.16.0
20
+ 1.16.1
@@ -10,4 +10,5 @@
10
10
  | 0.2.3 | 3.4.3
11
11
  | 0.2.4 | 3.4.4
12
12
  | 0.2.5 | 3.4.5
13
+ | 0.2.6 | 3.4.6
13
14
 
@@ -1,5 +1,5 @@
1
1
  module Tabulator
2
2
  module Rails
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
4
 
5
- /* Tabulator v3.4.5 (c) Oliver Folkerd */
5
+ /* Tabulator v3.4.6 (c) Oliver Folkerd */
6
6
 
7
7
  /*
8
8
  * This file is part of the Tabulator package.
@@ -4923,7 +4923,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4923
4923
 
4924
4924
  if (this.table.extExists("edit", true)) {
4925
4925
 
4926
- return this.table.extensions.edit.edit(this, false, force);
4926
+ return this.table.extensions.edit.editCell(this, false, force);
4927
4927
  }
4928
4928
  };
4929
4929
 
@@ -5543,9 +5543,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5543
5543
 
5544
5544
  _clearObjectPointers: function _clearObjectPointers() {
5545
5545
 
5546
- this.options.columns = this.options.columns.splice(0);
5546
+ this.options.columns = this.options.columns.slice(0);
5547
5547
 
5548
- this.options.data = this.options.data.splice(0);
5548
+ this.options.data = this.options.data.slice(0);
5549
5549
  },
5550
5550
 
5551
5551
  //build tabulator element
@@ -8741,6 +8741,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8741
8741
 
8742
8742
  this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening
8743
8743
 
8744
+
8745
+ this.recursionBlock = false; //prevent focus recursion
8746
+
8747
+
8748
+ this.invalidEdit = false;
8744
8749
  };
8745
8750
 
8746
8751
  //initialize column editor
@@ -8822,13 +8827,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8822
8827
 
8823
8828
  var cell = this.currentCell;
8824
8829
 
8825
- this.currentCell = false;
8830
+ this.invalidEdit = false;
8831
+
8832
+ if (cell) {
8833
+
8834
+ this.currentCell = false;
8826
8835
 
8827
- cell.getElement().removeClass("tabulator-validation-fail");
8836
+ cell.getElement().removeClass("tabulator-validation-fail");
8828
8837
 
8829
- cell.getElement().removeClass("tabulator-editing").empty();
8838
+ cell.getElement().removeClass("tabulator-editing").empty();
8830
8839
 
8831
- cell.row.getElement().removeClass("tabulator-row-editing");
8840
+ cell.row.getElement().removeClass("tabulator-row-editing");
8841
+ }
8832
8842
  };
8833
8843
 
8834
8844
  Edit.prototype.cancelEdit = function () {
@@ -8875,12 +8885,31 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8875
8885
  self.mouseClick = true;
8876
8886
  });
8877
8887
 
8878
- element.on("focus", function (e, force) {
8888
+ element.on("focus", function (e) {
8889
+
8890
+ if (!self.recursionBlock) {
8879
8891
 
8880
- self.edit(cell, e);
8892
+ self.edit(cell, e, false);
8893
+ }
8881
8894
  });
8882
8895
  };
8883
8896
 
8897
+ Edit.prototype.focusCellNoEvent = function (cell) {
8898
+
8899
+ this.recursionBlock = true;
8900
+
8901
+ cell.getElement().focus();
8902
+
8903
+ this.recursionBlock = false;
8904
+ };
8905
+
8906
+ Edit.prototype.editCell = function (cell, forceEdit) {
8907
+
8908
+ this.focusCellNoEvent(cell);
8909
+
8910
+ this.edit(cell, false, forceEdit);
8911
+ };
8912
+
8884
8913
  Edit.prototype.edit = function (cell, e, forceEdit) {
8885
8914
 
8886
8915
  var self = this,
@@ -8890,12 +8919,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8890
8919
  cellEditor,
8891
8920
  component;
8892
8921
 
8893
- //if currently editing another cell trigger blur to trigger save and validate actions
8922
+ //prevent editing if another cell is refusing to leave focus (eg. validation fail)
8894
8923
 
8895
8924
 
8896
8925
  if (this.currentCell) {
8897
8926
 
8898
- cell.getElement().focus();
8927
+ if (!this.invalidEdit) {
8928
+
8929
+ this.cancelEdit();
8930
+ } else {
8931
+
8932
+ return;
8933
+ }
8899
8934
 
8900
8935
  return;
8901
8936
  }
@@ -8905,25 +8940,35 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8905
8940
 
8906
8941
  function success(value) {
8907
8942
 
8908
- var valid = true;
8943
+ if (self.currentCell === cell) {
8909
8944
 
8910
- if (cell.column.extensions.validate && self.table.extExists("validate")) {
8945
+ var valid = true;
8911
8946
 
8912
- valid = self.table.extensions.validate.validate(cell.column.extensions.validate, cell.getComponent(), value);
8913
- }
8947
+ if (cell.column.extensions.validate && self.table.extExists("validate")) {
8914
8948
 
8915
- if (valid === true) {
8949
+ valid = self.table.extensions.validate.validate(cell.column.extensions.validate, cell.getComponent(), value);
8950
+ }
8916
8951
 
8917
- self.clearEditor();
8952
+ if (valid === true) {
8918
8953
 
8919
- cell.setValue(value, true);
8920
- } else {
8954
+ self.clearEditor();
8955
+
8956
+ cell.setValue(value, true);
8957
+ } else {
8958
+
8959
+ self.invalidEdit = true;
8960
+
8961
+ cell.getElement().addClass("tabulator-validation-fail");
8921
8962
 
8922
- cell.getElement().addClass("tabulator-validation-fail");
8963
+ self.focusCellNoEvent(cell);
8923
8964
 
8924
- rendered();
8965
+ rendered();
8925
8966
 
8926
- self.table.options.validationFailed(cell.getComponent(), value, valid);
8967
+ self.table.options.validationFailed(cell.getComponent(), value, valid);
8968
+ }
8969
+ } else {
8970
+
8971
+ console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited");
8927
8972
  }
8928
8973
  };
8929
8974
 
@@ -8932,7 +8977,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8932
8977
 
8933
8978
  function cancel() {
8934
8979
 
8935
- self.cancelEdit();
8980
+ if (self.currentCell === cell) {
8981
+
8982
+ self.cancelEdit();
8983
+ } else {
8984
+
8985
+ console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited");
8986
+ }
8936
8987
  };
8937
8988
 
8938
8989
  function onRendered(callback) {
@@ -11150,7 +11201,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11150
11201
 
11151
11202
  element.attr("aria-label", percentValue);
11152
11203
 
11153
- return "<div style='position:absolute; top:8px; bottom:8px; left:4px; right:4px;'><div style='position:relative; height:100%; width:calc(" + percentValue + "%); background-color:" + color + "; display:inline-block;' data-max='" + max + "' data-min='" + min + "'></div></div>" + (legend ? "<div style='position:absolute; top:4px; left:0; text-align:center; width:100%; color:" + legendColor + ";'>" + legend + "</div>" : "");
11204
+ return "<div style='position:absolute; top:8px; bottom:8px; left:4px; right:4px;' data-max='" + max + "' data-min='" + min + "'><div style='position:relative; height:100%; width:calc(" + percentValue + "%); background-color:" + color + "; display:inline-block;'></div></div>" + (legend ? "<div style='position:absolute; top:4px; left:0; text-align:center; width:100%; color:" + legendColor + ";'>" + legend + "</div>" : "");
11154
11205
  },
11155
11206
 
11156
11207
  //background color
@@ -1,4 +1,4 @@
1
- /* Tabulator v3.4.5 (c) Oliver Folkerd */
1
+ /* Tabulator v3.4.6 (c) Oliver Folkerd */
2
2
  .tabulator {
3
3
  position: relative;
4
4
  border: 1px solid #999;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tabulator-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - tanvir hasan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler