jsl-ui 8.12.1 → 9.0.0

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.
@@ -1,6 +1,7 @@
1
1
  import { IJSLComponent, IJSLVNode } from "jsl-render";
2
2
  import { IAutoSuggestOptions, IAutoSuggest } from "../../ui/auto.suggest";
3
3
  export interface IAutoSuggestComponentOptions extends IAutoSuggestOptions {
4
+ value?: string;
4
5
  class?: string;
5
6
  style?: string;
6
7
  placeholder?: string;
@@ -8,7 +8,7 @@ var AutoSuggestComponent = /** @class */ (function () {
8
8
  var _a;
9
9
  return {
10
10
  tag: "input",
11
- attr: { class: this.options.class, style: this.options.style, placeholder: (_a = this.options.placeholder, (_a !== null && _a !== void 0 ? _a : "")) }
11
+ attr: { value: this.options.value, class: this.options.class, style: this.options.style, placeholder: (_a = this.options.placeholder, (_a !== null && _a !== void 0 ? _a : "")) }
12
12
  };
13
13
  };
14
14
  AutoSuggestComponent.prototype.getRef = function () {
@@ -58,12 +58,11 @@ var ExcelFilter = /** @class */ (function () {
58
58
  return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
59
59
  };
60
60
  ExcelFilter.prototype.show = function (col) {
61
- var _a;
62
61
  return __awaiter(this, void 0, void 0, function () {
63
- var values, filters, currentFilters, mode, filterOptions, oldCheckedValues, _i, currentFilters_1, f, dlg, dlgBody, id, search, cbAllContainer, cbAll, cbAllLabel, sortedValues, _b, values_1, x, o, visibleValues, checkedValues, cbContainer, rowHeight, height, vr, renderer, dlgObj, dlgOkButton, dlgCancelButton, dlgClearButton;
62
+ var values, filters, currentFilters, mode, filterOptions, oldCheckedValues, _i, currentFilters_1, f, dlg, dlgBody, id, search, cbAllContainer, cbAll, cbAllLabel, sortedValues, _a, values_1, x, o, visibleValues, checkedValues, cbContainer, rowHeight, height, vr, renderer, dlgObj, dlgOkButton, dlgCancelButton, dlgClearButton;
64
63
  var _this = this;
65
- return __generator(this, function (_c) {
66
- switch (_c.label) {
64
+ return __generator(this, function (_b) {
65
+ switch (_b.label) {
67
66
  case 0:
68
67
  filters = this.grid.getFilters();
69
68
  currentFilters = filters.filter(function (f) { return f.columnId === col.id; });
@@ -82,8 +81,8 @@ var ExcelFilter = /** @class */ (function () {
82
81
  }
83
82
  return [4 /*yield*/, filterOptions(col)];
84
83
  case 2:
85
- values = _c.sent();
86
- _c.label = 3;
84
+ values = _b.sent();
85
+ _b.label = 3;
87
86
  case 3:
88
87
  oldCheckedValues = {};
89
88
  if (currentFilters.length > 0) {
@@ -127,15 +126,15 @@ var ExcelFilter = /** @class */ (function () {
127
126
  dlgBody.appendChild(cbAllContainer);
128
127
  sortedValues = [];
129
128
  if (Array.isArray(values)) {
130
- for (_b = 0, values_1 = values; _b < values_1.length; _b++) {
131
- x = values_1[_b];
129
+ for (_a = 0, values_1 = values; _a < values_1.length; _a++) {
130
+ x = values_1[_a];
132
131
  sortedValues.push({ id: x, txt: (x !== null && x !== void 0 ? x : "") });
133
132
  }
134
133
  }
135
134
  else {
136
135
  for (o in values) {
137
136
  if (values.hasOwnProperty(o)) {
138
- sortedValues.push({ id: o, txt: (_a = values[o], (_a !== null && _a !== void 0 ? _a : "")) });
137
+ sortedValues.push({ id: values[o], txt: (o !== null && o !== void 0 ? o : "") });
139
138
  }
140
139
  }
141
140
  }
@@ -156,13 +155,19 @@ var ExcelFilter = /** @class */ (function () {
156
155
  tag: "input",
157
156
  attr: {
158
157
  id: id + "_" + args.index,
159
- checked: checkedValues[args.rowData.id] ? "checked" : undefined,
158
+ checked: checkedValues[args.rowData.id[0]] ? "checked" : undefined,
160
159
  change: function (_, node) {
161
160
  if (node.dom.checked) {
162
- checkedValues[args.rowData.id] = true;
161
+ for (var _i = 0, _a = args.rowData.id; _i < _a.length; _i++) {
162
+ var selId = _a[_i];
163
+ checkedValues[selId] = true;
164
+ }
163
165
  }
164
166
  else {
165
- delete checkedValues[args.rowData.id];
167
+ for (var _b = 0, _c = args.rowData.id; _b < _c.length; _b++) {
168
+ var selId = _c[_b];
169
+ delete checkedValues[selId];
170
+ }
166
171
  }
167
172
  // check if all values or none are checked
168
173
  var allChecked = Object.getOwnPropertyNames(checkedValues).length === sortedValues.length;
@@ -201,11 +206,22 @@ var ExcelFilter = /** @class */ (function () {
201
206
  });
202
207
  cbAll.addEventListener("change", function () {
203
208
  for (var i = 0; i < visibleValues.length; i++) {
209
+ // if (cbAll.checked) {
210
+ // checkedValues[visibleValues[i].id] = true;
211
+ // } else {
212
+ // delete checkedValues[visibleValues[i].id];
213
+ // }
204
214
  if (cbAll.checked) {
205
- checkedValues[visibleValues[i].id] = true;
215
+ for (var _i = 0, _a = visibleValues[i].id; _i < _a.length; _i++) {
216
+ var selId = _a[_i];
217
+ checkedValues[selId] = true;
218
+ }
206
219
  }
207
220
  else {
208
- delete checkedValues[visibleValues[i].id];
221
+ for (var _b = 0, _c = visibleValues[i].id; _b < _c.length; _b++) {
222
+ var selId = _c[_b];
223
+ delete checkedValues[selId];
224
+ }
209
225
  }
210
226
  }
211
227
  renderer.refresh();
@@ -276,13 +292,20 @@ var ExcelFilter = /** @class */ (function () {
276
292
  // }
277
293
  // }
278
294
  ExcelFilter.prototype.getDistinctValues = function (col) {
279
- var result = {};
295
+ var textToValues = {};
280
296
  for (var idx = 0, len = this.grid.getDataLength(); idx < len; idx++) {
281
297
  var item = this.grid.getDataItem(idx);
282
298
  var value = this.grid.getDataItemValueForColumn(item, col);
283
- result[value] = this.grid.getFormattedValue(col, value, item);
299
+ var text = this.grid.getFormattedValue(col, value, item);
300
+ var valueList = textToValues[text];
301
+ if (valueList == null) {
302
+ valueList = textToValues[text] = [];
303
+ }
304
+ if (valueList.indexOf(value) < 0) {
305
+ valueList.push(value);
306
+ }
284
307
  }
285
- return result;
308
+ return textToValues;
286
309
  };
287
310
  return ExcelFilter;
288
311
  }());
@@ -12,7 +12,7 @@ export interface ISlickCreatorOptions extends ISlickGridOptions {
12
12
  saveColumnsKey?: string;
13
13
  groupItemMetadataProvider?: any;
14
14
  getFilterValues?: (column: ISlickColumn) => Promise<{
15
- [key: string]: string;
15
+ [key: string]: any[];
16
16
  } | any[]>;
17
17
  showFilterDialog?: (column: ISlickColumn, grid: IJSLGrid<any>) => void;
18
18
  }
@@ -92,7 +92,8 @@ export function DataView(options) {
92
92
  for (var i = startingIndex, l = items.length; i < l; i++) {
93
93
  id = items[i][idProperty];
94
94
  if (id === undefined) {
95
- throw new Error("Each data element must implement a unique 'id' property");
95
+ // throw new Error("Each data element must implement a unique 'id' property");
96
+ throw new Error("Id (" + idProperty + ") of element at index " + i + " was undefined");
96
97
  }
97
98
  idxById[id] = i;
98
99
  }
@@ -101,8 +102,11 @@ export function DataView(options) {
101
102
  var id;
102
103
  for (var i = 0, l = items.length; i < l; i++) {
103
104
  id = items[i][idProperty];
104
- if (id === undefined || idxById[id] !== i) {
105
- throw new Error("Each data element must implement a unique 'id' property");
105
+ if (id === undefined) {
106
+ throw new Error("Id (" + idProperty + ") of element at index " + i + " was undefined");
107
+ }
108
+ else if (idxById[id] !== i) {
109
+ throw new Error("Duplicate id (" + idProperty + ") for " + id + " found at index (" + idxById[id] + ", " + i + ")");
106
110
  }
107
111
  }
108
112
  }
@@ -10,6 +10,7 @@ export declare let HtmlFormatter: ISlickFormatter;
10
10
  export declare let LookupFormatter: ISlickFormatter;
11
11
  export declare let MultiLookupFormatter: ISlickFormatter;
12
12
  export declare let TextFormatter: ISlickFormatter;
13
+ export declare let TooltipFormatter: ISlickFormatter;
13
14
  export declare let MultiLineTextFormatter: ISlickFormatter;
14
15
  export declare let TimeFormatter: ISlickFormatter;
15
16
  export declare let DateTimeFormatter: ISlickFormatter;
@@ -101,6 +101,15 @@ export var TextFormatter = function (row, cell, value, columnDef, dataContext) {
101
101
  return escapeHTMLChars(value + "");
102
102
  }
103
103
  };
104
+ export var TooltipFormatter = function (row, cell, value, columnDef, dataContext) {
105
+ if (value == null) {
106
+ return "";
107
+ }
108
+ else {
109
+ var result = escapeHTMLChars(value + "");
110
+ return { text: result, toolTip: result };
111
+ }
112
+ };
104
113
  export var MultiLineTextFormatter = function (row, cell, value, columnDef, dataContext) {
105
114
  var txt = "";
106
115
  if (value != null) {
@@ -2957,9 +2957,16 @@ export function SlickGrid(container, data, columns, options) {
2957
2957
  }
2958
2958
  }
2959
2959
  function invalidate() {
2960
+ var currentActiveCell = null;
2961
+ if (currentEditor) {
2962
+ currentActiveCell = getActiveCell();
2963
+ }
2960
2964
  updateRowCount();
2961
2965
  invalidateAllRows();
2962
2966
  render();
2967
+ if (currentActiveCell) {
2968
+ makeActiveCellEditable(null, null, {});
2969
+ }
2963
2970
  }
2964
2971
  function invalidateAllRows() {
2965
2972
  if (currentEditor) {