ods-component-lib 1.18.102 → 1.18.103

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 (31) hide show
  1. package/dist/components/devextreme/OdsBasicDataGrid/OdsBasicDataGrid.Constant.d.ts +17 -0
  2. package/dist/components/devextreme/OdsBasicDataGrid/OdsBasicDataGrid.Constants.d.ts +17 -0
  3. package/dist/components/devextreme/OdsBasicDataGrid/OdsBasicDataGrid.Functions.d.ts +11 -0
  4. package/dist/components/devextreme/OdsBasicDataGrid/OdsBasicDataGrid.Types.d.ts +99 -0
  5. package/dist/components/devextreme/OdsBasicDataGrid/OdsBasicDataGrid.d.ts +5 -0
  6. package/dist/index.css +23 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +1162 -36
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.modern.js +1163 -38
  11. package/dist/index.modern.js.map +1 -1
  12. package/package.json +1 -1
  13. package/dist/components/antd/form/OdsBasicForm.d.ts +0 -18
  14. package/dist/components/antd/icon/OdsIcon.d.ts +0 -10
  15. package/dist/components/antd/modal/OdsAdvanceModal.d.ts +0 -7
  16. package/dist/components/antd/select/OdsCustomMultiSelect.d.ts +0 -7
  17. package/dist/components/antd/select/OdsMultiSelect.d.ts +0 -9
  18. package/dist/components/custom/OdsLogin.d.ts +0 -8
  19. package/dist/components/devextreme/DxDataPopupForm.d.ts +0 -3
  20. package/dist/components/devextreme/DynamicIcon.d.ts +0 -5
  21. package/dist/components/devextreme/OdsDataGridNew.d.ts +0 -56
  22. package/dist/components/devextreme/OdsProfDataGrid.d.ts +0 -3
  23. package/dist/components/devextreme/treeview/DxTreeView.d.ts +0 -3
  24. package/dist/stories/OdsAdvanceModal/OdsAdvanceModal.stories.d.ts +0 -42
  25. package/dist/stories/OdsAdvanceModal/Samples/BasicOdsAdvanceModal.sample.d.ts +0 -8
  26. package/dist/stories/OdsCustomMultiSelect/OdsCustomMultiSelect.stories.d.ts +0 -9
  27. package/dist/stories/OdsCustomMultiSelect/Samples/Basic.Sample.d.ts +0 -1
  28. package/dist/stories/OdsCustomMultiSelect/Samples/ModeMultiple.Sample.d.ts +0 -1
  29. package/dist/stories/OdsModal/Samples/OdsModal.Sample.d.ts +0 -1
  30. package/dist/stories/OdsTimePicker/Samples/TimeRangePicker.d.ts +0 -2
  31. package/dist/utils/DynamicIcon.d.ts +0 -5
@@ -16,7 +16,7 @@ import jsPDF from 'jspdf';
16
16
  import { Workbook } from 'exceljs';
17
17
  import { saveAs } from 'file-saver-es';
18
18
  import moment from 'moment';
19
- import { GridIcon, ChevronDownIcon, UpArrow5Icon, DownArrow5Icon, Loop1Icon, EditIcon, Trash1Icon, CopyIcon, DiscountIcon, KebabMenuIcon, RefreshIcon, LinkBreakIcon, FloppyDiskIcon, Discount2Icon } from 'ods-icon/react/24/outline';
19
+ import { GridIcon, ChevronDownIcon, UpArrow5Icon, DownArrow5Icon, Loop1Icon, KebabMenuIcon, EditIcon, Trash1Icon, CopyIcon, DiscountIcon, RefreshIcon, LinkBreakIcon, FloppyDiskIcon, Discount2Icon } from 'ods-icon/react/24/outline';
20
20
  import { TreeList, Lookup } from 'devextreme-react';
21
21
 
22
22
  function _extends() {
@@ -33628,27 +33628,6 @@ var queryString = {
33628
33628
  stringify: stringify
33629
33629
  };
33630
33630
 
33631
- var iconComponents = {
33632
- edit: EditIcon,
33633
- "delete": Trash1Icon,
33634
- copy: CopyIcon,
33635
- discount: DiscountIcon,
33636
- kebabMenu: KebabMenuIcon,
33637
- refresh: RefreshIcon,
33638
- unmap: LinkBreakIcon,
33639
- save: FloppyDiskIcon,
33640
- cancel: Loop1Icon,
33641
- discount2Icon: Discount2Icon
33642
- };
33643
- var DynamicIcon = function DynamicIcon(_ref) {
33644
- var iconName = _ref.iconName;
33645
- var IconComponent = iconComponents[iconName];
33646
- if (!IconComponent) {
33647
- return null;
33648
- }
33649
- return React.createElement(IconComponent, null);
33650
- };
33651
-
33652
33631
  var _excluded$4 = ["children", "visible"];
33653
33632
  function OdsDataGrdiRowButton(_ref) {
33654
33633
  var children = _ref.children,
@@ -33765,7 +33744,7 @@ var onCancelEditEvent = new CustomEvent("cancelEdit", {
33765
33744
  });
33766
33745
 
33767
33746
  var useToken$2 = theme.useToken;
33768
- var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
33747
+ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33769
33748
  var _props$axiosRequest4, _props$axiosRequest5, _props$axiosRequest6, _props$axiosRequest7, _props$axiosRequest8, _props$axiosRequest9, _props$axiosRequest10, _props$axiosRequest11, _props$selectOptions, _props$selectOptions$, _props$selectOptions2, _props$selectOptions$2, _props$selectOptions3;
33770
33749
  var keyExpr = props.keyExpr,
33771
33750
  hasFastUpdate = props.hasFastUpdate,
@@ -33883,7 +33862,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
33883
33862
  if (contentReady) checkSortingPropertyForInitilaize();
33884
33863
  }, [contentReady]);
33885
33864
  useEffect(function () {
33886
- var cssRules = "\n .data-exists .dx-datagrid-borders > .dx-datagrid-filter-panel,\n .data-exists .dx-datagrid-borders > .dx-datagrid-headers {\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n padding-right: 0px !important;\n }\n \n .data-exists .dx-datagrid-headers .dx-datagrid-content {\n margin-bottom: -1px;\n padding-right: 17px !important;\n }\n ";
33865
+ var cssRules = "\n .data-exists .dx-datagrid-borders > .dx-datagrid-filter-panel,\n .data-exists .dx-datagrid-borders > .dx-datagrid-headers {\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n padding-right: 0px !important;\n }\n \n .data-exists .dx-datagrid-headers .dx-datagrid-content {\n margin-bottom: -1px;\n padding-right: 17px !important;\n }\n ";
33887
33866
  var styleSheet = document.createElement("style");
33888
33867
  styleSheet.type = "text/css";
33889
33868
  styleSheet.innerText = cssRules;
@@ -34304,9 +34283,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34304
34283
  function actionCellRender(cellData, props) {
34305
34284
  var kebabMenuButtons = props.actionButtonGroup && props.actionButtonGroup.length >= 2 && !props.edit ? props.actionButtonGroup.slice(2).map(function (button) {
34306
34285
  return {
34307
- icon: React.createElement(DynamicIcon, {
34308
- iconName: button.icon
34309
- }),
34286
+ icon: button.icon,
34310
34287
  onClick: function onClick(event) {
34311
34288
  var customEvent = {
34312
34289
  column: cellData.column,
@@ -34335,9 +34312,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34335
34312
  size: "small",
34336
34313
  type: "text",
34337
34314
  disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
34338
- icon: React.createElement(DynamicIcon, {
34339
- iconName: buttonItem.icon
34340
- }),
34315
+ icon: buttonItem.icon,
34341
34316
  onClick: function onClick(event) {
34342
34317
  var customEvent = {
34343
34318
  column: cellData.column,
@@ -34367,9 +34342,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34367
34342
  size: "small",
34368
34343
  type: "text",
34369
34344
  disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
34370
- icon: React.createElement(DynamicIcon, {
34371
- iconName: buttonItem.icon
34372
- }),
34345
+ icon: buttonItem.icon,
34373
34346
  onClick: function onClick(event) {
34374
34347
  if (buttonItem.onClick) {
34375
34348
  var customEvent = {
@@ -34392,9 +34365,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34392
34365
  menuItems: kebabMenuButtons
34393
34366
  }, React.createElement(OdsDataGrdiRowButton, {
34394
34367
  type: "text",
34395
- icon: React.createElement(DynamicIcon, {
34396
- iconName: "kebabMenu"
34397
- })
34368
+ icon: React.createElement(KebabMenuIcon, null)
34398
34369
  })));
34399
34370
  }
34400
34371
  return React.createElement(React.Fragment, null, buttonElements);
@@ -34567,7 +34538,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34567
34538
  };
34568
34539
  var detailGrid = function detailGrid(_ref) {
34569
34540
  var data = _ref.data;
34570
- return React.createElement(OdsRemoteDataGrid, Object.assign({}, props, {
34541
+ return React.createElement(OdsBasicDataGrid, Object.assign({}, props, {
34571
34542
  showMasterDetail: false,
34572
34543
  columns: props.detailGridColums,
34573
34544
  dataSource: props.detailData[data.key.ID]
@@ -34801,5 +34772,1159 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34801
34772
  })));
34802
34773
  };
34803
34774
 
34804
- export { DxTreeList, OdsAlert, OdsAutoComplete, OdsBadge, OdsBadgeRibbon, OdsBannerAlert, OdsBasicTable, OdsButton, OdsCalendar, OdsCard, OdsCheckbox, OdsCheckboxGroup, OdsCollapse, OdsDataGrid, OdsDateRangePicker, OdsDatepicker, OdsDisplayGrid, OdsDivider, OdsDropdown, OdsDropdownButton, OdsFileUpload, OdsFilter, OdsFilterTagView, OdsImage, OdsInput, OdsInputNumber, OdsLink, OdsList, OdsModal, OdsModalOld, OdsMultiSelect, OdsNotification, OdsParagraph, OdsPassword, OdsPhoneInput, OdsRadio, OdsRadioGroup, OdsRangeTimepicker, OdsRate, OdsRemoteDataGrid, OdsSearch, OdsSelect, OdsSelectableTable, OdsSpin, OdsSwitch, OdsTab, OdsBasicTable as OdsTable, OdsTag, OdsText, OdsTextArea, OdsTimeline, OdsTimepicker, OdsTitle };
34775
+ var iconComponents = {
34776
+ edit: EditIcon,
34777
+ "delete": Trash1Icon,
34778
+ copy: CopyIcon,
34779
+ discount: DiscountIcon,
34780
+ kebabMenu: KebabMenuIcon,
34781
+ refresh: RefreshIcon,
34782
+ unmap: LinkBreakIcon,
34783
+ save: FloppyDiskIcon,
34784
+ cancel: Loop1Icon,
34785
+ discount2Icon: Discount2Icon
34786
+ };
34787
+ var DynamicIcon = function DynamicIcon(_ref) {
34788
+ var iconName = _ref.iconName;
34789
+ var IconComponent = iconComponents[iconName];
34790
+ if (!IconComponent) {
34791
+ return null;
34792
+ }
34793
+ return React.createElement(IconComponent, null);
34794
+ };
34795
+
34796
+ var checkCellSelectionConstraints$1 = function checkCellSelectionConstraints(e) {
34797
+ return e.rowType == "data" && e.columnIndex > -1 && e.rowIndex > -1;
34798
+ };
34799
+ var cellAlreadySelected$1 = function cellAlreadySelected(pkValue, dataField, cellInfos) {
34800
+ return cellInfos.some(function (cell) {
34801
+ return cell.pkValue == pkValue && cell.dataField == dataField;
34802
+ });
34803
+ };
34804
+ var getRequestHeaders$1 = function getRequestHeaders(props) {
34805
+ return new Headers({
34806
+ "Content-Type": "application/json",
34807
+ Authorization: "Bearer " + (props.axiosRequest ? props.axiosRequest.token : ""),
34808
+ "Accept-Language": props.language != "" ? props.language : "EN"
34809
+ });
34810
+ };
34811
+ var concatFilteredLabel$1 = function concatFilteredLabel(result, totalloaded, filteredRowCount, filterApplied, props) {
34812
+ if (filteredRowCount > 0 && totalloaded !== filteredRowCount && filterApplied) {
34813
+ var filteredLabel = filteredRowCount + " " + props.customSummary.summaryFilteredDataLabel + "- ";
34814
+ result = filteredLabel + " " + result + " ";
34815
+ }
34816
+ return result;
34817
+ };
34818
+ var showSummaryItems$1 = function showSummaryItems(props) {
34819
+ var _props$customSummary, _props$customSummary2, _props$customSummary3, _props$customSummary4, _props$customSummary5;
34820
+ return ((_props$customSummary = props.customSummary) === null || _props$customSummary === void 0 ? void 0 : _props$customSummary.showAvgInSummary) || ((_props$customSummary2 = props.customSummary) === null || _props$customSummary2 === void 0 ? void 0 : _props$customSummary2.showCountInSummary) || ((_props$customSummary3 = props.customSummary) === null || _props$customSummary3 === void 0 ? void 0 : _props$customSummary3.showMaxInSummary) || ((_props$customSummary4 = props.customSummary) === null || _props$customSummary4 === void 0 ? void 0 : _props$customSummary4.showMinInSummary) || ((_props$customSummary5 = props.customSummary) === null || _props$customSummary5 === void 0 ? void 0 : _props$customSummary5.showSumInSummary);
34821
+ };
34822
+ var getSummaryItems$1 = function getSummaryItems(props, columns, grid, isMultiLevelColumn) {
34823
+ if (isMultiLevelColumn === void 0) {
34824
+ isMultiLevelColumn = false;
34825
+ }
34826
+ var totalItems = [];
34827
+ columns.map(function (col, _index) {
34828
+ if (col.multiLevelColumns && col.multiLevelColumns.length > 0) {
34829
+ totalItems = [].concat(totalItems, getSummaryItems(props, col.multiLevelColumns, grid, true));
34830
+ } else {
34831
+ var _props$customSummary6, _props$customSummary7, _props$customSummary8, _props$customSummary9, _props$customSummary10, _props$customSummary11, _props$customSummary12, _props$customSummary13, _props$customSummary14, _props$customSummary15;
34832
+ var colOption = grid.columnOption(col.dataField);
34833
+ if (!colOption) {
34834
+ return col;
34835
+ }
34836
+ ((_props$customSummary6 = props.customSummary) === null || _props$customSummary6 === void 0 ? void 0 : _props$customSummary6.showAvgInSummary) && totalItems.push(getSummaryItem$1(col, colOption.visibleIndex, "avg", isMultiLevelColumn, (_props$customSummary7 = props.customSummary) === null || _props$customSummary7 === void 0 ? void 0 : _props$customSummary7.summaryAvgLabel));
34837
+ ((_props$customSummary8 = props.customSummary) === null || _props$customSummary8 === void 0 ? void 0 : _props$customSummary8.showCountInSummary) && totalItems.push(getSummaryItem$1(col, colOption.visibleIndex, "count", isMultiLevelColumn, (_props$customSummary9 = props.customSummary) === null || _props$customSummary9 === void 0 ? void 0 : _props$customSummary9.summaryCountLabel));
34838
+ ((_props$customSummary10 = props.customSummary) === null || _props$customSummary10 === void 0 ? void 0 : _props$customSummary10.showMaxInSummary) && totalItems.push(getSummaryItem$1(col, colOption.visibleIndex, "max", isMultiLevelColumn, (_props$customSummary11 = props.customSummary) === null || _props$customSummary11 === void 0 ? void 0 : _props$customSummary11.summaryMaxLabel));
34839
+ ((_props$customSummary12 = props.customSummary) === null || _props$customSummary12 === void 0 ? void 0 : _props$customSummary12.showMinInSummary) && totalItems.push(getSummaryItem$1(col, colOption.visibleIndex, "min", isMultiLevelColumn, (_props$customSummary13 = props.customSummary) === null || _props$customSummary13 === void 0 ? void 0 : _props$customSummary13.summaryMinLabel));
34840
+ ((_props$customSummary14 = props.customSummary) === null || _props$customSummary14 === void 0 ? void 0 : _props$customSummary14.showSumInSummary) && totalItems.push(getSummaryItem$1(col, colOption.visibleIndex, "sum", isMultiLevelColumn, (_props$customSummary15 = props.customSummary) === null || _props$customSummary15 === void 0 ? void 0 : _props$customSummary15.summarySumLabel));
34841
+ }
34842
+ return col;
34843
+ });
34844
+ return totalItems;
34845
+ };
34846
+ var getSummaryItem$1 = function getSummaryItem(col, visibleIndex, summaryType, isMultiLevelColumn, label) {
34847
+ if (!isMultiLevelColumn && visibleIndex == 0) {
34848
+ return React.createElement(TotalItem, {
34849
+ column: col.dataField,
34850
+ summaryType: "custom",
34851
+ cssClass: "grid-summary-row-label",
34852
+ customizeText: function customizeText(_itemInfo) {
34853
+ return label;
34854
+ }
34855
+ });
34856
+ }
34857
+ if (col.dataType != "number") {
34858
+ return React.createElement("div", null);
34859
+ }
34860
+ return React.createElement(TotalItem, {
34861
+ column: col.dataField,
34862
+ summaryType: summaryType,
34863
+ cssClass: "grid-summary-row-data",
34864
+ customizeText: function customizeText(itemInfo) {
34865
+ return Number(itemInfo.value).toFixed(2);
34866
+ }
34867
+ });
34868
+ };
34869
+ var getMultiLevelColumns$1 = function getMultiLevelColumns(col) {
34870
+ return col.multiLevelColumns && col.multiLevelColumns.map(function (colItem) {
34871
+ return React.createElement(Column, Object.assign({
34872
+ width: 80
34873
+ }, colItem), getMultiLevelColumns(colItem));
34874
+ });
34875
+ };
34876
+
34877
+ var constants$1 = {
34878
+ totalPageCount: 1,
34879
+ loadedPageCount: 1,
34880
+ totalRecordCount: 0,
34881
+ exportFormats: ["xlsx"],
34882
+ selectedCellBgColor: "#c1f9b8",
34883
+ allowedDataTypesForMultiCellEditing: ["number"]
34884
+ };
34885
+ var onCancelEditEvent$1 = new CustomEvent("cancelEdit", {
34886
+ bubbles: true,
34887
+ detail: {
34888
+ rowData: null
34889
+ }
34890
+ });
34891
+
34892
+ var useToken$3 = theme.useToken;
34893
+ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
34894
+ var _props$axiosRequest4, _props$axiosRequest5, _props$axiosRequest6, _props$axiosRequest7, _props$axiosRequest8, _props$axiosRequest9, _props$axiosRequest10, _props$axiosRequest11, _props$selectOptions, _props$selectOptions$, _props$selectOptions2, _props$selectOptions$2, _props$selectOptions3;
34895
+ var keyExpr = props.keyExpr,
34896
+ hasFastUpdate = props.hasFastUpdate,
34897
+ fastUpdateButtonText = props.fastUpdateButtonText,
34898
+ fastUpdateModalTitle = props.fastUpdateModalTitle,
34899
+ fastUpdateModalCancelText = props.fastUpdateModalCancelText,
34900
+ fastUpdateModalSaveText = props.fastUpdateModalSaveText,
34901
+ fastUpdateFormRequiredFieldMessage = props.fastUpdateFormRequiredFieldMessage,
34902
+ onCellClick = props.onCellClick,
34903
+ onCellHoverChanged = props.onCellHoverChanged,
34904
+ onFastUpdateButtonClick = props.onFastUpdateButtonClick,
34905
+ onFastUpdateFinish = props.onFastUpdateFinish,
34906
+ onFastUpdateCancel = props.onFastUpdateCancel,
34907
+ onFastUpdateFailed = props.onFastUpdateFailed;
34908
+ var _useToken = useToken$3(),
34909
+ token = _useToken.token;
34910
+ var _AntForm$useForm = Form$1.useForm(),
34911
+ fastUpdateForm = _AntForm$useForm[0];
34912
+ var gridRef = useRef(null);
34913
+ var filterApplied = useRef(false);
34914
+ var pkName = keyExpr && keyExpr.toString();
34915
+ var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
34916
+ var _useState = useState(false),
34917
+ render = _useState[0],
34918
+ rerender = _useState[1];
34919
+ var _useState2 = useState(props.columns),
34920
+ gridColumns = _useState2[0],
34921
+ setGridColumns = _useState2[1];
34922
+ var _useState3 = useState(false),
34923
+ loading = _useState3[0],
34924
+ setLoading = _useState3[1];
34925
+ var _useState4 = useState([]),
34926
+ data = _useState4[0],
34927
+ setData = _useState4[1];
34928
+ var _useState5 = useState(0),
34929
+ filteredRowCount = _useState5[0],
34930
+ setFilteredRowCount = _useState5[1];
34931
+ var _useState6 = useState(false),
34932
+ isFastUpdateModalOpen = _useState6[0],
34933
+ setIsFastUpdateModalOpen = _useState6[1];
34934
+ var _useState7 = useState([]),
34935
+ selectedCells = _useState7[0],
34936
+ setSelectedCells = _useState7[1];
34937
+ var _useState8 = useState([]),
34938
+ hoveredCells = _useState8[0],
34939
+ setHoveredCells = _useState8[1];
34940
+ var _useState9 = useState([]),
34941
+ ctrlSelectedCells = _useState9[0],
34942
+ setCtrlSelectedCells = _useState9[1];
34943
+ var _useState10 = useState(false),
34944
+ ctrlSelection = _useState10[0],
34945
+ setCtrlSelection = _useState10[1];
34946
+ var _useState11 = useState(false),
34947
+ contentReady = _useState11[0],
34948
+ setContentReady = _useState11[1];
34949
+ var _useState12 = useState(0),
34950
+ scrollPosition = _useState12[0],
34951
+ setScrollPosition = _useState12[1];
34952
+ useEffect(function () {
34953
+ constants$1.totalPageCount = 1;
34954
+ constants$1.loadedPageCount = 1;
34955
+ constants$1.totalRecordCount = 0;
34956
+ }, [props.dataGridPageName]);
34957
+ useEffect(function () {
34958
+ var _props$axiosRequest, _props$axiosRequest2, _props$axiosRequest3;
34959
+ if (props.axiosRequest !== undefined && ((_props$axiosRequest = props.axiosRequest) !== null && _props$axiosRequest !== void 0 && _props$axiosRequest.requestData && Object.keys((_props$axiosRequest2 = props.axiosRequest) === null || _props$axiosRequest2 === void 0 ? void 0 : _props$axiosRequest2.requestData).length > 0 || (_props$axiosRequest3 = props.axiosRequest) !== null && _props$axiosRequest3 !== void 0 && _props$axiosRequest3.requestQueryString)) {
34960
+ constants$1.totalPageCount = 1;
34961
+ constants$1.loadedPageCount = 1;
34962
+ constants$1.totalRecordCount = 0;
34963
+ setData([]);
34964
+ fetchData();
34965
+ }
34966
+ }, [(_props$axiosRequest4 = props.axiosRequest) === null || _props$axiosRequest4 === void 0 ? void 0 : _props$axiosRequest4.requestData, (_props$axiosRequest5 = props.axiosRequest) === null || _props$axiosRequest5 === void 0 ? void 0 : _props$axiosRequest5.requestQueryString]);
34967
+ useEffect(function () {
34968
+ if (props.columns !== undefined && props.columns.length > 0) {
34969
+ var newColumns = props.columns.map(function (colItem) {
34970
+ if (colItem.tooltip !== undefined && colItem.tooltip.enable) {
34971
+ var headerCellRenderr = function headerCellRenderr() {
34972
+ return React.createElement("div", null, React.createElement("span", null, colItem.caption), React.createElement(Tooltip, {
34973
+ title: colItem.tooltip.title
34974
+ }, React.createElement(InfoCircleOutlined, {
34975
+ style: {
34976
+ marginLeft: 5
34977
+ }
34978
+ })));
34979
+ };
34980
+ colItem.headerCellRender = headerCellRenderr;
34981
+ }
34982
+ if (props.isServerSide) colItem.calculateSortValue = String("dummyFieldForPreventClientSideSorting");
34983
+ return colItem;
34984
+ });
34985
+ setGridColumns(newColumns);
34986
+ }
34987
+ }, [props.columns]);
34988
+ useEffect(function () {
34989
+ rerender(!render);
34990
+ }, [gridColumns]);
34991
+ useEffect(function () {
34992
+ if (Array.isArray(props.dataSource)) {
34993
+ setData(props.dataSource);
34994
+ }
34995
+ }, [props.dataSource]);
34996
+ useEffect(function () {
34997
+ locale(localStorage.getItem("locale"));
34998
+ loadMessages(JSON.parse(localStorage.getItem("localTranslation")));
34999
+ if (gridRef.current) {
35000
+ gridRef.current.instance.updateDimensions();
35001
+ }
35002
+ hasFastUpdate && document.addEventListener("keydown", keydownEvent);
35003
+ return function () {
35004
+ hasFastUpdate && document.removeEventListener("keydown", keydownEvent);
35005
+ };
35006
+ }, []);
35007
+ useEffect(function () {
35008
+ if (contentReady) checkSortingPropertyForInitilaize();
35009
+ }, [contentReady]);
35010
+ useEffect(function () {
35011
+ var cssRules = "\n .data-exists .dx-datagrid-borders > .dx-datagrid-filter-panel,\n .data-exists .dx-datagrid-borders > .dx-datagrid-headers {\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n padding-right: 0px !important;\n }\n \n .data-exists .dx-datagrid-headers .dx-datagrid-content {\n margin-bottom: -1px;\n padding-right: 17px !important;\n }\n ";
35012
+ var styleSheet = document.createElement("style");
35013
+ styleSheet.type = "text/css";
35014
+ styleSheet.innerText = cssRules;
35015
+ document.head.appendChild(styleSheet);
35016
+ var checkData = function checkData() {
35017
+ if (gridRef.current) {
35018
+ var _dataGridInstance = gridRef.current.instance;
35019
+ var dataExists = data.length >= 15;
35020
+ var gridElement = _dataGridInstance.element();
35021
+ if (dataExists) {
35022
+ gridElement.classList.add("data-exists");
35023
+ } else {
35024
+ gridElement.classList.remove("data-exists");
35025
+ }
35026
+ }
35027
+ };
35028
+ var dataGridInstance = gridRef.current.instance;
35029
+ dataGridInstance.on("dataChanged", checkData);
35030
+ checkData();
35031
+ return function () {
35032
+ document.head.removeChild(styleSheet);
35033
+ dataGridInstance.off("dataChanged", checkData);
35034
+ };
35035
+ }, [data]);
35036
+ var checkSortingPropertyForInitilaize = function checkSortingPropertyForInitilaize() {
35037
+ var onOptionChanged = props.onOptionChanged;
35038
+ if (onOptionChanged) {
35039
+ var dataGridInstance = gridRef.current.instance;
35040
+ var sortingState = dataGridInstance.getVisibleColumns().filter(function (p) {
35041
+ return !p.command;
35042
+ }).map(function (column, index) {
35043
+ return {
35044
+ index: index,
35045
+ dataField: column.dataField,
35046
+ sortOrder: column.sortOrder
35047
+ };
35048
+ });
35049
+ var sortedColumn = sortingState.find(function (column) {
35050
+ return column.sortOrder !== undefined;
35051
+ });
35052
+ if (sortedColumn) {
35053
+ if (sortedColumn.sortOrder) {
35054
+ dataGridInstance.option("columns[" + sortedColumn.index + "].sortOrder", sortedColumn.sortOrder);
35055
+ var fullName = "columns[" + sortedColumn.index + "].sortOrder";
35056
+ var gridEvent = {
35057
+ component: dataGridInstance,
35058
+ fullName: fullName,
35059
+ name: "optionChanged",
35060
+ value: sortedColumn.sortOrder,
35061
+ previousValue: null,
35062
+ element: null
35063
+ };
35064
+ onOptionChanged(gridEvent);
35065
+ }
35066
+ }
35067
+ }
35068
+ };
35069
+ var checkRequestDataHasOnlySortingProperty = function checkRequestDataHasOnlySortingProperty(obj) {
35070
+ var keys = Object.keys(obj);
35071
+ return keys.length === 1 && keys[0] === "Sorting";
35072
+ };
35073
+ useEffect(function () {
35074
+ var gridElement = gridRef.current.instance.element();
35075
+ gridElement.scrollTop = scrollPosition;
35076
+ document.querySelectorAll(".dx-scrollable-container").forEach(function (container) {
35077
+ container.addEventListener("scrollend", handleScroll);
35078
+ });
35079
+ return function () {
35080
+ document.querySelectorAll(".dx-scrollable-container").forEach(function (container) {
35081
+ container.removeEventListener("scrollend", handleScroll);
35082
+ });
35083
+ };
35084
+ }, [data.length]);
35085
+ var keydownEvent = function keydownEvent(e) {
35086
+ switch (e.key) {
35087
+ case "Escape":
35088
+ {
35089
+ clearSelectedCells();
35090
+ }
35091
+ break;
35092
+ }
35093
+ };
35094
+ var clearSelectedCells = function clearSelectedCells() {
35095
+ setSelectedCells([]);
35096
+ };
35097
+ var singleSelect = function singleSelect(pkValue, dataField) {
35098
+ runSetSelectedCells([{
35099
+ dataField: dataField,
35100
+ pkValue: pkValue
35101
+ }]);
35102
+ };
35103
+ var multipleSelect = function multipleSelect(cells) {
35104
+ if (cells.length == 0) {
35105
+ return;
35106
+ }
35107
+ var _cells = [];
35108
+ var _loop = function _loop() {
35109
+ var element = cells[index];
35110
+ if (!_cells.some(function (cell) {
35111
+ return cell.colIndex == element.colIndex && cell.rowIndex == element.rowIndex;
35112
+ })) {
35113
+ _cells.push({
35114
+ colIndex: element.colIndex,
35115
+ rowIndex: element.rowIndex
35116
+ });
35117
+ }
35118
+ };
35119
+ for (var index = 0; index < cells.length; index++) {
35120
+ _loop();
35121
+ }
35122
+ var result = [];
35123
+ var maxColIndex = Math.max.apply(null, _cells.map(function (item) {
35124
+ return item.colIndex;
35125
+ }));
35126
+ var minColIndex = Math.min.apply(null, _cells.map(function (item) {
35127
+ return item.colIndex;
35128
+ }));
35129
+ var maxRowIndex = Math.max.apply(null, _cells.map(function (item) {
35130
+ return item.rowIndex;
35131
+ }));
35132
+ var minRowIndex = Math.min.apply(null, _cells.map(function (item) {
35133
+ return item.rowIndex;
35134
+ }));
35135
+ for (var rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
35136
+ var _loop2 = function _loop2() {
35137
+ var _column = gridRef.current.instance.columnOption(colIndex);
35138
+ if (constants$1.allowedDataTypesForMultiCellEditing.some(function (item) {
35139
+ return item.toLocaleLowerCase() == _column.dataType.toLocaleLowerCase();
35140
+ })) {
35141
+ result.push({
35142
+ dataField: _column.dataField,
35143
+ pkValue: gridRef.current.instance.cellValue(rowIndex, pkName)
35144
+ });
35145
+ }
35146
+ };
35147
+ for (var colIndex = minColIndex; colIndex <= maxColIndex; colIndex++) {
35148
+ _loop2();
35149
+ }
35150
+ }
35151
+ runSetSelectedCells(result);
35152
+ setHoveredCells([]);
35153
+ setCtrlSelectedCells([]);
35154
+ };
35155
+ var runSetSelectedCells = function runSetSelectedCells(value) {
35156
+ var removeDuplicates = function removeDuplicates(oldValues) {
35157
+ var result = [];
35158
+ var _loop3 = function _loop3() {
35159
+ var element = value[index];
35160
+ if (element.pkValue && !oldValues.some(function (cell) {
35161
+ return cell.dataField == element.dataField && cell.pkValue == element.pkValue;
35162
+ })) {
35163
+ result.push({
35164
+ dataField: element.dataField,
35165
+ pkValue: element.pkValue
35166
+ });
35167
+ }
35168
+ };
35169
+ for (var index = 0; index < value.length; index++) {
35170
+ _loop3();
35171
+ }
35172
+ return result;
35173
+ };
35174
+ setSelectedCells(function (prev) {
35175
+ return [].concat(prev, removeDuplicates(prev));
35176
+ });
35177
+ };
35178
+ var removeSelectedCell = function removeSelectedCell(rowIndex, colIndex) {
35179
+ var dataField = gridRef.current.instance.columnOption(colIndex).dataField;
35180
+ var pkValue = gridRef.current.instance.cellValue(rowIndex, pkName);
35181
+ setSelectedCells(function (prev) {
35182
+ return prev.filter(function (cell) {
35183
+ return !(cell.dataField == dataField && cell.pkValue == pkValue);
35184
+ });
35185
+ });
35186
+ };
35187
+ var closeModal = function closeModal() {
35188
+ setIsFastUpdateModalOpen(false);
35189
+ clearSelectedCells();
35190
+ fastUpdateForm.resetFields();
35191
+ };
35192
+ var actionButtons = useMemo(function () {
35193
+ if (props.actionButtonGroup) {
35194
+ if (props.actionButtonGroup.length >= 2 && !props.edit) {
35195
+ return props.actionButtonGroup.slice(0, 2);
35196
+ } else {
35197
+ return props.actionButtonGroup;
35198
+ }
35199
+ } else {
35200
+ return [];
35201
+ }
35202
+ }, [props.actionButtonGroup]);
35203
+ var fetchData = useCallback(function () {
35204
+ try {
35205
+ if (props.axiosRequest == undefined) return Promise.resolve();
35206
+ return Promise.resolve(function () {
35207
+ if (props.isServerSide) {
35208
+ var _props$axiosRequest$r;
35209
+ if (props.axiosRequest.requestData && checkRequestDataHasOnlySortingProperty(props.axiosRequest.requestData)) return;
35210
+ var apiUrl = props.axiosRequest.environmentUrl + "" + props.axiosRequest.apiUrl;
35211
+ if (((_props$axiosRequest$r = props.axiosRequest.requestData) === null || _props$axiosRequest$r === void 0 ? void 0 : _props$axiosRequest$r.PaginatedRequest) !== undefined) {
35212
+ props.axiosRequest.requestData.PaginatedRequest.PageNumber = constants$1.loadedPageCount;
35213
+ props.axiosRequest.requestData.PaginatedRequest.PageSize = props.pageSize;
35214
+ }
35215
+ if (props.axiosRequest.requestQueryString !== undefined) {
35216
+ props.axiosRequest.requestQueryString.maxResultCount = props.pageSize;
35217
+ if (constants$1.loadedPageCount > 1 && constants$1.totalPageCount >= constants$1.loadedPageCount) {
35218
+ props.axiosRequest.requestQueryString.skipCount = ((constants$1.loadedPageCount - 1) * props.pageSize).toString();
35219
+ }
35220
+ var query = queryString.stringify(props.axiosRequest.requestQueryString);
35221
+ apiUrl = apiUrl + "?" + query;
35222
+ }
35223
+ var requestOptions = {
35224
+ method: props.axiosRequest.requestType,
35225
+ headers: getRequestHeaders$1(props),
35226
+ body: JSON.stringify(props.axiosRequest.requestData)
35227
+ };
35228
+ var _temp = _finallyRethrows(function () {
35229
+ return _catch(function () {
35230
+ setLoading(true);
35231
+ return Promise.resolve(fetch(apiUrl, requestOptions)).then(function (response) {
35232
+ return Promise.resolve(response.json()).then(function (newData) {
35233
+ if (constants$1.loadedPageCount == 1) {
35234
+ setData(newData.Data ? newData.Data : newData);
35235
+ constants$1.loadedPageCount = 1;
35236
+ } else if (constants$1.totalPageCount >= constants$1.loadedPageCount) {
35237
+ var newArray = newData.Data ? newData.Data : newData;
35238
+ setData(function (prevData) {
35239
+ return [].concat(prevData, newArray);
35240
+ });
35241
+ }
35242
+ getTotalCount(response, newData);
35243
+ });
35244
+ });
35245
+ }, function (error) {
35246
+ console.error("Error fetching data:", error);
35247
+ setLoading(false);
35248
+ });
35249
+ }, function (_wasThrown, _result) {
35250
+ if (_wasThrown) throw _result;
35251
+ return _result;
35252
+ });
35253
+ if (_temp && _temp.then) return _temp.then(function () {});
35254
+ }
35255
+ }());
35256
+ } catch (e) {
35257
+ return Promise.reject(e);
35258
+ }
35259
+ }, [(_props$axiosRequest6 = props.axiosRequest) === null || _props$axiosRequest6 === void 0 ? void 0 : _props$axiosRequest6.requestData, (_props$axiosRequest7 = props.axiosRequest) === null || _props$axiosRequest7 === void 0 ? void 0 : _props$axiosRequest7.apiUrl, (_props$axiosRequest8 = props.axiosRequest) === null || _props$axiosRequest8 === void 0 ? void 0 : _props$axiosRequest8.environmentUrl, (_props$axiosRequest9 = props.axiosRequest) === null || _props$axiosRequest9 === void 0 ? void 0 : _props$axiosRequest9.requestQueryString, (_props$axiosRequest10 = props.axiosRequest) === null || _props$axiosRequest10 === void 0 ? void 0 : _props$axiosRequest10.requestType, props.pageSize, props.isServerSide]);
35260
+ var getTotalCount = function getTotalCount(response, data) {
35261
+ if (data !== null && data !== void 0 && data.PageCount || data !== null && data !== void 0 && data.RowCount) {
35262
+ constants$1.totalPageCount = data.PageCount;
35263
+ constants$1.totalRecordCount = data.RowCount;
35264
+ } else {
35265
+ var totalCount;
35266
+ if (response) totalCount = response.headers.get("x-total-count");
35267
+ if (totalCount == null) totalCount = data === null || data === void 0 ? void 0 : data.rowCount;
35268
+ if (totalCount == null) totalCount = data === null || data === void 0 ? void 0 : data.length;
35269
+ constants$1.totalRecordCount = parseInt(totalCount, 10) || 0;
35270
+ constants$1.totalPageCount = Math.ceil(constants$1.totalRecordCount / props.pageSize);
35271
+ }
35272
+ setLoading(false);
35273
+ };
35274
+ var onEditorPreparing = useCallback(function (e) {
35275
+ if (e.row !== undefined && e.parentType === "dataRow") {
35276
+ if (props.handleEditorPreparing) {
35277
+ props.handleEditorPreparing(e);
35278
+ }
35279
+ }
35280
+ if (e.editorOptions && e.rowType === "data" && e.parentType === "dataRow") {
35281
+ e.editorOptions.onValueChanged = function (args) {
35282
+ if (args.event && args.event.type === "cancel") e.cellElement.dispatchEvent(onCancelEditEvent$1);
35283
+ };
35284
+ }
35285
+ }, [props.isServerSide]);
35286
+ var getServerSide = useCallback(function (type) {
35287
+ try {
35288
+ return Promise.resolve(function () {
35289
+ if (type === "reachedBottom") {
35290
+ return function () {
35291
+ if (constants$1.totalPageCount <= constants$1.loadedPageCount) {} else {
35292
+ constants$1.loadedPageCount = constants$1.loadedPageCount + 1;
35293
+ return Promise.resolve(fetchData()).then(function () {});
35294
+ }
35295
+ }();
35296
+ }
35297
+ }());
35298
+ } catch (e) {
35299
+ return Promise.reject(e);
35300
+ }
35301
+ }, [constants$1.totalPageCount]);
35302
+ var onExporting = useCallback(function (e) {
35303
+ if (e.format === "xlsx") {
35304
+ var workbook = new Workbook();
35305
+ if (props.filterData != null) {
35306
+ var newColumnFromFilterData = props.filterData.map(function (filterItem) {
35307
+ return {
35308
+ dataField: filterItem.key,
35309
+ caption: filterItem.key
35310
+ };
35311
+ });
35312
+ var newColumns = [].concat(gridColumns, newColumnFromFilterData);
35313
+ e.component.beginUpdate();
35314
+ e.component.option("columns", newColumns);
35315
+ e.component.endUpdate();
35316
+ }
35317
+ exportDataGrid({
35318
+ component: e.component,
35319
+ worksheet: workbook.addWorksheet("Main sheet"),
35320
+ autoFilterEnabled: true,
35321
+ customizeCell: function customizeCell(options) {
35322
+ var gridCell = options.gridCell,
35323
+ excelCell = options.excelCell;
35324
+ if (gridCell.column.dataType === "datetime" && gridCell.value) {
35325
+ var _gridCell$column$calc, _gridCell$column$meta;
35326
+ if (((_gridCell$column$calc = gridCell.column.calculateFilterExpression) === null || _gridCell$column$calc === void 0 ? void 0 : _gridCell$column$calc.name) === "calculateFilterExpressionForColumn" && (_gridCell$column$meta = gridCell.column["meta"]) !== null && _gridCell$column$meta !== void 0 && _gridCell$column$meta.hasCustomCellRenderer) {
35327
+ var date = moment(gridCell.value);
35328
+ var offsetMinutes = date.utcOffset();
35329
+ var sign = offsetMinutes >= 0 ? "+" : "-";
35330
+ var hours = Math.floor(Math.abs(offsetMinutes) / 60);
35331
+ var minutes = Math.abs(offsetMinutes) % 60;
35332
+ var formattedOffset = "(UTC" + sign + hours.toString().padStart(2, "0") + ":" + minutes.toString().padStart(2, "0") + ")";
35333
+ var formattedDate = date.format("DD.MM.YYYY HH:mm") + " " + formattedOffset;
35334
+ excelCell.value = formattedDate;
35335
+ }
35336
+ }
35337
+ if (gridCell.rowType !== "header" && props.filterData != null) {
35338
+ var matchingItem = props.filterData.find(function (item) {
35339
+ return item.key === gridCell.column.dataField;
35340
+ });
35341
+ if (matchingItem) {
35342
+ excelCell.value = matchingItem.value;
35343
+ }
35344
+ }
35345
+ }
35346
+ }).then(function () {
35347
+ workbook.xlsx.writeBuffer().then(function (buffer) {
35348
+ saveAs(new Blob([buffer], {
35349
+ type: "application/octet-stream"
35350
+ }), fileName + ".xlsx");
35351
+ });
35352
+ });
35353
+ } else {
35354
+ var doc = new jsPDF();
35355
+ exportDataGrid$1({
35356
+ jsPDFDocument: doc,
35357
+ component: e.component,
35358
+ indent: 5
35359
+ }).then(function () {
35360
+ doc.save(fileName + ".pdf");
35361
+ });
35362
+ }
35363
+ }, [fileName, props.filterData]);
35364
+ var customLoad = useCallback(function () {
35365
+ var state = JSON.parse(localStorage.getItem(props.exportFileName + "Storage"));
35366
+ if (localStorage.getItem(props.exportFileName + "Storage")) {
35367
+ state.selectedRowKeys = [];
35368
+ if (props.filterEnabledShow) state.filterPanel = {
35369
+ filterEnabled: false
35370
+ };else state.filterPanel = {
35371
+ filterEnabled: true
35372
+ };
35373
+ }
35374
+ return state;
35375
+ }, [props.filterEnabledShow]);
35376
+ var customSave = useCallback(function (state) {
35377
+ state.selectedRowKeys = [];
35378
+ if (props.filterEnabledShow) state.filterPanel = {
35379
+ filterEnabled: false
35380
+ };else state.filterPanel = {
35381
+ filterEnabled: true
35382
+ };
35383
+ if (data.length === 0) {
35384
+ if (!state.filterValue && state.filterValue !== null) {
35385
+ state.filterValue = null;
35386
+ }
35387
+ }
35388
+ localStorage.setItem(props.exportFileName + "Storage", JSON.stringify(state));
35389
+ }, [props.filterEnabledShow]);
35390
+ var onEditorPrepared = useCallback(function (info) {
35391
+ if (info.parentType === "filterRow" && info.editorName === "dxSelectBox" && info.dataField === "IsActive") {
35392
+ if (info.dataSource != null && info.dataSource.length > 0) {
35393
+ info.showAllText = info.dataSource.find(function (i) {
35394
+ return i.value === null;
35395
+ }).label;
35396
+ info.trueText = info.dataSource.find(function (i) {
35397
+ return i.value === true;
35398
+ }).label;
35399
+ info.falseText = info.dataSource.find(function (i) {
35400
+ return i.value === false;
35401
+ }).label;
35402
+ }
35403
+ }
35404
+ }, []);
35405
+ var renderTotal = useCallback(function () {
35406
+ var _props$customSummary3;
35407
+ var result = "";
35408
+ var totalloaded = 0;
35409
+ if (data.length < 50 || !props.isServerSide || constants$1.loadedPageCount == constants$1.totalPageCount) {
35410
+ totalloaded = data.length;
35411
+ } else {
35412
+ totalloaded = constants$1.loadedPageCount * props.pageSize;
35413
+ }
35414
+ if (props.isServerSide) {
35415
+ var _props$customSummary, _props$customSummary2;
35416
+ result = constants$1.totalRecordCount > 0 ? totalloaded + " " + ((_props$customSummary = props.customSummary) === null || _props$customSummary === void 0 ? void 0 : _props$customSummary.summaryLoadedDataLabel) + ("- " + constants$1.totalRecordCount) + ((_props$customSummary2 = props.customSummary) === null || _props$customSummary2 === void 0 ? void 0 : _props$customSummary2.summaryTotalDataLabel) : "";
35417
+ result = concatFilteredLabel$1(result, totalloaded, filteredRowCount, filterApplied.current, props);
35418
+ }
35419
+ if (((_props$customSummary3 = props.customSummary) === null || _props$customSummary3 === void 0 ? void 0 : _props$customSummary3.summaryTotalCount) !== undefined && !props.isServerSide) {
35420
+ result = props.customSummary.summaryTotalDataLabel + " : " + props.customSummary.summaryTotalCount;
35421
+ result = concatFilteredLabel$1(result, totalloaded, filteredRowCount, filterApplied.current, props);
35422
+ }
35423
+ if (constants$1.totalPageCount > 1) {
35424
+ var _props$customSummary4;
35425
+ result = result + " - " + ((_props$customSummary4 = props.customSummary) === null || _props$customSummary4 === void 0 ? void 0 : _props$customSummary4.summaryTotalPageCountLabel) + " " + constants$1.loadedPageCount + " / " + constants$1.totalPageCount;
35426
+ }
35427
+ return result;
35428
+ }, [data, filteredRowCount, constants$1.loadedPageCount, props.pageSize, constants$1.totalRecordCount, filterApplied.current]);
35429
+ function actionCellRender(cellData, props) {
35430
+ var kebabMenuButtons = props.actionButtonGroup && props.actionButtonGroup.length >= 2 && !props.edit ? props.actionButtonGroup.slice(2).map(function (button) {
35431
+ return {
35432
+ icon: React.createElement(DynamicIcon, {
35433
+ iconName: button.icon
35434
+ }),
35435
+ onClick: function onClick(event) {
35436
+ var customEvent = {
35437
+ column: cellData.column,
35438
+ component: cellData.component,
35439
+ element: cellData.element,
35440
+ event: event,
35441
+ model: cellData.data,
35442
+ row: cellData.row
35443
+ };
35444
+ button.onClick(customEvent);
35445
+ }
35446
+ };
35447
+ }) : [];
35448
+ var buttonElements = [];
35449
+ {
35450
+ !props.edit && actionButtons.forEach(function (buttonItem, index) {
35451
+ var isVisible = typeof buttonItem.visible === "function" ? buttonItem.visible({
35452
+ column: cellData.column,
35453
+ component: cellData.component,
35454
+ row: cellData.row
35455
+ }) : buttonItem.visible;
35456
+ buttonElements.push(React.createElement(OdsDataGrdiRowButton, {
35457
+ key: "action-button-" + index,
35458
+ hint: buttonItem.hint,
35459
+ visible: isVisible,
35460
+ size: "small",
35461
+ type: "text",
35462
+ disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
35463
+ icon: React.createElement(DynamicIcon, {
35464
+ iconName: buttonItem.icon
35465
+ }),
35466
+ onClick: function onClick(event) {
35467
+ var customEvent = {
35468
+ column: cellData.column,
35469
+ component: cellData.component,
35470
+ element: cellData.element,
35471
+ event: event,
35472
+ model: cellData.data,
35473
+ row: cellData.row
35474
+ };
35475
+ buttonItem.onClick(customEvent);
35476
+ }
35477
+ }));
35478
+ });
35479
+ }
35480
+ {
35481
+ props.edit && actionButtons.forEach(function (buttonItem, index) {
35482
+ var isVisible = typeof buttonItem.visible === "function" ? buttonItem.visible({
35483
+ column: cellData.column,
35484
+ component: cellData.component,
35485
+ row: cellData.row
35486
+ }) : buttonItem.visible;
35487
+ buttonElements.push(React.createElement(OdsDataGrdiRowButton, {
35488
+ key: "action-button-" + index,
35489
+ name: buttonItem.name,
35490
+ hint: buttonItem.hint,
35491
+ visible: isVisible,
35492
+ size: "small",
35493
+ type: "text",
35494
+ disabled: buttonItem.actionPermission === undefined ? false : !buttonItem.actionPermission,
35495
+ icon: React.createElement(DynamicIcon, {
35496
+ iconName: buttonItem.icon
35497
+ }),
35498
+ onClick: function onClick(event) {
35499
+ if (buttonItem.onClick) {
35500
+ var customEvent = {
35501
+ column: cellData.column,
35502
+ component: cellData.component,
35503
+ element: cellData.element,
35504
+ event: event,
35505
+ model: cellData.data,
35506
+ row: cellData.row
35507
+ };
35508
+ buttonItem.onClick(customEvent);
35509
+ }
35510
+ }
35511
+ }));
35512
+ });
35513
+ }
35514
+ if (kebabMenuButtons.length > 0) {
35515
+ buttonElements.push(React.createElement(OdsDropdown, {
35516
+ key: "dropdown-" + (cellData.rowIndex || cellData.data.ID),
35517
+ menuItems: kebabMenuButtons
35518
+ }, React.createElement(OdsDataGrdiRowButton, {
35519
+ type: "text",
35520
+ icon: React.createElement(DynamicIcon, {
35521
+ iconName: "kebabMenu"
35522
+ })
35523
+ })));
35524
+ }
35525
+ return React.createElement(React.Fragment, null, buttonElements);
35526
+ }
35527
+ var onScrollEnd = useCallback(function () {
35528
+ getServerSide("reachedBottom");
35529
+ }, [(_props$axiosRequest11 = props.axiosRequest) === null || _props$axiosRequest11 === void 0 ? void 0 : _props$axiosRequest11.requestData, getServerSide]);
35530
+ var handleScroll = function handleScroll(e) {
35531
+ var run = debounce_1(function (e) {
35532
+ var _scrollable$scrollTop, _scrollable$clientHei, _scrollable$scrollHei;
35533
+ var scrollable = e.target;
35534
+ var top = (_scrollable$scrollTop = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollTop) != null ? _scrollable$scrollTop : 0;
35535
+ var height = (_scrollable$clientHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.clientHeight) != null ? _scrollable$clientHei : 0;
35536
+ var scrollHeight = (_scrollable$scrollHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollHeight) != null ? _scrollable$scrollHei : 0;
35537
+ var maxHeight = Math.max(top, height, scrollHeight) - 1;
35538
+ if (scrollHeight <= height) return;
35539
+ var reachedBottom = Math.ceil(top + height) >= maxHeight;
35540
+ var lastScrollTop = 0;
35541
+ if (top < lastScrollTop) return;
35542
+ lastScrollTop = top <= 0 ? 0 : top;
35543
+ if (reachedBottom) onScrollEnd();
35544
+ setScrollPosition(top);
35545
+ }, 200);
35546
+ run(e);
35547
+ };
35548
+ var handleContentReady = function handleContentReady(e) {
35549
+ var dataGridInstance = e.component;
35550
+ var filteredDataCount = dataGridInstance.totalCount();
35551
+ if (filterApplied.current && filteredDataCount > 0) {
35552
+ setFilteredRowCount(filteredDataCount);
35553
+ } else {
35554
+ setFilteredRowCount(0);
35555
+ }
35556
+ if (!contentReady) setContentReady(true);
35557
+ };
35558
+ var onFilterValueChange = function onFilterValueChange(e) {
35559
+ if (e !== null) filterApplied.current = true;else {
35560
+ filterApplied.current = false;
35561
+ setFilteredRowCount(0);
35562
+ }
35563
+ };
35564
+ var onCustomCellClick = function onCustomCellClick(e) {
35565
+ e.cellElement.style.backgroundColor = "transparent";
35566
+ if (hasFastUpdate) {
35567
+ if (checkCellSelectionConstraints$1(e) && constants$1.allowedDataTypesForMultiCellEditing.some(function (item) {
35568
+ return item.toLocaleLowerCase() == e.column.dataType.toLocaleLowerCase();
35569
+ })) {
35570
+ if (!e.event.ctrlKey) {
35571
+ if (cellAlreadySelected$1(e.data[pkName], e.column.dataField, selectedCells)) {
35572
+ removeSelectedCell(e.rowIndex, e.columnIndex);
35573
+ } else {
35574
+ singleSelect(e.data[pkName], e.column.dataField);
35575
+ }
35576
+ } else {
35577
+ var selectedCell = {
35578
+ colIndex: e.columnIndex,
35579
+ rowIndex: e.rowIndex
35580
+ };
35581
+ if (ctrlSelection) {
35582
+ multipleSelect([].concat(ctrlSelectedCells, [selectedCell]));
35583
+ } else {
35584
+ setCtrlSelectedCells(function (prev) {
35585
+ return [].concat(prev, [selectedCell]);
35586
+ });
35587
+ }
35588
+ setCtrlSelection(function (prev) {
35589
+ return !prev;
35590
+ });
35591
+ }
35592
+ }
35593
+ }
35594
+ onCellClick && onCellClick(e);
35595
+ };
35596
+ var onCustomCellHoverChanged = function onCustomCellHoverChanged(e) {
35597
+ if (hasFastUpdate) {
35598
+ if (!e.event.ctrlKey && !ctrlSelection) {
35599
+ if (checkCellSelectionConstraints$1(e)) {
35600
+ if (e.event.buttons === 1) {
35601
+ setHoveredCells(function (prev) {
35602
+ return [].concat(prev, [{
35603
+ colIndex: e.columnIndex,
35604
+ rowIndex: e.rowIndex
35605
+ }]);
35606
+ });
35607
+ } else {
35608
+ multipleSelect(hoveredCells);
35609
+ }
35610
+ } else if (e.rowType != "data") {
35611
+ multipleSelect(hoveredCells);
35612
+ }
35613
+ }
35614
+ }
35615
+ onCellHoverChanged && onCellHoverChanged(e);
35616
+ };
35617
+ var onCustomFastUpdateButtonClick = function onCustomFastUpdateButtonClick(e) {
35618
+ if (selectedCells.length > 0) {
35619
+ setIsFastUpdateModalOpen(true);
35620
+ }
35621
+ onFastUpdateButtonClick && onFastUpdateButtonClick(e);
35622
+ };
35623
+ var onFastUpdateModalCancel = function onFastUpdateModalCancel(_e) {
35624
+ closeModal();
35625
+ onFastUpdateCancel && onFastUpdateCancel();
35626
+ };
35627
+ var onFastUpdateFormFinish = function onFastUpdateFormFinish(values) {
35628
+ onFastUpdateFinish && onFastUpdateFinish(values, selectedCells);
35629
+ closeModal();
35630
+ };
35631
+ var onFastUpdateFormFinishFailed = function onFastUpdateFormFinishFailed(errorInfo) {
35632
+ onFastUpdateFailed && onFastUpdateFailed(errorInfo);
35633
+ };
35634
+ var onClickFastUpdateFormCancel = function onClickFastUpdateFormCancel(_e) {
35635
+ closeModal();
35636
+ onFastUpdateCancel && onFastUpdateCancel();
35637
+ };
35638
+ var onCustomCellPrepared = function onCustomCellPrepared(e) {
35639
+ var _props$edit, _props$edit2;
35640
+ if (hasFastUpdate) {
35641
+ if (e.rowType === "data" && e.column.allowEditing && constants$1.allowedDataTypesForMultiCellEditing.some(function (item) {
35642
+ return item.toLocaleLowerCase() == e.column.dataType.toLocaleLowerCase();
35643
+ })) {
35644
+ if (selectedCells.some(function (cell) {
35645
+ return cell.pkValue == e.data[pkName] && cell.dataField == e.column.dataField;
35646
+ })) {
35647
+ e.cellElement.classList.add("grid-cell-selected");
35648
+ }
35649
+ }
35650
+ }
35651
+ if (((_props$edit = props.edit) === null || _props$edit === void 0 ? void 0 : _props$edit.mode) == "cell" && (_props$edit2 = props.edit) !== null && _props$edit2 !== void 0 && _props$edit2.allowUpdating && e.rowType == "data" && !e.column.allowEditing) {
35652
+ e.cellElement.classList.add("grid-cell-disable-colored");
35653
+ }
35654
+ };
35655
+ var onToolbarPreparing = function onToolbarPreparing(e) {
35656
+ if (props.toolbarButtonGroup && props.toolbarButtonGroup.length > 0) {
35657
+ e.toolbarOptions.items.unshift({
35658
+ location: "before",
35659
+ template: function template(_, __, container) {
35660
+ var wrapper = document.createElement("div");
35661
+ container.appendChild(wrapper);
35662
+ reactDom.render(React.createElement(React.StrictMode, null, props.toolbarButtonGroup && Array.isArray(props.toolbarButtonGroup) && props.toolbarButtonGroup.map(function (buttonGroupItem, index) {
35663
+ return React.createElement(OdsButton, {
35664
+ key: index,
35665
+ style: {
35666
+ marginLeft: token.margin
35667
+ },
35668
+ type: buttonGroupItem.type,
35669
+ onClick: buttonGroupItem.onClick
35670
+ }, buttonGroupItem.label);
35671
+ })), wrapper);
35672
+ }
35673
+ });
35674
+ }
35675
+ e.toolbarOptions.items.unshift({
35676
+ location: "before",
35677
+ cssClass: "toolbarTitleItem",
35678
+ template: function template(_, __, container) {
35679
+ var wrapper = document.createElement("div");
35680
+ container.appendChild(wrapper);
35681
+ reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
35682
+ level: 5,
35683
+ style: {
35684
+ display: "flex",
35685
+ alignItems: "center",
35686
+ alignSelf: "stretch",
35687
+ margin: 0
35688
+ }
35689
+ }, props.pageTitle)), wrapper);
35690
+ }
35691
+ });
35692
+ };
35693
+ var detailGrid = function detailGrid(_ref) {
35694
+ var data = _ref.data;
35695
+ return React.createElement(OdsRemoteDataGrid, Object.assign({}, props, {
35696
+ showMasterDetail: false,
35697
+ columns: props.detailGridColums,
35698
+ dataSource: props.detailData[data.key.ID]
35699
+ }));
35700
+ };
35701
+ return React.createElement(React.Fragment, null, React.createElement(Modal, {
35702
+ title: fastUpdateModalTitle != null ? fastUpdateModalTitle : "Fast Update",
35703
+ open: isFastUpdateModalOpen,
35704
+ onCancel: onFastUpdateModalCancel,
35705
+ footer: [],
35706
+ maskClosable: true,
35707
+ width: 300
35708
+ }, React.createElement(Form$1, {
35709
+ key: "form-fastupdate",
35710
+ form: fastUpdateForm,
35711
+ style: {
35712
+ maxWidth: "100%"
35713
+ },
35714
+ layout: "vertical",
35715
+ onFinish: onFastUpdateFormFinish,
35716
+ onFinishFailed: onFastUpdateFormFinishFailed
35717
+ }, constants$1.allowedDataTypesForMultiCellEditing.map(function (item) {
35718
+ switch (item) {
35719
+ case "number":
35720
+ return React.createElement(Form$1.Item, {
35721
+ name: "number",
35722
+ label: "",
35723
+ rules: [{
35724
+ required: true,
35725
+ message: fastUpdateFormRequiredFieldMessage != null ? fastUpdateFormRequiredFieldMessage : "Required field"
35726
+ }]
35727
+ }, React.createElement(OdsInputNumber, {
35728
+ key: "odsinputnumber-fastupdate",
35729
+ style: {
35730
+ width: "100%"
35731
+ },
35732
+ min: 0
35733
+ }));
35734
+ default:
35735
+ return React.createElement("div", null);
35736
+ }
35737
+ }), React.createElement(Row, {
35738
+ style: {
35739
+ justifyContent: "end",
35740
+ gap: token.marginSM
35741
+ }
35742
+ }, React.createElement(Col, null, React.createElement(OdsButton, {
35743
+ key: "back",
35744
+ onClick: onClickFastUpdateFormCancel
35745
+ }, " ", fastUpdateModalCancelText != null ? fastUpdateModalCancelText : "Cancel")), React.createElement(Col, null, React.createElement(OdsButton, {
35746
+ htmlType: "submit",
35747
+ type: "primary"
35748
+ }, " ", fastUpdateModalSaveText != null ? fastUpdateModalSaveText : "Save"))))), React.createElement(DataGrid$1, {
35749
+ keyExpr: keyExpr,
35750
+ dataSource: data,
35751
+ showBorders: true,
35752
+ columnAutoWidth: false,
35753
+ ref: gridRef,
35754
+ height: props.height == undefined ? window.innerHeight - 164 : props.height,
35755
+ allowColumnResizing: true,
35756
+ columnResizingMode: "nextColumn",
35757
+ showRowLines: true,
35758
+ allowColumnReordering: true,
35759
+ scrolling: {
35760
+ useNative: true
35761
+ },
35762
+ remoteOperations: false,
35763
+ paging: {
35764
+ enabled: false
35765
+ },
35766
+ repaintChangesOnly: true,
35767
+ focusedRowEnabled: false,
35768
+ filterSyncEnabled: true,
35769
+ wordWrapEnabled: props.wordWrapEnabled ? props.wordWrapEnabled : false,
35770
+ columnFixing: {
35771
+ enabled: true
35772
+ },
35773
+ noDataText: props.noDataText,
35774
+ onEditorPreparing: onEditorPreparing,
35775
+ onExporting: onExporting,
35776
+ onRowClick: props.onRowClick,
35777
+ onEditorPrepared: onEditorPrepared,
35778
+ onSelectionChanged: props.onSelectionChanged,
35779
+ onSaved: props.onSaved,
35780
+ onSaving: props.onSaving,
35781
+ onEditCanceling: props.onEditCanceling,
35782
+ onContentReady: handleContentReady,
35783
+ onFilterValueChange: onFilterValueChange,
35784
+ onCellClick: onCustomCellClick,
35785
+ onCellHoverChanged: onCustomCellHoverChanged,
35786
+ onCellPrepared: onCustomCellPrepared,
35787
+ onOptionChanged: props.onOptionChanged,
35788
+ onToolbarPreparing: props.onToolbarPreparing || onToolbarPreparing
35789
+ }, gridColumns.map(function (col) {
35790
+ return React.createElement(Column, Object.assign({
35791
+ key: col.dataField
35792
+ }, col, {
35793
+ minWidth: 50,
35794
+ cssClass: col.cssClass + " " + (hasFastUpdate ? "grid-cell-disable-text-selection" : "")
35795
+ }), col.lookUp && React.createElement(Lookup, Object.assign({}, col.lookUp)), col.dataField === "IsActive" && React.createElement(HeaderFilter, {
35796
+ dataSource: [{
35797
+ text: "Active",
35798
+ value: true
35799
+ }, {
35800
+ text: "Passive",
35801
+ value: false
35802
+ }]
35803
+ }), col.useDynamicHeaderFilter && React.createElement(HeaderFilter, {
35804
+ allowSearch: true,
35805
+ dataSource: [{
35806
+ text: "(Blanks)",
35807
+ value: null
35808
+ }].concat(data && data.length > 0 ? data.filter(function (item) {
35809
+ return item[col.dataField] !== null && item[col.dataField] !== undefined && item[col.dataField] !== "";
35810
+ }).map(function (item) {
35811
+ return {
35812
+ text: item[col.dataField].toString(),
35813
+ value: item[col.dataField]
35814
+ };
35815
+ }) : [])
35816
+ }), getMultiLevelColumns$1(col));
35817
+ }), props.actionColumnEnable !== undefined && props.actionColumnEnable === true && React.createElement(Column, {
35818
+ dataField: "Actions",
35819
+ fixed: true,
35820
+ allowSorting: false,
35821
+ caption: props.actionButtonGroupCaption,
35822
+ type: "buttons",
35823
+ showInColumnChooser: false,
35824
+ cellRender: function cellRender(cellData) {
35825
+ return actionCellRender(cellData, props);
35826
+ }
35827
+ }), props.showMasterDetail && React.createElement(MasterDetail, {
35828
+ enabled: true,
35829
+ component: detailGrid
35830
+ }), props.edit && React.createElement(Editing, {
35831
+ mode: props.edit.mode,
35832
+ allowUpdating: props.edit.allowUpdating,
35833
+ allowDeleting: props.edit.allowDeleting,
35834
+ allowAdding: props.edit.allowAdding,
35835
+ useIcons: true
35836
+ }, props.edit.mode === "popup" && React.createElement("div", null, React.createElement(Popup, {
35837
+ showTitle: true,
35838
+ width: 700,
35839
+ height: 300,
35840
+ showCloseButton: false
35841
+ }), React.createElement(Form, null, props.edit.formItems && props.edit.formItems.map(function (formItem) {
35842
+ return React.createElement(Item, {
35843
+ itemType: formItem.itemType,
35844
+ colCount: formItem.colCount,
35845
+ colSpan: formItem.colSpan
35846
+ }, formItem.items.map(function (subItem) {
35847
+ return React.createElement(Item, {
35848
+ key: subItem.dataField,
35849
+ dataField: subItem.dataField
35850
+ });
35851
+ }));
35852
+ })))), React.createElement(Paging, {
35853
+ defaultPageSize: props.pageSize
35854
+ }), props.pagingEnable && React.createElement(Pager, {
35855
+ visible: false,
35856
+ displayMode: "full",
35857
+ showPageSizeSelector: false,
35858
+ showNavigationButtons: false,
35859
+ showInfo: false
35860
+ }), React.createElement(Scrolling, {
35861
+ showScrollbar: "always",
35862
+ scrollByContent: true,
35863
+ scrollByThumb: true,
35864
+ mode: "virtual",
35865
+ rowRenderingMode: "virtual"
35866
+ }), loading && React.createElement(LoadPanel, {
35867
+ enabled: true,
35868
+ shadingColor: "rgba(0,0,0,0.4)"
35869
+ }), React.createElement(SearchPanel, {
35870
+ visible: true
35871
+ }), React.createElement(FilterRow, {
35872
+ visible: props.isFilterRow != undefined ? props.isFilterRow : true
35873
+ }), React.createElement(FilterPanel, {
35874
+ visible: true
35875
+ }), React.createElement(HeaderFilter, {
35876
+ visible: true
35877
+ }), React.createElement(Sorting, {
35878
+ mode: "multiple"
35879
+ }), React.createElement(Export, {
35880
+ enabled: true,
35881
+ allowExportSelectedData: true,
35882
+ formats: constants$1.exportFormats
35883
+ }), ((_props$selectOptions = props.selectOptions) === null || _props$selectOptions === void 0 ? void 0 : _props$selectOptions.selectEnable) && React.createElement(Selection, {
35884
+ mode: (_props$selectOptions$ = (_props$selectOptions2 = props.selectOptions) === null || _props$selectOptions2 === void 0 ? void 0 : _props$selectOptions2.mode) != null ? _props$selectOptions$ : "multiple",
35885
+ deferred: (_props$selectOptions$2 = (_props$selectOptions3 = props.selectOptions) === null || _props$selectOptions3 === void 0 ? void 0 : _props$selectOptions3.deferred) != null ? _props$selectOptions$2 : true
35886
+ }), React.createElement(ColumnChooser, {
35887
+ enabled: true,
35888
+ mode: "select"
35889
+ }, !props.columnChooserPositionDisabled && React.createElement(Position, {
35890
+ my: "right top",
35891
+ at: "right bottom",
35892
+ of: document.querySelector("." + props.dataGridPageName) ? "." + props.dataGridPageName + " .dx-datagrid-column-chooser-button" : ".dx-datagrid-column-chooser-button"
35893
+ }), React.createElement(ColumnChooserSearch, {
35894
+ enabled: true,
35895
+ editorOptions: {
35896
+ placeholder: ""
35897
+ }
35898
+ }), React.createElement(ColumnChooserSelection, {
35899
+ allowSelectAll: true,
35900
+ selectByClick: true,
35901
+ recursive: true
35902
+ })), React.createElement(Toolbar, null, React.createElement(Item$1, {
35903
+ name: "searchPanel"
35904
+ }), React.createElement(Item$1, {
35905
+ name: "columnChooserButton",
35906
+ cssClass: "toolbarPanelItems"
35907
+ }), React.createElement(Item$1, {
35908
+ name: "exportButton",
35909
+ cssClass: "toolbarPanelItems"
35910
+ }), hasFastUpdate && React.createElement(Item$1, null, React.createElement(OdsButton, {
35911
+ key: "odsbutton-fastupdate",
35912
+ onClick: onCustomFastUpdateButtonClick
35913
+ }, fastUpdateButtonText != null ? fastUpdateButtonText : "Fast Update"))), React.createElement(Summary, {
35914
+ calculateCustomSummary: renderTotal
35915
+ }, React.createElement(TotalItem, {
35916
+ column: gridColumns[0].dataField,
35917
+ summaryType: "custom",
35918
+ displayFormat: renderTotal()
35919
+ }), gridRef.current && showSummaryItems$1(props) && getSummaryItems$1(props, gridColumns, gridRef.current.instance).map(function (item, _index) {
35920
+ return item;
35921
+ })), React.createElement(StateStoring, {
35922
+ enabled: true,
35923
+ type: "custom",
35924
+ customLoad: customLoad,
35925
+ customSave: customSave
35926
+ })));
35927
+ };
35928
+
35929
+ export { DxTreeList, OdsAlert, OdsAutoComplete, OdsBadge, OdsBadgeRibbon, OdsBannerAlert, OdsBasicDataGrid, OdsBasicTable, OdsButton, OdsCalendar, OdsCard, OdsCheckbox, OdsCheckboxGroup, OdsCollapse, OdsDataGrid, OdsDateRangePicker, OdsDatepicker, OdsDisplayGrid, OdsDivider, OdsDropdown, OdsDropdownButton, OdsFileUpload, OdsFilter, OdsFilterTagView, OdsImage, OdsInput, OdsInputNumber, OdsLink, OdsList, OdsModal, OdsModalOld, OdsMultiSelect, OdsNotification, OdsParagraph, OdsPassword, OdsPhoneInput, OdsRadio, OdsRadioGroup, OdsRangeTimepicker, OdsRate, OdsRemoteDataGrid, OdsSearch, OdsSelect, OdsSelectableTable, OdsSpin, OdsSwitch, OdsTab, OdsBasicTable as OdsTable, OdsTag, OdsText, OdsTextArea, OdsTimeline, OdsTimepicker, OdsTitle };
34805
35930
  //# sourceMappingURL=index.modern.js.map