@michalrakus/x-react-web-lib 1.38.1 → 1.38.3
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.
- package/lib/components/XFormComponentDT.js +3 -1
- package/lib/components/XInputDate.d.ts +1 -1
- package/lib/components/XLazyDataTable/XLazyDataTable.d.ts +7 -0
- package/lib/components/XLazyDataTable/XLazyDataTable.js +134 -45
- package/lib/components/XLocale.d.ts +2 -0
- package/lib/components/XUtils.js +3 -1
- package/lib/components/locale/x-en.json +2 -0
- package/lib/serverApi/FindParam.d.ts +2 -0
- package/lib/serverApi/FindParam.js +2 -0
- package/package.json +1 -1
|
@@ -55,7 +55,9 @@ var XFormComponentDT = /** @class */ (function (_super) {
|
|
|
55
55
|
// if the length of field is 2 or more, then readOnly
|
|
56
56
|
readOnly = true;
|
|
57
57
|
}
|
|
58
|
-
// formReadOnlyBase is called on the level XFormDataTable2
|
|
58
|
+
// formReadOnlyBase is called on the level XFormDataTable2 and XFormPanelList
|
|
59
|
+
// the reason is (probably) that in XFormDataTable2 and XFormPanelList we know the assoc name whereas here in component we know only field name
|
|
60
|
+
// (assoc name is param of formReadOnlyBase)
|
|
59
61
|
// else if (this.props.form.formReadOnlyBase("xxx")) {
|
|
60
62
|
// readOnly = true;
|
|
61
63
|
// }
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { XFormComponentProps } from "./XFormComponent";
|
|
3
3
|
import { XInput } from "./XInput";
|
|
4
4
|
import { XDateScale } from "../serverApi/XUtilsConversions";
|
|
5
|
-
export interface XInputDateProps extends XFormComponentProps<
|
|
5
|
+
export interface XInputDateProps extends XFormComponentProps<Date> {
|
|
6
6
|
field: string;
|
|
7
7
|
scale?: XDateScale;
|
|
8
8
|
}
|
|
@@ -23,6 +23,10 @@ export interface XOptionalCustomFilter {
|
|
|
23
23
|
label: string;
|
|
24
24
|
filter: XCustomFilter;
|
|
25
25
|
}
|
|
26
|
+
export interface XAssocToSort {
|
|
27
|
+
assoc: string;
|
|
28
|
+
sortField: string;
|
|
29
|
+
}
|
|
26
30
|
export interface XEditModeHandlers {
|
|
27
31
|
onStart: () => void;
|
|
28
32
|
onSave: () => void;
|
|
@@ -92,6 +96,7 @@ export interface XLazyDataTableProps {
|
|
|
92
96
|
sortField?: string | DataTableSortMeta[];
|
|
93
97
|
fullTextSearch?: boolean | string[];
|
|
94
98
|
fields?: string[];
|
|
99
|
+
assocsToSort?: XAssocToSort[];
|
|
95
100
|
multilineSwitch?: boolean;
|
|
96
101
|
multilineSwitchInitValue?: XMultilineRenderType;
|
|
97
102
|
multilineSwitchFewLinesCount?: number;
|
|
@@ -157,6 +162,8 @@ export interface XLazyColumnProps {
|
|
|
157
162
|
aggregateType?: XAggregateFunction;
|
|
158
163
|
columnViewStatus: XViewStatusOrBoolean;
|
|
159
164
|
filterElement?: XFilterElementProp;
|
|
165
|
+
className?: string;
|
|
166
|
+
style?: React.CSSProperties;
|
|
160
167
|
body?: React.ReactNode | ((data: any, options: ColumnBodyOptions) => React.ReactNode);
|
|
161
168
|
}
|
|
162
169
|
export type XLazyColumnType = {
|
|
@@ -202,17 +202,22 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
202
202
|
var createFiltersInit = function () {
|
|
203
203
|
var e_2, _a;
|
|
204
204
|
var filtersInit = {};
|
|
205
|
+
// warning note: props.children are used to get props of XLazyColumn whereas dataTableEl.current.props.children are used to get props of Primereact DataTable
|
|
205
206
|
//let columns = dataTableEl.current.props.children; - does not work
|
|
206
207
|
var columns = props.children;
|
|
207
208
|
try {
|
|
208
209
|
for (var columns_2 = __values(columns), columns_2_1 = columns_2.next(); !columns_2_1.done; columns_2_1 = columns_2.next()) {
|
|
209
210
|
var column = columns_2_1.value;
|
|
210
211
|
var xLazyColumn = column; // nevedel som to krajsie...
|
|
212
|
+
// in some situations, this would be suitable, but for dynamic hide/show columns it can cause crash
|
|
213
|
+
// better place for initializing filters is probably creating columns - function(child)
|
|
214
|
+
//if (XUtils.xViewStatus(xLazyColumn.props.columnViewStatus) !== XViewStatus.Hidden) {
|
|
211
215
|
var field = xLazyColumn.props.field;
|
|
212
216
|
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, field);
|
|
213
217
|
// TODO column.props.dropdownInFilter - pre "menu" by bolo fajn mat zoznam "enumov"
|
|
214
218
|
var filterMatchMode = getInitFilterMatchMode(xLazyColumn.props, xField);
|
|
215
219
|
filtersInit[field] = createFilterItem(props.filterDisplay, { value: null, matchMode: filterMatchMode });
|
|
220
|
+
//}
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -358,6 +363,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
358
363
|
return filtersInit;
|
|
359
364
|
};
|
|
360
365
|
var _y = __read((0, useXStateStorageBase_1.useXStateStorageBase)(props.stateStorage, getStateKey(XStateKeySuffix.filters), filtersInitialStateFunction), 2), filters = _y[0], setFilters = _y[1]; // filtrovanie na "controlled manner" (moze sa sem nainicializovat nejaka hodnota)
|
|
366
|
+
var matchModeChangeFieldRef = (0, react_1.useRef)(null);
|
|
361
367
|
var initFtsInputValue = props.fullTextSearch ? createInitFtsInputValue() : undefined;
|
|
362
368
|
var _z = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.ftsInputValue), initFtsInputValue), 2), ftsInputValue = _z[0], setFtsInputValue = _z[1];
|
|
363
369
|
var _0 = __read((0, useXStateStorage_1.useXStateStorage)(props.stateStorage, getStateKey(XStateKeySuffix.optionalCustomFilter), undefined), 2), optionalCustomFilter = _0[0], setOptionalCustomFilter = _0[1];
|
|
@@ -417,14 +423,62 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
417
423
|
return [2 /*return*/];
|
|
418
424
|
});
|
|
419
425
|
}); };
|
|
420
|
-
var onFilter = function (
|
|
421
|
-
//
|
|
422
|
-
//
|
|
423
|
-
//console.log("
|
|
426
|
+
var onFilter = function (e) {
|
|
427
|
+
// HEY! this method is not called (on filter value change) since we use filterElement on component Column (in filter there are always custom components those call direct setFilters(...))
|
|
428
|
+
// this method is called (probably) only when user changes match mode
|
|
429
|
+
//console.log("called onFilter - this.state.filters = " + JSON.stringify(filters));
|
|
430
|
+
//console.log("called onFilter - event.filters = " + JSON.stringify(e.filters));
|
|
431
|
+
var filtersChanged = false;
|
|
432
|
+
var changedField = matchModeChangeFieldRef.current;
|
|
433
|
+
if (changedField) {
|
|
434
|
+
// method onFilterMatchModeChange was called (user changed match mode)
|
|
435
|
+
var filterValueOld = filters[changedField];
|
|
436
|
+
var filterValue = e.filters[changedField];
|
|
437
|
+
if (filterValueOld && filterValue) { // should be always true
|
|
438
|
+
var xFilterValueOld = filterValueOld; // works only for filterDisplay="row"
|
|
439
|
+
var xFilterValue = filterValue; // works only for filterDisplay="row"
|
|
440
|
+
if (xFilterValue.matchMode !== xFilterValueOld.matchMode) {
|
|
441
|
+
var isNotNullValueAlias = "<".concat((0, XLocale_1.xLocaleOption)('xIsNotNull'), ">");
|
|
442
|
+
var isNullValueAlias = "<".concat((0, XLocale_1.xLocaleOption)('xIsNull'), ">");
|
|
443
|
+
var xFilterMatchMode = xFilterValue.matchMode;
|
|
444
|
+
if (xFilterMatchMode === FindParam_1.XFilterMatchMode.X_IS_NOT_NULL || xFilterMatchMode === FindParam_1.XFilterMatchMode.X_IS_NULL) {
|
|
445
|
+
var newValue = null;
|
|
446
|
+
// for string types we set alias, for other types we set null (alias is not displayed -> NaN or Invalid date are displayed)
|
|
447
|
+
var xField = XUtilsMetadataCommon_1.XUtilsMetadataCommon.getXFieldByPath(xEntity, changedField);
|
|
448
|
+
if (xField.type === "string" || xField.type === "jsonb") {
|
|
449
|
+
if (xFilterMatchMode === FindParam_1.XFilterMatchMode.X_IS_NOT_NULL) {
|
|
450
|
+
newValue = isNotNullValueAlias;
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
// xFilterMatchMode === XFilterMatchMode.X_IS_NULL
|
|
454
|
+
newValue = isNullValueAlias;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
xFilterValue.value = newValue;
|
|
458
|
+
filtersChanged = true;
|
|
459
|
+
}
|
|
460
|
+
else if (xFilterMatchMode === FindParam_1.XFilterMatchMode.X_AUTO_COMPLETE) {
|
|
461
|
+
xFilterValue.value = null;
|
|
462
|
+
filtersChanged = true;
|
|
463
|
+
}
|
|
464
|
+
// all other match modes - change to null, if previous match mode was X_IS_NOT_NULL or X_IS_NULL or X_AUTO_COMPLETE
|
|
465
|
+
else if (xFilterValue.value === isNotNullValueAlias || xFilterValue.value === isNullValueAlias || typeof xFilterValue.value === 'object') {
|
|
466
|
+
xFilterValue.value = null;
|
|
467
|
+
filtersChanged = true;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
matchModeChangeFieldRef.current = null;
|
|
472
|
+
}
|
|
473
|
+
var filtersNew = e.filters;
|
|
474
|
+
if (filtersChanged) {
|
|
475
|
+
// clone needed if there was change, otherwise react does not show the change
|
|
476
|
+
filtersNew = __assign({}, filtersNew);
|
|
477
|
+
}
|
|
424
478
|
// tymto zavolanim sa zapise znak zapisany klavesnicou do inputu filtra (ak prikaz zakomentujeme, input filtra zostane prazdny)
|
|
425
|
-
setFilters(
|
|
479
|
+
setFilters(filtersNew);
|
|
426
480
|
removePagingFromStorage();
|
|
427
|
-
loadDataBaseIfAutoFilter(
|
|
481
|
+
loadDataBaseIfAutoFilter(filtersNew, false); // TODO - pass value Column.props.autoFilter here
|
|
428
482
|
};
|
|
429
483
|
var onSort = function (event) {
|
|
430
484
|
//console.log("zavolany onSort - this.state.multiSortMeta = " + JSON.stringify(multiSortMeta));
|
|
@@ -569,6 +623,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
569
623
|
return [4 /*yield*/, findByFilter(findParam)];
|
|
570
624
|
case 1:
|
|
571
625
|
findResult = _a.sent();
|
|
626
|
+
sortAssocsToSort(findResult);
|
|
572
627
|
setValue(findResult);
|
|
573
628
|
setupExpandedRows(findResult, multilineSwitchValue);
|
|
574
629
|
setLoading(false);
|
|
@@ -585,8 +640,44 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
585
640
|
}
|
|
586
641
|
});
|
|
587
642
|
}); };
|
|
643
|
+
var sortAssocsToSort = function (findResult) {
|
|
644
|
+
var e_4, _a, e_5, _b;
|
|
645
|
+
if (props.assocsToSort) {
|
|
646
|
+
if (findResult.rowList) {
|
|
647
|
+
try {
|
|
648
|
+
for (var _c = __values(findResult.rowList), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
649
|
+
var row = _d.value;
|
|
650
|
+
try {
|
|
651
|
+
// sorting in javascript (avoid of sorting in DB)
|
|
652
|
+
for (var _e = (e_5 = void 0, __values(props.assocsToSort)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
653
|
+
var assocToSort = _f.value;
|
|
654
|
+
var assocRowList = row[assocToSort.assoc];
|
|
655
|
+
if (assocRowList) {
|
|
656
|
+
row[assocToSort.assoc] = XUtilsCommon_1.XUtilsCommon.arraySort(assocRowList, assocToSort.sortField);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
661
|
+
finally {
|
|
662
|
+
try {
|
|
663
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
664
|
+
}
|
|
665
|
+
finally { if (e_5) throw e_5.error; }
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
670
|
+
finally {
|
|
671
|
+
try {
|
|
672
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
673
|
+
}
|
|
674
|
+
finally { if (e_4) throw e_4.error; }
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
};
|
|
588
679
|
var setupExpandedRows = function (findResult, multilineSwitchValue) {
|
|
589
|
-
var
|
|
680
|
+
var e_6, _a;
|
|
590
681
|
if (props.rowExpansionTemplate) {
|
|
591
682
|
var expandedRowsLocal = {};
|
|
592
683
|
if (findResult.rowList) {
|
|
@@ -602,12 +693,12 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
602
693
|
}
|
|
603
694
|
}
|
|
604
695
|
}
|
|
605
|
-
catch (
|
|
696
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
606
697
|
finally {
|
|
607
698
|
try {
|
|
608
699
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
609
700
|
}
|
|
610
|
-
finally { if (
|
|
701
|
+
finally { if (e_6) throw e_6.error; }
|
|
611
702
|
}
|
|
612
703
|
}
|
|
613
704
|
setExpandedRows(expandedRowsLocal);
|
|
@@ -650,7 +741,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
650
741
|
var getFields = function (addPropsFields) {
|
|
651
742
|
// krasne zobrazi cely objekt!
|
|
652
743
|
//console.log(dataTableEl.current);
|
|
653
|
-
var
|
|
744
|
+
var e_7, _a;
|
|
654
745
|
var fields = [];
|
|
655
746
|
var columns = dataTableEl.current.props.children;
|
|
656
747
|
try {
|
|
@@ -659,12 +750,12 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
659
750
|
fields.push(column.props.field);
|
|
660
751
|
}
|
|
661
752
|
}
|
|
662
|
-
catch (
|
|
753
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
663
754
|
finally {
|
|
664
755
|
try {
|
|
665
756
|
if (columns_3_1 && !columns_3_1.done && (_a = columns_3.return)) _a.call(columns_3);
|
|
666
757
|
}
|
|
667
|
-
finally { if (
|
|
758
|
+
finally { if (e_7) throw e_7.error; }
|
|
668
759
|
}
|
|
669
760
|
if (addPropsFields) {
|
|
670
761
|
if (props.fields) {
|
|
@@ -676,7 +767,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
676
767
|
var getHeaders = function () {
|
|
677
768
|
// krasne zobrazi cely objekt!
|
|
678
769
|
//console.log(dataTableEl.current);
|
|
679
|
-
var
|
|
770
|
+
var e_8, _a;
|
|
680
771
|
var headers = [];
|
|
681
772
|
var columns = dataTableEl.current.props.children;
|
|
682
773
|
try {
|
|
@@ -686,17 +777,17 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
686
777
|
headers.push(column.props.header);
|
|
687
778
|
}
|
|
688
779
|
}
|
|
689
|
-
catch (
|
|
780
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
690
781
|
finally {
|
|
691
782
|
try {
|
|
692
783
|
if (columns_4_1 && !columns_4_1.done && (_a = columns_4.return)) _a.call(columns_4);
|
|
693
784
|
}
|
|
694
|
-
finally { if (
|
|
785
|
+
finally { if (e_8) throw e_8.error; }
|
|
695
786
|
}
|
|
696
787
|
return headers;
|
|
697
788
|
};
|
|
698
789
|
var getWidths = function () {
|
|
699
|
-
var
|
|
790
|
+
var e_9, _a;
|
|
700
791
|
var _b;
|
|
701
792
|
// vrati sirky stlpcov napr. ['7.75rem', '20rem', '8.5rem', '8.5rem', '6rem']
|
|
702
793
|
// nevracia aktualne sirky stlpcov (po manualnom rozsireni) ale tie ktore boli nastavene/vypocitane v kode
|
|
@@ -708,17 +799,17 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
708
799
|
widths.push((_b = column.props.headerStyle) === null || _b === void 0 ? void 0 : _b.width);
|
|
709
800
|
}
|
|
710
801
|
}
|
|
711
|
-
catch (
|
|
802
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
712
803
|
finally {
|
|
713
804
|
try {
|
|
714
805
|
if (columns_5_1 && !columns_5_1.done && (_a = columns_5.return)) _a.call(columns_5);
|
|
715
806
|
}
|
|
716
|
-
finally { if (
|
|
807
|
+
finally { if (e_9) throw e_9.error; }
|
|
717
808
|
}
|
|
718
809
|
return widths;
|
|
719
810
|
};
|
|
720
811
|
var getFieldSetIds = function () {
|
|
721
|
-
var
|
|
812
|
+
var e_10, _a;
|
|
722
813
|
var fieldSetIds = [];
|
|
723
814
|
// warning note: props.children are used to get props of XLazyColumn whereas dataTableEl.current.props.children are used to get props of Primereact DataTable
|
|
724
815
|
var columns = props.children;
|
|
@@ -730,12 +821,12 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
730
821
|
}
|
|
731
822
|
}
|
|
732
823
|
}
|
|
733
|
-
catch (
|
|
824
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
734
825
|
finally {
|
|
735
826
|
try {
|
|
736
827
|
if (columns_6_1 && !columns_6_1.done && (_a = columns_6.return)) _a.call(columns_6);
|
|
737
828
|
}
|
|
738
|
-
finally { if (
|
|
829
|
+
finally { if (e_10) throw e_10.error; }
|
|
739
830
|
}
|
|
740
831
|
return fieldSetIds;
|
|
741
832
|
};
|
|
@@ -820,7 +911,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
820
911
|
setFormDialogState({ opened: false });
|
|
821
912
|
};
|
|
822
913
|
var onClickRemoveRow = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
823
|
-
var reread_1,
|
|
914
|
+
var reread_1, e_11, e_12;
|
|
824
915
|
return __generator(this, function (_a) {
|
|
825
916
|
switch (_a.label) {
|
|
826
917
|
case 0:
|
|
@@ -835,8 +926,8 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
835
926
|
reread_1 = _a.sent();
|
|
836
927
|
return [3 /*break*/, 4];
|
|
837
928
|
case 3:
|
|
838
|
-
|
|
839
|
-
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('removeRowFailed'),
|
|
929
|
+
e_11 = _a.sent();
|
|
930
|
+
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('removeRowFailed'), e_11);
|
|
840
931
|
return [3 /*break*/, 4];
|
|
841
932
|
case 4:
|
|
842
933
|
if (reread_1) {
|
|
@@ -858,8 +949,8 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
858
949
|
_a.sent();
|
|
859
950
|
return [3 /*break*/, 9];
|
|
860
951
|
case 8:
|
|
861
|
-
|
|
862
|
-
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('removeRowFailed'),
|
|
952
|
+
e_12 = _a.sent();
|
|
953
|
+
XUtils_1.XUtils.showErrorMessage((0, XLocale_1.xLocaleOption)('removeRowFailed'), e_12);
|
|
863
954
|
return [3 /*break*/, 9];
|
|
864
955
|
case 9:
|
|
865
956
|
loadData();
|
|
@@ -1046,23 +1137,15 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1046
1137
|
}
|
|
1047
1138
|
return betweenFilter;
|
|
1048
1139
|
};
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
if (filterValue !== null && typeof filterValue === 'object') {
|
|
1059
|
-
console.log("idem volat setFilterValue");
|
|
1060
|
-
setFilterValue(e.field, null);
|
|
1061
|
-
console.log(getFilterValue(e.field));
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
*/
|
|
1140
|
+
var onFilterMatchModeChange = function (e) {
|
|
1141
|
+
//console.log(e.matchMode);
|
|
1142
|
+
//console.log(e.field);
|
|
1143
|
+
// warning: we can not change/set the filter value for the column where match mode was changed
|
|
1144
|
+
// if we call setFilters in this method, then after finishing this method primereact calls another setting of "filters" and that second call overwrites our change
|
|
1145
|
+
// this method is only "read only" and the change must be done in onFilter method
|
|
1146
|
+
// we only save the field of the column where the match mode was changed - it is used later in onFilter method
|
|
1147
|
+
matchModeChangeFieldRef.current = e.field;
|
|
1148
|
+
};
|
|
1066
1149
|
var valueAsUI = function (value, xField, contentType, fieldSetId) {
|
|
1067
1150
|
var valueResult;
|
|
1068
1151
|
if (xField.type === "boolean") {
|
|
@@ -1104,6 +1187,9 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1104
1187
|
else {
|
|
1105
1188
|
bodyValue = valueAsUI(rowDataValue, xField, columnProps.contentType, columnProps.fieldSetId);
|
|
1106
1189
|
}
|
|
1190
|
+
if (columnProps.className || columnProps.style) {
|
|
1191
|
+
bodyValue = react_1.default.createElement("div", { className: columnProps.className, style: columnProps.style }, bodyValue);
|
|
1192
|
+
}
|
|
1107
1193
|
return bodyValue;
|
|
1108
1194
|
};
|
|
1109
1195
|
// in order that row expansion works like standard row, we wrap row expansion into div
|
|
@@ -1322,7 +1408,8 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1322
1408
|
}
|
|
1323
1409
|
else if (xField.type === "string") {
|
|
1324
1410
|
var stringValue = getFilterValue(childColumn.props.field);
|
|
1325
|
-
|
|
1411
|
+
var xFilterMatchMode = getFilterMatchMode(childColumn.props.field);
|
|
1412
|
+
filterElement = react_1.default.createElement(XInputTextBase_1.XInputTextBase, { value: stringValue, onChange: function (value) { return setFilterValue(childColumn.props.field, value, undefined, undefined, childColumn.props.autoFilter); }, readOnly: xFilterMatchMode === FindParam_1.XFilterMatchMode.X_IS_NOT_NULL || xFilterMatchMode === FindParam_1.XFilterMatchMode.X_IS_NULL });
|
|
1326
1413
|
}
|
|
1327
1414
|
else if (xField.type === "date" || xField.type === "datetime") {
|
|
1328
1415
|
betweenFilter = getBetweenFilter(childColumn.props.betweenFilter, props.betweenFilter);
|
|
@@ -1385,6 +1472,8 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1385
1472
|
//filterMatchModeOptions = primeReactContext.filterMatchModeOptions![dataType].map((key) => ({ label: prLocaleOption(key), value: key }));
|
|
1386
1473
|
filterMatchModeOptions = (primeReactContext && primeReactContext.filterMatchModeOptions[dataType].map(function (key) { return ({ label: (0, XLocale_1.prLocaleOption)(key), value: key }); })) ||
|
|
1387
1474
|
api_1.default.filterMatchModeOptions[dataType].map(function (key) { return ({ label: (0, XLocale_1.prLocaleOption)(key), value: key }); });
|
|
1475
|
+
filterMatchModeOptions.push({ label: (0, XLocale_1.xLocaleOption)('xIsNotNull'), value: FindParam_1.XFilterMatchMode.X_IS_NOT_NULL });
|
|
1476
|
+
filterMatchModeOptions.push({ label: (0, XLocale_1.xLocaleOption)('xIsNull'), value: FindParam_1.XFilterMatchMode.X_IS_NULL });
|
|
1388
1477
|
if (isAutoCompleteInFilterEnabled(childColumn.props)) {
|
|
1389
1478
|
filterMatchModeOptions.push({ label: (0, XLocale_1.xLocaleOption)('xAutoComplete'), value: FindParam_1.XFilterMatchMode.X_AUTO_COMPLETE });
|
|
1390
1479
|
}
|
|
@@ -1444,7 +1533,7 @@ exports.XLazyDataTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
1444
1533
|
}
|
|
1445
1534
|
footer = aggregateValue;
|
|
1446
1535
|
}
|
|
1447
|
-
return react_1.default.createElement(column_1.Column, { field: childColumn.props.field, header: header, footer: footer, filter: true, sortable: true, filterElement: filterElement, dataType: dataType, showFilterMenu: showFilterMenu, filterMatchModeOptions: filterMatchModeOptions, showClearButton: showClearButton, onFilterMatchModeChange:
|
|
1536
|
+
return react_1.default.createElement(column_1.Column, { field: childColumn.props.field, header: header, footer: footer, filter: true, sortable: true, filterElement: filterElement, dataType: dataType, showFilterMenu: showFilterMenu, filterMatchModeOptions: filterMatchModeOptions, showClearButton: showClearButton, onFilterMatchModeChange: onFilterMatchModeChange, body: body, headerStyle: headerStyle, align: align });
|
|
1448
1537
|
});
|
|
1449
1538
|
// align-items-center centruje vertikalne (posuva smerom dolu do stredu)
|
|
1450
1539
|
// x-lazy-datatable-label-right-compensation - vyvazuje label, aby item-y v strede isli aspon priblizne do stredu
|
package/lib/components/XUtils.js
CHANGED
|
@@ -582,7 +582,9 @@ var XUtils = exports.XUtils = /** @class */ (function () {
|
|
|
582
582
|
// if the length of field is 2 or more, then readOnly
|
|
583
583
|
isReadOnly = true;
|
|
584
584
|
}
|
|
585
|
-
// formReadOnlyBase is called on the level XFormDataTable2
|
|
585
|
+
// formReadOnlyBase is called on the level XFormDataTable2 and XFormPanelList
|
|
586
|
+
// the reason is (probably) that in XFormDataTable2 and XFormPanelList we know the assoc name whereas here in component we know only field name
|
|
587
|
+
// (assoc name is param of formReadOnlyBase)
|
|
586
588
|
// else if (this.props.form.formReadOnlyBase("xxx")) {
|
|
587
589
|
// isReadOnly = true;
|
|
588
590
|
// }
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"pessimisticLockNotAcquired": "The row is being edited by the user {lockXUser} from {lockDate}\nDo you still want to edit the row? (The choice Cancel will open the form in read only mode).",
|
|
21
21
|
"optimisticLockFailed": "Someone else has changed the row during the editation. Sorry, you have to cancel the editation and start the editation again.",
|
|
22
22
|
"formRemoveRowConfirm": "Are you sure to remove the row?",
|
|
23
|
+
"xIsNotNull": "Is not null",
|
|
24
|
+
"xIsNull": "Is null",
|
|
23
25
|
"xAutoComplete": "Autocomplete",
|
|
24
26
|
"expRowCount": "Row count",
|
|
25
27
|
"expExportType": "Export type",
|
|
@@ -14,6 +14,8 @@ export interface XCustomFilterItem {
|
|
|
14
14
|
}
|
|
15
15
|
export type XCustomFilter = XCustomFilterItem | XCustomFilterItem[];
|
|
16
16
|
export declare enum XFilterMatchMode {
|
|
17
|
+
X_IS_NOT_NULL = "isNotNull",
|
|
18
|
+
X_IS_NULL = "isNull",
|
|
17
19
|
X_AUTO_COMPLETE = "xAutoComplete",
|
|
18
20
|
X_FILTER_ELEMENT = "xFilterElement"
|
|
19
21
|
}
|
|
@@ -11,6 +11,8 @@ var ResultType;
|
|
|
11
11
|
// additional match modes (extension to primereact enum FilterMatchMode)
|
|
12
12
|
var XFilterMatchMode;
|
|
13
13
|
(function (XFilterMatchMode) {
|
|
14
|
+
XFilterMatchMode["X_IS_NOT_NULL"] = "isNotNull";
|
|
15
|
+
XFilterMatchMode["X_IS_NULL"] = "isNull";
|
|
14
16
|
XFilterMatchMode["X_AUTO_COMPLETE"] = "xAutoComplete";
|
|
15
17
|
XFilterMatchMode["X_FILTER_ELEMENT"] = "xFilterElement"; // custom filter element (defined in filterElement property)
|
|
16
18
|
})(XFilterMatchMode || (exports.XFilterMatchMode = XFilterMatchMode = {}));
|