d2coreui 21.0.11 → 21.0.12

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 (37) hide show
  1. package/components/color/colorPicker.d.ts +20 -0
  2. package/components/color/colorPicker.js +54 -0
  3. package/components/color/colorPicker.js.map +1 -0
  4. package/components/color/colorUtils.d.ts +2 -0
  5. package/components/color/colorUtils.js +29 -0
  6. package/components/color/colorUtils.js.map +1 -1
  7. package/components/date/dateRangeInput.d.ts +13 -1
  8. package/components/date/dateRangeInput.js +100 -9
  9. package/components/date/dateRangeInput.js.map +1 -1
  10. package/components/date/dateRangeInputAdvancedPanel.d.ts +26 -0
  11. package/components/date/dateRangeInputAdvancedPanel.js +116 -0
  12. package/components/date/dateRangeInputAdvancedPanel.js.map +1 -0
  13. package/components/date/dateRangeInputConfirm.d.ts +11 -1
  14. package/components/date/dateRangeInputConfirm.js +67 -27
  15. package/components/date/dateRangeInputConfirm.js.map +1 -1
  16. package/components/date/dateTimeInput.d.ts +2 -0
  17. package/components/date/dateTimeInput.js +5 -5
  18. package/components/date/dateTimeInput.js.map +1 -1
  19. package/components/grid/cell/simpleStatusTextCellEditor.d.ts +1 -0
  20. package/components/grid/cell/simpleStatusTextCellEditor.js +17 -10
  21. package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
  22. package/components/grid/config/rowStylePicker.d.ts +1 -5
  23. package/components/grid/config/rowStylePicker.js +14 -70
  24. package/components/grid/config/rowStylePicker.js.map +1 -1
  25. package/components/grid/dataGrid.d.ts +1 -1
  26. package/components/grid/dataGrid.js +101 -122
  27. package/components/grid/dataGrid.js.map +1 -1
  28. package/components/grid/extendedDataGrid.d.ts +2 -0
  29. package/components/grid/extendedDataGrid.js +6 -1
  30. package/components/grid/extendedDataGrid.js.map +1 -1
  31. package/components/input/maskedInput.d.ts +3 -3
  32. package/components/scrollTo/scrollTo.d.ts +1 -0
  33. package/components/scrollTo/scrollTo.js +13 -0
  34. package/components/scrollTo/scrollTo.js.map +1 -1
  35. package/i18n/components.sk.json +17 -0
  36. package/package.json +2 -2
  37. package/style/index.less +5 -0
@@ -30,6 +30,7 @@ import NoRecordsOverlay from "d2coreui/components/grid/panel/noRecordsOverlay";
30
30
  import at from "lodash/at";
31
31
  import ColumnTransfer from "d2coreui/components/grid/config/columnTransfer";
32
32
  import cloneDeep from "lodash/cloneDeep";
33
+ import escape from "lodash/escape";
33
34
  import { RangeSelector } from "d2coreui/components/grid/cell/rangeSelector";
34
35
  import { WildcardQuickFilter } from "d2coreui/components/grid/cell/wildcardQuickFilter";
35
36
  import { ColDefUtil } from "ag-grid-community";
@@ -141,8 +142,8 @@ export default class DataGrid extends React.Component {
141
142
  this.wildcardQuickFilter = new WildcardQuickFilter();
142
143
  this.columnTypes = {
143
144
  "localizedArrayColumn": {
144
- cellRenderer: (props) => {
145
- const value = DataGrid.getFieldValue(props);
145
+ cellRenderer: (params) => {
146
+ const value = DataGrid.getCellValue(params);
146
147
  if (value) {
147
148
  return value.map((s) => i18n(s)).join(",");
148
149
  }
@@ -154,27 +155,23 @@ export default class DataGrid extends React.Component {
154
155
  textCustomComparator: this.textCustomComparator
155
156
  },
156
157
  filterValueGetter: function (params) {
157
- if (params.colDef.field) {
158
- const value = DataGrid.getFieldValue(params);
159
- if (value) {
160
- return value.map((s) => i18n(s)).join(",");
161
- }
158
+ const value = DataGrid.getCellValue(params);
159
+ if (value) {
160
+ return value.map((s) => i18n(s)).join(",");
162
161
  }
163
162
  return null;
164
163
  },
165
164
  getQuickFilterText: function (params) {
166
- if (params.colDef.field) {
167
- const value = DataGrid.getFieldValue(params);
168
- if (value || value === 0) {
169
- return value.map((s) => i18n(s)).join(",");
170
- }
165
+ const value = DataGrid.getCellValue(params);
166
+ if (value) {
167
+ return value.map((s) => i18n(s)).join(",");
171
168
  }
172
169
  return "";
173
170
  }
174
171
  },
175
172
  "numberColumn": {
176
- cellRenderer: (props) => {
177
- const value = DataGrid.getFieldValue(props);
173
+ cellRenderer: (params) => {
174
+ const value = DataGrid.getCellValue(params);
178
175
  if (value || value === 0) {
179
176
  return LocaleHolder.formatNumber(value);
180
177
  }
@@ -186,33 +183,27 @@ export default class DataGrid extends React.Component {
186
183
  textCustomComparator: this.textCustomComparator
187
184
  },
188
185
  filterValueGetter: function (params) {
189
- if (params.colDef.field) {
190
- const value = DataGrid.getFieldValue(params);
191
- if (value || value === 0) {
192
- return LocaleHolder.formatNumber(value);
193
- }
194
- else {
195
- return "";
196
- }
186
+ const value = DataGrid.getCellValue(params);
187
+ if (value || value === 0) {
188
+ return LocaleHolder.formatNumber(value);
189
+ }
190
+ else {
191
+ return "";
197
192
  }
198
- return null;
199
193
  },
200
194
  getQuickFilterText: function (params) {
201
- if (params.colDef.field) {
202
- const value = DataGrid.getFieldValue(params);
203
- if (value || value === 0) {
204
- return LocaleHolder.formatNumber(value);
205
- }
206
- else {
207
- return "";
208
- }
195
+ const value = DataGrid.getCellValue(params);
196
+ if (value || value === 0) {
197
+ return LocaleHolder.formatNumber(value);
198
+ }
199
+ else {
200
+ return "";
209
201
  }
210
- return "";
211
202
  }
212
203
  },
213
204
  "dateColumn": {
214
- cellRenderer: (props) => {
215
- const value = DataGrid.getFieldValue(props);
205
+ cellRenderer: (params) => {
206
+ const value = DataGrid.getCellValue(params);
216
207
  if (value) {
217
208
  if (value === D2000UnixTimeNullValue) {
218
209
  return "---";
@@ -225,12 +216,10 @@ export default class DataGrid extends React.Component {
225
216
  return "---";
226
217
  }
227
218
  },
228
- valueFormatter: (props) => {
229
- if (props.colDef.field) {
230
- const value = DataGrid.getFieldValue(props);
231
- if (value) {
232
- return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
233
- }
219
+ valueFormatter: (params) => {
220
+ const value = DataGrid.getCellValue(params);
221
+ if (value) {
222
+ return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
234
223
  }
235
224
  return "---";
236
225
  },
@@ -238,46 +227,39 @@ export default class DataGrid extends React.Component {
238
227
  textCustomComparator: this.textCustomComparator
239
228
  },
240
229
  filterValueGetter: (params) => {
241
- if (params.colDef.field) {
242
- const value = DataGrid.getFieldValue(params);
243
- if (value) {
244
- return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
245
- }
230
+ const value = DataGrid.getCellValue(params);
231
+ if (value) {
232
+ return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
246
233
  }
247
234
  return null;
248
235
  },
249
236
  getQuickFilterText: (params) => {
250
- if (params.colDef.field) {
251
- const value = DataGrid.getFieldValue(params);
252
- if (value) {
253
- return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
254
- }
237
+ const value = DataGrid.getCellValue(params);
238
+ if (value) {
239
+ return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
255
240
  }
256
241
  return "";
257
242
  }
258
243
  },
259
244
  "dateTimeColumn": {
260
- cellRenderer: (props) => {
261
- var _a;
262
- if ((_a = props.colDef) === null || _a === void 0 ? void 0 : _a.field) {
263
- const value = DataGrid.getFieldValue(props);
264
- if (value) {
265
- if (value === D2000UnixTimeNullValue) {
266
- return "---";
267
- }
268
- let tooltipValue;
269
- tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true));
270
- return `<span title="${tooltipValue}">${unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds))}</span>`;
245
+ cellRenderer: (params) => {
246
+ const value = DataGrid.getCellValue(params);
247
+ if (value) {
248
+ if (value === D2000UnixTimeNullValue) {
249
+ return "---";
271
250
  }
251
+ let tooltipValue;
252
+ tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true));
253
+ return `<span title="${tooltipValue}">${unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds))}</span>`;
254
+ }
255
+ else {
256
+ return "---";
272
257
  }
273
- return "---";
274
258
  },
275
- valueFormatter: (props) => {
276
- if (props.colDef.field) {
277
- const value = DataGrid.getFieldValue(props);
278
- if (value) {
279
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
280
- }
259
+ valueFormatter: (params) => {
260
+ const value = DataGrid.getCellValue(params);
261
+ if (value) {
262
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
281
263
  }
282
264
  return "---";
283
265
  },
@@ -285,27 +267,23 @@ export default class DataGrid extends React.Component {
285
267
  textCustomComparator: this.textCustomComparator
286
268
  },
287
269
  filterValueGetter: (params) => {
288
- if (params.colDef.field) {
289
- const value = DataGrid.getFieldValue(params);
290
- if (value) {
291
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
292
- }
270
+ const value = DataGrid.getCellValue(params);
271
+ if (value) {
272
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
293
273
  }
294
274
  return null;
295
275
  },
296
276
  getQuickFilterText: (params) => {
297
- if (params.colDef.field) {
298
- const value = DataGrid.getFieldValue(params);
299
- if (value) {
300
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
301
- }
277
+ const value = DataGrid.getCellValue(params);
278
+ if (value) {
279
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
302
280
  }
303
281
  return "";
304
282
  }
305
283
  },
306
284
  "fromNowDateTimeColumn": {
307
- cellRenderer: (props) => {
308
- const value = DataGrid.getFieldValue(props);
285
+ cellRenderer: (params) => {
286
+ const value = DataGrid.getCellValue(params);
309
287
  if (value) {
310
288
  let tooltipValue;
311
289
  tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true));
@@ -315,12 +293,10 @@ export default class DataGrid extends React.Component {
315
293
  return "---";
316
294
  }
317
295
  },
318
- valueFormatter: (props) => {
319
- if (props.colDef.field) {
320
- const value = DataGrid.getFieldValue(props);
321
- if (value) {
322
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
323
- }
296
+ valueFormatter: (params) => {
297
+ const value = DataGrid.getCellValue(params);
298
+ if (value) {
299
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
324
300
  }
325
301
  return "---";
326
302
  },
@@ -328,24 +304,41 @@ export default class DataGrid extends React.Component {
328
304
  textCustomComparator: this.textCustomComparator
329
305
  },
330
306
  filterValueGetter: (params) => {
331
- if (params.colDef.field) {
332
- const value = DataGrid.getFieldValue(params);
333
- if (value) {
334
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
335
- }
307
+ const value = DataGrid.getCellValue(params);
308
+ if (value) {
309
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
336
310
  }
337
311
  return null;
338
312
  },
339
313
  getQuickFilterText: (params) => {
340
- if (params.colDef.field) {
341
- const value = DataGrid.getFieldValue(params);
342
- if (value) {
343
- return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
344
- }
314
+ const value = DataGrid.getCellValue(params);
315
+ if (value) {
316
+ return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds));
345
317
  }
346
318
  return "";
347
319
  }
348
320
  },
321
+ "escapedValueColumn": {
322
+ cellRenderer: (params) => {
323
+ const value = DataGrid.getCellValue(params);
324
+ if (value) {
325
+ const text = typeof value === "string" ? escape(value.replace(/[\r\n]+/g, ' ')) : value;
326
+ return `<span style="white-space: pre" title="${text}">${text}</span>`;
327
+ }
328
+ else {
329
+ return "";
330
+ }
331
+ },
332
+ valueFormatter: (params) => {
333
+ const value = DataGrid.getCellValue(params);
334
+ if (value) {
335
+ return typeof value === "string" ? value.replace(/[\r\n]+/g, ' ') : value;
336
+ }
337
+ else {
338
+ return "";
339
+ }
340
+ }
341
+ },
349
342
  "textColumnFilter": {
350
343
  filter: "agTextColumnFilter",
351
344
  floatingFilter: true,
@@ -384,33 +377,19 @@ export default class DataGrid extends React.Component {
384
377
  "alignRight": {}
385
378
  };
386
379
  }
387
- static getFieldValue(props) {
388
- var _a, _b;
389
- switch (typeof ((_a = props.colDef) === null || _a === void 0 ? void 0 : _a.valueGetter)) {
390
- case "undefined":
391
- if ((_b = props.colDef) === null || _b === void 0 ? void 0 : _b.field) {
392
- return at(props.data, props.colDef.field)[0];
393
- }
394
- else {
395
- return "---";
396
- }
397
- case "string":
398
- return props.colDef.valueGetter;
399
- case "function":
400
- try {
401
- return props.colDef.valueGetter(props);
402
- }
403
- catch (e) {
404
- if (props.colDef.field) {
405
- return at(props.data, props.colDef.field)[0];
406
- }
407
- else {
408
- return "---";
409
- }
410
- }
411
- default:
412
- return "---";
380
+ static getCellValue(props) {
381
+ if (props) {
382
+ if (props.colDef.field && typeof props.getValue === "function") {
383
+ return props.getValue(props.colDef.field);
384
+ }
385
+ if (props.data && props.colDef && props.colDef.field) {
386
+ return at(props.data, props.colDef.field)[0];
387
+ }
388
+ if (props.value !== undefined) {
389
+ return props.value;
390
+ }
413
391
  }
392
+ return undefined;
414
393
  }
415
394
  textCustomComparator(filter, value, filterText) {
416
395
  const filterTextLowerCase = filterText.toLowerCase();