@salesgenterp/ui-components 0.4.323 → 0.4.324

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/index.js CHANGED
@@ -33,6 +33,7 @@ var tfi = require('react-icons/tfi');
33
33
  var go = require('react-icons/go');
34
34
  var ri = require('react-icons/ri');
35
35
  var bi = require('react-icons/bi');
36
+ var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
36
37
  var FormControl = _interopDefault(require('@mui/material/FormControl'));
37
38
  var InputLabel = _interopDefault(require('@mui/material/InputLabel'));
38
39
  var MenuItem = _interopDefault(require('@mui/material/MenuItem'));
@@ -49,7 +50,6 @@ var reactSpinners = require('react-spinners');
49
50
  var Box = _interopDefault(require('@mui/material/Box'));
50
51
  var TableSortLabel = _interopDefault(require('@mui/material/TableSortLabel'));
51
52
  var hi2 = require('react-icons/hi2');
52
- var Checkbox = _interopDefault(require('@mui/material/Checkbox'));
53
53
  var InputBase = _interopDefault(require('@mui/material/InputBase'));
54
54
  var reactSelect = require('react-select');
55
55
  var ReactAsyncSelect = _interopDefault(require('react-select/async'));
@@ -3567,7 +3567,7 @@ var SideMenu = function SideMenu(props) {
3567
3567
  };
3568
3568
 
3569
3569
  var _templateObject$g, _templateObject2$8;
3570
- var _excluded$3 = ["label", "onChange", "defaultValue", "options", "valueKey", "labelKey", "addNone", "fontColor"];
3570
+ var _excluded$3 = ["label", "onChange", "defaultValue", "options", "valueKey", "labelKey", "addNone", "fontColor", "maxWidth", "checkAllOption", "multiple"];
3571
3571
  function MuiSelect(_ref) {
3572
3572
  var label = _ref.label,
3573
3573
  onChange = _ref.onChange,
@@ -3579,18 +3579,34 @@ function MuiSelect(_ref) {
3579
3579
  labelKey = _ref$labelKey === void 0 ? 'name' : _ref$labelKey,
3580
3580
  addNone = _ref.addNone,
3581
3581
  fontColor = _ref.fontColor,
3582
+ maxWidth = _ref.maxWidth,
3583
+ checkAllOption = _ref.checkAllOption,
3584
+ multiple = _ref.multiple,
3582
3585
  props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
3583
3586
  var _React$useState = React.useState(defaultValue),
3584
3587
  value = _React$useState[0],
3585
3588
  setValue = _React$useState[1];
3586
- var handleChange = function handleChange(e) {
3587
- setValue(e.target.value);
3588
- onChange && onChange(e.target.value);
3589
+ var checkAll = (options === null || options === void 0 ? void 0 : options.length) === (value === null || value === void 0 ? void 0 : value.length);
3590
+ var indeterminate = (value === null || value === void 0 ? void 0 : value.length) > 0 && (value === null || value === void 0 ? void 0 : value.length) < (options === null || options === void 0 ? void 0 : options.length);
3591
+ var handleChange = function handleChange(event) {
3592
+ var value = event.target.value;
3593
+ if (checkAllOption && value[(value === null || value === void 0 ? void 0 : value.length) - 1] === 'all') {
3594
+ var updateValue = (value === null || value === void 0 ? void 0 : value.length) - 1 === (options === null || options === void 0 ? void 0 : options.length) ? [] : options === null || options === void 0 ? void 0 : options.map(function (value) {
3595
+ return valueKey ? value[valueKey] : value;
3596
+ });
3597
+ setValue(updateValue);
3598
+ onChange && onChange(updateValue);
3599
+ return;
3600
+ } else {
3601
+ setValue(value);
3602
+ onChange && onChange(value);
3603
+ }
3589
3604
  };
3590
3605
  return /*#__PURE__*/React.createElement(FormControl, {
3591
3606
  sx: {
3592
3607
  m: 1,
3593
- minWidth: 160
3608
+ minWidth: 160,
3609
+ maxWidth: maxWidth
3594
3610
  },
3595
3611
  size: "small"
3596
3612
  }, /*#__PURE__*/React.createElement(InputContainer$1, {
@@ -3602,20 +3618,28 @@ function MuiSelect(_ref) {
3602
3618
  value: value,
3603
3619
  label: label,
3604
3620
  onChange: handleChange,
3605
- fontColor: fontColor
3621
+ fontColor: fontColor,
3622
+ multiple: multiple
3606
3623
  }, props), addNone && /*#__PURE__*/React.createElement(MenuItem, {
3607
3624
  value: ""
3608
- }, /*#__PURE__*/React.createElement("em", null, "None")), options === null || options === void 0 ? void 0 : options.map(function (data) {
3625
+ }, /*#__PURE__*/React.createElement("em", null, "None")), checkAllOption && multiple && /*#__PURE__*/React.createElement(MenuItem, {
3626
+ value: 'all'
3627
+ }, /*#__PURE__*/React.createElement(Checkbox, {
3628
+ checked: checkAll,
3629
+ indeterminate: indeterminate
3630
+ }), "All"), options === null || options === void 0 ? void 0 : options.map(function (data) {
3609
3631
  return /*#__PURE__*/React.createElement(MenuItem, {
3610
3632
  value: valueKey ? data[valueKey] : data,
3611
3633
  disabled: data === null || data === void 0 ? void 0 : data.disabled
3612
- }, getLabelValue({
3634
+ }, checkAllOption && multiple && /*#__PURE__*/React.createElement(Checkbox, {
3635
+ checked: value.indexOf(valueKey ? data[valueKey] : data) > -1
3636
+ }), getLabelValue({
3613
3637
  labelKey: labelKey,
3614
3638
  option: data
3615
3639
  }));
3616
3640
  })));
3617
3641
  }
3618
- var SelectContainer = styled__default(Select$1)(_templateObject$g || (_templateObject$g = _taggedTemplateLiteralLoose(["\n color: ", " !important;\n svg,\n input {\n color: ", " !important;\n }\n fieldset {\n border-color: ", " !important;\n }\n"])), function (props) {
3642
+ var SelectContainer = styled__default(Select$1)(_templateObject$g || (_templateObject$g = _taggedTemplateLiteralLoose(["\n color: ", " !important;\n svg,\n input {\n color: ", " !important;\n }\n fieldset {\n border-color: ", " !important;\n }\n .MuiCheckbox-root {\n padding: 0;\n }\n"])), function (props) {
3619
3643
  return props.fontColor;
3620
3644
  }, function (props) {
3621
3645
  return props.fontColor;
@@ -3822,7 +3846,9 @@ var Statement = function Statement(_ref) {
3822
3846
  labelKey: "${firstName} ${lastName} (${company})",
3823
3847
  multiple: true,
3824
3848
  fontColor: fontColor,
3825
- primaryColor: primaryColor
3849
+ primaryColor: primaryColor,
3850
+ maxWidth: 300,
3851
+ checkAllOption: true
3826
3852
  })), /*#__PURE__*/React__default.createElement(material.Grid, {
3827
3853
  item: true
3828
3854
  }, /*#__PURE__*/React__default.createElement(DateRangePicker, {