ods-component-lib 1.18.53 → 1.18.55

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.
@@ -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, EditIcon, Trash1Icon, CopyIcon, DiscountIcon, KebabMenuIcon, RefreshIcon } from 'ods-icon/react/24/outline';
19
+ import { GridIcon, EditIcon, Trash1Icon, CopyIcon, DiscountIcon, KebabMenuIcon, RefreshIcon, LinkBreakIcon, FloppyDiskIcon, Loop1Icon } from 'ods-icon/react/24/outline';
20
20
  import { TreeList, DropDownButton, Lookup } from 'devextreme-react';
21
21
 
22
22
  function _extends() {
@@ -16285,80 +16285,16 @@ function debounce(func, wait, options) {
16285
16285
 
16286
16286
  var debounce_1 = debounce;
16287
16287
 
16288
- /** Error message constants. */
16289
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
16290
-
16291
- /**
16292
- * Creates a throttled function that only invokes `func` at most once per
16293
- * every `wait` milliseconds. The throttled function comes with a `cancel`
16294
- * method to cancel delayed `func` invocations and a `flush` method to
16295
- * immediately invoke them. Provide `options` to indicate whether `func`
16296
- * should be invoked on the leading and/or trailing edge of the `wait`
16297
- * timeout. The `func` is invoked with the last arguments provided to the
16298
- * throttled function. Subsequent calls to the throttled function return the
16299
- * result of the last `func` invocation.
16300
- *
16301
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
16302
- * invoked on the trailing edge of the timeout only if the throttled function
16303
- * is invoked more than once during the `wait` timeout.
16304
- *
16305
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
16306
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
16307
- *
16308
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
16309
- * for details over the differences between `_.throttle` and `_.debounce`.
16310
- *
16311
- * @static
16312
- * @memberOf _
16313
- * @since 0.1.0
16314
- * @category Function
16315
- * @param {Function} func The function to throttle.
16316
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
16317
- * @param {Object} [options={}] The options object.
16318
- * @param {boolean} [options.leading=true]
16319
- * Specify invoking on the leading edge of the timeout.
16320
- * @param {boolean} [options.trailing=true]
16321
- * Specify invoking on the trailing edge of the timeout.
16322
- * @returns {Function} Returns the new throttled function.
16323
- * @example
16324
- *
16325
- * // Avoid excessively updating the position while scrolling.
16326
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
16327
- *
16328
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
16329
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
16330
- * jQuery(element).on('click', throttled);
16331
- *
16332
- * // Cancel the trailing throttled invocation.
16333
- * jQuery(window).on('popstate', throttled.cancel);
16334
- */
16335
- function throttle(func, wait, options) {
16336
- var leading = true,
16337
- trailing = true;
16338
-
16339
- if (typeof func != 'function') {
16340
- throw new TypeError(FUNC_ERROR_TEXT$1);
16341
- }
16342
- if (isObject_1(options)) {
16343
- leading = 'leading' in options ? !!options.leading : leading;
16344
- trailing = 'trailing' in options ? !!options.trailing : trailing;
16345
- }
16346
- return debounce_1(func, wait, {
16347
- 'leading': leading,
16348
- 'maxWait': wait,
16349
- 'trailing': trailing
16350
- });
16351
- }
16352
-
16353
- var throttle_1 = throttle;
16354
-
16355
16288
  var iconComponents = {
16356
16289
  edit: EditIcon,
16357
16290
  "delete": Trash1Icon,
16358
16291
  copy: CopyIcon,
16359
16292
  discount: DiscountIcon,
16360
16293
  kebabMenu: KebabMenuIcon,
16361
- refresh: RefreshIcon
16294
+ refresh: RefreshIcon,
16295
+ unmap: LinkBreakIcon,
16296
+ save: FloppyDiskIcon,
16297
+ cancel: Loop1Icon
16362
16298
  };
16363
16299
  var DynamicIcon = function DynamicIcon(_ref) {
16364
16300
  var iconName = _ref.iconName;
@@ -16381,20 +16317,13 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16381
16317
  var _useState = useState([]),
16382
16318
  data = _useState[0],
16383
16319
  setData = _useState[1];
16384
- var _useState2 = useState(false),
16385
- isLoading = _useState2[0],
16386
- setIsLoading = _useState2[1];
16387
16320
  var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
16388
- var _useState3 = useState(0),
16389
- filteredRowCount = _useState3[0],
16390
- setFilteredRowCount = _useState3[1];
16391
- var _useState4 = useState(props.columns),
16392
- columns = _useState4[0],
16393
- setColumns = _useState4[1];
16321
+ var _useState2 = useState(0),
16322
+ filteredRowCount = _useState2[0],
16323
+ setFilteredRowCount = _useState2[1];
16324
+ var columns = useRef(props.columns);
16394
16325
  var gridRef = useRef(null);
16395
- var _useState5 = useState(false),
16396
- filterApplied = _useState5[0],
16397
- setFilterApplied = _useState5[1];
16326
+ var filterApplied = useRef(false);
16398
16327
  var onCancelEditEvent = new CustomEvent('cancelEdit', {
16399
16328
  bubbles: true,
16400
16329
  detail: {
@@ -16422,13 +16351,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16422
16351
  }
16423
16352
  }, [(_props$axiosRequest2 = props.axiosRequest) === null || _props$axiosRequest2 === void 0 ? void 0 : _props$axiosRequest2.requestData]);
16424
16353
  useEffect(function () {
16425
- if (props.ref !== undefined) {
16426
- gridRef = props.ref;
16427
- }
16428
- }, [props.ref]);
16429
- useEffect(function () {
16430
- if (columns !== undefined && columns.length > 0) {
16431
- var newColumns = columns.map(function (colItem) {
16354
+ if (columns.current !== undefined && columns.current.length > 0) {
16355
+ var newColumns = columns.current.map(function (colItem) {
16432
16356
  if (colItem.tooltip !== undefined && colItem.tooltip.enable) {
16433
16357
  var headerCellRenderr = function headerCellRenderr() {
16434
16358
  return React.createElement("div", null, React.createElement("span", null, colItem.caption), React.createElement(Tooltip, {
@@ -16443,7 +16367,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16443
16367
  }
16444
16368
  return colItem;
16445
16369
  });
16446
- setColumns(newColumns);
16370
+ columns.current = newColumns;
16447
16371
  }
16448
16372
  }, [props.columns]);
16449
16373
  useEffect(function () {
@@ -16483,7 +16407,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16483
16407
  var fetchData = useCallback(function () {
16484
16408
  try {
16485
16409
  if (props.axiosRequest == undefined) return Promise.resolve();
16486
- setIsLoading(true);
16487
16410
  var _temp2 = function () {
16488
16411
  if (props.isServerSide) {
16489
16412
  var apiUrl = props.axiosRequest.environmentUrl + "" + props.axiosRequest.apiUrl;
@@ -16555,30 +16478,20 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16555
16478
  }, [props.isServerSide]);
16556
16479
  var getServerSide = useCallback(function (type) {
16557
16480
  try {
16558
- var run = throttle_1(function (type) {
16559
- try {
16560
- return Promise.resolve(function () {
16561
- if (type === "reachedBottom") {
16562
- return function () {
16563
- if (totalPageCount <= loadedPageCount) {} else {
16564
- loadedPageCount = loadedPageCount + 1;
16565
- return Promise.resolve(fetchData()).then(function () {});
16566
- }
16567
- }();
16481
+ return Promise.resolve(function () {
16482
+ if (type === "reachedBottom") {
16483
+ return function () {
16484
+ if (totalPageCount <= loadedPageCount) {} else {
16485
+ loadedPageCount = loadedPageCount + 1;
16486
+ return Promise.resolve(fetchData()).then(function () {});
16568
16487
  }
16569
- }());
16570
- } catch (e) {
16571
- return Promise.reject(e);
16488
+ }();
16572
16489
  }
16573
- }, 5000, {
16574
- trailing: false
16575
- });
16576
- run(type);
16577
- return Promise.resolve();
16490
+ }());
16578
16491
  } catch (e) {
16579
16492
  return Promise.reject(e);
16580
16493
  }
16581
- }, [totalPageCount, loadedPageCount, fetchData]);
16494
+ }, [totalPageCount]);
16582
16495
  var onExporting = useCallback(function (e) {
16583
16496
  if (e.format === 'xlsx') {
16584
16497
  var workbook = new Workbook();
@@ -16682,9 +16595,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16682
16595
  result = result + " - " + props.customSummary.summaryTotalPageCountLabel + " " + loadedPageCount + " / " + totalPageCount;
16683
16596
  }
16684
16597
  return result;
16685
- }, [data, filteredRowCount, loadedPageCount, props.pageSize, totalRecordCount, filterApplied]);
16598
+ }, [data, filteredRowCount, loadedPageCount, props.pageSize, totalRecordCount, filterApplied.current]);
16686
16599
  var concatFilteredLabel = function concatFilteredLabel(result, totalloaded) {
16687
- if (filteredRowCount > 0 && totalloaded !== filteredRowCount && filterApplied) {
16600
+ if (filteredRowCount > 0 && totalloaded !== filteredRowCount && filterApplied.current) {
16688
16601
  var filteredLabel = filteredRowCount + " " + props.customSummary.summaryFilteredDataLabel + "- ";
16689
16602
  result = filteredLabel + " " + result + " ";
16690
16603
  }
@@ -16734,10 +16647,13 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16734
16647
  var handleContentReady = function handleContentReady(e) {
16735
16648
  var dataGridInstance = e.component;
16736
16649
  var filteredDataCount = dataGridInstance.totalCount();
16737
- setFilteredRowCount(filteredDataCount);
16650
+ if (filterApplied.current && filteredDataCount > 0) setFilteredRowCount(filteredDataCount);
16738
16651
  };
16739
16652
  var onFilterValueChange = function onFilterValueChange(e) {
16740
- if (e !== null) setFilterApplied(true);else setFilterApplied(false);
16653
+ if (e !== null) filterApplied.current = true;else {
16654
+ filterApplied.current = false;
16655
+ setFilteredRowCount(0);
16656
+ }
16741
16657
  };
16742
16658
  return React.createElement(React.Fragment, null, React.createElement(DataGrid$1, {
16743
16659
  keyExpr: props.keyExpr,
@@ -16775,7 +16691,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16775
16691
  onEditCanceling: props.onEditCanceling,
16776
16692
  onContentReady: handleContentReady,
16777
16693
  onFilterValueChange: onFilterValueChange
16778
- }, columns.map(function (col) {
16694
+ }, columns.current.map(function (col) {
16779
16695
  return React.createElement(Column, Object.assign({
16780
16696
  key: col.dataField
16781
16697
  }, col, {
@@ -16802,8 +16718,21 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16802
16718
  caption: props.actionButtonGroupCaption,
16803
16719
  type: "buttons",
16804
16720
  showInColumnChooser: false
16805
- }, !props.edit && actionButtons.map(function (buttonItem) {
16721
+ }, !props.edit && actionButtons.map(function (buttonItem, index) {
16806
16722
  return React.createElement(Button$1, {
16723
+ key: "action-button-" + index,
16724
+ hint: buttonItem.hint,
16725
+ visible: buttonItem.visible,
16726
+ disabled: buttonItem.actionPermission == undefined ? false : !buttonItem.actionPermission,
16727
+ icon: server_browser.renderToString(React.createElement(DynamicIcon, {
16728
+ iconName: buttonItem.icon
16729
+ })),
16730
+ onClick: buttonItem.onClick
16731
+ });
16732
+ }), props.edit && actionButtons.map(function (buttonItem, index) {
16733
+ return React.createElement(Button$1, {
16734
+ key: "action-button-" + index,
16735
+ name: buttonItem.name,
16807
16736
  hint: buttonItem.hint,
16808
16737
  visible: buttonItem.visible,
16809
16738
  disabled: buttonItem.actionPermission == undefined ? false : !buttonItem.actionPermission,
@@ -16812,8 +16741,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16812
16741
  })),
16813
16742
  onClick: buttonItem.onClick
16814
16743
  });
16815
- }), props.edit && actionButtons.map(function (buttonItem) {
16816
- return React.createElement(Button$1, Object.assign({}, buttonItem));
16817
16744
  })), kebabMenuButtons.length > 0 && React.createElement(Column, {
16818
16745
  dataField: "Actionss",
16819
16746
  fixed: true,
@@ -16860,7 +16787,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16860
16787
  scrollByThumb: true,
16861
16788
  mode: "infinite"
16862
16789
  }), React.createElement(LoadPanel, {
16863
- enabled: isLoading,
16790
+ enabled: true,
16864
16791
  shadingColor: "rgba(0,0,0,0.4)"
16865
16792
  }), React.createElement(SearchPanel, {
16866
16793
  visible: true
@@ -16906,8 +16833,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16906
16833
  alignSelf: "stretch",
16907
16834
  margin: 0
16908
16835
  }
16909
- }, props.pageTitle)), props.toolbarButtonGroup && Array.isArray(props.toolbarButtonGroup) && props.toolbarButtonGroup.map(function (buttonGroupItem) {
16836
+ }, props.pageTitle)), props.toolbarButtonGroup && Array.isArray(props.toolbarButtonGroup) && props.toolbarButtonGroup.map(function (buttonGroupItem, index) {
16910
16837
  return React.createElement(Item$1, {
16838
+ key: "toolbar-button-" + index,
16911
16839
  location: "before"
16912
16840
  }, React.createElement(OdsButton, {
16913
16841
  style: {
@@ -16924,11 +16852,12 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16924
16852
  }), React.createElement(Item$1, {
16925
16853
  name: "exportButton",
16926
16854
  cssClass: 'toolbarPanelItems'
16927
- })), React.createElement(Summary, null, React.createElement(TotalItem, {
16928
- column: columns[0].dataField,
16855
+ })), React.createElement(Summary, {
16856
+ calculateCustomSummary: renderTotal
16857
+ }, React.createElement(TotalItem, {
16858
+ column: columns.current[0].dataField,
16929
16859
  summaryType: "custom",
16930
- displayFormat: "customizeText",
16931
- customizeText: renderTotal
16860
+ displayFormat: renderTotal()
16932
16861
  })), React.createElement(StateStoring, {
16933
16862
  enabled: true,
16934
16863
  type: "custom",