@banyan_cloud/roots 1.0.120 → 1.0.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -24066,15 +24066,24 @@ function requireCssExtras () {
24066
24066
  return cssExtras_1;
24067
24067
  }
24068
24068
 
24069
- var csv_1 = csv;
24070
- csv.displayName = 'csv';
24071
- csv.aliases = [];
24072
- function csv(Prism) {
24073
- // https://tools.ietf.org/html/rfc4180
24074
- Prism.languages.csv = {
24075
- value: /[^\r\n,"]+|"(?:[^"]|"")*"(?!")/,
24076
- punctuation: /,/
24077
- };
24069
+ var csv_1;
24070
+ var hasRequiredCsv;
24071
+
24072
+ function requireCsv () {
24073
+ if (hasRequiredCsv) return csv_1;
24074
+ hasRequiredCsv = 1;
24075
+
24076
+ csv_1 = csv;
24077
+ csv.displayName = 'csv';
24078
+ csv.aliases = [];
24079
+ function csv(Prism) {
24080
+ // https://tools.ietf.org/html/rfc4180
24081
+ Prism.languages.csv = {
24082
+ value: /[^\r\n,"]+|"(?:[^"]|"")*"(?!")/,
24083
+ punctuation: /,/
24084
+ };
24085
+ }
24086
+ return csv_1;
24078
24087
  }
24079
24088
 
24080
24089
  var cypher_1;
@@ -43096,7 +43105,7 @@ refractor.register(requireCsharp());
43096
43105
  refractor.register(requireCshtml());
43097
43106
  refractor.register(requireCsp());
43098
43107
  refractor.register(requireCssExtras());
43099
- refractor.register(csv_1);
43108
+ refractor.register(requireCsv());
43100
43109
  refractor.register(requireCypher());
43101
43110
  refractor.register(requireD());
43102
43111
  refractor.register(requireDart());
@@ -49020,6 +49029,211 @@ TableFilters.defaultProps = {
49020
49029
  theme: 'light'
49021
49030
  };
49022
49031
 
49032
+ var useTableSearch = function useTableSearch() {
49033
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
49034
+ _ref$filters = _ref.filters,
49035
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
49036
+ onApply = _ref.onApply;
49037
+ var _useState = React.useState([]),
49038
+ _useState2 = _slicedToArray(_useState, 2),
49039
+ selectedFilters = _useState2[0],
49040
+ setSelectedFilters = _useState2[1];
49041
+ var _useState3 = React.useState(false),
49042
+ _useState4 = _slicedToArray(_useState3, 2),
49043
+ autocompleteOpen = _useState4[0],
49044
+ setAutocompleteOpen = _useState4[1];
49045
+ var _useState5 = React.useState(''),
49046
+ _useState6 = _slicedToArray(_useState5, 2),
49047
+ value = _useState6[0],
49048
+ setValue = _useState6[1];
49049
+ var onChange = function onChange(event, newValue) {
49050
+ setValue(newValue);
49051
+ };
49052
+ var setFieldValue = function setFieldValue(fieldValue, type) {
49053
+ var id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
49054
+ var lock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
49055
+ if ((selectedFilters === null || selectedFilters === void 0 ? void 0 : selectedFilters.length) > 0) {
49056
+ var _clonedFilters$length;
49057
+ var clonedFilters = _toConsumableArray$1(selectedFilters);
49058
+ var current = clonedFilters === null || clonedFilters === void 0 ? void 0 : clonedFilters[((_clonedFilters$length = clonedFilters === null || clonedFilters === void 0 ? void 0 : clonedFilters.length) !== null && _clonedFilters$length !== void 0 ? _clonedFilters$length : 0) - 1];
49059
+ current[type] = fieldValue;
49060
+ current["".concat(type, "Search")] = !lock;
49061
+ current["".concat(type, "Id")] = id;
49062
+ if (type === 'label') {
49063
+ var _filters$find$icon, _filters$find;
49064
+ current.icon = (_filters$find$icon = (_filters$find = filters.find(function (fil) {
49065
+ return fil.id === id;
49066
+ })) === null || _filters$find === void 0 ? void 0 : _filters$find.icon) !== null && _filters$find$icon !== void 0 ? _filters$find$icon : null;
49067
+ }
49068
+ // the chip is about to be locked
49069
+ if (lock && type === 'value') {
49070
+ onApply === null || onApply === void 0 ? void 0 : onApply(clonedFilters);
49071
+ current.temp = true;
49072
+ }
49073
+ setSelectedFilters(clonedFilters);
49074
+ }
49075
+ };
49076
+
49077
+ // onSearch will be fired on change of chip input
49078
+ function onSearch(event) {
49079
+ var _inputHelper = inputHelper(event),
49080
+ fieldValue = _inputHelper.fieldValue,
49081
+ dataset = _inputHelper.dataset;
49082
+ var search = dataset.search;
49083
+ if (search === 'label') {
49084
+ setFieldValue(fieldValue, 'label');
49085
+ } else if (search === 'value') {
49086
+ setFieldValue(fieldValue, 'value');
49087
+ }
49088
+ }
49089
+ var onRemove = function onRemove(chip, index) {
49090
+ var clonedFilters = _toConsumableArray$1(selectedFilters);
49091
+ clonedFilters.splice(index, 1);
49092
+ setSelectedFilters(clonedFilters);
49093
+ };
49094
+ var onLock = function onLock(event, index) {
49095
+ if (event.keyCode === 13) {
49096
+ var _current$value;
49097
+ var current = selectedFilters === null || selectedFilters === void 0 ? void 0 : selectedFilters[index];
49098
+ if (current && (current === null || current === void 0 ? void 0 : (_current$value = current.value) === null || _current$value === void 0 ? void 0 : _current$value.length) > 0) {
49099
+ setFieldValue(current.value, 'value', current.value, true);
49100
+ }
49101
+ }
49102
+ };
49103
+
49104
+ // on selecting searchbar option we will add an empty chip
49105
+ // that chip will have dropdown options from all filters provided through options
49106
+ var onAdd = function onAdd(fil) {
49107
+ var clonedFilters = _toConsumableArray$1(selectedFilters);
49108
+ var newChip = new TableChip({
49109
+ labelSearch: false,
49110
+ label: fil.title,
49111
+ labelId: fil.id,
49112
+ icon: fil.icon,
49113
+ valueSearch: true,
49114
+ autocompleteOptions: {
49115
+ middlewareOptions: {
49116
+ offset: {
49117
+ mainAxis: 10
49118
+ }
49119
+ },
49120
+ predicate: function predicate() {
49121
+ return true;
49122
+ },
49123
+ placement: 'bottom-start'
49124
+ }
49125
+ });
49126
+ clonedFilters.push(newChip);
49127
+ setSelectedFilters(clonedFilters);
49128
+ setValue('');
49129
+ };
49130
+
49131
+ // onBlur will remove the incomplete chip
49132
+ var onBlur = function onBlur() {
49133
+ if ((selectedFilters === null || selectedFilters === void 0 ? void 0 : selectedFilters.length) > 0) {
49134
+ var _clonedFilters$at, _clonedFilters$at2;
49135
+ var clonedFilters = _toConsumableArray$1(selectedFilters);
49136
+ if (clonedFilters !== null && clonedFilters !== void 0 && (_clonedFilters$at = clonedFilters.at(-1)) !== null && _clonedFilters$at !== void 0 && _clonedFilters$at.labelSearch && clonedFilters !== null && clonedFilters !== void 0 && (_clonedFilters$at2 = clonedFilters.at(-1)) !== null && _clonedFilters$at2 !== void 0 && _clonedFilters$at2.valueSearch) {
49137
+ clonedFilters === null || clonedFilters === void 0 ? void 0 : clonedFilters.pop();
49138
+ }
49139
+ setSelectedFilters(clonedFilters);
49140
+ }
49141
+ };
49142
+
49143
+ // the autocomplete options which get rendered for table searchbar
49144
+ // call the onAdd method on selection of an option
49145
+ var renderAutocomplete = function renderAutocomplete(_ref2) {
49146
+ var _filters$filter;
49147
+ var inputValue = _ref2.value;
49148
+ return filters === null || filters === void 0 ? void 0 : (_filters$filter = filters.filter(function (fil) {
49149
+ var _fil$title$toLowerCas;
49150
+ return (fil === null || fil === void 0 ? void 0 : (_fil$title$toLowerCas = fil.title.toLowerCase()) === null || _fil$title$toLowerCas === void 0 ? void 0 : _fil$title$toLowerCas.indexOf(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase())) !== -1;
49151
+ })) === null || _filters$filter === void 0 ? void 0 : _filters$filter.map(function (fil) {
49152
+ var _fil$deps, _fil$deps$every;
49153
+ var disabled = ((_fil$deps = fil.deps) === null || _fil$deps === void 0 ? void 0 : (_fil$deps$every = _fil$deps.every) === null || _fil$deps$every === void 0 ? void 0 : _fil$deps$every.call(_fil$deps, function (dep) {
49154
+ return (selectedFilters === null || selectedFilters === void 0 ? void 0 : selectedFilters.find(function (sFil) {
49155
+ return (sFil === null || sFil === void 0 ? void 0 : sFil.labelId) === dep && sFil.temp;
49156
+ })) != null;
49157
+ })) === false;
49158
+ return /*#__PURE__*/jsxRuntime.jsx(DropdownItem, {
49159
+ value: fil.id,
49160
+ title: fil.title,
49161
+ disabled: disabled,
49162
+ onClick: function onClick() {
49163
+ if (!disabled) {
49164
+ onAdd(fil);
49165
+ setAutocompleteOpen(false);
49166
+ }
49167
+ }
49168
+ }, fil.id);
49169
+ });
49170
+ };
49171
+
49172
+ // the autocomplete options which get rendered for a chip
49173
+ // and set the state on selection
49174
+ var renderChipAutocomplete = function renderChipAutocomplete(_ref3) {
49175
+ var name = _ref3.name,
49176
+ inputValue = _ref3.value;
49177
+ var filtersDOM = [];
49178
+ if (name === 'label') {
49179
+ var _filters$filter2;
49180
+ filtersDOM = filters === null || filters === void 0 ? void 0 : (_filters$filter2 = filters.filter(function (fil) {
49181
+ var _fil$title$toLowerCas2;
49182
+ return (fil === null || fil === void 0 ? void 0 : (_fil$title$toLowerCas2 = fil.title.toLowerCase()) === null || _fil$title$toLowerCas2 === void 0 ? void 0 : _fil$title$toLowerCas2.indexOf(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase())) !== -1;
49183
+ })) === null || _filters$filter2 === void 0 ? void 0 : _filters$filter2.map(function (fil) {
49184
+ return /*#__PURE__*/jsxRuntime.jsx(DropdownItem, {
49185
+ value: fil.id,
49186
+ title: fil.title,
49187
+ onClick: function onClick() {
49188
+ setFieldValue(fil.title, 'label', fil.id, true);
49189
+ }
49190
+ }, fil.id);
49191
+ });
49192
+ }
49193
+ if (name === 'value') {
49194
+ var _selectedFilters$at, _filters$find2, _filters$find2$option, _filters$find2$option2;
49195
+ var currentFilter = selectedFilters === null || selectedFilters === void 0 ? void 0 : (_selectedFilters$at = selectedFilters.at(-1)) === null || _selectedFilters$at === void 0 ? void 0 : _selectedFilters$at.labelId;
49196
+ filtersDOM = filters === null || filters === void 0 ? void 0 : (_filters$find2 = filters.find(function (fil) {
49197
+ return fil.id === currentFilter;
49198
+ })) === null || _filters$find2 === void 0 ? void 0 : (_filters$find2$option = _filters$find2.options) === null || _filters$find2$option === void 0 ? void 0 : (_filters$find2$option2 = _filters$find2$option.filter(function (option) {
49199
+ var _option$toLowerCase;
49200
+ return (option === null || option === void 0 ? void 0 : (_option$toLowerCase = option.toLowerCase()) === null || _option$toLowerCase === void 0 ? void 0 : _option$toLowerCase.indexOf(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase())) !== -1;
49201
+ })) === null || _filters$find2$option2 === void 0 ? void 0 : _filters$find2$option2.map(function (option) {
49202
+ return /*#__PURE__*/jsxRuntime.jsx(DropdownItem, {
49203
+ value: option,
49204
+ title: option,
49205
+ onClick: function onClick() {
49206
+ setFieldValue(option, 'value', option, true);
49207
+ }
49208
+ }, option);
49209
+ });
49210
+ }
49211
+ return filtersDOM;
49212
+ };
49213
+ return {
49214
+ onAdd: onAdd,
49215
+ onBlur: onBlur,
49216
+ onSearch: onSearch,
49217
+ onRemove: onRemove,
49218
+ onLock: onLock,
49219
+ searchbarOptions: {
49220
+ value: value,
49221
+ onChange: onChange,
49222
+ autocomplete: true,
49223
+ autocompleteOptions: {
49224
+ open: autocompleteOpen,
49225
+ setOpen: setAutocompleteOpen,
49226
+ render: renderAutocomplete,
49227
+ predicate: function predicate() {
49228
+ return true;
49229
+ }
49230
+ }
49231
+ },
49232
+ renderChipAutocomplete: renderChipAutocomplete,
49233
+ selectedFilters: selectedFilters
49234
+ };
49235
+ };
49236
+
49023
49237
  var css$j = ".Table_module_root__b07b1753 {\n position: relative;\n border-style: solid;\n border-color: var(--grey4);\n border-width: 1px 1px 0px 1px;\n border-radius: 0.25rem;\n width: 100%;\n max-width: 100%;\n height: 100%;\n overflow: hidden;\n}\n.Table_module_root__b07b1753 .Table_module_table__b07b1753 {\n height: calc(100% - 6rem);\n padding-bottom: 3.5rem;\n}\n.Table_module_root__b07b1753 .Table_module_pagination__b07b1753 {\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n}\n.Table_module_root__b07b1753 .Table_module_pagination__b07b1753.Table_module_floating__b07b1753 {\n bottom: 1rem;\n}\n.Table_module_root__b07b1753 .Table_module_chips__b07b1753,\n.Table_module_root__b07b1753 .Table_module_filters__b07b1753,\n.Table_module_root__b07b1753 .Table_module_table__b07b1753 > [data-elem=table-header] {\n position: sticky;\n z-index: 1;\n top: 0;\n}";
49024
49238
  var modules_2e8406c7 = {"root":"Table_module_root__b07b1753","table":"Table_module_table__b07b1753","pagination":"Table_module_pagination__b07b1753","floating":"Table_module_floating__b07b1753","chips":"Table_module_chips__b07b1753","filters":"Table_module_filters__b07b1753"};
49025
49239
  n(css$j,{});
@@ -109664,7 +109878,7 @@ var ChartSkeleton$3 = function ChartSkeleton(_ref) {
109664
109878
 
109665
109879
  use([install$8, install$9, install$a, install$1, install$h, install]);
109666
109880
  var BaseHorizontalBarChart = function BaseHorizontalBarChart(props) {
109667
- var _seriesOption$length, _seriesData$metaData$, _seriesData$metaData, _seriesData$metaData$2, _seriesData$chartData, _seriesData$chartData13;
109881
+ var _seriesOption$length, _seriesData$metaData$, _seriesData$metaData, _seriesData$metaData$2, _seriesData$chartData, _seriesData$chartData16;
109668
109882
  var loading = props.loading,
109669
109883
  title = props.title,
109670
109884
  titleOptions = props.titleOptions,
@@ -109688,7 +109902,8 @@ var BaseHorizontalBarChart = function BaseHorizontalBarChart(props) {
109688
109902
  style = props.style,
109689
109903
  className = props.className,
109690
109904
  theme = props.theme,
109691
- fallback = props.fallback;
109905
+ fallback = props.fallback,
109906
+ minBarHeight = props.minBarHeight;
109692
109907
  if (loading || fallback) {
109693
109908
  return /*#__PURE__*/jsxRuntime.jsx(ChartSkeleton$3, {
109694
109909
  theme: theme,
@@ -109722,6 +109937,18 @@ var BaseHorizontalBarChart = function BaseHorizontalBarChart(props) {
109722
109937
  return (_seriesData$chartData2 = seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$chartData3 = seriesData.chartData) === null || _seriesData$chartData3 === void 0 ? void 0 : (_seriesData$chartData4 = _seriesData$chartData3[key]) === null || _seriesData$chartData4 === void 0 ? void 0 : _seriesData$chartData4.x1) !== null && _seriesData$chartData2 !== void 0 ? _seriesData$chartData2 : '';
109723
109938
  })
109724
109939
  };
109940
+ var calcHeight = function calcHeight(barVal) {
109941
+ if (barVal === 0) {
109942
+ return 0;
109943
+ }
109944
+ if (barVal > minBarHeight) {
109945
+ return barVal - minBarHeight;
109946
+ }
109947
+ if (barVal < minBarHeight) {
109948
+ return barVal + minBarHeight;
109949
+ }
109950
+ return barVal;
109951
+ };
109725
109952
  var generateSeries = function generateSeries() {
109726
109953
  return seriesOption.map(function (objectData, index) {
109727
109954
  var _seriesOptionObject$l, _objectData$label, _seriesOption$index, _seriesOption$index$m, _seriesOption$index2, _seriesData$chartData5, _seriesData$chartData9;
@@ -109745,9 +109972,9 @@ var BaseHorizontalBarChart = function BaseHorizontalBarChart(props) {
109745
109972
  tooltip: _objectSpread2({}, (_seriesOption$subInde = (_seriesOption$subInde2 = seriesOption[subIndex]) === null || _seriesOption$subInde2 === void 0 ? void 0 : _seriesOption$subInde2.tooltip) !== null && _seriesOption$subInde !== void 0 ? _seriesOption$subInde : {})
109746
109973
  };
109747
109974
  }))) : Object.keys((_seriesData$chartData9 = seriesData === null || seriesData === void 0 ? void 0 : seriesData.chartData) !== null && _seriesData$chartData9 !== void 0 ? _seriesData$chartData9 : {}).map(function (key, subIndex) {
109748
- var _seriesData$chartData10, _seriesData$chartData11, _seriesData$chartData12, _ref2, _objectData$color4, _objectData$barColor$3, _objectData$barColor3, _objectData$color5, _objectData$barColor$4, _objectData$barColor4, _objectData$color6, _seriesOption$subInde3, _seriesOption$subInde4;
109975
+ var _seriesData$chartData10, _seriesData$chartData11, _seriesData$chartData12, _seriesData$chartData13, _seriesData$chartData14, _seriesData$chartData15, _ref2, _objectData$color4, _objectData$barColor$3, _objectData$barColor3, _objectData$color5, _objectData$barColor$4, _objectData$barColor4, _objectData$color6, _seriesOption$subInde3, _seriesOption$subInde4;
109749
109976
  return {
109750
- value: (_seriesData$chartData10 = seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$chartData11 = seriesData.chartData) === null || _seriesData$chartData11 === void 0 ? void 0 : (_seriesData$chartData12 = _seriesData$chartData11[key]) === null || _seriesData$chartData12 === void 0 ? void 0 : _seriesData$chartData12["x".concat(index + 1)]) !== null && _seriesData$chartData10 !== void 0 ? _seriesData$chartData10 : '',
109977
+ value: minBarHeight ? calcHeight((_seriesData$chartData10 = seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$chartData11 = seriesData.chartData) === null || _seriesData$chartData11 === void 0 ? void 0 : (_seriesData$chartData12 = _seriesData$chartData11[key]) === null || _seriesData$chartData12 === void 0 ? void 0 : _seriesData$chartData12["x".concat(index + 1)]) !== null && _seriesData$chartData10 !== void 0 ? _seriesData$chartData10 : 0) : (_seriesData$chartData13 = seriesData === null || seriesData === void 0 ? void 0 : (_seriesData$chartData14 = seriesData.chartData) === null || _seriesData$chartData14 === void 0 ? void 0 : (_seriesData$chartData15 = _seriesData$chartData14[key]) === null || _seriesData$chartData15 === void 0 ? void 0 : _seriesData$chartData15["x".concat(index + 1)]) !== null && _seriesData$chartData13 !== void 0 ? _seriesData$chartData13 : 0,
109751
109978
  itemStyle: {
109752
109979
  color: typeof ((_ref2 = (_objectData$color4 = objectData === null || objectData === void 0 ? void 0 : objectData.color) !== null && _objectData$color4 !== void 0 ? _objectData$color4 : '') !== null && _ref2 !== void 0 ? _ref2 : {}) !== 'string' ? _construct(LinearGradient$1, _toConsumableArray$1(((_objectData$barColor$3 = objectData === null || objectData === void 0 ? void 0 : (_objectData$barColor3 = objectData.barColor) === null || _objectData$barColor3 === void 0 ? void 0 : _objectData$barColor3[subIndex]) !== null && _objectData$barColor$3 !== void 0 ? _objectData$barColor$3 : '') || ((_objectData$color5 = objectData === null || objectData === void 0 ? void 0 : objectData.color) !== null && _objectData$color5 !== void 0 ? _objectData$color5 : ''))) : ((_objectData$barColor$4 = objectData === null || objectData === void 0 ? void 0 : (_objectData$barColor4 = objectData.barColor) === null || _objectData$barColor4 === void 0 ? void 0 : _objectData$barColor4[subIndex]) !== null && _objectData$barColor$4 !== void 0 ? _objectData$barColor$4 : '') || ((_objectData$color6 = objectData === null || objectData === void 0 ? void 0 : objectData.color) !== null && _objectData$color6 !== void 0 ? _objectData$color6 : '')
109753
109980
  },
@@ -109773,7 +110000,7 @@ var BaseHorizontalBarChart = function BaseHorizontalBarChart(props) {
109773
110000
  legend: _objectSpread2({}, legend),
109774
110001
  tooltip: _objectSpread2({}, tooltip),
109775
110002
  yAxis: {
109776
- data: Object.keys((_seriesData$chartData13 = seriesData === null || seriesData === void 0 ? void 0 : seriesData.chartData) !== null && _seriesData$chartData13 !== void 0 ? _seriesData$chartData13 : {}),
110003
+ data: Object.keys((_seriesData$chartData16 = seriesData === null || seriesData === void 0 ? void 0 : seriesData.chartData) !== null && _seriesData$chartData16 !== void 0 ? _seriesData$chartData16 : {}),
109777
110004
  type: 'category',
109778
110005
  axisLabel: {
109779
110006
  show: yAxisLabelShow
@@ -109822,6 +110049,7 @@ BaseHorizontalBarChart.propTypes = {
109822
110049
  legend: propTypes$1.exports.object,
109823
110050
  seriesName: propTypes$1.exports.func,
109824
110051
  cursor: propTypes$1.exports.string,
110052
+ minBarHeight: propTypes$1.exports.number,
109825
110053
  stacked: propTypes$1.exports.bool,
109826
110054
  seriesOption: propTypes$1.exports.objectOf(propTypes$1.exports.shape),
109827
110055
  style: propTypes$1.exports.object,
@@ -109851,6 +110079,7 @@ BaseHorizontalBarChart.defaultProps = {
109851
110079
  ySplitLineShow: false,
109852
110080
  yAxisLineShow: false,
109853
110081
  yAxisTickShow: false,
110082
+ minBarHeight: 0,
109854
110083
  barWidth: '50%',
109855
110084
  seriesName: function seriesName() {},
109856
110085
  legend: {
@@ -113675,4 +113904,5 @@ exports.useOutsideClickListener = useOutsideClickListener;
113675
113904
  exports.usePagination = usePagination;
113676
113905
  exports.useResize = useResize;
113677
113906
  exports.useRowFilter = useRowFilter;
113907
+ exports.useTableSearch = useTableSearch;
113678
113908
  //# sourceMappingURL=index.js.map