ywana-core8 0.0.942 → 0.0.944

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.
@@ -1061,7 +1061,10 @@ var Tabs = function Tabs(props) {
1061
1061
  fillLeft = _props$fillLeft === void 0 ? false : _props$fillLeft,
1062
1062
  _props$fillRight = props.fillRight,
1063
1063
  fillRight = _props$fillRight === void 0 ? true : _props$fillRight;
1064
- var tabs = React.Children.map(children, function (child, index) {
1064
+ var notNullChildren = React.Children.toArray(children).filter(function (child) {
1065
+ return child !== null;
1066
+ });
1067
+ var tabs = notNullChildren.map(function (child, index) {
1065
1068
  function select(id) {
1066
1069
  if (onChange) onChange(id || index);
1067
1070
  }
@@ -1111,7 +1114,10 @@ var Tab = function Tab(props) {
1111
1114
  var Stack = function Stack(props) {
1112
1115
  var _props$selected = props.selected,
1113
1116
  selected = _props$selected === void 0 ? 0 : _props$selected;
1114
- var child = React.Children.toArray(props.children).filter(function (child, index) {
1117
+ var notNullChildren = React.Children.toArray(props.children).filter(function (child) {
1118
+ return child !== null;
1119
+ });
1120
+ var child = notNullChildren.filter(function (child, index) {
1115
1121
  return index === selected;
1116
1122
  })[0];
1117
1123
  return /*#__PURE__*/React.createElement(Fragment, null, child);
@@ -1832,8 +1838,25 @@ var DataTable = function DataTable(props) {
1832
1838
  icon: "search_off"
1833
1839
  }), /*#__PURE__*/React.createElement(Text, null, emptyMessage)))))));
1834
1840
  };
1841
+
1842
+ /**
1843
+ * DataTableFiltersRow
1844
+ */
1835
1845
  var DataTableFiltersRow = function DataTableFiltersRow(_ref4) {
1836
1846
  var columns = _ref4.columns;
1847
+ var _useState3 = useState({}),
1848
+ form = _useState3[0],
1849
+ setForm = _useState3[1];
1850
+ function changeFilter(id, value, onFilter) {
1851
+ var _extends2;
1852
+ setForm(_extends({}, form, (_extends2 = {}, _extends2[id] = value, _extends2)));
1853
+ if (onFilter) onFilter(value);
1854
+ }
1855
+ function clear() {
1856
+ setForm({});
1857
+ }
1858
+ var dirty = Object.keys(form).length > 0; // dirty if there are filters set
1859
+
1837
1860
  return /*#__PURE__*/React.createElement("tr", {
1838
1861
  className: "filters-row"
1839
1862
  }, columns.map(function (_ref5) {
@@ -1843,18 +1866,30 @@ var DataTableFiltersRow = function DataTableFiltersRow(_ref4) {
1843
1866
  options = _ref5.options;
1844
1867
  var field = options ? /*#__PURE__*/React.createElement(DropDown, {
1845
1868
  id: id,
1869
+ value: form[id],
1846
1870
  options: options,
1847
- onChange: onFilter,
1871
+ onChange: function onChange(id, value) {
1872
+ return changeFilter(id, value, onFilter);
1873
+ },
1848
1874
  outlined: true
1849
1875
  }) : /*#__PURE__*/React.createElement(TextField, {
1850
1876
  id: id,
1851
- onChange: onFilter,
1877
+ value: form[id],
1878
+ onChange: function onChange(id, value) {
1879
+ return changeFilter(id, value, onFilter);
1880
+ },
1852
1881
  outlined: true
1853
1882
  });
1854
1883
  return /*#__PURE__*/React.createElement("td", {
1855
1884
  className: "filter-cell"
1856
1885
  }, filterable ? field : null);
1857
- }));
1886
+ }), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(Icon, {
1887
+ icon: "close",
1888
+ size: "small",
1889
+ clickable: true,
1890
+ action: clear,
1891
+ disabled: !dirty
1892
+ })));
1858
1893
  };
1859
1894
 
1860
1895
  /**
@@ -1872,9 +1907,9 @@ var DataTableRow = function DataTableRow(props) {
1872
1907
  var _row$selected = row.selected,
1873
1908
  selected = _row$selected === void 0 ? false : _row$selected,
1874
1909
  className = row.className;
1875
- var _useState3 = useState(expanded),
1876
- isInfoOpen = _useState3[0],
1877
- toggleInfo = _useState3[1];
1910
+ var _useState4 = useState(expanded),
1911
+ isInfoOpen = _useState4[0],
1912
+ toggleInfo = _useState4[1];
1878
1913
  var infoIcon = isInfoOpen ? 'expand_less' : 'expand_more';
1879
1914
  var style = isInfoOpen ? "expanded" : "";
1880
1915
  if (selected) style += " selected";
@@ -5779,6 +5814,9 @@ var Planner2 = function Planner2(_ref) {
5779
5814
  function selectCell(cell) {
5780
5815
  if (onSelectCell) onSelectCell(cell);
5781
5816
  }
5817
+ function drop() {
5818
+ //TODO
5819
+ }
5782
5820
  var uniqueMonths = Array.from(new Set(days.map(function (_ref2) {
5783
5821
  var month = _ref2.month;
5784
5822
  return month;
@@ -5879,18 +5917,19 @@ var Planner2 = function Planner2(_ref) {
5879
5917
  });
5880
5918
  var weekendClass = isWeekend ? 'weekend' : '';
5881
5919
  return /*#__PURE__*/React.createElement("div", {
5920
+ key: "content" + index + "_" + year + "-" + month + "-" + day,
5882
5921
  className: "content-cell " + weekendClass,
5883
5922
  style: {
5884
5923
  minWidth: dayWidth,
5885
5924
  maxWidth: dayWidth
5886
5925
  },
5887
- key: "content" + index + "_" + year + "-" + month + "-" + day,
5888
5926
  onClick: function onClick() {
5889
5927
  return selectCell({
5890
5928
  lane: lane.id,
5891
5929
  date: dayDate
5892
5930
  });
5893
- }
5931
+ },
5932
+ onDrop: drop
5894
5933
  }, dayEvents.map(function (event, index) {
5895
5934
  return /*#__PURE__*/React.createElement(EventRenderer, {
5896
5935
  key: event.id + "-" + index,