@scaleflex/widget-common 4.1.0 → 4.4.0
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/CHANGELOG.md +24 -0
- package/package.json +4 -4
- package/dist/style.css +0 -1126
- package/dist/style.min.css +0 -1
- package/lib/ApprovalStatus/ApprovalStatus.styled.js +0 -21
- package/lib/ApprovalStatus/index.js +0 -104
- package/lib/AssetPreview.js +0 -53
- package/lib/AutoSuggest.js +0 -166
- package/lib/Avatar/Avatar.styled.js +0 -25
- package/lib/Avatar/index.js +0 -83
- package/lib/AvatarWithStatus/AvatarWithStatus.styled.js +0 -12
- package/lib/AvatarWithStatus/index.js +0 -30
- package/lib/BackButton.js +0 -46
- package/lib/BackdropOverlay.js +0 -77
- package/lib/BadgeButton.js +0 -35
- package/lib/BaseButton.js +0 -36
- package/lib/Button.js +0 -29
- package/lib/Carousel/Carousel.styled.js +0 -19
- package/lib/Carousel/index.js +0 -136
- package/lib/Checkbox.js +0 -55
- package/lib/CloseButton.js +0 -46
- package/lib/ColorPicker/ColorPicker.styled.js +0 -29
- package/lib/ColorPicker/index.js +0 -117
- package/lib/ColorPickerModal/ColorPickerModal.styled.js +0 -17
- package/lib/ColorPickerModal/index.js +0 -103
- package/lib/DatePicker/MyDatePicker.js +0 -350
- package/lib/DatePicker/index.js +0 -1
- package/lib/DropFilesWindow.js +0 -45
- package/lib/FilterItem/FilterItem.styled.js +0 -42
- package/lib/FilterItem/index.js +0 -48
- package/lib/FilterPopup/FilterPopup.styled.js +0 -16
- package/lib/FilterPopup/index.js +0 -85
- package/lib/FormControl.js +0 -25
- package/lib/FormGroup.js +0 -18
- package/lib/FormHelperText.js +0 -29
- package/lib/IconLabeledButton.js +0 -32
- package/lib/Image/Image.styled.js +0 -16
- package/lib/Image/index.js +0 -95
- package/lib/ImagePreview/ImagePreview.styled.js +0 -19
- package/lib/ImagePreview/index.js +0 -198
- package/lib/InputAndLabel.js +0 -77
- package/lib/InputGroupTime.js +0 -6
- package/lib/InputLabel.js +0 -18
- package/lib/ItemButtonOverlay/ItemButtonOverlay.styled.js +0 -33
- package/lib/ItemButtonOverlay/index.js +0 -23
- package/lib/ItemHoverTopOptions.js +0 -58
- package/lib/LoaderView/LoaderView.styled.js +0 -37
- package/lib/LoaderView/index.js +0 -32
- package/lib/MetaData/FilterMetadataFields.js +0 -115
- package/lib/MetaData/FilterMetadataFields.styled.js +0 -16
- package/lib/MetaData/MetaDataField.js +0 -246
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldBooleanType.js +0 -36
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldDateType.js +0 -53
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldMultiSelectType.js +0 -71
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldNumericType.js +0 -45
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldSelectType.js +0 -69
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldTagsType.js +0 -143
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldTextType.js +0 -42
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldTextareaType.js +0 -72
- package/lib/MetaData/MetaDataFieldTypes/MetaDataFieldTypes.styled.js +0 -57
- package/lib/MetaData/MetaDataFieldTypes/MetadataAttachmentsFieldType/AttachmentsAssetsMetadataAccordion.styled.js +0 -95
- package/lib/MetaData/MetaDataFieldTypes/MetadataAttachmentsFieldType/MetadataAttachmentsAction.js +0 -188
- package/lib/MetaData/MetaDataFieldTypes/MetadataAttachmentsFieldType/MetadataAttachmentsFieldType.constants.js +0 -48
- package/lib/MetaData/MetaDataFieldTypes/MetadataAttachmentsFieldType/MetadataAttachmentsInfo.js +0 -93
- package/lib/MetaData/MetaDataFieldTypes/MetadataAttachmentsFieldType/index.js +0 -114
- package/lib/MetaData/MetaDataFieldTypes/MetadataFieldUriType.js +0 -71
- package/lib/MetaData/MetaDataFieldTypes/MetadataGeoPointField/MetadataGeoPointField.styled.js +0 -8
- package/lib/MetaData/MetaDataFieldTypes/MetadataGeoPointField/constants.js +0 -10
- package/lib/MetaData/MetaDataFieldTypes/MetadataGeoPointField/index.js +0 -135
- package/lib/MetaData/MetaDataFieldTypes/index.js +0 -9
- package/lib/MetaData/MetaDataFieldTypes.hooks.js +0 -53
- package/lib/OverlayCard/OverlayCard.styled.js +0 -8
- package/lib/OverlayCard/index.js +0 -28
- package/lib/PoweredBy.js +0 -12
- package/lib/Radiobox.js +0 -63
- package/lib/RegionalVariantsFilters/RegionalVariantFilters.styled.js +0 -17
- package/lib/RegionalVariantsFilters/index.js +0 -160
- package/lib/SVGUrlToElement.js +0 -73
- package/lib/SearchGroup/SearchGroup.styled.js +0 -93
- package/lib/SearchGroup/index.js +0 -293
- package/lib/Spinner.js +0 -40
- package/lib/SuggestedSelectInput/SuggestedSelectInput.styled.js +0 -57
- package/lib/SuggestedSelectInput/index.js +0 -238
- package/lib/SuggestedTagsInput/SuggestedTagsInput.js +0 -295
- package/lib/SuggestedTagsInput/SuggestedTagsInput.styled.js +0 -83
- package/lib/SuggestedTagsInput/SuggestedTagsInput.utils.js +0 -15
- package/lib/SuggestedTagsInput/SuggestedTagsInputSkeleton.js +0 -14
- package/lib/Tabs.js +0 -62
- package/lib/ToggleButton/ToggleButton.styled.js +0 -16
- package/lib/ToggleButton/index.js +0 -16
- package/lib/Transitions/SlideTransition.js +0 -24
- package/lib/Transitions/TransitionWrapper.js +0 -83
- package/lib/Transitions/Transitions.styled.js +0 -8
- package/lib/Transitions/index.js +0 -2
- package/lib/Typography/Typography.js +0 -47
- package/lib/Typography/Typography.mixin.js +0 -46
- package/lib/Typography/Typography.styled.js +0 -18
- package/lib/Typography/index.js +0 -3
- package/lib/Typography/types/index.js +0 -1
- package/lib/Typography/types/variant.js +0 -9
- package/lib/UploadFileFloatyLabel/UploadFileFloatyLabel.mixin.js +0 -23
- package/lib/UploadFileFloatyLabel/UploadFileFloatyLabel.styled.js +0 -24
- package/lib/UploadFileFloatyLabel/index.js +0 -12
- package/lib/UsersAutocomplete/Tag.js +0 -25
- package/lib/UsersAutocomplete/Tag.styled.js +0 -35
- package/lib/UsersAutocomplete/UsersAutocomplete.styled.js +0 -94
- package/lib/UsersAutocomplete/index.js +0 -303
- package/lib/VirtualGrid/VirtualGrid.styled.js +0 -33
- package/lib/VirtualGrid/VirtualGrid.utils.js +0 -38
- package/lib/VirtualGrid/VirtualGridItem.js +0 -15
- package/lib/VirtualGrid/index.js +0 -252
- package/lib/VirtualList/VirtualListItem.js +0 -14
- package/lib/VirtualList/index.js +0 -105
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/useDebounce.js +0 -24
- package/lib/hooks/useInputWithLocaleNumber.js +0 -115
- package/lib/hooks/useIsUnMountedRef.js +0 -12
- package/lib/hooks/useKeyboardNavigation.js +0 -60
- package/lib/hooks/useUpdateEffect.js +0 -19
- package/lib/index.js +0 -36
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["label", "hint", "onChange", "value", "i18n", "style", "size", "placeholder", "fieldKey"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { DatePicker } from '@scaleflex/ui/core';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
var MetaDataFieldDateType = function MetaDataFieldDateType(_ref) {
|
|
13
|
-
var _ref$label = _ref.label,
|
|
14
|
-
label = _ref$label === void 0 ? '' : _ref$label,
|
|
15
|
-
_ref$hint = _ref.hint,
|
|
16
|
-
hint = _ref$hint === void 0 ? '' : _ref$hint,
|
|
17
|
-
onChange = _ref.onChange,
|
|
18
|
-
value = _ref.value,
|
|
19
|
-
i18n = _ref.i18n,
|
|
20
|
-
_ref$style = _ref.style,
|
|
21
|
-
style = _ref$style === void 0 ? {} : _ref$style,
|
|
22
|
-
_ref$size = _ref.size,
|
|
23
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
24
|
-
placeholder = _ref.placeholder,
|
|
25
|
-
fieldKey = _ref.fieldKey,
|
|
26
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
// TODO: Remove the following after having the fix,
|
|
28
|
-
// TMP-SOLUTION: for avoiding triggering onChange in the first load of the DatePicker component from sfx/ui side,
|
|
29
|
-
// we shouldn't trigger onChange in the first load, as it should take the value as the default value for the initial load.
|
|
30
|
-
// Remove the handleChange and replace it below onChange={onChange} directly after having this fixed from @sfx/ui lib.
|
|
31
|
-
var handleChange = function handleChange(newDate) {
|
|
32
|
-
if (value && newDate === value) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
onChange(newDate);
|
|
36
|
-
};
|
|
37
|
-
return /*#__PURE__*/_jsx(DatePicker, _objectSpread({
|
|
38
|
-
label: label,
|
|
39
|
-
hint: hint,
|
|
40
|
-
style: style,
|
|
41
|
-
onChange: handleChange,
|
|
42
|
-
value: value,
|
|
43
|
-
fullWidth: true,
|
|
44
|
-
size: size,
|
|
45
|
-
id: fieldKey,
|
|
46
|
-
calendarStyles: {
|
|
47
|
-
position: 'relative',
|
|
48
|
-
height: 300,
|
|
49
|
-
marginBottom: 9
|
|
50
|
-
}
|
|
51
|
-
}, props));
|
|
52
|
-
};
|
|
53
|
-
export default MetaDataFieldDateType;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["i18n", "onChange", "field", "value", "multiple", "inputRef", "showClearIcon", "fromFilters", "size", "onBlur", "handleSelectMenuClose"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { useMetaDataSortedOptions } from '../MetaDataFieldTypes.hooks';
|
|
11
|
-
import Styled from './MetaDataFieldTypes.styled';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
var MENU_PROPS = {
|
|
14
|
-
position: 'bottom-start'
|
|
15
|
-
};
|
|
16
|
-
export default (function (_ref) {
|
|
17
|
-
var i18n = _ref.i18n,
|
|
18
|
-
onChange = _ref.onChange,
|
|
19
|
-
field = _ref.field,
|
|
20
|
-
value = _ref.value,
|
|
21
|
-
_ref$multiple = _ref.multiple,
|
|
22
|
-
multiple = _ref$multiple === void 0 ? true : _ref$multiple,
|
|
23
|
-
inputRef = _ref.inputRef,
|
|
24
|
-
_ref$showClearIcon = _ref.showClearIcon,
|
|
25
|
-
showClearIcon = _ref$showClearIcon === void 0 ? false : _ref$showClearIcon,
|
|
26
|
-
_ref$fromFilters = _ref.fromFilters,
|
|
27
|
-
fromFilters = _ref$fromFilters === void 0 ? false : _ref$fromFilters,
|
|
28
|
-
_ref$size = _ref.size,
|
|
29
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
30
|
-
onBlur = _ref.onBlur,
|
|
31
|
-
handleSelectMenuClose = _ref.handleSelectMenuClose,
|
|
32
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
-
var _useMetaDataSortedOpt = useMetaDataSortedOptions({
|
|
34
|
-
field: field,
|
|
35
|
-
value: value,
|
|
36
|
-
multiple: multiple,
|
|
37
|
-
i18n: i18n
|
|
38
|
-
}),
|
|
39
|
-
sortedOptions = _useMetaDataSortedOpt.sortedOptions,
|
|
40
|
-
getValue = _useMetaDataSortedOpt.getValue;
|
|
41
|
-
var handleChange = function handleChange(valueOrEvent) {
|
|
42
|
-
if (valueOrEvent && valueOrEvent.target) {
|
|
43
|
-
var eventValue = valueOrEvent.target.value;
|
|
44
|
-
onChange(eventValue);
|
|
45
|
-
} else {
|
|
46
|
-
onChange(valueOrEvent);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return /*#__PURE__*/_jsx(Styled.Autocomplete, _objectSpread({
|
|
50
|
-
ref: inputRef,
|
|
51
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
52
|
-
return option === null || option === void 0 ? void 0 : option.label;
|
|
53
|
-
},
|
|
54
|
-
getOptionValue: function getOptionValue(option) {
|
|
55
|
-
var _option$id;
|
|
56
|
-
return (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.i18nKey;
|
|
57
|
-
},
|
|
58
|
-
onChange: handleChange,
|
|
59
|
-
fullWidth: true,
|
|
60
|
-
value: getValue(),
|
|
61
|
-
multiple: multiple,
|
|
62
|
-
size: size,
|
|
63
|
-
showClearIcon: showClearIcon,
|
|
64
|
-
options: sortedOptions,
|
|
65
|
-
submitOnBlur: function submitOnBlur() {
|
|
66
|
-
return handleSelectMenuClose && handleSelectMenuClose(value);
|
|
67
|
-
},
|
|
68
|
-
MenuProps: MENU_PROPS,
|
|
69
|
-
smallPaddings: fromFilters && multiple && (value === null || value === void 0 ? void 0 : value.length)
|
|
70
|
-
}, rest));
|
|
71
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["isFilterOptions", "selectOnly", "onChange", "containerHeight", "value", "inputRef", "size", "numberFormatLocale"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { Input } from '@scaleflex/ui/core';
|
|
11
|
-
import { useCallback, useRef } from 'react';
|
|
12
|
-
import useInputWithLocaleNumber from '../../hooks/useInputWithLocaleNumber';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export default (function (_ref) {
|
|
15
|
-
var isFilterOptions = _ref.isFilterOptions,
|
|
16
|
-
selectOnly = _ref.selectOnly,
|
|
17
|
-
onChange = _ref.onChange,
|
|
18
|
-
containerHeight = _ref.containerHeight,
|
|
19
|
-
value = _ref.value,
|
|
20
|
-
inputRef = _ref.inputRef,
|
|
21
|
-
_ref$size = _ref.size,
|
|
22
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
23
|
-
numberFormatLocale = _ref.numberFormatLocale,
|
|
24
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
var internalInputWrapperRef = useRef();
|
|
26
|
-
var handleOnChange = useCallback(function (newValue, event) {
|
|
27
|
-
if (isFilterOptions) selectOnly(String(newValue));
|
|
28
|
-
onChange(String(newValue), event);
|
|
29
|
-
}, [onChange, selectOnly]);
|
|
30
|
-
var inputWithLocaleProps = useInputWithLocaleNumber({
|
|
31
|
-
enabled: Boolean(numberFormatLocale),
|
|
32
|
-
value: value,
|
|
33
|
-
locale: numberFormatLocale,
|
|
34
|
-
onChange: handleOnChange,
|
|
35
|
-
inputWrapperRef: inputRef || internalInputWrapperRef
|
|
36
|
-
});
|
|
37
|
-
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({
|
|
38
|
-
type: "number",
|
|
39
|
-
ref: inputRef || internalInputWrapperRef
|
|
40
|
-
}, inputWithLocaleProps), {}, {
|
|
41
|
-
background: "primary",
|
|
42
|
-
size: size,
|
|
43
|
-
fullWidth: true
|
|
44
|
-
}, rest));
|
|
45
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["i18n", "onChange", "field", "value", "multiple", "inputRef", "size", "showClearIcon", "fromFilters", "onBlur", "handleSelectMenuClose"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { useMetaDataSortedOptions } from '../MetaDataFieldTypes.hooks';
|
|
11
|
-
import Styled from './MetaDataFieldTypes.styled';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export default (function (_ref) {
|
|
14
|
-
var i18n = _ref.i18n,
|
|
15
|
-
onChange = _ref.onChange,
|
|
16
|
-
field = _ref.field,
|
|
17
|
-
value = _ref.value,
|
|
18
|
-
multiple = _ref.multiple,
|
|
19
|
-
inputRef = _ref.inputRef,
|
|
20
|
-
_ref$size = _ref.size,
|
|
21
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
22
|
-
_ref$showClearIcon = _ref.showClearIcon,
|
|
23
|
-
showClearIcon = _ref$showClearIcon === void 0 ? false : _ref$showClearIcon,
|
|
24
|
-
_ref$fromFilters = _ref.fromFilters,
|
|
25
|
-
fromFilters = _ref$fromFilters === void 0 ? false : _ref$fromFilters,
|
|
26
|
-
onBlur = _ref.onBlur,
|
|
27
|
-
handleSelectMenuClose = _ref.handleSelectMenuClose,
|
|
28
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
var _useMetaDataSortedOpt = useMetaDataSortedOptions({
|
|
30
|
-
field: field,
|
|
31
|
-
value: value,
|
|
32
|
-
multiple: multiple,
|
|
33
|
-
i18n: i18n
|
|
34
|
-
}),
|
|
35
|
-
sortedOptions = _useMetaDataSortedOpt.sortedOptions,
|
|
36
|
-
getValue = _useMetaDataSortedOpt.getValue;
|
|
37
|
-
var handleChange = function handleChange(valueOrEvent) {
|
|
38
|
-
if (valueOrEvent && valueOrEvent.target) {
|
|
39
|
-
var eventValue = valueOrEvent.target.value;
|
|
40
|
-
onChange(eventValue);
|
|
41
|
-
} else {
|
|
42
|
-
onChange(valueOrEvent);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return /*#__PURE__*/_jsx(Styled.Autocomplete, _objectSpread({
|
|
46
|
-
ref: inputRef,
|
|
47
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
48
|
-
return option === null || option === void 0 ? void 0 : option.label;
|
|
49
|
-
},
|
|
50
|
-
getOptionValue: function getOptionValue(option) {
|
|
51
|
-
var _option$id;
|
|
52
|
-
return (_option$id = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id !== void 0 ? _option$id : option === null || option === void 0 ? void 0 : option.i18nKey;
|
|
53
|
-
},
|
|
54
|
-
onChange: handleChange,
|
|
55
|
-
fullWidth: true,
|
|
56
|
-
value: getValue(),
|
|
57
|
-
multiple: multiple,
|
|
58
|
-
size: size,
|
|
59
|
-
showClearIcon: showClearIcon,
|
|
60
|
-
options: sortedOptions,
|
|
61
|
-
submitOnBlur: function submitOnBlur() {
|
|
62
|
-
return handleSelectMenuClose && handleSelectMenuClose(value);
|
|
63
|
-
},
|
|
64
|
-
MenuProps: {
|
|
65
|
-
position: 'bottom-start'
|
|
66
|
-
},
|
|
67
|
-
smallPaddings: fromFilters && multiple && (value === null || value === void 0 ? void 0 : value.length)
|
|
68
|
-
}, rest));
|
|
69
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["onChange", "value", "i18n", "activeRegionalKey", "item", "isFetching", "isMetadataFilter", "isFocused", "setIsFocused", "isShowGenerateBtn", "inputRef", "generateTags", "isLoading", "allTags", "config", "size", "onChangeSearchQuery", "isMetadataGeneralSection", "disableOnEnter"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
-
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."); }
|
|
10
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
-
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."); }
|
|
14
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
-
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; } }
|
|
17
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
19
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
20
|
-
import { useEffect, useMemo, useState, useRef } from 'react';
|
|
21
|
-
import SuggestedTagsInput from '../../SuggestedTagsInput/SuggestedTagsInput';
|
|
22
|
-
// TODO: Check if we should move the place of the this component to FileCard or not.
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
export default (function (_ref) {
|
|
25
|
-
var onChange = _ref.onChange,
|
|
26
|
-
_ref$value = _ref.value,
|
|
27
|
-
value = _ref$value === void 0 ? [] : _ref$value,
|
|
28
|
-
i18n = _ref.i18n,
|
|
29
|
-
activeRegionalKey = _ref.activeRegionalKey,
|
|
30
|
-
item = _ref.item,
|
|
31
|
-
isFetching = _ref.isFetching,
|
|
32
|
-
isMetadataFilter = _ref.isMetadataFilter,
|
|
33
|
-
isFocused = _ref.isFocused,
|
|
34
|
-
setIsFocused = _ref.setIsFocused,
|
|
35
|
-
isShowGenerateBtn = _ref.isShowGenerateBtn,
|
|
36
|
-
inputRef = _ref.inputRef,
|
|
37
|
-
generateTags = _ref.generateTags,
|
|
38
|
-
isLoading = _ref.isLoading,
|
|
39
|
-
allTags = _ref.allTags,
|
|
40
|
-
config = _ref.config,
|
|
41
|
-
_ref$size = _ref.size,
|
|
42
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
43
|
-
onChangeSearchQuery = _ref.onChangeSearchQuery,
|
|
44
|
-
isMetadataGeneralSection = _ref.isMetadataGeneralSection,
|
|
45
|
-
disableOnEnter = _ref.disableOnEnter,
|
|
46
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
-
value = Array.isArray(value) ? value : [];
|
|
48
|
-
var initialValue = useRef(value);
|
|
49
|
-
var tagsList = useMemo(function () {
|
|
50
|
-
return (allTags || []).map(function (tag) {
|
|
51
|
-
var _tag$names, _tag$names2;
|
|
52
|
-
return {
|
|
53
|
-
sid: tag === null || tag === void 0 ? void 0 : tag.sid,
|
|
54
|
-
label: tag === null || tag === void 0 ? void 0 : (_tag$names = tag.names) === null || _tag$names === void 0 ? void 0 : _tag$names[activeRegionalKey],
|
|
55
|
-
name: tag === null || tag === void 0 ? void 0 : (_tag$names2 = tag.names) === null || _tag$names2 === void 0 ? void 0 : _tag$names2[activeRegionalKey],
|
|
56
|
-
primary: Boolean(tag === null || tag === void 0 ? void 0 : tag.primary)
|
|
57
|
-
};
|
|
58
|
-
}).filter(function (tag) {
|
|
59
|
-
return (tag === null || tag === void 0 ? void 0 : tag.sid) && (tag === null || tag === void 0 ? void 0 : tag.label);
|
|
60
|
-
});
|
|
61
|
-
}, [allTags, activeRegionalKey]);
|
|
62
|
-
var _useState = useState(tagsList),
|
|
63
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
-
filteredTagsList = _useState2[0],
|
|
65
|
-
setFilteredTagsList = _useState2[1];
|
|
66
|
-
var notSuggestedTagsList = Array.isArray(filteredTagsList) ? filteredTagsList.filter(function (tag) {
|
|
67
|
-
return (tag === null || tag === void 0 ? void 0 : tag.sid) && !(tag !== null && tag !== void 0 && tag.primary) && !(value || []).some(function (tagValue) {
|
|
68
|
-
return tagValue.sid === tag.sid;
|
|
69
|
-
});
|
|
70
|
-
}) : [];
|
|
71
|
-
var suggestedTagsList = Array.isArray(filteredTagsList) ? filteredTagsList.filter(function (tag) {
|
|
72
|
-
return (tag === null || tag === void 0 ? void 0 : tag.sid) && (tag === null || tag === void 0 ? void 0 : tag.primary) && !(value || []).some(function (tagValue) {
|
|
73
|
-
return tagValue.sid === tag.sid;
|
|
74
|
-
});
|
|
75
|
-
}) : [];
|
|
76
|
-
var handleAdd = function handleAdd(item) {
|
|
77
|
-
var oldTagIndex = (initialValue.current || []).findIndex(function (_ref2) {
|
|
78
|
-
var label = _ref2.label,
|
|
79
|
-
name = _ref2.name;
|
|
80
|
-
return item === label || item === name;
|
|
81
|
-
});
|
|
82
|
-
var newTag = oldTagIndex !== -1 && initialValue.current[oldTagIndex] || item;
|
|
83
|
-
var newTags = _toConsumableArray(value);
|
|
84
|
-
if (oldTagIndex !== -1) {
|
|
85
|
-
newTags.splice(oldTagIndex, 0, newTag);
|
|
86
|
-
} else {
|
|
87
|
-
newTags.push(newTag);
|
|
88
|
-
}
|
|
89
|
-
var uniqueTags = _toConsumableArray(new Set(newTags));
|
|
90
|
-
onChange(uniqueTags);
|
|
91
|
-
return uniqueTags;
|
|
92
|
-
};
|
|
93
|
-
var handleRemove = function handleRemove(index) {
|
|
94
|
-
var newTags = _toConsumableArray(value);
|
|
95
|
-
newTags.splice(index, 1);
|
|
96
|
-
|
|
97
|
-
// removing tags from TagField and bringing back these removed tags (if it was in the suggestion list) to the list
|
|
98
|
-
|
|
99
|
-
setFilteredTagsList(function (prevValue) {
|
|
100
|
-
var removedFromSuggestedList = tagsList.filter(function (option) {
|
|
101
|
-
return option.name === value[index];
|
|
102
|
-
});
|
|
103
|
-
return [].concat(_toConsumableArray(prevValue), _toConsumableArray(removedFromSuggestedList));
|
|
104
|
-
});
|
|
105
|
-
onChange(newTags);
|
|
106
|
-
};
|
|
107
|
-
useEffect(function () {
|
|
108
|
-
if (tagsList !== null && tagsList !== void 0 && tagsList.length) {
|
|
109
|
-
setFilteredTagsList(tagsList);
|
|
110
|
-
}
|
|
111
|
-
}, [tagsList]);
|
|
112
|
-
return /*#__PURE__*/_jsx(SuggestedTagsInput, _objectSpread(_objectSpread({}, rest), {}, {
|
|
113
|
-
i18n: i18n,
|
|
114
|
-
values: value,
|
|
115
|
-
onClear: function onClear() {
|
|
116
|
-
return onChange([]);
|
|
117
|
-
},
|
|
118
|
-
onChange: onChange,
|
|
119
|
-
onRemove: handleRemove,
|
|
120
|
-
handleAdd: handleAdd,
|
|
121
|
-
generateTags: generateTags,
|
|
122
|
-
filteredTagsList: filteredTagsList,
|
|
123
|
-
notSuggestedTagsList: notSuggestedTagsList,
|
|
124
|
-
suggestedTagsList: suggestedTagsList,
|
|
125
|
-
setFilteredTagsList: setFilteredTagsList,
|
|
126
|
-
config: config,
|
|
127
|
-
size: size,
|
|
128
|
-
isLoading: isLoading,
|
|
129
|
-
isFocused: isFocused,
|
|
130
|
-
setIsFocused: setIsFocused,
|
|
131
|
-
showGenerateTagsButton: isShowGenerateBtn,
|
|
132
|
-
generateTagsButtonLabel: i18n('mutualizedGenerateTagsButton'),
|
|
133
|
-
clearTagsButtonLabel: i18n('mutualizedClearAllButton'),
|
|
134
|
-
allTags: allTags,
|
|
135
|
-
isItemCard: true,
|
|
136
|
-
ref: inputRef,
|
|
137
|
-
disableOnEnter: disableOnEnter,
|
|
138
|
-
onChangeSearchQuery: onChangeSearchQuery,
|
|
139
|
-
isFetching: isFetching,
|
|
140
|
-
isMetadataGeneralSection: isMetadataGeneralSection,
|
|
141
|
-
isMetadataFilter: isMetadataFilter
|
|
142
|
-
}));
|
|
143
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["isFilterOptions", "value", "selectOnly", "onChange", "containerHeight", "inputRef", "style", "size"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { Input } from '@scaleflex/ui/core';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
export default (function (_ref) {
|
|
13
|
-
var isFilterOptions = _ref.isFilterOptions,
|
|
14
|
-
_ref$value = _ref.value,
|
|
15
|
-
value = _ref$value === void 0 ? '' : _ref$value,
|
|
16
|
-
selectOnly = _ref.selectOnly,
|
|
17
|
-
onChange = _ref.onChange,
|
|
18
|
-
containerHeight = _ref.containerHeight,
|
|
19
|
-
inputRef = _ref.inputRef,
|
|
20
|
-
style = _ref.style,
|
|
21
|
-
_ref$size = _ref.size,
|
|
22
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
23
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
-
var handleOnChange = function handleOnChange(value) {
|
|
25
|
-
if (isFilterOptions) selectOnly(value);
|
|
26
|
-
onChange(value);
|
|
27
|
-
};
|
|
28
|
-
return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({}, rest), {}, {
|
|
29
|
-
value: value,
|
|
30
|
-
ref: inputRef,
|
|
31
|
-
style: _objectSpread({
|
|
32
|
-
marginBottom: 0,
|
|
33
|
-
minWidth: 30
|
|
34
|
-
}, style),
|
|
35
|
-
onChange: function onChange(_ref2) {
|
|
36
|
-
var value = _ref2.target.value;
|
|
37
|
-
return handleOnChange(value);
|
|
38
|
-
},
|
|
39
|
-
size: size,
|
|
40
|
-
fullWidth: true
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
var _excluded = ["isFilterOptions", "value", "selectOnly", "onChange", "containerHeight", "inputRef", "enableAIDescription", "generateDescription", "isDescriptionLoading", "setIsDescriptionLoading", "isDescribeBtnHidden", "placeholder", "i18n", "considerMaxWidth", "considerAutoHeight", "readOnly", "size", "activeRegionalKey"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import { DESCRIBE_AI_SUPPORTED_LANGUAGES } from '@scaleflex/widget-utils/lib/constants';
|
|
11
|
-
import { Success } from '@scaleflex/icons';
|
|
12
|
-
import Styled from '../FilterMetadataFields.styled';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export default (function (_ref) {
|
|
15
|
-
var isFilterOptions = _ref.isFilterOptions,
|
|
16
|
-
_ref$value = _ref.value,
|
|
17
|
-
value = _ref$value === void 0 ? '' : _ref$value,
|
|
18
|
-
selectOnly = _ref.selectOnly,
|
|
19
|
-
onChange = _ref.onChange,
|
|
20
|
-
containerHeight = _ref.containerHeight,
|
|
21
|
-
inputRef = _ref.inputRef,
|
|
22
|
-
enableAIDescription = _ref.enableAIDescription,
|
|
23
|
-
generateDescription = _ref.generateDescription,
|
|
24
|
-
isDescriptionLoading = _ref.isDescriptionLoading,
|
|
25
|
-
setIsDescriptionLoading = _ref.setIsDescriptionLoading,
|
|
26
|
-
isDescribeBtnHidden = _ref.isDescribeBtnHidden,
|
|
27
|
-
placeholder = _ref.placeholder,
|
|
28
|
-
i18n = _ref.i18n,
|
|
29
|
-
_ref$considerMaxWidth = _ref.considerMaxWidth,
|
|
30
|
-
considerMaxWidth = _ref$considerMaxWidth === void 0 ? false : _ref$considerMaxWidth,
|
|
31
|
-
_ref$considerAutoHeig = _ref.considerAutoHeight,
|
|
32
|
-
considerAutoHeight = _ref$considerAutoHeig === void 0 ? false : _ref$considerAutoHeig,
|
|
33
|
-
readOnly = _ref.readOnly,
|
|
34
|
-
_ref$size = _ref.size,
|
|
35
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
36
|
-
activeRegionalKey = _ref.activeRegionalKey,
|
|
37
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
-
var showDescribeWithAIBtn = !isDescribeBtnHidden && enableAIDescription && !!DESCRIBE_AI_SUPPORTED_LANGUAGES[activeRegionalKey];
|
|
39
|
-
var isReadonly = readOnly || isDescriptionLoading;
|
|
40
|
-
var handleOnChange = function handleOnChange(value) {
|
|
41
|
-
if (isFilterOptions) selectOnly(value);
|
|
42
|
-
onChange(value);
|
|
43
|
-
};
|
|
44
|
-
var handleClearAll = function handleClearAll() {
|
|
45
|
-
onChange('');
|
|
46
|
-
};
|
|
47
|
-
return /*#__PURE__*/_jsx(Styled.TextArea, _objectSpread(_objectSpread({}, rest), {}, {
|
|
48
|
-
fullWidth: true,
|
|
49
|
-
value: value,
|
|
50
|
-
placeholder: isDescriptionLoading ? '' : placeholder,
|
|
51
|
-
ref: inputRef,
|
|
52
|
-
onChange: function onChange(_ref2) {
|
|
53
|
-
var value = _ref2.target.value;
|
|
54
|
-
return handleOnChange(value);
|
|
55
|
-
},
|
|
56
|
-
showActionButton: showDescribeWithAIBtn,
|
|
57
|
-
readOnly: isReadonly,
|
|
58
|
-
hideCopyIcon: isReadonly && !isDescriptionLoading,
|
|
59
|
-
isActionButtonLoading: isDescriptionLoading,
|
|
60
|
-
disableActionButton: isDescriptionLoading,
|
|
61
|
-
actionButtonLabel: i18n('metaDataTextAreaFieldDescribeWithAIButtonText'),
|
|
62
|
-
onClickActionButton: generateDescription,
|
|
63
|
-
size: size,
|
|
64
|
-
showClearButton: !!(value !== null && value !== void 0 && value.length),
|
|
65
|
-
onClear: handleClearAll,
|
|
66
|
-
clearAllButtonLabel: i18n('mutualizedClearAllButton'),
|
|
67
|
-
copyTextMessage: i18n('mutualizedCopyLink'),
|
|
68
|
-
copySuccessIcon: /*#__PURE__*/_jsx(Success, {
|
|
69
|
-
size: 16
|
|
70
|
-
})
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Autocomplete as SfxAutocomplete, Button as SfxButton } from '@scaleflex/ui/core';
|
|
5
|
-
import { FV, PC } from '../../Typography';
|
|
6
|
-
var TimeFramesPopperContent = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 12px;\n"])));
|
|
7
|
-
var TimeFramesTitle = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n"])), function (_ref) {
|
|
8
|
-
var typography = _ref.theme.typography;
|
|
9
|
-
return typography.font[FV.LabelMediumEmphasis];
|
|
10
|
-
});
|
|
11
|
-
var TimeFramesWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n display: ", ";\n grid-template-columns: ", ";\n grid-auto-rows: max-content;\n gap: 12px;\n"])), function (_ref2) {
|
|
12
|
-
var typography = _ref2.theme.typography;
|
|
13
|
-
return typography.font[FV.LabelMediumEmphasis];
|
|
14
|
-
}, function (_ref3) {
|
|
15
|
-
var hidden = _ref3.hidden;
|
|
16
|
-
return hidden ? 'none' : 'grid';
|
|
17
|
-
}, function (_ref4) {
|
|
18
|
-
var _ref4$col = _ref4.col,
|
|
19
|
-
col = _ref4$col === void 0 ? 2 : _ref4$col;
|
|
20
|
-
return "repeat(".concat(col, ", 1fr)");
|
|
21
|
-
});
|
|
22
|
-
var TimeFrameSelectFieldWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n"])));
|
|
23
|
-
var TimeFrameSelectField = styled(SfxButton)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: ", ";\n height: 32px;\n\n color: ", ";\n > span {\n display: flex;\n justify-content: space-between;\n width: 100%;\n }\n"])), function (_ref5) {
|
|
24
|
-
var _ref5$width = _ref5.width,
|
|
25
|
-
width = _ref5$width === void 0 ? 352 : _ref5$width;
|
|
26
|
-
return isNaN(width) ? width : "".concat(width, "px");
|
|
27
|
-
}, function (_ref6) {
|
|
28
|
-
var theme = _ref6.theme;
|
|
29
|
-
return theme.palette[PC.TextPrimary];
|
|
30
|
-
});
|
|
31
|
-
var SelectMenuItemLabelWrapper = styled.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n white-space: pre-wrap;\n"])));
|
|
32
|
-
var Autocomplete = styled(SfxAutocomplete)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n .SfxTag-Label {\n white-space: break-spaces;\n overflow: unset;\n text-overflow: unset;\n display: block;\n }\n\n .SfxInput-root {\n &:hover {\n .SfxInput-ClearIcon {\n display: flex;\n }\n }\n }\n\n ", "\n\n // TODO: Added as tmp solution to sync multi-select field size with other fields height for filters case only. Styles should be improved (on An to discuss with designers).\n ", "\n"])), function (_ref7) {
|
|
33
|
-
var showClearIcon = _ref7.showClearIcon;
|
|
34
|
-
return showClearIcon && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .SfxInput-ClearIcon {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: 4px;\n padding: 6px;\n height: 24px;\n color: ", ";\n background: transparent;\n border: none;\n transition: all 100ms ease-out;\n\n svg {\n width: 12px;\n height: 12px;\n }\n\n &:hover {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n }\n }\n "])), function (_ref8) {
|
|
35
|
-
var theme = _ref8.theme;
|
|
36
|
-
return theme.palette[PC.IconsSecondary];
|
|
37
|
-
}, function (_ref9) {
|
|
38
|
-
var theme = _ref9.theme;
|
|
39
|
-
return theme.palette[PC.BackgroundHover];
|
|
40
|
-
}, function (_ref10) {
|
|
41
|
-
var theme = _ref10.theme;
|
|
42
|
-
return theme.palette[PC.IconsPrimary];
|
|
43
|
-
});
|
|
44
|
-
}, function (_ref11) {
|
|
45
|
-
var smallPaddings = _ref11.smallPaddings;
|
|
46
|
-
return smallPaddings && "\n .SfxInput-root {\n min-height: 32px;\n padding: 4px 8px;\n\n .SfxTag-root {\n padding: 2px 12px;\n }\n }\n ";
|
|
47
|
-
});
|
|
48
|
-
var Styled = {
|
|
49
|
-
SelectMenuItemLabelWrapper: SelectMenuItemLabelWrapper,
|
|
50
|
-
TimeFramesPopperContent: TimeFramesPopperContent,
|
|
51
|
-
TimeFramesWrapper: TimeFramesWrapper,
|
|
52
|
-
TimeFramesTitle: TimeFramesTitle,
|
|
53
|
-
TimeFrameSelectFieldWrapper: TimeFrameSelectFieldWrapper,
|
|
54
|
-
TimeFrameSelectField: TimeFrameSelectField,
|
|
55
|
-
Autocomplete: Autocomplete
|
|
56
|
-
};
|
|
57
|
-
export default Styled;
|