ods-component-lib 1.18.42 → 1.18.43

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.
@@ -18,7 +18,6 @@ import { saveAs } from 'file-saver-es';
18
18
  import moment from 'moment';
19
19
  import { GridIcon, EditIcon, Trash1Icon, CopyIcon, DiscountIcon, KebabMenuIcon, RefreshIcon } from 'ods-icon/react/24/outline';
20
20
  import { TreeList, DropDownButton, Lookup } from 'devextreme-react';
21
- import { TreeView } from 'devextreme-react/tree-view';
22
21
 
23
22
  function _extends() {
24
23
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -1119,14 +1118,16 @@ var dayjs_min = createCommonjsModule(function (module, exports) {
1119
1118
  !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
1120
1119
  });
1121
1120
 
1121
+ var format = "HH:mm";
1122
1122
  function StyledOdsTimepicker(props) {
1123
- var format = "HH:mm";
1124
1123
  return React.createElement(React.Fragment, null, React.createElement(StyledTimepicker, Object.assign({}, props, {
1125
1124
  defaultValue: dayjs_min("00:00", format)
1126
1125
  })));
1127
1126
  }
1128
1127
  var OdsTimepicker = function OdsTimepicker(props) {
1129
- return React.createElement(StyledOdsTimepicker, Object.assign({}, props));
1128
+ return React.createElement(StyledOdsTimepicker, Object.assign({}, props, {
1129
+ defaultValue: dayjs_min("00:00", format)
1130
+ }));
1130
1131
  };
1131
1132
 
1132
1133
  var _templateObject$m;
@@ -1576,24 +1577,6 @@ var DxTreeList = function DxTreeList(props) {
1576
1577
  return React.createElement(React.Fragment, null, React.createElement(TreeList, Object.assign({}, props), props.children));
1577
1578
  };
1578
1579
 
1579
- var DxTreeView = function DxTreeView(props) {
1580
- return React.createElement(React.Fragment, null, React.createElement(TreeView, {
1581
- id: "treeView",
1582
- dataSource: props.dataSource,
1583
- dataStructure: props.dataStructure !== undefined ? props.dataStructure : "plain",
1584
- keyExpr: props.keyExpr,
1585
- displayExpr: props.displayExpr,
1586
- parentIdExpr: props.parentIdExp,
1587
- searchEnabled: true,
1588
- searchMode: "contains",
1589
- expandAllEnabled: props.expandAllEnabled !== undefined ? props.expandAllEnabled : false,
1590
- expandedExpr: "expanded",
1591
- scrollDirection: "vertical",
1592
- selectNodesRecursive: true,
1593
- visible: true
1594
- }));
1595
- };
1596
-
1597
1580
  // A type of promise-like that resolves synchronously and supports only one observer
1598
1581
 
1599
1582
  const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
@@ -16456,6 +16439,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16456
16439
  columns = _useState4[0],
16457
16440
  setColumns = _useState4[1];
16458
16441
  var gridRef = useRef(null);
16442
+ var _useState5 = useState(false),
16443
+ filterApplied = _useState5[0],
16444
+ setFilterApplied = _useState5[1];
16459
16445
  var onCancelEditEvent = new CustomEvent('cancelEdit', {
16460
16446
  bubbles: true,
16461
16447
  detail: {
@@ -16570,7 +16556,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16570
16556
  } else if (totalPageCount >= loadedPageCount) {
16571
16557
  setData(function (prevData) {
16572
16558
  var uniqueData = newData.Data.filter(function (newItem) {
16573
- return !prevData.some(function (prevItem) {
16559
+ return !newItem.Id || newItem.Id <= 0 || !prevData.some(function (prevItem) {
16574
16560
  return prevItem.Id === newItem.Id;
16575
16561
  });
16576
16562
  });
@@ -16614,9 +16600,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16614
16600
  }
16615
16601
  if (e.editorOptions && e.rowType === 'data' && e.parentType === 'dataRow') {
16616
16602
  e.editorOptions.onValueChanged = function (args) {
16617
- if (args.event && args.event.type === 'cancel') {
16618
- e.cellElement.dispatchEvent(onCancelEditEvent);
16619
- }
16603
+ if (args.event && args.event.type === 'cancel') e.cellElement.dispatchEvent(onCancelEditEvent);
16620
16604
  };
16621
16605
  }
16622
16606
  }, [props.isServerSide]);
@@ -16707,6 +16691,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16707
16691
  };else state.filterPanel = {
16708
16692
  filterEnabled: true
16709
16693
  };
16694
+ if (data.length === 0) {
16695
+ if (!state.filterValue && state.filterValue !== null) {
16696
+ state.filterValue = null;
16697
+ }
16698
+ }
16710
16699
  localStorage.setItem(props.exportFileName + "Storage", JSON.stringify(state));
16711
16700
  }, [props.filterEnabledShow]);
16712
16701
  var onEditorPrepared = useCallback(function (info) {
@@ -16734,16 +16723,21 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16734
16723
  }
16735
16724
  if (props.isServerSide) {
16736
16725
  result = totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : "";
16737
- if (filteredRowCount > 0 && totalloaded !== filteredRowCount) {
16738
- var filteredLabel = filteredRowCount + " " + props.customSummary.summaryFilteredDataLabel + "- ";
16739
- result = filteredLabel + " " + result;
16740
- }
16726
+ result = concatFilteredLabel(result, totalloaded);
16741
16727
  }
16742
16728
  if (props.customSummary.summaryTotalCount !== undefined && !props.isServerSide) {
16743
16729
  result = props.customSummary.summaryTotalDataLabel + " : " + props.customSummary.summaryTotalCount;
16730
+ result = concatFilteredLabel(result, totalloaded);
16731
+ }
16732
+ return result;
16733
+ }, [data, filteredRowCount, loadedPageCount, props.pageSize, totalRecordCount, filterApplied]);
16734
+ var concatFilteredLabel = function concatFilteredLabel(result, totalloaded) {
16735
+ if (filteredRowCount > 0 && totalloaded !== filteredRowCount && filterApplied) {
16736
+ var filteredLabel = filteredRowCount + " " + props.customSummary.summaryFilteredDataLabel + "- ";
16737
+ result = filteredLabel + " " + result;
16744
16738
  }
16745
16739
  return result;
16746
- }, [data, filteredRowCount, loadedPageCount, props.pageSize, totalRecordCount]);
16740
+ };
16747
16741
  var renderTotalPaging = useCallback(function () {
16748
16742
  var result = "";
16749
16743
  if (totalPageCount > 1) {
@@ -16773,18 +16767,12 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16773
16767
  var height = (_scrollable$clientHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.clientHeight) != null ? _scrollable$clientHei : 0;
16774
16768
  var scrollHeight = (_scrollable$scrollHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollHeight) != null ? _scrollable$scrollHei : 0;
16775
16769
  var maxHeight = Math.max(top, height, scrollHeight) - 1;
16776
- if (scrollHeight <= height) {
16777
- return;
16778
- }
16770
+ if (scrollHeight <= height) return;
16779
16771
  var reachedBottom = Math.ceil(top + height) >= maxHeight;
16780
16772
  var lastScrollTop = 0;
16781
- if (top < lastScrollTop) {
16782
- return;
16783
- }
16773
+ if (top < lastScrollTop) return;
16784
16774
  lastScrollTop = top <= 0 ? 0 : top;
16785
- if (reachedBottom) {
16786
- onScrollEnd();
16787
- }
16775
+ if (reachedBottom) onScrollEnd();
16788
16776
  }, 200);
16789
16777
  run(e);
16790
16778
  };
@@ -16803,6 +16791,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16803
16791
  var filteredDataCount = dataGridInstance.totalCount();
16804
16792
  setFilteredRowCount(filteredDataCount);
16805
16793
  };
16794
+ var onFilterValueChange = function onFilterValueChange(e) {
16795
+ if (e !== null) setFilterApplied(true);else setFilterApplied(false);
16796
+ };
16806
16797
  return React.createElement(React.Fragment, null, React.createElement(DataGrid$1, {
16807
16798
  keyExpr: props.keyExpr,
16808
16799
  dataSource: data,
@@ -16837,7 +16828,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16837
16828
  onSaved: props.onSaved,
16838
16829
  onSaving: props.onSaving,
16839
16830
  onEditCanceling: props.onEditCanceling,
16840
- onContentReady: handleContentReady
16831
+ onContentReady: handleContentReady,
16832
+ onFilterValueChange: onFilterValueChange
16841
16833
  }, columns.map(function (col) {
16842
16834
  return React.createElement(Column, Object.assign({
16843
16835
  key: col.dataField
@@ -17005,5 +16997,5 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17005
16997
  })));
17006
16998
  };
17007
16999
 
17008
- export { DxTreeList, DxTreeView, OdsAlert, OdsAutoComplete, OdsBannerAlert, OdsBasicTable, OdsButton, OdsCalendar, OdsCard, OdsCheckbox, OdsCheckboxGroup, OdsCollapse, OdsDataGrid, OdsDateRangePicker, OdsDatepicker, OdsDisplayGrid, OdsDivider, OdsCollapse as OdsDropdown, OdsDropdownButton, OdsImage, OdsInput, OdsInputNumber, OdsLink, OdsList, OdsModal, 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 };
17000
+ export { DxTreeList, OdsAlert, OdsAutoComplete, OdsBannerAlert, OdsBasicTable, OdsButton, OdsCalendar, OdsCard, OdsCheckbox, OdsCheckboxGroup, OdsCollapse, OdsDataGrid, OdsDateRangePicker, OdsDatepicker, OdsDisplayGrid, OdsDivider, OdsCollapse as OdsDropdown, OdsDropdownButton, OdsImage, OdsInput, OdsInputNumber, OdsLink, OdsList, OdsModal, 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 };
17009
17001
  //# sourceMappingURL=index.modern.js.map