@michalrakus/x-react-web-lib 1.0.0 → 1.2.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.
Files changed (98) hide show
  1. package/FindParam.d.ts +3 -0
  2. package/FindParam.js +5 -0
  3. package/LICENSE.md +21 -0
  4. package/XButtonIconNarrow.d.ts +3 -0
  5. package/XButtonIconNarrow.js +5 -0
  6. package/XButtonIconSmall.d.ts +3 -0
  7. package/XButtonIconSmall.js +5 -0
  8. package/XFieldChangeEvent.d.ts +3 -0
  9. package/XFieldChangeEvent.js +5 -0
  10. package/XInputTextarea.d.ts +3 -0
  11. package/XInputTextarea.js +5 -0
  12. package/gulpfile.js +5 -0
  13. package/lib/administration/XBrowseMetaBrowse.js +2 -1
  14. package/lib/administration/XBrowseMetaForm.js +4 -2
  15. package/lib/administration/XUserBrowse.js +3 -2
  16. package/lib/administration/XUserForm.js +5 -3
  17. package/lib/components/SearchTableParams.d.ts +8 -2
  18. package/lib/components/SourceCodeLinkEntity.js +3 -2
  19. package/lib/components/XAutoComplete.d.ts +10 -7
  20. package/lib/components/XAutoComplete.js +37 -41
  21. package/lib/components/XAutoCompleteBase.d.ts +8 -5
  22. package/lib/components/XAutoCompleteBase.js +86 -43
  23. package/lib/components/XAutoCompleteDT.d.ts +33 -0
  24. package/lib/components/XAutoCompleteDT.js +141 -0
  25. package/lib/components/XBrowse.js +11 -5
  26. package/lib/components/XButton.d.ts +3 -1
  27. package/lib/components/XButton.js +3 -2
  28. package/lib/components/XButtonIconNarrow.d.ts +10 -0
  29. package/lib/components/XButtonIconNarrow.js +25 -0
  30. package/lib/components/XButtonIconSmall.d.ts +3 -1
  31. package/lib/components/XButtonIconSmall.js +2 -1
  32. package/lib/components/XChangePasswordForm.js +12 -7
  33. package/lib/components/XCheckbox.d.ts +8 -10
  34. package/lib/components/XCheckbox.js +39 -31
  35. package/lib/components/XCheckboxDT.js +2 -1
  36. package/lib/components/XDataTable.js +16 -10
  37. package/lib/components/XDropdown.d.ts +7 -5
  38. package/lib/components/XDropdown.js +24 -45
  39. package/lib/components/XDropdownDT.js +10 -5
  40. package/lib/components/XDropdownDTFilter.js +12 -7
  41. package/lib/components/XDropdownFormDTFilter.js +12 -7
  42. package/lib/components/XEditColumnDialog.js +12 -7
  43. package/lib/components/XErrors.d.ts +1 -0
  44. package/lib/components/XExportRowsDialog.js +13 -8
  45. package/lib/components/XFieldChangeEvent.d.ts +11 -0
  46. package/lib/components/XFieldChangeEvent.js +2 -0
  47. package/lib/components/XFieldSelector.js +11 -6
  48. package/lib/components/XFormBase.d.ts +17 -8
  49. package/lib/components/XFormBase.js +127 -48
  50. package/lib/components/XFormBaseT.js +3 -1
  51. package/lib/components/XFormComponent.d.ts +19 -7
  52. package/lib/components/XFormComponent.js +89 -49
  53. package/lib/components/XFormComponentDT.d.ts +30 -0
  54. package/lib/components/XFormComponentDT.js +119 -0
  55. package/lib/components/XFormDataTable2.d.ts +53 -8
  56. package/lib/components/XFormDataTable2.js +270 -57
  57. package/lib/components/XFormFooter.js +2 -1
  58. package/lib/components/XFormNavigator3.js +18 -7
  59. package/lib/components/XHolders.js +4 -2
  60. package/lib/components/XInput.d.ts +13 -0
  61. package/lib/components/XInput.js +38 -0
  62. package/lib/components/XInputDT.d.ts +11 -0
  63. package/lib/components/XInputDT.js +37 -0
  64. package/lib/components/XInputDate.d.ts +2 -1
  65. package/lib/components/XInputDate.js +7 -4
  66. package/lib/components/XInputDateDT.js +3 -2
  67. package/lib/components/XInputDecimal.d.ts +9 -2
  68. package/lib/components/XInputDecimal.js +63 -45
  69. package/lib/components/XInputDecimalDT.d.ts +10 -8
  70. package/lib/components/XInputDecimalDT.js +59 -36
  71. package/lib/components/XInputText.d.ts +7 -11
  72. package/lib/components/XInputText.js +22 -49
  73. package/lib/components/XInputTextDT.js +4 -4
  74. package/lib/components/XInputTextarea.d.ts +18 -0
  75. package/lib/components/XInputTextarea.js +85 -0
  76. package/lib/components/XLazyDataTable.d.ts +8 -0
  77. package/lib/components/XLazyDataTable.js +187 -85
  78. package/lib/components/XLoginDialog.js +2 -1
  79. package/lib/components/XLoginForm.js +11 -6
  80. package/lib/components/XResponseError.js +4 -2
  81. package/lib/components/XSearchButton.d.ts +8 -7
  82. package/lib/components/XSearchButton.js +32 -51
  83. package/lib/components/XSearchButtonDT.js +15 -10
  84. package/lib/components/XSearchButtonOld.js +13 -8
  85. package/lib/components/XToOneAssocButton.js +2 -1
  86. package/lib/components/XUtils.d.ts +13 -1
  87. package/lib/components/XUtils.js +125 -5
  88. package/lib/components/XUtilsConversions.d.ts +1 -0
  89. package/lib/components/XUtilsConversions.js +24 -3
  90. package/lib/components/XUtilsMetadata.d.ts +4 -1
  91. package/lib/components/XUtilsMetadata.js +62 -14
  92. package/lib/components/useXToken.js +1 -1
  93. package/lib/serverApi/ExportImportParam.d.ts +3 -3
  94. package/lib/serverApi/FindParam.d.ts +12 -14
  95. package/lib/serverApi/FindParam.js +14 -0
  96. package/lib/serverApi/XUtilsCommon.d.ts +1 -0
  97. package/lib/serverApi/XUtilsCommon.js +6 -2
  98. package/package.json +24 -25
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromModel = exports.numberAsUI = exports.numberFromUI = exports.stringAsUI = exports.stringFromUI = void 0;
3
+ exports.datetimeFormatUI = exports.dateFormatCalendar = exports.dateFormatUI = exports.timeFromModel = exports.datetimeAsUI = exports.dateAsUI = exports.dateFromModel = exports.numberFromModel = exports.numberAsUI = exports.numberFromUI = exports.stringAsUI = exports.stringFromUI = void 0;
4
4
  var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
5
5
  function stringFromUI(stringValue) {
6
6
  var value;
@@ -40,6 +40,19 @@ function numberAsUI(value, fractionDigits) {
40
40
  }
41
41
  }
42
42
  exports.numberAsUI = numberAsUI;
43
+ // v modeli na klientovi by mal byt vzdy number, teraz je tam niekedy string (z json-u zo servera) a niekedy number (z komponentu)
44
+ // provizorne zatial takato konverzia
45
+ function numberFromModel(value) {
46
+ var numberValue = null;
47
+ if (typeof value === 'string') {
48
+ numberValue = parseFloat(value);
49
+ }
50
+ else if (typeof value === 'number') {
51
+ numberValue = value;
52
+ }
53
+ return numberValue;
54
+ }
55
+ exports.numberFromModel = numberFromModel;
43
56
  // v modeli na klientovi by mal byt vzdy Date, teraz je tam niekedy string (z json-u zo servera) a niekedy Date (z komponentu)
44
57
  // provizorne zatial takato konverzia
45
58
  function dateFromModel(value) {
@@ -55,7 +68,7 @@ function dateFromModel(value) {
55
68
  exports.dateFromModel = dateFromModel;
56
69
  function dateAsUI(value) {
57
70
  if (value !== null) {
58
- return XUtilsCommon_1.dateFormat(value, dateFormatUI());
71
+ return (0, XUtilsCommon_1.dateFormat)(value, dateFormatUI());
59
72
  }
60
73
  else {
61
74
  return "";
@@ -64,7 +77,7 @@ function dateAsUI(value) {
64
77
  exports.dateAsUI = dateAsUI;
65
78
  function datetimeAsUI(value) {
66
79
  if (value !== null) {
67
- return XUtilsCommon_1.dateFormat(value, datetimeFormatUI());
80
+ return (0, XUtilsCommon_1.dateFormat)(value, datetimeFormatUI());
68
81
  }
69
82
  else {
70
83
  return "";
@@ -82,6 +95,14 @@ function timeFromModel(value) {
82
95
  // mame '19:30:00' -> pridame hociaky rok aby sme skonvertovali na validny Date
83
96
  rowDataCasStr = '1970-01-01 ' + rowDataCasStr;
84
97
  }
98
+ // na safari nefunguje konverzia new Date('2021-06-07 19:30:00') - vrati NaN
99
+ // preto string prehodime na '2021-06-07T19:30:00+01:00'
100
+ // 19:30:00 je cas z timezony Central Europe (taka je nastavena na nodejs)), preto oznacime tento cas touto timezonou
101
+ // (spravne riesenie je posielat time cez json vzdy vo formate '2021-06-07T18:30:00Z', v tomto formate chodia aj datetime atributy)
102
+ rowDataCasStr = rowDataCasStr.replace(' ', 'T');
103
+ if (!rowDataCasStr.endsWith('Z') && rowDataCasStr.indexOf('+') === -1) {
104
+ rowDataCasStr += '+01:00'; // Central Europe timezone
105
+ }
85
106
  timeValue = new Date(rowDataCasStr);
86
107
  }
87
108
  else if (typeof value === 'object' && value instanceof Date) {
@@ -11,6 +11,8 @@ export declare class XUtilsMetadata {
11
11
  static getXFieldByPathStr(entity: string, path: string): XField;
12
12
  static getXAssocToOne(xEntity: XEntity, assocField: string): XAssoc;
13
13
  static getXAssocToMany(xEntity: XEntity, assocField: string): XAssoc;
14
+ static getXAssocToOneByAssocEntity(xEntity: XEntity, assocEntityName: string): XAssoc;
15
+ static getXAssocToManyByAssocEntity(xEntity: XEntity, assocEntityName: string): XAssoc;
14
16
  static getXEntityForAssocToOne(xEntity: XEntity, assocField: string): XEntity;
15
17
  static getXEntityForAssocToMany(xEntity: XEntity, assocField: string): XEntity;
16
18
  static getXFieldList(xEntity: XEntity): XField[];
@@ -22,11 +24,12 @@ export declare class XUtilsMetadata {
22
24
  size?: number;
23
25
  };
24
26
  static CHAR_SIZE: number;
25
- static computeColumnWidth(xField: XField, formColumnType: string | undefined, header: string | undefined): string | undefined;
27
+ static computeColumnWidth(xField: XField, filterMenuInFilterRow: boolean, formColumnType: string | undefined, header: string | undefined, sortableButtonInHeader: boolean, filterButtonInHeader: boolean): string | undefined;
26
28
  static computeColumnWidthBase(charSize?: number, paddingAndOther?: number): number | undefined;
27
29
  static getXBrowseMeta(entity: string, browseId?: string): XBrowseMeta;
28
30
  static setXBrowseMeta(entity: string, browseId: string | undefined, xBrowseMeta: XBrowseMeta): void;
29
31
  static getXBrowseFormMetaKey(entity: string, browseId?: string): string;
30
32
  private static getXAssoc;
33
+ private static getXAssocByAssocEntity;
31
34
  private static getXEntityForAssoc;
32
35
  }
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -109,7 +109,7 @@ var XUtilsMetadata = /** @class */ (function () {
109
109
  XUtilsMetadata.getXEntity = function (entity) {
110
110
  var xEntity = XUtilsMetadata.xEntityMap[entity];
111
111
  if (xEntity === undefined) {
112
- throw "Entity " + entity + " was not found in entity metadata";
112
+ throw "Entity ".concat(entity, " was not found in entity metadata");
113
113
  }
114
114
  return xEntity;
115
115
  };
@@ -117,7 +117,7 @@ var XUtilsMetadata = /** @class */ (function () {
117
117
  // TODO - pozor, vo fieldMap su aj asociacie, trebalo by zmenit vytvaranie metadat tak aby tam tie asociacie neboli
118
118
  var xField = xEntity.fieldMap[field];
119
119
  if (xField === undefined) {
120
- throw "Field " + field + " was not found in entity " + xEntity.name;
120
+ throw "Field ".concat(field, " was not found in entity ").concat(xEntity.name);
121
121
  }
122
122
  return xField;
123
123
  };
@@ -141,6 +141,12 @@ var XUtilsMetadata = /** @class */ (function () {
141
141
  XUtilsMetadata.getXAssocToMany = function (xEntity, assocField) {
142
142
  return XUtilsMetadata.getXAssoc(xEntity, xEntity.assocToManyMap, assocField);
143
143
  };
144
+ XUtilsMetadata.getXAssocToOneByAssocEntity = function (xEntity, assocEntityName) {
145
+ return XUtilsMetadata.getXAssocByAssocEntity(xEntity, xEntity.assocToOneMap, assocEntityName);
146
+ };
147
+ XUtilsMetadata.getXAssocToManyByAssocEntity = function (xEntity, assocEntityName) {
148
+ return XUtilsMetadata.getXAssocByAssocEntity(xEntity, xEntity.assocToManyMap, assocEntityName);
149
+ };
144
150
  XUtilsMetadata.getXEntityForAssocToOne = function (xEntity, assocField) {
145
151
  return XUtilsMetadata.getXEntityForAssoc(XUtilsMetadata.getXAssocToOne(xEntity, assocField));
146
152
  };
@@ -192,7 +198,7 @@ var XUtilsMetadata = /** @class */ (function () {
192
198
  size = precision;
193
199
  }
194
200
  else {
195
- throw "XInputDecimal: field " + xField.name + " has unsupported type " + xField.type + ". Supported types are decimal and number.";
201
+ throw "XInputDecimal: field ".concat(xField.name, " has unsupported type ").concat(xField.type, ". Supported types are decimal and number.");
196
202
  }
197
203
  var min = undefined;
198
204
  var max = undefined;
@@ -203,7 +209,7 @@ var XUtilsMetadata = /** @class */ (function () {
203
209
  }
204
210
  return { useGrouping: useGrouping, fractionDigits: fractionDigits, min: min, max: max, size: size };
205
211
  };
206
- XUtilsMetadata.computeColumnWidth = function (xField, formColumnType, header) {
212
+ XUtilsMetadata.computeColumnWidth = function (xField, filterMenuInFilterRow, formColumnType, header, sortableButtonInHeader, filterButtonInHeader) {
207
213
  var width;
208
214
  if (formColumnType === undefined) {
209
215
  // lazy datatable (no inputs, no buttons, only text and padding)
@@ -224,7 +230,7 @@ var XUtilsMetadata = /** @class */ (function () {
224
230
  width = 1.43 + 0.5 + 0.5; // checkbox ma sirku 20px
225
231
  }
226
232
  else {
227
- throw "XField " + xField.name + ": unknown xField.type = " + xField.type;
233
+ throw "XField ".concat(xField.name, ": unknown xField.type = ").concat(xField.type);
228
234
  }
229
235
  }
230
236
  else {
@@ -248,10 +254,10 @@ var XUtilsMetadata = /** @class */ (function () {
248
254
  width = 1.43 + 0.5 + 0.5; // checkbox ma sirku 20px
249
255
  }
250
256
  else {
251
- throw "XField " + xField.name + ": unknown xField.type = " + xField.type;
257
+ throw "XField ".concat(xField.name, ": unknown xField.type = ").concat(xField.type);
252
258
  }
253
259
  }
254
- else if (formColumnType === "dropdown" || formColumnType === "searchButton" || formColumnType === "autoComplete") {
260
+ else if (formColumnType === "dropdown" || formColumnType === "autoComplete" || formColumnType === "searchButton") {
255
261
  // vyratame sirku inputu
256
262
  var padding = 0.21 + 0.07 + 0.5; // padding is 2.94px + 1px border + 7px padding in input
257
263
  if (xField.type === "string") {
@@ -268,7 +274,7 @@ var XUtilsMetadata = /** @class */ (function () {
268
274
  width = XUtilsMetadata.computeColumnWidthBase(10 + 9, padding + padding); // napr. 31.12.2021 03:03:00
269
275
  }
270
276
  else {
271
- throw "XField " + xField.name + ": xField.type = " + xField.type + " not implemented for dropdown/searchButton/autoComplete";
277
+ throw "XField ".concat(xField.name, ": xField.type = ").concat(xField.type, " not implemented for dropdown/autoComplete/searchButton");
272
278
  }
273
279
  // pridame sirku buttonu
274
280
  if (formColumnType === "dropdown") {
@@ -276,22 +282,36 @@ var XUtilsMetadata = /** @class */ (function () {
276
282
  width += 2; // button for dropdown
277
283
  }
278
284
  }
285
+ else if (formColumnType === "autoComplete") {
286
+ if (width !== undefined) {
287
+ width += 1.56; // button for auto complete
288
+ }
289
+ }
279
290
  else if (formColumnType === "searchButton") {
280
291
  if (width !== undefined) {
281
292
  width += 2.18; // button for search button
282
293
  }
283
294
  }
284
- else if (formColumnType === "autoComplete") {
285
- throw "XField " + xField.name + ": computing button width not implemented for autoComplete";
286
- }
287
295
  }
288
296
  else {
289
297
  throw "Unknown prop type = " + formColumnType;
290
298
  }
291
299
  }
300
+ if (filterMenuInFilterRow) {
301
+ // if the column has width of 25 characters or more, then the input field can be shorter
302
+ if (width !== undefined && width < 25 * XUtilsMetadata.CHAR_SIZE) {
303
+ width += 1.25; // filter menu icon
304
+ }
305
+ }
292
306
  // ak je label dlhsi ako sirka stlpca, tak sirka stlpca bude podla label-u
293
307
  if (header !== undefined) {
294
- var widthHeader = XUtilsMetadata.computeColumnWidthBase(header.length, 0.5 + 0.5 + 1.28 + 0.5); // padding (7px) + space (7px) + sort icon (18px) + padding (7px)
308
+ var widthHeader = XUtilsMetadata.computeColumnWidthBase(header.length, 0.5); // padding (7px)
309
+ if (sortableButtonInHeader && widthHeader !== undefined) {
310
+ widthHeader += 0.5 + 1.28; // sort icon (25px = 7px (space/margin) + 18px (icon body))
311
+ }
312
+ if (filterButtonInHeader && widthHeader !== undefined) {
313
+ widthHeader += 1.5; // filter icon (21px = 14px (icon body) + 7px (right padding))
314
+ }
295
315
  if (widthHeader !== undefined) {
296
316
  if (width === undefined || widthHeader > width) {
297
317
  width = widthHeader;
@@ -329,10 +349,38 @@ var XUtilsMetadata = /** @class */ (function () {
329
349
  XUtilsMetadata.getXAssoc = function (xEntity, assocMap, assocField) {
330
350
  var xAssoc = assocMap[assocField];
331
351
  if (xAssoc === undefined) {
332
- throw "Assoc " + assocField + " was not found in entity = " + xEntity.name;
352
+ throw "Assoc ".concat(assocField, " was not found in entity = ").concat(xEntity.name);
333
353
  }
334
354
  return xAssoc;
335
355
  };
356
+ XUtilsMetadata.getXAssocByAssocEntity = function (xEntity, assocMap, assocEntityName) {
357
+ var e_2, _a;
358
+ var xAssocFound = undefined;
359
+ try {
360
+ for (var _b = __values(Object.entries(assocMap)), _c = _b.next(); !_c.done; _c = _b.next()) {
361
+ var _d = __read(_c.value, 2), key = _d[0], xAssoc = _d[1];
362
+ if (xAssoc.entityName === assocEntityName) {
363
+ if (xAssocFound === undefined) {
364
+ xAssocFound = xAssoc;
365
+ }
366
+ else {
367
+ throw "In entity ".concat(xEntity.name, " found more then 1 assoc for assocEntityName = ").concat(assocEntityName);
368
+ }
369
+ }
370
+ }
371
+ }
372
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
373
+ finally {
374
+ try {
375
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
376
+ }
377
+ finally { if (e_2) throw e_2.error; }
378
+ }
379
+ if (xAssocFound === undefined) {
380
+ throw "Assoc for assocEntityName = ".concat(assocEntityName, " not found in entity ").concat(xEntity.name);
381
+ }
382
+ return xAssocFound;
383
+ };
336
384
  XUtilsMetadata.getXEntityForAssoc = function (xAssoc) {
337
385
  return XUtilsMetadata.getXEntity(xAssoc.entityName);
338
386
  };
@@ -27,7 +27,7 @@ function useXToken() {
27
27
  }
28
28
  return xToken;
29
29
  };
30
- var _a = __read(react_1.useState(getXToken()), 2), xToken = _a[0], setXToken = _a[1];
30
+ var _a = __read((0, react_1.useState)(getXToken()), 2), xToken = _a[0], setXToken = _a[1];
31
31
  XUtils_1.XUtils.setXToken(xToken);
32
32
  var saveXToken = function (xToken) {
33
33
  if (xToken !== null) {
@@ -1,12 +1,12 @@
1
- import { Filters, SortMeta } from "./FindParam";
1
+ import { DataTableFilterMeta, DataTableSortMeta } from "primereact/datatable";
2
2
  export declare enum ExportType {
3
3
  Csv = "csv",
4
4
  Json = "json"
5
5
  }
6
6
  export interface ExportParam {
7
7
  exportType: ExportType;
8
- filters: Filters;
9
- multiSortMeta?: SortMeta[];
8
+ filters: DataTableFilterMeta;
9
+ multiSortMeta?: DataTableSortMeta[];
10
10
  entity: string;
11
11
  fields: string[];
12
12
  csvParam?: CsvParam;
@@ -1,25 +1,23 @@
1
- export interface FilterValue {
2
- value: string;
3
- matchMode: 'startsWith' | 'equals';
4
- }
5
- export interface Filters {
6
- [field: string]: FilterValue;
7
- }
8
- export interface SortMeta {
9
- field: string;
10
- order: 1 | -1;
11
- }
1
+ import { DataTableFilterMeta, DataTableSortMeta } from "primereact/datatable";
12
2
  export declare enum ResultType {
13
3
  OnlyRowCount = 0,
14
4
  RowCountAndPagedRows = 1,
15
5
  AllRows = 2
16
6
  }
7
+ export interface XCustomFilterValues {
8
+ [key: string]: any;
9
+ }
10
+ export interface XCustomFilter {
11
+ filter: string;
12
+ values: XCustomFilterValues;
13
+ }
17
14
  export interface FindParam {
18
15
  resultType: ResultType;
19
16
  first?: number;
20
17
  rows?: number;
21
- filters: Filters;
22
- multiSortMeta?: SortMeta[];
18
+ filters?: DataTableFilterMeta;
19
+ customFilter?: XCustomFilter;
20
+ multiSortMeta?: DataTableSortMeta[];
23
21
  entity: string;
24
- fields: string[];
22
+ fields?: string[];
25
23
  }
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResultType = void 0;
4
+ // TODO - replaced with DataTableFilterMetaData
5
+ // export interface FilterValue {
6
+ // value : string;
7
+ // matchMode : 'startsWith' | 'equals'; // matchMode ma konstanty napr. startsWith
8
+ // }
9
+ // TODO - replaced with DataTableFilterMeta
10
+ // export interface Filters {
11
+ // [field: string]: FilterValue; // specialny typ pre object (dictionary) ktory ma dynamicky pocet propertiesov
12
+ // }
13
+ // TODO - replace with DataTableSortMeta
14
+ // export interface SortMeta {
15
+ // field : string;
16
+ // order : 1 | -1; // hodnoty 1 alebo -1
17
+ // }
4
18
  var ResultType;
5
19
  (function (ResultType) {
6
20
  ResultType[ResultType["OnlyRowCount"] = 0] = "OnlyRowCount";
@@ -7,5 +7,6 @@ export declare class XUtilsCommon {
7
7
  static objectAsJSON(value: any): string;
8
8
  static getDayName(date: Date | null | undefined): string | undefined;
9
9
  static dateAddDays(date: Date | null, days: number): Date | null;
10
+ static findFirstMatch(pattern: RegExp, value: string): string | null;
10
11
  }
11
12
  export declare const dateFormat: any;
@@ -64,11 +64,11 @@ var XUtilsCommon = /** @class */ (function () {
64
64
  // TODO - ak pre datetime nastavime vsetky zlozky casu na 00:00:00, tak sformatuje hodnotu ako datum a spravi chybu pri zapise do DB - zapise 1:00:00
65
65
  var dateStr;
66
66
  if (this.getHours() === 0 && this.getMinutes() === 0 && this.getSeconds() === 0) {
67
- dateStr = exports.dateFormat(this, 'yyyy-mm-dd');
67
+ dateStr = (0, exports.dateFormat)(this, 'yyyy-mm-dd');
68
68
  }
69
69
  else {
70
70
  // jedna sa o datetime
71
- dateStr = exports.dateFormat(this, 'yyyy-mm-dd HH:MM:ss');
71
+ dateStr = (0, exports.dateFormat)(this, 'yyyy-mm-dd HH:MM:ss');
72
72
  }
73
73
  return dateStr;
74
74
  };
@@ -89,6 +89,10 @@ var XUtilsCommon = /** @class */ (function () {
89
89
  }
90
90
  return result;
91
91
  };
92
+ XUtilsCommon.findFirstMatch = function (pattern, value) {
93
+ var match = pattern.exec(value);
94
+ return match != null ? match[0] : null;
95
+ };
92
96
  XUtilsCommon.newLine = '\n';
93
97
  return XUtilsCommon;
94
98
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michalrakus/x-react-web-lib",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "clean": "rimraf lib",
@@ -18,33 +18,32 @@
18
18
  "preinstall": "npx only-allow pnpm"
19
19
  },
20
20
  "author": "Michal Rakus",
21
- "license": "ISC",
22
- "dependencies": {},
21
+ "license": "MIT",
22
+ "dependencies": {
23
+ "dateformat": "^4.6.3",
24
+ "lodash": "^4.17.21"
25
+ },
23
26
  "devDependencies": {
24
- "@testing-library/jest-dom": "^4.2.4",
25
- "@testing-library/react": "^9.5.0",
26
- "@testing-library/user-event": "^7.2.1",
27
- "@types/classnames": "^2.2.10",
28
- "@types/jest": "^24.9.1",
29
- "@types/lodash": "^4.14.168",
30
- "@types/node": "^12.12.67",
31
- "@types/react": "^17.0.5",
32
- "@types/react-dom": "^17.0.5",
33
- "@types/react-transition-group": "^4.2.4",
34
- "axios": "^0.19.0",
35
- "classnames": "^2.2.6",
27
+ "@testing-library/jest-dom": "^5.16.5",
28
+ "@testing-library/react": "^14.0.0",
29
+ "@testing-library/user-event": "^14.4.3",
30
+ "@types/jest": "^29.5.0",
31
+ "@types/lodash": "^4.14.191",
32
+ "@types/node": "^18.15.3",
33
+ "@types/react": "^18.0.28",
34
+ "@types/react-dom": "^18.0.11",
35
+ "@types/react-transition-group": "^4.4.5",
36
+ "gulp": "^4.0.2",
37
+ "rimraf": "^4.4.0",
38
+ "typescript": "^4.9.5"
39
+ },
40
+ "peerDependencies": {
36
41
  "primeflex": "^3.3.0",
37
42
  "primeicons": "^6.0.1",
38
- "primereact": "6.0.2",
39
- "lodash": "^4.17.21",
40
- "react": "^17.0.1",
41
- "react-dom": "^17.0.1",
42
- "react-scripts": "3.4.3",
43
- "react-transition-group": "^4.4.1",
44
- "gulp": "^4.0.2",
45
- "rimraf": "^3.0.2",
46
- "typescript": "^3.2.1",
47
- "dateformat": "^4.4.1"
43
+ "primereact": "~9.2.1",
44
+ "react": "^18.2.0",
45
+ "react-dom": "^18.2.0",
46
+ "react-transition-group": "^4.4.5"
48
47
  },
49
48
  "files": [
50
49
  "lib/**/*",