@michalrakus/x-react-web-lib 1.12.0 → 1.13.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 (44) hide show
  1. package/XUtilsConversions.d.ts +1 -1
  2. package/XUtilsConversions.js +1 -1
  3. package/XUtilsMetadataCommon.d.ts +3 -0
  4. package/XUtilsMetadataCommon.js +5 -0
  5. package/gulpfile.js +3 -2
  6. package/lib/components/XAutoComplete.d.ts +3 -1
  7. package/lib/components/XAutoComplete.js +14 -8
  8. package/lib/components/XAutoCompleteBase.d.ts +4 -0
  9. package/lib/components/XAutoCompleteBase.js +33 -2
  10. package/lib/components/XAutoCompleteDT.js +4 -4
  11. package/lib/components/XCalendar.js +1 -1
  12. package/lib/components/XDropdown.js +2 -2
  13. package/lib/components/XDropdownDT.js +4 -4
  14. package/lib/components/XDropdownDTFilter.js +2 -2
  15. package/lib/components/XDropdownForEntity.js +2 -2
  16. package/lib/components/XEditBrowse.js +4 -3
  17. package/lib/components/XExportRowsDialog.js +1 -1
  18. package/lib/components/XFieldSelector.js +4 -4
  19. package/lib/components/XFormDataTable2.js +13 -12
  20. package/lib/components/XFtsInput.js +1 -1
  21. package/lib/components/XInput.js +2 -2
  22. package/lib/components/XInputDT.js +2 -2
  23. package/lib/components/XInputDateDT.js +1 -1
  24. package/lib/components/XInputFileList.js +6 -6
  25. package/lib/components/XInputIntervalBase.js +1 -1
  26. package/lib/components/XInputText.js +1 -1
  27. package/lib/components/XInputTextDT.js +3 -3
  28. package/lib/components/XInputTextarea.js +1 -1
  29. package/lib/components/XLazyDataTable.d.ts +9 -0
  30. package/lib/components/XLazyDataTable.js +21 -43
  31. package/lib/components/XSearchButton.js +4 -4
  32. package/lib/components/XSearchButtonDT.js +3 -3
  33. package/lib/components/XSearchButtonOld.js +5 -5
  34. package/lib/components/XToOneAssocButton.js +3 -3
  35. package/lib/components/XUtils.js +2 -1
  36. package/lib/components/XUtilsMetadata.d.ts +1 -19
  37. package/lib/components/XUtilsMetadata.js +8 -186
  38. package/lib/components/locale/x-en.json +4 -1
  39. package/lib/{components → serverApi}/XUtilsConversions.d.ts +18 -1
  40. package/lib/serverApi/XUtilsConversions.js +330 -0
  41. package/lib/serverApi/XUtilsMetadataCommon.d.ts +30 -0
  42. package/lib/serverApi/XUtilsMetadataCommon.js +208 -0
  43. package/package.json +2 -2
  44. package/lib/components/XUtilsConversions.js +0 -177
@@ -1,177 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.intervalAsUI = exports.intervalFromUI = 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
- var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
5
- function stringFromUI(stringValue) {
6
- var value;
7
- if (stringValue === '') {
8
- value = null;
9
- }
10
- else {
11
- value = stringValue;
12
- }
13
- return value;
14
- }
15
- exports.stringFromUI = stringFromUI;
16
- function stringAsUI(value) {
17
- return value !== null ? value : "";
18
- }
19
- exports.stringAsUI = stringAsUI;
20
- function numberFromUI(stringValue) {
21
- var value;
22
- if (stringValue === '') {
23
- value = null;
24
- }
25
- else {
26
- value = parseInt(stringValue, 10);
27
- }
28
- return value;
29
- }
30
- exports.numberFromUI = numberFromUI;
31
- function numberAsUI(value, fractionDigits) {
32
- if (fractionDigits === undefined) {
33
- fractionDigits = 2; // default
34
- }
35
- if (value !== null) {
36
- return value.toLocaleString('de-DE', { style: 'decimal', minimumFractionDigits: fractionDigits, maximumFractionDigits: fractionDigits });
37
- }
38
- else {
39
- return "";
40
- }
41
- }
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;
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)
57
- // provizorne zatial takato konverzia
58
- function dateFromModel(value) {
59
- var dateValue = null;
60
- if (typeof value === 'string') {
61
- dateValue = new Date(value);
62
- }
63
- else if (typeof value === 'object' && value instanceof Date) {
64
- dateValue = value;
65
- }
66
- return dateValue;
67
- }
68
- exports.dateFromModel = dateFromModel;
69
- function dateAsUI(value) {
70
- if (value !== null) {
71
- return (0, XUtilsCommon_1.dateFormat)(value, dateFormatUI());
72
- }
73
- else {
74
- return "";
75
- }
76
- }
77
- exports.dateAsUI = dateAsUI;
78
- function datetimeAsUI(value) {
79
- if (value !== null) {
80
- return (0, XUtilsCommon_1.dateFormat)(value, datetimeFormatUI());
81
- }
82
- else {
83
- return "";
84
- }
85
- }
86
- exports.datetimeAsUI = datetimeAsUI;
87
- // provizorne zatial takato konverzia
88
- function timeFromModel(value) {
89
- var timeValue = null;
90
- if (typeof value === 'string') {
91
- // ak prichadza cas priamo z databazy, pride '19:30:00'
92
- // ak prichadza reloadnuty objekt (napr. cez webservis saveRow), pride '2021-06-07 19:30:00'
93
- var rowDataCasStr = value;
94
- if (rowDataCasStr.length < 10) {
95
- // mame '19:30:00' -> pridame hociaky rok aby sme skonvertovali na validny Date
96
- rowDataCasStr = '1970-01-01 ' + rowDataCasStr;
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
- }
106
- timeValue = new Date(rowDataCasStr);
107
- }
108
- else if (typeof value === 'object' && value instanceof Date) {
109
- timeValue = value;
110
- }
111
- return timeValue;
112
- }
113
- exports.timeFromModel = timeFromModel;
114
- function dateFormatUI() {
115
- return "dd.mm.yyyy";
116
- }
117
- exports.dateFormatUI = dateFormatUI;
118
- function dateFormatCalendar() {
119
- return "dd.mm.yy";
120
- }
121
- exports.dateFormatCalendar = dateFormatCalendar;
122
- function datetimeFormatUI() {
123
- return "dd.mm.yyyy HH:MM:ss";
124
- }
125
- exports.datetimeFormatUI = datetimeFormatUI;
126
- function intervalFromUI(valueString) {
127
- // convert e.target.value (e.g. 10:29) into IPostgresInterval (e.g. {hours: 10, minutes: 29})
128
- // if stringValue is invalid, returns undefined
129
- var valueInterval = undefined;
130
- if (valueString === '') {
131
- valueInterval = null;
132
- }
133
- else {
134
- var posColon = valueString.indexOf(':');
135
- if (posColon === -1) {
136
- var minutes = parseInt(valueString);
137
- if (!isNaN(minutes)) {
138
- var hours = Math.floor(minutes / 60);
139
- minutes = minutes - (hours * 60);
140
- valueInterval = { hours: hours, minutes: minutes };
141
- }
142
- }
143
- else {
144
- var hours = parseInt(valueString.substring(0, posColon));
145
- var minutes = parseInt(valueString.substring(posColon + 1));
146
- if (!isNaN(hours) && !isNaN(minutes)) {
147
- if (minutes >= 60) {
148
- var hoursFromMinutes = Math.floor(minutes / 60);
149
- hours += hoursFromMinutes;
150
- minutes = minutes - (hoursFromMinutes * 60);
151
- }
152
- valueInterval = { hours: hours, minutes: minutes };
153
- }
154
- }
155
- }
156
- return valueInterval;
157
- }
158
- exports.intervalFromUI = intervalFromUI;
159
- function intervalAsUI(valueInterval) {
160
- var _a, _b;
161
- // conversion e.g. {hours: 10, minutes: 29} => '10:29'
162
- var valueString;
163
- if (valueInterval !== null) {
164
- var hours = (_a = valueInterval.hours) !== null && _a !== void 0 ? _a : 0;
165
- var minutes = (_b = valueInterval.minutes) !== null && _b !== void 0 ? _b : 0;
166
- //const seconds: number = value.seconds ?? 0;
167
- if (valueInterval.days) {
168
- hours += valueInterval.days * 24;
169
- }
170
- valueString = "".concat(hours.toString(), ":").concat(minutes.toString().padStart(2, '0'));
171
- }
172
- else {
173
- valueString = ''; // null
174
- }
175
- return valueString;
176
- }
177
- exports.intervalAsUI = intervalAsUI;