@michalrakus/x-react-web-lib 1.7.3 → 1.9.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 (152) hide show
  1. package/README.md +3 -3
  2. package/gulpfile.js +82 -82
  3. package/lib/administration/XBrowseMetaBrowse.d.ts +2 -2
  4. package/lib/administration/XBrowseMetaBrowse.js +21 -21
  5. package/lib/administration/XBrowseMetaForm.d.ts +5 -5
  6. package/lib/administration/XBrowseMetaForm.js +63 -63
  7. package/lib/administration/XUserBrowse.d.ts +2 -2
  8. package/lib/administration/XUserBrowse.js +88 -87
  9. package/lib/administration/XUserForm.d.ts +9 -9
  10. package/lib/administration/XUserForm.js +195 -194
  11. package/lib/components/SearchTableParams.d.ts +11 -11
  12. package/lib/components/SearchTableParams.js +2 -2
  13. package/lib/components/SourceCodeLinkEntity.d.ts +4 -4
  14. package/lib/components/SourceCodeLinkEntity.js +14 -14
  15. package/lib/components/XAutoComplete.d.ts +36 -36
  16. package/lib/components/XAutoComplete.js +155 -155
  17. package/lib/components/XAutoCompleteBase.d.ts +45 -45
  18. package/lib/components/XAutoCompleteBase.js +371 -371
  19. package/lib/components/XAutoCompleteDT.d.ts +33 -33
  20. package/lib/components/XAutoCompleteDT.js +140 -140
  21. package/lib/components/XBrowse.d.ts +33 -33
  22. package/lib/components/XBrowse.js +360 -360
  23. package/lib/components/XButton.d.ts +9 -9
  24. package/lib/components/XButton.js +13 -13
  25. package/lib/components/XButtonIconMedium.d.ts +9 -9
  26. package/lib/components/XButtonIconMedium.js +13 -13
  27. package/lib/components/XButtonIconNarrow.d.ts +10 -10
  28. package/lib/components/XButtonIconNarrow.js +25 -25
  29. package/lib/components/XButtonIconSmall.d.ts +9 -9
  30. package/lib/components/XButtonIconSmall.js +13 -13
  31. package/lib/components/XCalendar.d.ts +8 -8
  32. package/lib/components/XCalendar.js +27 -27
  33. package/lib/components/XChangePasswordForm.d.ts +5 -5
  34. package/lib/components/XChangePasswordForm.js +160 -160
  35. package/lib/components/XCheckbox.d.ts +8 -8
  36. package/lib/components/XCheckbox.js +57 -57
  37. package/lib/components/XCheckboxDT.d.ts +10 -10
  38. package/lib/components/XCheckboxDT.js +46 -46
  39. package/lib/components/XDataTable.d.ts +11 -11
  40. package/lib/components/XDataTable.js +197 -197
  41. package/lib/components/XDropdown.d.ts +18 -18
  42. package/lib/components/XDropdown.js +57 -57
  43. package/lib/components/XDropdownDT.d.ts +13 -13
  44. package/lib/components/XDropdownDT.js +128 -128
  45. package/lib/components/XDropdownDTFilter.d.ts +7 -7
  46. package/lib/components/XDropdownDTFilter.js +121 -121
  47. package/lib/components/XDropdownForEntity.d.ts +25 -25
  48. package/lib/components/XDropdownForEntity.js +149 -149
  49. package/lib/components/XDropdownFormDTFilter.d.ts +7 -7
  50. package/lib/components/XDropdownFormDTFilter.js +121 -121
  51. package/lib/components/XEditColumnDialog.d.ts +13 -13
  52. package/lib/components/XEditColumnDialog.js +112 -112
  53. package/lib/components/XEnvVars.d.ts +15 -12
  54. package/lib/components/XEnvVars.js +23 -20
  55. package/lib/components/XErrors.d.ts +12 -12
  56. package/lib/components/XErrors.js +2 -2
  57. package/lib/components/XExportRowsDialog.d.ts +15 -15
  58. package/lib/components/XExportRowsDialog.js +184 -184
  59. package/lib/components/XFieldChangeEvent.d.ts +11 -11
  60. package/lib/components/XFieldChangeEvent.js +2 -2
  61. package/lib/components/XFieldSelector.d.ts +7 -7
  62. package/lib/components/XFieldSelector.js +113 -113
  63. package/lib/components/XFormBase.d.ts +59 -59
  64. package/lib/components/XFormBase.js +526 -526
  65. package/lib/components/XFormBaseModif.d.ts +5 -5
  66. package/lib/components/XFormBaseModif.js +33 -33
  67. package/lib/components/XFormBaseT.d.ts +4 -4
  68. package/lib/components/XFormBaseT.js +31 -31
  69. package/lib/components/XFormComponent.d.ts +40 -40
  70. package/lib/components/XFormComponent.js +177 -177
  71. package/lib/components/XFormComponentDT.d.ts +30 -30
  72. package/lib/components/XFormComponentDT.js +145 -145
  73. package/lib/components/XFormDataTable2.d.ts +143 -143
  74. package/lib/components/XFormDataTable2.js +686 -686
  75. package/lib/components/XFormFooter.d.ts +6 -6
  76. package/lib/components/XFormFooter.js +19 -19
  77. package/lib/components/XFormNavigator3.d.ts +12 -12
  78. package/lib/components/XFormNavigator3.js +130 -130
  79. package/lib/components/XHolders.d.ts +7 -7
  80. package/lib/components/XHolders.js +15 -15
  81. package/lib/components/XInput.d.ts +13 -13
  82. package/lib/components/XInput.js +38 -38
  83. package/lib/components/XInputDT.d.ts +11 -11
  84. package/lib/components/XInputDT.js +37 -37
  85. package/lib/components/XInputDate.d.ts +13 -13
  86. package/lib/components/XInputDate.js +63 -63
  87. package/lib/components/XInputDateDT.d.ts +10 -10
  88. package/lib/components/XInputDateDT.js +55 -55
  89. package/lib/components/XInputDecimal.d.ts +15 -15
  90. package/lib/components/XInputDecimal.js +78 -78
  91. package/lib/components/XInputDecimalBase.d.ts +12 -12
  92. package/lib/components/XInputDecimalBase.js +18 -18
  93. package/lib/components/XInputDecimalDT.d.ts +11 -11
  94. package/lib/components/XInputDecimalDT.js +74 -74
  95. package/lib/components/XInputFileList.d.ts +36 -36
  96. package/lib/components/XInputFileList.js +251 -244
  97. package/lib/components/XInputText.d.ts +12 -12
  98. package/lib/components/XInputText.js +69 -69
  99. package/lib/components/XInputTextDT.d.ts +9 -9
  100. package/lib/components/XInputTextDT.js +42 -42
  101. package/lib/components/XInputTextarea.d.ts +18 -18
  102. package/lib/components/XInputTextarea.js +85 -85
  103. package/lib/components/XLazyDataTable.d.ts +78 -78
  104. package/lib/components/XLazyDataTable.js +885 -885
  105. package/lib/components/XLocale.d.ts +26 -26
  106. package/lib/components/XLocale.js +59 -59
  107. package/lib/components/XLoginDialog.d.ts +8 -8
  108. package/lib/components/XLoginDialog.js +21 -21
  109. package/lib/components/XLoginForm.d.ts +7 -7
  110. package/lib/components/XLoginForm.js +128 -128
  111. package/lib/components/XObject.d.ts +3 -3
  112. package/lib/components/XObject.js +2 -2
  113. package/lib/components/XResponseError.d.ts +11 -11
  114. package/lib/components/XResponseError.js +32 -32
  115. package/lib/components/XSearchButton.d.ts +26 -26
  116. package/lib/components/XSearchButton.js +225 -225
  117. package/lib/components/XSearchButtonDT.d.ts +12 -12
  118. package/lib/components/XSearchButtonDT.js +188 -188
  119. package/lib/components/XSearchButtonOld.d.ts +13 -13
  120. package/lib/components/XSearchButtonOld.js +212 -212
  121. package/lib/components/XToOneAssocButton.d.ts +8 -8
  122. package/lib/components/XToOneAssocButton.js +30 -30
  123. package/lib/components/XToken.d.ts +6 -6
  124. package/lib/components/XToken.js +2 -2
  125. package/lib/components/XUtils.d.ts +74 -74
  126. package/lib/components/XUtils.js +627 -627
  127. package/lib/components/XUtilsConversions.d.ts +12 -12
  128. package/lib/components/XUtilsConversions.js +125 -125
  129. package/lib/components/XUtilsMetadata.d.ts +39 -39
  130. package/lib/components/XUtilsMetadata.js +452 -452
  131. package/lib/components/locale/x-en.json +26 -26
  132. package/lib/components/useXToken.d.ts +2 -2
  133. package/lib/components/useXToken.js +44 -44
  134. package/lib/serverApi/ExportImportParam.d.ts +51 -51
  135. package/lib/serverApi/ExportImportParam.js +34 -34
  136. package/lib/serverApi/FindParam.d.ts +34 -34
  137. package/lib/serverApi/FindParam.js +30 -30
  138. package/lib/serverApi/FindResult.d.ts +8 -8
  139. package/lib/serverApi/FindResult.js +2 -2
  140. package/lib/serverApi/XBrowseMetadata.d.ts +19 -19
  141. package/lib/serverApi/XBrowseMetadata.js +2 -2
  142. package/lib/serverApi/XEntityMetadata.d.ts +35 -35
  143. package/lib/serverApi/XEntityMetadata.js +2 -2
  144. package/lib/serverApi/XFileJsonField.d.ts +6 -0
  145. package/lib/serverApi/XFileJsonField.js +2 -0
  146. package/lib/serverApi/XUser.d.ts +8 -7
  147. package/lib/serverApi/XUser.js +2 -2
  148. package/lib/serverApi/XUserAuthenticationIfc.d.ts +9 -9
  149. package/lib/serverApi/XUserAuthenticationIfc.js +2 -2
  150. package/lib/serverApi/XUtilsCommon.d.ts +13 -13
  151. package/lib/serverApi/XUtilsCommon.js +110 -110
  152. package/package.json +1 -1
@@ -1,128 +1,128 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- 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;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.XDropdownDT = void 0;
63
- var react_1 = __importStar(require("react"));
64
- var XUtils_1 = require("./XUtils");
65
- var dropdown_1 = require("primereact/dropdown");
66
- var XDropdownDT = function (props) {
67
- // poznamka: nacitanie/ulozenie options je vytiahnute do parent komponentu XFormDataTable koli tomu aby sme nenacitavali options pre kazdy riadok tabulky
68
- // parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
69
- (0, react_1.useEffect)(function () {
70
- //console.log("XDropdownDT - zavolany useEffect *******************")
71
- findOptions();
72
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
73
- var findOptions = function () { return __awaiter(void 0, void 0, void 0, function () {
74
- var options;
75
- return __generator(this, function (_a) {
76
- switch (_a.label) {
77
- case 0:
78
- options = props.dropdownOptionsMap[props.assocField];
79
- if (!(options === undefined)) return [3 /*break*/, 2];
80
- // nacitavanie som dal sem, lebo sa bojim ze ak by som ho dal mimo useEffect (napr. priamo do funkcie bodyTemplate), tak by som koli Promise odsunul vytvaranie komponentov na iny cas a asi by to nebolo dobre
81
- // Toto je trosku hack - zapisanim prazdneho pola si oznacime, ze ideme nacitat options z DB (stane sa to pri prvom riadku tabulky).
82
- // Ked potom tento kod zbieha pre dalsie riadky tabulky, tak najdu v props.dropdownOptionsMap[props.assocField] prazdne pole (nie undefined) a uz nevyvolavaju nacitavanie z DB.
83
- // Nacitanie z DB sa koli asynchronnosti vykona az po zavolani tejto metody pre vsetky riadky tabulky, co je pre nas neskoro.
84
- // ak by tu tento riadok nebol, tak by sa options nacitavali tolkokrat, kolko je riadkov v tabulke
85
- props.dropdownOptionsMap[props.assocField] = [];
86
- return [4 /*yield*/, XUtils_1.XUtils.fetchMany('findRowsForAssoc', { entity: props.entity, assocField: props.assocField })];
87
- case 1:
88
- options = _a.sent();
89
- options.splice(0, 0, {}); // null polozka (nepridavat pre not null atributy)
90
- props.dropdownOptionsMap[props.assocField] = options;
91
- //console.log("XDropdownDT - findOptions - citali sme options pre field = " + props.assocField);
92
- //console.log(props.dropdownOptionsMap);
93
- props.onDropdownOptionsMapChange(props.dropdownOptionsMap); // vyrenderujeme nacitane hodnoty
94
- _a.label = 2;
95
- case 2: return [2 /*return*/];
96
- }
97
- });
98
- }); };
99
- var readOnly = props.readOnly !== undefined ? props.readOnly : false;
100
- var onValueChange = function (assocField, rowData, newValue) {
101
- // zmenime hodnotu v modeli (odtial sa hodnota cita)
102
- var newValueOrNull;
103
- // specialna null polozka nema ziadne atributy
104
- if (Object.keys(newValue).length === 0) {
105
- newValueOrNull = null;
106
- }
107
- else {
108
- newValueOrNull = newValue;
109
- }
110
- rowData[assocField] = newValueOrNull;
111
- // kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
112
- props.form.onObjectDataChange();
113
- };
114
- // TODO - readOnly implementovat
115
- // Dropdown setuje do atributu object.assocField asociovany objekt zo zoznamu objektov ktore ziskame podla asociacie
116
- var assocObject = null;
117
- if (props.rowData !== null) {
118
- assocObject = props.rowData[props.assocField];
119
- // pri inserte noveho riadku su (zatial) vsetky fieldy undefined, dame na null, null je standard
120
- if (assocObject === undefined) {
121
- assocObject = null;
122
- }
123
- }
124
- var options = props.dropdownOptionsMap[props.assocField] !== undefined ? props.dropdownOptionsMap[props.assocField] : []; // mozno mozme do options prasknut rovno undefined...
125
- // appendTo={document.body} appenduje overlay panel na element body - eliminuje problem s overflow (pozri poznamku v XDropdownDTFilter)
126
- return (react_1.default.createElement(dropdown_1.Dropdown, { appendTo: document.body, id: props.assocField, optionLabel: props.displayField, value: assocObject, options: options, onChange: function (e) { return onValueChange(props.assocField, props.rowData, e.target.value); } }));
127
- };
128
- exports.XDropdownDT = XDropdownDT;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ 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;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ exports.XDropdownDT = void 0;
63
+ var react_1 = __importStar(require("react"));
64
+ var XUtils_1 = require("./XUtils");
65
+ var dropdown_1 = require("primereact/dropdown");
66
+ var XDropdownDT = function (props) {
67
+ // poznamka: nacitanie/ulozenie options je vytiahnute do parent komponentu XFormDataTable koli tomu aby sme nenacitavali options pre kazdy riadok tabulky
68
+ // parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
69
+ (0, react_1.useEffect)(function () {
70
+ //console.log("XDropdownDT - zavolany useEffect *******************")
71
+ findOptions();
72
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
73
+ var findOptions = function () { return __awaiter(void 0, void 0, void 0, function () {
74
+ var options;
75
+ return __generator(this, function (_a) {
76
+ switch (_a.label) {
77
+ case 0:
78
+ options = props.dropdownOptionsMap[props.assocField];
79
+ if (!(options === undefined)) return [3 /*break*/, 2];
80
+ // nacitavanie som dal sem, lebo sa bojim ze ak by som ho dal mimo useEffect (napr. priamo do funkcie bodyTemplate), tak by som koli Promise odsunul vytvaranie komponentov na iny cas a asi by to nebolo dobre
81
+ // Toto je trosku hack - zapisanim prazdneho pola si oznacime, ze ideme nacitat options z DB (stane sa to pri prvom riadku tabulky).
82
+ // Ked potom tento kod zbieha pre dalsie riadky tabulky, tak najdu v props.dropdownOptionsMap[props.assocField] prazdne pole (nie undefined) a uz nevyvolavaju nacitavanie z DB.
83
+ // Nacitanie z DB sa koli asynchronnosti vykona az po zavolani tejto metody pre vsetky riadky tabulky, co je pre nas neskoro.
84
+ // ak by tu tento riadok nebol, tak by sa options nacitavali tolkokrat, kolko je riadkov v tabulke
85
+ props.dropdownOptionsMap[props.assocField] = [];
86
+ return [4 /*yield*/, XUtils_1.XUtils.fetchMany('findRowsForAssoc', { entity: props.entity, assocField: props.assocField })];
87
+ case 1:
88
+ options = _a.sent();
89
+ options.splice(0, 0, {}); // null polozka (nepridavat pre not null atributy)
90
+ props.dropdownOptionsMap[props.assocField] = options;
91
+ //console.log("XDropdownDT - findOptions - citali sme options pre field = " + props.assocField);
92
+ //console.log(props.dropdownOptionsMap);
93
+ props.onDropdownOptionsMapChange(props.dropdownOptionsMap); // vyrenderujeme nacitane hodnoty
94
+ _a.label = 2;
95
+ case 2: return [2 /*return*/];
96
+ }
97
+ });
98
+ }); };
99
+ var readOnly = props.readOnly !== undefined ? props.readOnly : false;
100
+ var onValueChange = function (assocField, rowData, newValue) {
101
+ // zmenime hodnotu v modeli (odtial sa hodnota cita)
102
+ var newValueOrNull;
103
+ // specialna null polozka nema ziadne atributy
104
+ if (Object.keys(newValue).length === 0) {
105
+ newValueOrNull = null;
106
+ }
107
+ else {
108
+ newValueOrNull = newValue;
109
+ }
110
+ rowData[assocField] = newValueOrNull;
111
+ // kedze "rowData" je sucastou "props.form.state.object", tak nam staci zavolat setState({object: object}), aby sa zmena prejavila
112
+ props.form.onObjectDataChange();
113
+ };
114
+ // TODO - readOnly implementovat
115
+ // Dropdown setuje do atributu object.assocField asociovany objekt zo zoznamu objektov ktore ziskame podla asociacie
116
+ var assocObject = null;
117
+ if (props.rowData !== null) {
118
+ assocObject = props.rowData[props.assocField];
119
+ // pri inserte noveho riadku su (zatial) vsetky fieldy undefined, dame na null, null je standard
120
+ if (assocObject === undefined) {
121
+ assocObject = null;
122
+ }
123
+ }
124
+ var options = props.dropdownOptionsMap[props.assocField] !== undefined ? props.dropdownOptionsMap[props.assocField] : []; // mozno mozme do options prasknut rovno undefined...
125
+ // appendTo={document.body} appenduje overlay panel na element body - eliminuje problem s overflow (pozri poznamku v XDropdownDTFilter)
126
+ return (react_1.default.createElement(dropdown_1.Dropdown, { appendTo: document.body, id: props.assocField, optionLabel: props.displayField, value: assocObject, options: options, onChange: function (e) { return onValueChange(props.assocField, props.rowData, e.target.value); } }));
127
+ };
128
+ exports.XDropdownDT = XDropdownDT;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- export declare const XDropdownDTFilter: (props: {
3
- entity: string;
4
- path: string;
5
- value: any;
6
- onValueChange: (field: string, displayValue: any) => void;
7
- }) => JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const XDropdownDTFilter: (props: {
3
+ entity: string;
4
+ path: string;
5
+ value: any;
6
+ onValueChange: (field: string, displayValue: any) => void;
7
+ }) => JSX.Element;
@@ -1,121 +1,121 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- 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;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
- var __read = (this && this.__read) || function (o, n) {
62
- var m = typeof Symbol === "function" && o[Symbol.iterator];
63
- if (!m) return o;
64
- var i = m.call(o), r, ar = [], e;
65
- try {
66
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
67
- }
68
- catch (error) { e = { error: error }; }
69
- finally {
70
- try {
71
- if (r && !r.done && (m = i["return"])) m.call(i);
72
- }
73
- finally { if (e) throw e.error; }
74
- }
75
- return ar;
76
- };
77
- Object.defineProperty(exports, "__esModule", { value: true });
78
- exports.XDropdownDTFilter = void 0;
79
- var react_1 = __importStar(require("react"));
80
- var XUtils_1 = require("./XUtils");
81
- var dropdown_1 = require("primereact/dropdown");
82
- var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
83
- var XUtilsMetadata_1 = require("./XUtilsMetadata");
84
- // pouzivany vo filtri v XLazyDataTable aj v XFormDataTable2
85
- var XDropdownDTFilter = function (props) {
86
- var _a = __read((0, react_1.useState)([]), 2), options = _a[0], setOptions = _a[1];
87
- var fieldList = XUtilsCommon_1.XUtilsCommon.getFieldListForPath(props.path);
88
- if (fieldList.length < 2) {
89
- throw "XDropdownDTFilter: prop path (".concat(props.path, ") must have at least 2 items");
90
- }
91
- var displayField = fieldList[fieldList.length - 1];
92
- // parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
93
- (0, react_1.useEffect)(function () {
94
- findOptions(props.entity, props.path, displayField);
95
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
96
- var onValueChange = function (e) {
97
- props.onValueChange(props.path, e.target.value);
98
- };
99
- var findOptions = function (entity, path, displayField) { return __awaiter(void 0, void 0, void 0, function () {
100
- var xAssoc, options, emptyOption;
101
- return __generator(this, function (_a) {
102
- switch (_a.label) {
103
- case 0:
104
- xAssoc = XUtilsMetadata_1.XUtilsMetadata.getLastXAssocByPath(XUtilsMetadata_1.XUtilsMetadata.getXEntity(entity), path);
105
- return [4 /*yield*/, XUtils_1.XUtils.fetchRows(xAssoc.entityName, undefined, displayField)];
106
- case 1:
107
- options = _a.sent();
108
- emptyOption = {};
109
- emptyOption[displayField] = XUtils_1.XUtils.dropdownEmptyOptionValue;
110
- options.splice(0, 0, emptyOption); // null polozka (nepridavat pre not null atributy)
111
- setOptions(options);
112
- return [2 /*return*/];
113
- }
114
- });
115
- }); };
116
- // dropdown pouziva ako optionValue displayField (nie cely objekt) - je to koli problemom s prazdnym riadkom (nepodarilo sa to spravit inac)
117
- // appendTo={document.body} appenduje overlay panel na element body - panel je vdaka tomu viditelny aj ked ma jeho parent (TH/TD element tabulky)
118
- // nastavny overflow: hidden, resp. koli scrollovaniu by overlay panel "nevysiel" von z tabulky, v pripade ze je tabulka mala (napr. ma 1 riadok)
119
- return (react_1.default.createElement(dropdown_1.Dropdown, { appendTo: document.body, style: { width: '100%' }, className: "ui-column-filter", optionLabel: displayField, optionValue: displayField, value: props.value, options: options, onChange: onValueChange }));
120
- };
121
- exports.XDropdownDTFilter = XDropdownDTFilter;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ 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;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ var __read = (this && this.__read) || function (o, n) {
62
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
63
+ if (!m) return o;
64
+ var i = m.call(o), r, ar = [], e;
65
+ try {
66
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
67
+ }
68
+ catch (error) { e = { error: error }; }
69
+ finally {
70
+ try {
71
+ if (r && !r.done && (m = i["return"])) m.call(i);
72
+ }
73
+ finally { if (e) throw e.error; }
74
+ }
75
+ return ar;
76
+ };
77
+ Object.defineProperty(exports, "__esModule", { value: true });
78
+ exports.XDropdownDTFilter = void 0;
79
+ var react_1 = __importStar(require("react"));
80
+ var XUtils_1 = require("./XUtils");
81
+ var dropdown_1 = require("primereact/dropdown");
82
+ var XUtilsCommon_1 = require("../serverApi/XUtilsCommon");
83
+ var XUtilsMetadata_1 = require("./XUtilsMetadata");
84
+ // pouzivany vo filtri v XLazyDataTable aj v XFormDataTable2
85
+ var XDropdownDTFilter = function (props) {
86
+ var _a = __read((0, react_1.useState)([]), 2), options = _a[0], setOptions = _a[1];
87
+ var fieldList = XUtilsCommon_1.XUtilsCommon.getFieldListForPath(props.path);
88
+ if (fieldList.length < 2) {
89
+ throw "XDropdownDTFilter: prop path (".concat(props.path, ") must have at least 2 items");
90
+ }
91
+ var displayField = fieldList[fieldList.length - 1];
92
+ // parameter [] zabezpeci ze sa metoda zavola len po prvom renderingu (a nie po kazdej zmene stavu (zavolani setNieco()))
93
+ (0, react_1.useEffect)(function () {
94
+ findOptions(props.entity, props.path, displayField);
95
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
96
+ var onValueChange = function (e) {
97
+ props.onValueChange(props.path, e.target.value);
98
+ };
99
+ var findOptions = function (entity, path, displayField) { return __awaiter(void 0, void 0, void 0, function () {
100
+ var xAssoc, options, emptyOption;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0:
104
+ xAssoc = XUtilsMetadata_1.XUtilsMetadata.getLastXAssocByPath(XUtilsMetadata_1.XUtilsMetadata.getXEntity(entity), path);
105
+ return [4 /*yield*/, XUtils_1.XUtils.fetchRows(xAssoc.entityName, undefined, displayField)];
106
+ case 1:
107
+ options = _a.sent();
108
+ emptyOption = {};
109
+ emptyOption[displayField] = XUtils_1.XUtils.dropdownEmptyOptionValue;
110
+ options.splice(0, 0, emptyOption); // null polozka (nepridavat pre not null atributy)
111
+ setOptions(options);
112
+ return [2 /*return*/];
113
+ }
114
+ });
115
+ }); };
116
+ // dropdown pouziva ako optionValue displayField (nie cely objekt) - je to koli problemom s prazdnym riadkom (nepodarilo sa to spravit inac)
117
+ // appendTo={document.body} appenduje overlay panel na element body - panel je vdaka tomu viditelny aj ked ma jeho parent (TH/TD element tabulky)
118
+ // nastavny overflow: hidden, resp. koli scrollovaniu by overlay panel "nevysiel" von z tabulky, v pripade ze je tabulka mala (napr. ma 1 riadok)
119
+ return (react_1.default.createElement(dropdown_1.Dropdown, { appendTo: document.body, style: { width: '100%' }, className: "ui-column-filter", optionLabel: displayField, optionValue: displayField, value: props.value, options: options, onChange: onValueChange }));
120
+ };
121
+ exports.XDropdownDTFilter = XDropdownDTFilter;
@@ -1,25 +1,25 @@
1
- import { Component } from "react";
2
- import { DropdownChangeEvent } from "primereact/dropdown";
3
- import { XCustomFilter } from "../serverApi/FindParam";
4
- export interface XDropdownForEntityProps {
5
- id?: string;
6
- entity: string;
7
- displayField: string;
8
- sortField?: string;
9
- value: any | null;
10
- onChange: (value: any | null) => void;
11
- readOnly?: boolean;
12
- isNotNull?: boolean;
13
- error?: string;
14
- filter?: XCustomFilter;
15
- }
16
- export declare class XDropdownForEntity extends Component<XDropdownForEntityProps> {
17
- state: {
18
- options: any[];
19
- };
20
- constructor(props: XDropdownForEntityProps);
21
- componentDidMount(): void;
22
- loadOptions(): Promise<void>;
23
- onChange(e: DropdownChangeEvent): void;
24
- render(): JSX.Element;
25
- }
1
+ import { Component } from "react";
2
+ import { DropdownChangeEvent } from "primereact/dropdown";
3
+ import { XCustomFilter } from "../serverApi/FindParam";
4
+ export interface XDropdownForEntityProps {
5
+ id?: string;
6
+ entity: string;
7
+ displayField: string;
8
+ sortField?: string;
9
+ value: any | null;
10
+ onChange: (value: any | null) => void;
11
+ readOnly?: boolean;
12
+ isNotNull?: boolean;
13
+ error?: string;
14
+ filter?: XCustomFilter;
15
+ }
16
+ export declare class XDropdownForEntity extends Component<XDropdownForEntityProps> {
17
+ state: {
18
+ options: any[];
19
+ };
20
+ constructor(props: XDropdownForEntityProps);
21
+ componentDidMount(): void;
22
+ loadOptions(): Promise<void>;
23
+ onChange(e: DropdownChangeEvent): void;
24
+ render(): JSX.Element;
25
+ }