@widergy/energy-ui 2.12.1 → 2.12.2
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/components/EnergyThemeProvider/index.js +36 -13
- package/dist/components/Loading/constants.js +2 -1
- package/dist/components/Loading/index.js +12 -13
- package/dist/components/Loading/theme.js +2 -4
- package/dist/components/UTAlert/AlertHandler.js +101 -75
- package/dist/components/UTAlert/index.js +87 -65
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +9 -8
- package/dist/components/UTAttachment/constants.js +13 -7
- package/dist/components/UTAttachment/index.js +250 -159
- package/dist/components/UTAttachment/layout.js +27 -26
- package/dist/components/UTAttachment/theme.js +2 -4
- package/dist/components/UTAttachment/utils.js +117 -34
- package/dist/components/UTAutocomplete/components/ListBox/index.js +21 -13
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -9
- package/dist/components/UTAutocomplete/constants.js +23 -12
- package/dist/components/UTAutocomplete/index.js +94 -54
- package/dist/components/UTAutocomplete/theme.js +4 -6
- package/dist/components/UTAvatar/constants.js +3 -2
- package/dist/components/UTAvatar/index.js +17 -18
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
- package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +22 -21
- package/dist/components/UTBarChart/components/Bars/constants.js +6 -3
- package/dist/components/UTBarChart/components/Bars/index.js +80 -70
- package/dist/components/UTBarChart/components/Legend/constants.js +18 -12
- package/dist/components/UTBarChart/components/Legend/index.js +93 -75
- package/dist/components/UTBarChart/components/Legend/utils.js +5 -1
- package/dist/components/UTBarChart/components/Levels/index.js +14 -16
- package/dist/components/UTBarChart/components/Levels/utils.js +27 -25
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +5 -3
- package/dist/components/UTBarChart/components/LinearPlot/index.js +20 -25
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -37
- package/dist/components/UTBarChart/components/Pagination/constants.js +2 -1
- package/dist/components/UTBarChart/components/Pagination/index.js +24 -20
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +32 -21
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +4 -2
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -20
- package/dist/components/UTBarChart/components/XAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/XAxis/index.js +65 -54
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -12
- package/dist/components/UTBarChart/components/YAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/YAxis/index.js +37 -30
- package/dist/components/UTBarChart/components/YAxis/utils.js +6 -4
- package/dist/components/UTBarChart/constants.js +8 -4
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +40 -23
- package/dist/components/UTBarChart/index.js +166 -152
- package/dist/components/UTBarChart/theme.js +2 -4
- package/dist/components/UTBarChart/types.js +19 -10
- package/dist/components/UTBarChart/utils.js +111 -107
- package/dist/components/UTBreadcrumbs/constants.js +31 -23
- package/dist/components/UTBreadcrumbs/index.js +101 -76
- package/dist/components/UTBreadcrumbs/theme.js +2 -4
- package/dist/components/UTButton/constants.js +17 -11
- package/dist/components/UTButton/index.js +31 -28
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +40 -36
- package/dist/components/UTCBUInput/theme.js +2 -4
- package/dist/components/UTCaptcha/index.js +45 -19
- package/dist/components/UTCard/components/UTCardFooter/index.js +16 -15
- package/dist/components/UTCard/index.js +120 -85
- package/dist/components/UTCard/theme.js +12 -11
- package/dist/components/UTCard/types.js +3 -2
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +15 -13
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +10 -5
- package/dist/components/UTCarousel/components/Slider/index.js +273 -204
- package/dist/components/UTCarousel/components/Slider/layout.js +94 -67
- package/dist/components/UTCarousel/index.js +15 -14
- package/dist/components/UTCarousel/theme.js +2 -4
- package/dist/components/UTCheckList/constants.js +2 -1
- package/dist/components/UTCheckList/index.js +93 -72
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +6 -3
- package/dist/components/UTCheckbox/index.js +44 -32
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +6 -3
- package/dist/components/UTConsumptionBar/index.js +80 -53
- package/dist/components/UTCuit/index.js +133 -109
- package/dist/components/UTCuit/theme.js +53 -51
- package/dist/components/UTDatePicker/components/Day/constants.js +2 -1
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +31 -20
- package/dist/components/UTDatePicker/index.js +102 -60
- package/dist/components/UTDatePicker/theme.js +3 -5
- package/dist/components/UTDatePicker/types.js +3 -2
- package/dist/components/UTDatePicker/utils.js +6 -2
- package/dist/components/UTDialog/constants.js +4 -2
- package/dist/components/UTDialog/index.js +37 -38
- package/dist/components/UTDialog/theme.js +2 -4
- package/dist/components/UTDialog/types.js +3 -2
- package/dist/components/UTDotMenu/index.js +61 -39
- package/dist/components/UTEmojiPicker/constants.js +11 -6
- package/dist/components/UTEmojiPicker/index.js +65 -45
- package/dist/components/UTEmojiPicker/theme.js +2 -4
- package/dist/components/UTEmojiPicker/utils.js +51 -21
- package/dist/components/UTExternalLink/constants.js +5 -3
- package/dist/components/UTExternalLink/index.js +15 -18
- package/dist/components/UTExternalLink/theme.js +6 -8
- package/dist/components/UTFileInput/constants.js +4 -2
- package/dist/components/UTFileInput/index.js +31 -7
- package/dist/components/UTFileInput/layout.js +97 -68
- package/dist/components/UTIconButton/index.js +72 -49
- package/dist/components/UTIconButton/theme.js +2 -4
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +58 -53
- package/dist/components/UTImageRadio/constants.js +6 -3
- package/dist/components/UTImageRadio/index.js +47 -39
- package/dist/components/UTImageRadio/theme.js +12 -11
- package/dist/components/UTImageRadio/types.js +3 -2
- package/dist/components/UTImageRadio/utils.js +6 -2
- package/dist/components/UTLabel/constants.js +20 -14
- package/dist/components/UTLabel/index.js +20 -18
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +18 -15
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +11 -8
- package/dist/components/UTMap/components/GoogleMaps/index.js +91 -63
- package/dist/components/UTMap/components/GoogleMaps/styles.js +3 -2
- package/dist/components/UTMap/constants.js +12 -6
- package/dist/components/UTMap/index.js +198 -163
- package/dist/components/UTMap/types.js +6 -4
- package/dist/components/UTMap/utils.js +46 -29
- package/dist/components/UTMap/withGoogleMapScript.js +22 -18
- package/dist/components/UTMenu/index.js +69 -52
- package/dist/components/UTMenu/theme.js +3 -5
- package/dist/components/UTMenu/utils.js +11 -5
- package/dist/components/UTModal/constants.js +13 -9
- package/dist/components/UTModal/index.js +30 -26
- package/dist/components/UTModal/theme.js +2 -4
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -11
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +39 -28
- package/dist/components/UTPagination/components/Pagination/utils.js +14 -8
- package/dist/components/UTPagination/constants.js +6 -3
- package/dist/components/UTPagination/index.js +17 -16
- package/dist/components/UTPagination/theme.js +2 -4
- package/dist/components/UTPanel/index.js +44 -38
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +10 -13
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +19 -22
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +50 -63
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +26 -25
- package/dist/components/UTPasswordField/index.js +23 -26
- package/dist/components/UTPasswordField/theme.js +2 -4
- package/dist/components/UTPhoneInput/constants.js +6 -3
- package/dist/components/UTPhoneInput/index.js +205 -180
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +8 -4
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -24
- package/dist/components/UTPieChart/components/Legend/contants.js +6 -3
- package/dist/components/UTPieChart/components/Legend/index.js +24 -27
- package/dist/components/UTPieChart/constants.js +26 -13
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +33 -15
- package/dist/components/UTPieChart/index.js +76 -73
- package/dist/components/UTPieChart/theme.js +2 -4
- package/dist/components/UTPieChart/utils.js +2 -4
- package/dist/components/UTProgressBar/constants.js +4 -2
- package/dist/components/UTProgressBar/index.js +17 -15
- package/dist/components/UTProgressBar/theme.js +2 -4
- package/dist/components/UTProgressBar/types.js +3 -2
- package/dist/components/UTRadioGroup/index.js +83 -56
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +56 -41
- package/dist/components/UTRating/components/Faces/constants.js +4 -2
- package/dist/components/UTRating/components/Faces/index.js +36 -34
- package/dist/components/UTRating/components/Star/index.js +40 -36
- package/dist/components/UTRating/constants.js +8 -4
- package/dist/components/UTRating/index.js +46 -31
- package/dist/components/UTRating/theme.js +2 -4
- package/dist/components/UTRipple/Ripple.js +39 -22
- package/dist/components/UTRipple/index.js +37 -18
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +8 -4
- package/dist/components/UTSelect/index.js +85 -63
- package/dist/components/UTSelect/stylesJS.js +3 -2
- package/dist/components/UTSelect/theme.js +4 -6
- package/dist/components/UTSelect/utils.js +13 -3
- package/dist/components/UTSidebar/components/ListOption/index.js +49 -34
- package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
- package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
- package/dist/components/UTSidebar/components/Option/constants.js +3 -2
- package/dist/components/UTSidebar/components/Option/index.js +32 -28
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +53 -42
- package/dist/components/UTSidebar/theme.js +2 -4
- package/dist/components/UTSidebar/types.js +10 -5
- package/dist/components/UTSkeleton/index.js +36 -10
- package/dist/components/UTStatus/constants.js +9 -5
- package/dist/components/UTStatus/index.js +15 -16
- package/dist/components/UTStatus/theme.js +49 -66
- package/dist/components/UTSwitch/constants.js +6 -3
- package/dist/components/UTSwitch/index.js +57 -42
- package/dist/components/UTSwitch/theme.js +2 -4
- package/dist/components/UTTable/components/ActionIcons/constants.js +2 -1
- package/dist/components/UTTable/components/ActionIcons/index.js +85 -47
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +12 -10
- package/dist/components/UTTable/components/Cell/index.js +23 -18
- package/dist/components/UTTable/components/HeaderCell/constants.js +3 -2
- package/dist/components/UTTable/components/HeaderCell/index.js +30 -23
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +11 -12
- package/dist/components/UTTable/components/ResponsiveCell/index.js +20 -19
- package/dist/components/UTTable/components/Status/index.js +19 -18
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -10
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +32 -21
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +14 -8
- package/dist/components/UTTable/components/TableFooter/constants.js +2 -1
- package/dist/components/UTTable/components/TableFooter/index.js +15 -15
- package/dist/components/UTTable/components/TableHeader/index.js +11 -11
- package/dist/components/UTTable/components/TableRow/constants.js +6 -3
- package/dist/components/UTTable/components/TableRow/index.js +94 -79
- package/dist/components/UTTable/constants.js +43 -26
- package/dist/components/UTTable/hook.js +26 -11
- package/dist/components/UTTable/index.js +223 -132
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +8 -4
- package/dist/components/UTTable/utils.js +74 -70
- package/dist/components/UTTabs/components/TooltipTab/index.js +30 -20
- package/dist/components/UTTabs/constants.js +8 -4
- package/dist/components/UTTabs/index.js +86 -57
- package/dist/components/UTTabs/theme.js +2 -4
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +6 -3
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +2 -4
- package/dist/components/UTTextInput/constants.js +3 -2
- package/dist/components/UTTextInput/index.js +165 -137
- package/dist/components/UTTextInput/theme.js +4 -6
- package/dist/components/UTThirdPartyCookieChecker/index.js +21 -17
- package/dist/components/UTToggle/components/ToggleOption/index.js +17 -16
- package/dist/components/UTToggle/index.js +26 -25
- package/dist/components/UTToggle/theme.js +2 -4
- package/dist/components/UTTooltip/index.js +30 -23
- package/dist/components/UTTooltip/theme.js +2 -4
- package/dist/components/UTTopbar/components/Notifications/index.js +14 -11
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +31 -28
- package/dist/components/UTTopbar/theme.js +2 -4
- package/dist/components/UTTopbar/types.js +9 -5
- package/dist/components/UTTouchableWithoutFeedback/index.js +27 -14
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +4 -2
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +12 -6
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +18 -8
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +47 -23
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +93 -81
- package/dist/components/UTVirtualizedList/constants.js +8 -4
- package/dist/components/UTVirtualizedList/index.js +38 -26
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +21 -17
- package/dist/components/UTWorkflowContainer/constants.js +6 -3
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +51 -32
- package/dist/components/UTWorkflowContainer/theme.js +53 -60
- package/dist/components/UTWorkflowContainer/types.js +3 -2
- package/dist/components/WithLoading/index.js +15 -10
- package/dist/components/WithTheme/index.js +17 -10
- package/dist/components/WithTheme/layout.js +28 -22
- package/dist/components/WithTouch/index.js +19 -12
- package/dist/constants/UTTable.js +3 -2
- package/dist/index.js +58 -58
- package/dist/theme.js +5 -6
- package/dist/types/commonTypes.js +5 -3
- package/dist/types/consumptionTypes.js +5 -3
- package/dist/types/formTypes.js +7 -4
- package/dist/types/tableTypes.js +3 -2
- package/dist/utils/classesUtils.js +13 -5
- package/dist/utils/componentUtils.js +13 -10
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +11 -13
- package/dist/utils/useScreenSize.js +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,6 +8,11 @@ exports.validateProps = exports.retrieveStyle = exports.getLabelTheme = exports.
|
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _constants = require("./constants");
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
16
|
var ErrorIcon = function ErrorIcon(props) {
|
|
11
17
|
return /*#__PURE__*/_react.default.createElement("svg", props, /*#__PURE__*/_react.default.createElement("path", {
|
|
12
18
|
fillRule: "evenodd",
|
|
@@ -82,62 +88,47 @@ WarningIcon.defaultProps = {
|
|
|
82
88
|
fill: "none",
|
|
83
89
|
xmlns: "http://www.w3.org/2000/svg"
|
|
84
90
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
variant
|
|
90
|
-
} = _ref;
|
|
91
|
+
var getBackgroundColor = function getBackgroundColor(_ref) {
|
|
92
|
+
var theme = _ref.theme,
|
|
93
|
+
type = _ref.type,
|
|
94
|
+
variant = _ref.variant;
|
|
91
95
|
return variant !== _constants.VARIANTS.unassigned ? theme.Palette[variant][type === _constants.TYPES.negative ? '04' : '01'] : type === _constants.TYPES.negative ? theme.Palette.gray['04'] : theme.Palette.light['04'];
|
|
92
96
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
type,
|
|
97
|
-
variant
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
const defaultIconMapper = variant => ({
|
|
106
|
-
[_constants.VARIANTS.error]: ErrorIcon,
|
|
107
|
-
[_constants.VARIANTS.information]: InfoIcon,
|
|
108
|
-
[_constants.VARIANTS.success]: SuccessIcon,
|
|
109
|
-
[_constants.VARIANTS.unassigned]: UnassignedIcon,
|
|
110
|
-
[_constants.VARIANTS.warning]: WarningIcon
|
|
111
|
-
})[variant];
|
|
97
|
+
var getIconFill = function getIconFill(_ref2) {
|
|
98
|
+
var _TYPES$default$TYPES$;
|
|
99
|
+
var theme = _ref2.theme,
|
|
100
|
+
type = _ref2.type,
|
|
101
|
+
variant = _ref2.variant;
|
|
102
|
+
return (_TYPES$default$TYPES$ = {}, _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.default, theme.Palette.dark['05']), _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.light, theme.Palette[variant !== _constants.VARIANTS.unassigned ? variant : 'gray']['05']), _defineProperty(_TYPES$default$TYPES$, _constants.TYPES.negative, theme.Palette.light['01']), _TYPES$default$TYPES$)[type];
|
|
103
|
+
};
|
|
104
|
+
var defaultIconMapper = function defaultIconMapper(variant) {
|
|
105
|
+
var _VARIANTS$error$VARIA;
|
|
106
|
+
return (_VARIANTS$error$VARIA = {}, _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.error, ErrorIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.information, InfoIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.success, SuccessIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.unassigned, UnassignedIcon), _defineProperty(_VARIANTS$error$VARIA, _constants.VARIANTS.warning, WarningIcon), _VARIANTS$error$VARIA)[variant];
|
|
107
|
+
};
|
|
112
108
|
exports.defaultIconMapper = defaultIconMapper;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
variant
|
|
117
|
-
} = _ref3;
|
|
109
|
+
var validateProps = function validateProps(_ref3) {
|
|
110
|
+
var type = _ref3.type,
|
|
111
|
+
variant = _ref3.variant;
|
|
118
112
|
return {
|
|
119
113
|
type: _constants.TYPES[type] || _constants.TYPES[_constants.DEFAULT_PROPS.type],
|
|
120
114
|
variant: _constants.VARIANTS[variant] || _constants.VARIANTS[_constants.DEFAULT_PROPS.variant]
|
|
121
115
|
};
|
|
122
116
|
};
|
|
123
117
|
exports.validateProps = validateProps;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
variant
|
|
130
|
-
} = _ref4;
|
|
118
|
+
var retrieveStyle = function retrieveStyle(_ref4) {
|
|
119
|
+
var theme = _ref4.theme,
|
|
120
|
+
type = _ref4.type,
|
|
121
|
+
uppercase = _ref4.uppercase,
|
|
122
|
+
variant = _ref4.variant;
|
|
131
123
|
return {
|
|
132
124
|
root: {
|
|
133
125
|
alignItems: 'center',
|
|
134
|
-
backgroundColor: getBackgroundColor({
|
|
135
|
-
theme
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}),
|
|
126
|
+
backgroundColor: getBackgroundColor(_objectSpread({
|
|
127
|
+
theme: theme
|
|
128
|
+
}, validateProps({
|
|
129
|
+
type: type,
|
|
130
|
+
variant: variant
|
|
131
|
+
}))),
|
|
141
132
|
borderRadius: '4px',
|
|
142
133
|
display: 'flex',
|
|
143
134
|
gridGap: '8px',
|
|
@@ -148,37 +139,29 @@ const retrieveStyle = _ref4 => {
|
|
|
148
139
|
display: 'none'
|
|
149
140
|
}
|
|
150
141
|
},
|
|
151
|
-
label: {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
} : {})
|
|
155
|
-
},
|
|
142
|
+
label: _objectSpread({}, uppercase ? {
|
|
143
|
+
textTransform: 'uppercase'
|
|
144
|
+
} : {}),
|
|
156
145
|
icon: {
|
|
157
146
|
flexShrink: '0',
|
|
158
147
|
height: '20px',
|
|
159
148
|
width: '20px',
|
|
160
149
|
'& path': {
|
|
161
|
-
fill: getIconFill({
|
|
162
|
-
theme
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
150
|
+
fill: getIconFill(_objectSpread({
|
|
151
|
+
theme: theme
|
|
152
|
+
}, validateProps({
|
|
153
|
+
type: type,
|
|
154
|
+
variant: variant
|
|
155
|
+
})))
|
|
168
156
|
}
|
|
169
157
|
}
|
|
170
158
|
};
|
|
171
159
|
};
|
|
172
160
|
exports.retrieveStyle = retrieveStyle;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
variant
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
[_constants.TYPES.default]: 'dark',
|
|
180
|
-
[_constants.TYPES.light]: variant !== _constants.VARIANTS.unassigned ? variant : 'gray',
|
|
181
|
-
[_constants.TYPES.negative]: 'light'
|
|
182
|
-
}[type];
|
|
161
|
+
var getLabelTheme = function getLabelTheme(_ref5) {
|
|
162
|
+
var _TYPES$default$TYPES$2;
|
|
163
|
+
var type = _ref5.type,
|
|
164
|
+
variant = _ref5.variant;
|
|
165
|
+
return (_TYPES$default$TYPES$2 = {}, _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.default, 'dark'), _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.light, variant !== _constants.VARIANTS.unassigned ? variant : 'gray'), _defineProperty(_TYPES$default$TYPES$2, _constants.TYPES.negative, 'light'), _TYPES$default$TYPES$2)[type];
|
|
183
166
|
};
|
|
184
167
|
exports.getLabelTheme = getLabelTheme;
|
|
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TRUE = exports.STATES = exports.DEFAULT_SWITCH_ID = void 0;
|
|
7
|
-
|
|
7
|
+
var STATES = {
|
|
8
8
|
ON: 'SI',
|
|
9
9
|
OFF: 'NO'
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
exports.STATES = STATES;
|
|
12
|
+
var DEFAULT_SWITCH_ID = 'switch';
|
|
13
|
+
exports.DEFAULT_SWITCH_ID = DEFAULT_SWITCH_ID;
|
|
14
|
+
var TRUE = 'true';
|
|
15
|
+
exports.TRUE = TRUE;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -15,49 +16,62 @@ var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
|
15
16
|
var _theme = require("./theme");
|
|
16
17
|
var _constants = require("./constants.js");
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
22
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
24
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var UTSwitch = function UTSwitch(_ref) {
|
|
32
|
+
var _ref$classes = _ref.classes,
|
|
33
|
+
themeClasses = _ref$classes === void 0 ? {} : _ref$classes,
|
|
34
|
+
classNames = _ref.classNames,
|
|
35
|
+
disabled = _ref.disabled,
|
|
36
|
+
_ref$field = _ref.field,
|
|
37
|
+
field = _ref$field === void 0 ? {} : _ref$field,
|
|
38
|
+
_ref$input = _ref.input,
|
|
39
|
+
input = _ref$input === void 0 ? {} : _ref$input,
|
|
40
|
+
_ref$meta = _ref.meta,
|
|
41
|
+
meta = _ref$meta === void 0 ? {} : _ref$meta,
|
|
42
|
+
showErrors = _ref.showErrors;
|
|
43
|
+
var value = input.value,
|
|
44
|
+
onChange_ = input.onChange;
|
|
45
|
+
var key = field.key,
|
|
46
|
+
fieldOptions = field.field_options,
|
|
47
|
+
_field$configuration = field.configuration,
|
|
48
|
+
configuration = _field$configuration === void 0 ? {} : _field$configuration;
|
|
49
|
+
var textOff_ = configuration.textOff,
|
|
50
|
+
textOn_ = configuration.textOn,
|
|
51
|
+
_configuration$inside = configuration.insideText,
|
|
52
|
+
insideText = _configuration$inside === void 0 ? true : _configuration$inside,
|
|
53
|
+
withText = configuration.withText;
|
|
54
|
+
var switchId = key || _constants.DEFAULT_SWITCH_ID;
|
|
55
|
+
var classes = (0, _react.useMemo)(function () {
|
|
56
|
+
return (0, _classesUtils.mergeClasses)(themeClasses, classNames);
|
|
57
|
+
}, [classNames]);
|
|
58
|
+
var useFieldOptions = fieldOptions && !(0, _array.isEmpty)(fieldOptions);
|
|
59
|
+
var _ref2 = useFieldOptions ? _toConsumableArray(fieldOptions).sort(function (_, _ref4) {
|
|
60
|
+
var optionValue = _ref4.value,
|
|
61
|
+
name = _ref4.name;
|
|
62
|
+
return [optionValue, name === _constants.TRUE].includes(value) ? 1 : -1;
|
|
63
|
+
}) : [],
|
|
64
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
65
|
+
currentOption = _ref3[0],
|
|
66
|
+
switchedOption = _ref3[1];
|
|
67
|
+
var onChange = useFieldOptions ? function () {
|
|
68
|
+
return onChange_(switchedOption.value);
|
|
69
|
+
} : onChange_;
|
|
70
|
+
(0, _react.useEffect)(function () {
|
|
57
71
|
if (useFieldOptions && value === false) onChange_(currentOption.value);
|
|
58
72
|
}, [value]);
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
var textOn = textOn_ || _constants.STATES.ON;
|
|
74
|
+
var textOff = textOff_ || _constants.STATES.OFF;
|
|
61
75
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
62
76
|
className: classes.outerContainer
|
|
63
77
|
}, withText && !insideText && textOff, /*#__PURE__*/_react.default.createElement("label", {
|
|
@@ -99,4 +113,5 @@ UTSwitch.propTypes = {
|
|
|
99
113
|
meta: _formTypes.metaPropTypes,
|
|
100
114
|
showErrors: _propTypes.bool
|
|
101
115
|
};
|
|
102
|
-
var _default =
|
|
116
|
+
var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTSwitch);
|
|
117
|
+
exports.default = _default;
|
|
@@ -7,10 +7,8 @@ exports.retrieveStyle = void 0;
|
|
|
7
7
|
var _seamlessImmutable = require("seamless-immutable");
|
|
8
8
|
var _colorsModule = _interopRequireDefault(require("../../scss/variables/colors.module.scss"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
theme
|
|
13
|
-
} = _ref;
|
|
10
|
+
var retrieveStyle = function retrieveStyle(_ref) {
|
|
11
|
+
var theme = _ref.theme;
|
|
14
12
|
return {
|
|
15
13
|
outerContainer: {
|
|
16
14
|
alignItems: (0, _seamlessImmutable.getIn)(theme, ['UTSwitch', 'outerContainer', 'alignItems'], 'center'),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -14,57 +15,91 @@ var _types = require("../../types");
|
|
|
14
15
|
var _constants = require("./constants");
|
|
15
16
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
function _getRequireWildcardCache(
|
|
18
|
-
function _interopRequireWildcard(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var ActionIcons = function ActionIcons(_ref) {
|
|
32
|
+
var classes = _ref.classes,
|
|
33
|
+
column = _ref.column,
|
|
34
|
+
rowData = _ref.rowData;
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, column.actions.map(function (_ref2) {
|
|
36
|
+
var key = _ref2.key,
|
|
37
|
+
Icon = _ref2.Icon,
|
|
38
|
+
tooltip = _ref2.tooltip,
|
|
39
|
+
disabledTooltip = _ref2.disabledTooltip,
|
|
40
|
+
onClick = _ref2.onClick,
|
|
41
|
+
buttonClassName = _ref2.buttonClassName,
|
|
42
|
+
iconClassName = _ref2.iconClassName,
|
|
43
|
+
disabledIconClassName = _ref2.disabledIconClassName,
|
|
44
|
+
loadingClassName = _ref2.loadingClassName,
|
|
45
|
+
_ref2$loadingSize = _ref2.loadingSize,
|
|
46
|
+
loadingSize = _ref2$loadingSize === void 0 ? _constants.DEAULT_LOADING_SIZE : _ref2$loadingSize,
|
|
47
|
+
_ref2$isVisible = _ref2.isVisible,
|
|
48
|
+
isVisible = _ref2$isVisible === void 0 ? function () {
|
|
49
|
+
return true;
|
|
50
|
+
} : _ref2$isVisible,
|
|
51
|
+
_ref2$tooltipProps = _ref2.tooltipProps,
|
|
52
|
+
tooltipProps = _ref2$tooltipProps === void 0 ? {} : _ref2$tooltipProps,
|
|
53
|
+
_ref2$isDisabled = _ref2.isDisabled,
|
|
54
|
+
isDisabled = _ref2$isDisabled === void 0 ? function () {
|
|
55
|
+
return false;
|
|
56
|
+
} : _ref2$isDisabled,
|
|
57
|
+
_ref2$isLoading = _ref2.isLoading,
|
|
58
|
+
isLoading = _ref2$isLoading === void 0 ? function () {
|
|
59
|
+
return false;
|
|
60
|
+
} : _ref2$isLoading,
|
|
61
|
+
_ref2$menuItems = _ref2.menuItems,
|
|
62
|
+
menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
|
|
63
|
+
withMenuDivider = _ref2.withMenuDivider;
|
|
64
|
+
var _useState = (0, _react.useState)(),
|
|
65
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
+
menuAnchor = _useState2[0],
|
|
67
|
+
setMenuAnchor = _useState2[1];
|
|
68
|
+
var _useState3 = (0, _react.useState)(),
|
|
69
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
|
+
menuRowContextData = _useState4[0],
|
|
71
|
+
setMenuRowConextData = _useState4[1];
|
|
72
|
+
var openMenu = function openMenu(event) {
|
|
73
|
+
return setMenuAnchor(event.currentTarget);
|
|
74
|
+
};
|
|
75
|
+
var closeMenu = function closeMenu() {
|
|
76
|
+
return setMenuAnchor();
|
|
77
|
+
};
|
|
78
|
+
var handleActionClick = function handleActionClick(event, eventRowData) {
|
|
49
79
|
if ((0, _array.isEmpty)(menuItems)) onClick(eventRowData);else {
|
|
50
|
-
setMenuRowConextData({
|
|
51
|
-
...eventRowData,
|
|
80
|
+
setMenuRowConextData(_objectSpread(_objectSpread({}, eventRowData), {}, {
|
|
52
81
|
clickCallback: closeMenu
|
|
53
|
-
});
|
|
82
|
+
}));
|
|
54
83
|
openMenu(event);
|
|
55
84
|
}
|
|
56
85
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...tooltipProps
|
|
86
|
+
var visibleMenuItems = menuItems.filter(function (menuItem) {
|
|
87
|
+
return !menuItem.isVisible || menuItem.isVisible(rowData);
|
|
88
|
+
}).map(function (menuItem) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, menuItem), {}, {
|
|
90
|
+
disabled: menuItem.isDisabled && menuItem.isDisabled(rowData)
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
var getDisabledTooltip = function getDisabledTooltip() {
|
|
94
|
+
return typeof disabledTooltip === 'function' ? disabledTooltip(rowData) : disabledTooltip;
|
|
67
95
|
};
|
|
96
|
+
var tooltipContent = isDisabled(rowData) && disabledTooltip ? getDisabledTooltip() : tooltip;
|
|
97
|
+
var tippyProps = _objectSpread({
|
|
98
|
+
appendTo: function appendTo() {
|
|
99
|
+
return document.body;
|
|
100
|
+
},
|
|
101
|
+
interactive: false
|
|
102
|
+
}, tooltipProps);
|
|
68
103
|
return isVisible(rowData) && /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
|
|
69
104
|
key: key,
|
|
70
105
|
content: tooltipContent,
|
|
@@ -72,7 +107,9 @@ const ActionIcons = _ref => {
|
|
|
72
107
|
tippyProps: tippyProps
|
|
73
108
|
}, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
74
109
|
className: "".concat(_stylesModule.default.iconButton, " ").concat(classes.actionIconButton, " \n ").concat((isDisabled(rowData) || isLoading(rowData)) && _stylesModule.default.disabled, " ").concat(buttonClassName),
|
|
75
|
-
onClick:
|
|
110
|
+
onClick: function onClick(event) {
|
|
111
|
+
return handleActionClick(event, rowData);
|
|
112
|
+
},
|
|
76
113
|
role: "button"
|
|
77
114
|
}, isLoading(rowData) ? /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
78
115
|
className: "".concat(classes.actionLoading, " ").concat(loadingClassName),
|
|
@@ -95,4 +132,5 @@ ActionIcons.propTypes = {
|
|
|
95
132
|
column: _types.columnType,
|
|
96
133
|
rowData: _propTypes.object
|
|
97
134
|
};
|
|
98
|
-
var _default =
|
|
135
|
+
var _default = /*#__PURE__*/(0, _react.memo)(ActionIcons);
|
|
136
|
+
exports.default = _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -10,19 +11,19 @@ var _object = require("@widergy/web-utils/lib/object");
|
|
|
10
11
|
var _UTButton = _interopRequireDefault(require("../../../../../UTButton"));
|
|
11
12
|
var _types = require("../../../../types");
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function _getRequireWildcardCache(
|
|
14
|
-
function _interopRequireWildcard(
|
|
15
|
-
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
var ActionButton = function ActionButton(_ref) {
|
|
16
17
|
var _column$actions;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
21
|
-
const actionConfig = (_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions[0];
|
|
18
|
+
var column = _ref.column,
|
|
19
|
+
rowData = _ref.rowData;
|
|
20
|
+
var actionConfig = (_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions[0];
|
|
22
21
|
return !(0, _object.objectIsEmpty)(actionConfig) && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
23
22
|
classNames: actionConfig.buttonClassNames,
|
|
24
23
|
key: actionConfig.key,
|
|
25
|
-
onClick:
|
|
24
|
+
onClick: function onClick() {
|
|
25
|
+
return actionConfig.onClick(rowData);
|
|
26
|
+
},
|
|
26
27
|
variant: "text"
|
|
27
28
|
}, actionConfig.text);
|
|
28
29
|
};
|
|
@@ -30,4 +31,5 @@ ActionButton.propTypes = {
|
|
|
30
31
|
column: _types.columnType,
|
|
31
32
|
rowData: _propTypes.object
|
|
32
33
|
};
|
|
33
|
-
var _default =
|
|
34
|
+
var _default = /*#__PURE__*/(0, _react.memo)(ActionButton);
|
|
35
|
+
exports.default = _default;
|
|
@@ -13,25 +13,29 @@ var _Status = _interopRequireDefault(require("../Status"));
|
|
|
13
13
|
var _ActionButton = _interopRequireDefault(require("./components/ActionButton"));
|
|
14
14
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
+
var Cell = function Cell(_ref) {
|
|
25
|
+
var _ref$align = _ref.align,
|
|
26
|
+
align = _ref$align === void 0 ? _constants.COLUMN_POSITION.LEFT : _ref$align,
|
|
27
|
+
classes = _ref.classes,
|
|
28
|
+
column = _ref.column,
|
|
29
|
+
columnSizes = _ref.columnSizes,
|
|
30
|
+
defaultNullValue = _ref.defaultNullValue,
|
|
31
|
+
rowData = _ref.rowData,
|
|
32
|
+
style = _ref.style;
|
|
33
|
+
var cellAlignStyles = [_constants.CELL_TYPES.ACTION_ICONS, _constants.CELL_TYPES.ACTION_BUTTON].includes(column.type) ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
|
|
29
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
35
|
className: " ".concat(_stylesModule.default.rowElement, " ").concat(cellAlignStyles, " ").concat(classes.rowCell),
|
|
31
|
-
style: {
|
|
32
|
-
width: columnSizes[column.key]
|
|
33
|
-
|
|
34
|
-
}
|
|
36
|
+
style: _objectSpread({
|
|
37
|
+
width: columnSizes[column.key]
|
|
38
|
+
}, style)
|
|
35
39
|
}, column.cellRenderer ? column.cellRenderer(rowData[column.key], rowData) : column.type === _constants.CELL_TYPES.ACTION_BUTTON ? /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
|
|
36
40
|
column: column,
|
|
37
41
|
rowData: rowData
|
|
@@ -55,4 +59,5 @@ Cell.propTypes = {
|
|
|
55
59
|
rowData: _propTypes.object,
|
|
56
60
|
style: _propTypes.object
|
|
57
61
|
};
|
|
58
|
-
var _default =
|
|
62
|
+
var _default = /*#__PURE__*/(0, _react.memo)(Cell);
|
|
63
|
+
exports.default = _default;
|
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ORDER_DIRECTION = void 0;
|
|
7
|
-
|
|
7
|
+
var ORDER_DIRECTION = {
|
|
8
8
|
ASC: 'asc',
|
|
9
9
|
DESC: 'desc'
|
|
10
|
-
};
|
|
10
|
+
};
|
|
11
|
+
exports.ORDER_DIRECTION = ORDER_DIRECTION;
|