@scaleflex/widget-explorer 4.0.7 → 4.1.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12123 -12100
  2. package/LICENSE +21 -21
  3. package/README.md +1260 -1235
  4. package/dist/style.css +1438 -1094
  5. package/dist/style.min.css +1 -1
  6. package/lib/components/AssetsList/SearchView.hook.js +24 -24
  7. package/lib/components/AssetsList/__SearchTestPannel.js +27 -27
  8. package/lib/components/BulkEditPanel/components/AssetsList/Columns/columns.utils.js +2 -2
  9. package/lib/components/CropPanel/index.scss +55 -55
  10. package/lib/components/Details/FileItem/style.scss +11 -11
  11. package/lib/components/Drawer/ResizerCore.js +3 -3
  12. package/lib/components/FileItem/PreUploadFileThumbnail/index.scss +19 -19
  13. package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralSection.js +1 -1
  14. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.constants.js +7 -3
  15. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.styled.js +4 -2
  16. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.thunks.js +45 -0
  17. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsContent.js +15 -1
  18. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTabs.js +11 -3
  19. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTopOptions.js +4 -4
  20. package/lib/components/FileWindowPanel/FileTabs/VariationsTab/index.js +194 -27
  21. package/lib/components/FileWindowPanel/Header/BeforeUploadActionBtns.js +4 -4
  22. package/lib/components/GalleryRoleSelect/GalleryRoleSelect.utils.js +3 -3
  23. package/lib/components/GalleryRoleSelect/index.js +11 -11
  24. package/lib/components/Modals/TransformedDownload/TransformedDownload.hooks.js +11 -11
  25. package/lib/components/Modals/TransformedDownload/TransformedDownload.utils.js +4 -4
  26. package/lib/components/TopBar/index.scss +20 -20
  27. package/lib/components/UrlBuilderModal/index.js +6 -2
  28. package/lib/components/common/FileMetadataFieldValue/FileMetadataFieldValue.utils.js +12 -8
  29. package/lib/components/metadata.adapter.js +18 -18
  30. package/lib/defaultLocale.js +7 -1
  31. package/lib/hooks/useEditFileDetails.js +5 -5
  32. package/lib/hooks/useFileMetadata.js +5 -3
  33. package/lib/hooks/useIsSmallScreen.js +6 -6
  34. package/lib/hooks/useValidateFileName.js +22 -22
  35. package/lib/index.js +154 -151
  36. package/lib/slices/files.slice.js +15 -15
  37. package/lib/slices/folders.slice.js +9 -9
  38. package/lib/slices/metadata.slice.js +9 -2
  39. package/lib/style.scss +268 -268
  40. package/lib/utils/SearchSuggestions/SearchSuggestionsMenu.js +4 -4
  41. package/lib/utils/createSuperFocus.js +5 -5
  42. package/lib/utils/filters.js +3 -3
  43. package/lib/utils/formatPinSubTitle.js +6 -6
  44. package/lib/utils/getActiveOverlayEl.js +2 -2
  45. package/lib/utils/truncateString.js +7 -7
  46. package/package.json +8 -8
  47. package/types/index.d.ts +102 -102
@@ -1,20 +1,20 @@
1
- // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/PrependedOptions/index.jsx
2
- // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/ContextDropdown/index.jsx
3
- // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/PrependedOptions/PinsOverlay/index.jsx
4
- .filerobot-Explorer-TopBar-PrependedOptions {
5
- display: flex;
6
- align-items: center;
7
- height: 100%;
8
- }
9
-
10
- .filerobot-Explorer-TopBar-AppendedOptions {
11
- display: flex;
12
- align-items: center;
13
- float: right;
14
- }
15
-
16
- .filerobot-Explorer-TopBar-Search-ContextDropdown-SubList-container {
17
- padding: 0 !important;
18
- cursor: default !important;
19
- background: #ffffff !important;
20
- }
1
+ // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/PrependedOptions/index.jsx
2
+ // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/ContextDropdown/index.jsx
3
+ // packages/@scaleflex/widget-provider-views/src/components/TopBar/Search/PrependedOptions/PinsOverlay/index.jsx
4
+ .filerobot-Explorer-TopBar-PrependedOptions {
5
+ display: flex;
6
+ align-items: center;
7
+ height: 100%;
8
+ }
9
+
10
+ .filerobot-Explorer-TopBar-AppendedOptions {
11
+ display: flex;
12
+ align-items: center;
13
+ float: right;
14
+ }
15
+
16
+ .filerobot-Explorer-TopBar-Search-ContextDropdown-SubList-container {
17
+ padding: 0 !important;
18
+ cursor: default !important;
19
+ background: #ffffff !important;
20
+ }
@@ -12,6 +12,9 @@ import { useConfirmationModal } from '../Modals';
12
12
  import { removeExtraUrlParams } from '../../utils/removeExtraUrlParams';
13
13
  import Styled from './UrlBuilderModal.styled';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
+ var modalStyles = {
16
+ zIndex: 1300
17
+ };
15
18
  var UrlBuilderModal = function UrlBuilderModal(_ref) {
16
19
  var showUrlBuilderModal = _ref.showUrlBuilderModal,
17
20
  setShowUrlBuilderModal = _ref.setShowUrlBuilderModal,
@@ -19,7 +22,7 @@ var UrlBuilderModal = function UrlBuilderModal(_ref) {
19
22
  urlTitle = _ref.urlTitle,
20
23
  headerTitle = _ref.headerTitle,
21
24
  actionButtonLabel = _ref.actionButtonLabel,
22
- triggerAddVariantModal = _ref.triggerAddVariantModal,
25
+ onNewSave = _ref.onNewSave,
23
26
  i18n = _ref.i18n,
24
27
  selectedVariant = _ref.selectedVariant,
25
28
  submitVariantEdit = _ref.submitVariantEdit,
@@ -65,13 +68,14 @@ var UrlBuilderModal = function UrlBuilderModal(_ref) {
65
68
  triggerVariantEdit(nextUrl);
66
69
  setShowUrlBuilderModal(false);
67
70
  } else {
68
- triggerAddVariantModal(nextUrl);
71
+ onNewSave(nextUrl);
69
72
  }
70
73
  };
71
74
  return /*#__PURE__*/_jsx(Styled.Modal, {
72
75
  fullWidth: true,
73
76
  open: showUrlBuilderModal,
74
77
  onClose: handleClose,
78
+ modalStyles: modalStyles,
75
79
  children: /*#__PURE__*/_jsx(ModalContent, {
76
80
  children: /*#__PURE__*/_jsx(UrlBuilder, {
77
81
  url: urlWithParams,
@@ -126,7 +126,8 @@ var getRemoteFields = function getRemoteFields(_ref3) {
126
126
  scrollToMetaField = _ref3.scrollToMetaField,
127
127
  isApprovalsEnabled = _ref3.isApprovalsEnabled,
128
128
  rootFieldsRegionalUuidsByKeys = _ref3.rootFieldsRegionalUuidsByKeys,
129
- smallerFont = _ref3.smallerFont;
129
+ smallerFont = _ref3.smallerFont,
130
+ hideFileSpecsMetadataFields = _ref3.hideFileSpecsMetadataFields;
130
131
  var _file$meta = file.meta,
131
132
  meta = _file$meta === void 0 ? {} : _file$meta,
132
133
  _file$tags = file.tags,
@@ -173,7 +174,7 @@ var getRemoteFields = function getRemoteFields(_ref3) {
173
174
  type: 'labels',
174
175
  uuid: 'GENERAL-LABELS',
175
176
  value: Array.isArray(labels) ? labels : [],
176
- hide: isFastToken
177
+ hide: hideFileSpecsMetadataFields || isFastToken
177
178
  }, {
178
179
  key: 'orientation',
179
180
  placeholder: "".concat(i18n('generalSectionOrientationLabel'), "..."),
@@ -205,14 +206,16 @@ var getRemoteFields = function getRemoteFields(_ref3) {
205
206
  return "#".concat(color);
206
207
  })) || currentMainColors.map(function (color) {
207
208
  return getCorrectColor(color);
208
- })
209
+ }),
210
+ hide: hideFileSpecsMetadataFields
209
211
  }, {
210
212
  key: 'dominantColor',
211
213
  placeholder: "".concat(i18n('mutualizedDominantColorLabel'), "..."),
212
214
  title: i18n('mutualizedDominantColorLabel'),
213
215
  type: 'dominantColor',
214
216
  uuid: 'GENERAL-DOMINANT_COLOR',
215
- value: info !== null && info !== void 0 && info.dominant_color_hex ? "#".concat(info === null || info === void 0 ? void 0 : info.dominant_color_hex) : getCorrectColor(info === null || info === void 0 ? void 0 : info.dominant_color)
217
+ value: info !== null && info !== void 0 && info.dominant_color_hex ? "#".concat(info === null || info === void 0 ? void 0 : info.dominant_color_hex) : getCorrectColor(info === null || info === void 0 ? void 0 : info.dominant_color),
218
+ hide: hideFileSpecsMetadataFields
216
219
  }, {
217
220
  key: 'logoAndBrand',
218
221
  placeholder: "".concat(i18n('generalSectionLogoAndBrandLabel'), "..."),
@@ -220,7 +223,7 @@ var getRemoteFields = function getRemoteFields(_ref3) {
220
223
  type: 'linked-text',
221
224
  uuid: 'GENERAL-LOGO_AND_BRAND',
222
225
  value: fileDetails.brandAndLogosLabels,
223
- hide: !fileDetails.brandAndLogosLabels.length
226
+ hide: hideFileSpecsMetadataFields || !fileDetails.brandAndLogosLabels.length
224
227
  }, {
225
228
  key: 'createdAt',
226
229
  placeholder: "".concat(i18n('mutualizedCreatedAtText'), "..."),
@@ -235,7 +238,8 @@ var getRemoteFields = function getRemoteFields(_ref3) {
235
238
  title: i18n('mutualizedCreatedByText'),
236
239
  type: 'text',
237
240
  uuid: 'GENERAL-CREATED_BY',
238
- value: fileDetails.createdBy
241
+ value: fileDetails.createdBy,
242
+ hide: hideFileSpecsMetadataFields
239
243
  }, {
240
244
  key: 'modifiedAt',
241
245
  placeholder: "".concat(i18n('mutualizedModifiedAtText'), "..."),
@@ -251,7 +255,7 @@ var getRemoteFields = function getRemoteFields(_ref3) {
251
255
  type: 'expiryDate',
252
256
  uuid: 'GENERAL-EXPIRY_DATE',
253
257
  value: expireDateMappedField && meta[expireDateMappedField.key],
254
- hide: !expireDateMappedField,
258
+ hide: hideFileSpecsMetadataFields || !expireDateMappedField,
255
259
  labelIconTooltip: ExpiryDateTooltipContent({
256
260
  expireDateMappedField: expireDateMappedField,
257
261
  i18nArray: i18nArray,
@@ -263,7 +267,7 @@ var getRemoteFields = function getRemoteFields(_ref3) {
263
267
  title: i18n('explorerGeneralFileDetailsStatusLabel'),
264
268
  type: 'custom',
265
269
  uuid: 'GENERAL-STATUS',
266
- hide: !isApprovalsEnabled,
270
+ hide: hideFileSpecsMetadataFields || !isApprovalsEnabled,
267
271
  Component: FileApprovalsInfoPopup
268
272
  }, {
269
273
  key: 'uuid',
@@ -19,9 +19,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
19
19
  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); }
20
20
  import cuid from 'cuid';
21
21
 
22
- /**
23
- * Connected with ticket -- http://sk.fl3x.cc/?i=8KJIbM0d51zOLt
24
- * We need to adapt metadata to new format which support Regional variants groups
22
+ /**
23
+ * Connected with ticket -- http://sk.fl3x.cc/?i=8KJIbM0d51zOLt
24
+ * We need to adapt metadata to new format which support Regional variants groups
25
25
  */
26
26
 
27
27
  var generateFieldPossibleValue = function generateFieldPossibleValue(posValue) {
@@ -114,8 +114,8 @@ var adaptMetadata = function adaptMetadata(metadata) {
114
114
  });
115
115
  var oldMetaModel = metadata === null || metadata === void 0 ? void 0 : metadata.model;
116
116
 
117
- /**
118
- * Generate regionalVariantsGroups and update model fields regional_variants params, to use group uuid instead of string[]
117
+ /**
118
+ * Generate regionalVariantsGroups and update model fields regional_variants params, to use group uuid instead of string[]
119
119
  */
120
120
 
121
121
  // Regional variants group hash buffer
@@ -131,12 +131,12 @@ var adaptMetadata = function adaptMetadata(metadata) {
131
131
  possibleValues = field.possible_values,
132
132
  permissions = field.permissions,
133
133
  fieldRest = _objectWithoutProperties(field, _excluded);
134
- /**
135
- * For select types we can't use regional variants. (Disscussed with Julian)
136
- * Bad file metadata:
137
- * which_colors: { default: [@item1, @item2] }
138
- * Good file metadata:
139
- * which_colors: [@item1, @item2]
134
+ /**
135
+ * For select types we can't use regional variants. (Disscussed with Julian)
136
+ * Bad file metadata:
137
+ * which_colors: { default: [@item1, @item2] }
138
+ * Good file metadata:
139
+ * which_colors: [@item1, @item2]
140
140
  */
141
141
  var needRemoveRegionalVariants = ['select-one', 'multi-select'].indexOf(fieldRest === null || fieldRest === void 0 ? void 0 : fieldRest.type) > -1;
142
142
  var adaptedField = _objectSpread(_objectSpread({}, fieldRest), {}, {
@@ -206,9 +206,9 @@ var adaptMetadata = function adaptMetadata(metadata) {
206
206
  }
207
207
  adaptedMetadata.store.regional_variants_groups = rvGroupsArray;
208
208
 
209
- /**
210
- * Add default "Root fields" group.
211
- * We wait what regional_variants_groups list is generated, to find language regional group
209
+ /**
210
+ * Add default "Root fields" group.
211
+ * We wait what regional_variants_groups list is generated, to find language regional group
212
212
  */
213
213
  adaptedMetadata.model = adaptedMetadata.model.map(function (item) {
214
214
  var _ref3;
@@ -242,10 +242,10 @@ var adaptMetadata = function adaptMetadata(metadata) {
242
242
  return adaptedMetadata;
243
243
  };
244
244
 
245
- /**
246
- * @param {object} groupsObj
247
- * @param {string[]} variants
248
- * @param {boolean} [isRoot=false] - Flag to mark group as root. TRUE is mean that this group is not deletable. Added for meta "Root fields" group
245
+ /**
246
+ * @param {object} groupsObj
247
+ * @param {string[]} variants
248
+ * @param {boolean} [isRoot=false] - Flag to mark group as root. TRUE is mean that this group is not deletable. Added for meta "Root fields" group
249
249
  */
250
250
  var generateNewRegionalVariantGroup = function generateNewRegionalVariantGroup(groupsObj, variants) {
251
251
  var _adaptedVariants;
@@ -1350,5 +1350,11 @@ export default {
1350
1350
  galleryRoleSelectorCustomTabLabel: 'Custom',
1351
1351
  galleryRoleSelectorLessRolePermsTooltip: 'This role has less permissions than the default access',
1352
1352
  explorerGridFileOptionsOverlaySelectBtn: 'Select',
1353
- explorer3rdPartyUploadIncludeSubFolders: 'Include subfolders'
1353
+ explorer3rdPartyUploadIncludeSubFolders: 'Include subfolders',
1354
+ explorerFileWindowAddPresetTitle: 'Add preset',
1355
+ explorerFileWindowAddPresetNamePlaceholder: 'Enter name (URL placeholder)',
1356
+ explorerFileWindowAddPresetDescPlaceholder: 'Enter description here',
1357
+ explorerFileWindowAddPresetDescLabel: 'Description',
1358
+ explorerFileWindowPresetAddedInfo: 'Preset is added!',
1359
+ explorerFileWindowAddPresetNameRegexError: '{ , } , | , \\ , ^ , ~ , @ , spaces , ` and , characters are not allowed'
1354
1360
  };
@@ -470,11 +470,11 @@ var useEditFileDetails = function useEditFileDetails(_ref) {
470
470
  var metaFieldElem = document.querySelector("#meta-field-".concat(metaFieldKey));
471
471
  if (metaFieldElem) {
472
472
  var _metaFieldElem$queryS;
473
- /**
474
- * block: 'center' replaced with block: 'nearest' as 'center' causes the whole panel's block to be scrolled outside of the view (hidden)
475
- * in-case of small screen which is not good as it blocks further operations.
476
- * And it's a common issue for people on StackOverFlow so nearest fixed the issue, seems like some strange behavior of scrollIntoView.
477
- * https://stackoverflow.com/q/11039885
473
+ /**
474
+ * block: 'center' replaced with block: 'nearest' as 'center' causes the whole panel's block to be scrolled outside of the view (hidden)
475
+ * in-case of small screen which is not good as it blocks further operations.
476
+ * And it's a common issue for people on StackOverFlow so nearest fixed the issue, seems like some strange behavior of scrollIntoView.
477
+ * https://stackoverflow.com/q/11039885
478
478
  */
479
479
  metaFieldElem.scrollIntoView({
480
480
  block: 'nearest',
@@ -28,7 +28,8 @@ var useFileMetadata = function useFileMetadata(_ref) {
28
28
  var metaRegionalGroups = useSelector(selectMetadataRegionalGroups);
29
29
  var expireDateMappedField = useSelector(selectMetaMappedLicenseExpireDateField);
30
30
  var isFastToken = opts.isFastToken,
31
- findAssetLocationEnabled = opts.findAssetLocationEnabled;
31
+ findAssetLocationEnabled = opts.findAssetLocationEnabled,
32
+ hideFileSpecsMetadataFields = opts.hideFileSpecsMetadataFields;
32
33
  var isPreUpload = isUploadableFile(file);
33
34
  var isApprovalsEnabled = (_filerobot$getPlugin = filerobot.getPlugin(PLUGINS_IDS.APPROVALS)) === null || _filerobot$getPlugin === void 0 ? void 0 : (_filerobot$getPlugin$ = _filerobot$getPlugin.isEnabled) === null || _filerobot$getPlugin$ === void 0 ? void 0 : _filerobot$getPlugin$.call(_filerobot$getPlugin);
34
35
  var languageRegionalFilterUuid = useMemo(function () {
@@ -51,9 +52,10 @@ var useFileMetadata = function useFileMetadata(_ref) {
51
52
  isFastToken: isFastToken,
52
53
  findAssetLocationEnabled: findAssetLocationEnabled,
53
54
  isApprovalsEnabled: isApprovalsEnabled,
54
- smallerFont: smallerFont
55
+ smallerFont: smallerFont,
56
+ hideFileSpecsMetadataFields: hideFileSpecsMetadataFields
55
57
  });
56
- }, [file, rootFieldsRegionalUuidsByKeys, languageRegionalFilterUuid, i18n, isPreUpload, expireDateMappedField, i18nArray, scrollToMetaField, isFastToken, findAssetLocationEnabled, isApprovalsEnabled]),
58
+ }, [file, rootFieldsRegionalUuidsByKeys, languageRegionalFilterUuid, i18n, isPreUpload, expireDateMappedField, i18nArray, scrollToMetaField, isFastToken, findAssetLocationEnabled, isApprovalsEnabled, hideFileSpecsMetadataFields]),
57
59
  readOnlyGeneralMetadataFields = _useMemo.readOnlyFields,
58
60
  editableGeneralMetadataGFields = _useMemo.editableFields;
59
61
  var customMetadataGroups = useMemo(function () {
@@ -2,12 +2,12 @@ import { useSelector } from 'react-redux';
2
2
  import { useTheme } from '@scaleflex/ui/theme/hooks';
3
3
  import { selectContainerWidth } from '../slices/common.slice';
4
4
 
5
- /**
6
- * check if the widget container <= 1085px
7
- *
8
- * @param {containerWidth} Number container width
9
- * @param {theme} Object Scaleflex theme
10
- * @returns {Boolean}
5
+ /**
6
+ * check if the widget container <= 1085px
7
+ *
8
+ * @param {containerWidth} Number container width
9
+ * @param {theme} Object Scaleflex theme
10
+ * @returns {Boolean}
11
11
  */
12
12
 
13
13
  var useIsSmallScreen = function useIsSmallScreen() {
@@ -45,16 +45,16 @@ var handleError = function handleError(_ref) {
45
45
  };
46
46
  };
47
47
 
48
- /**
49
- * Validate file name changes, to be able to control extension remove/update.
50
- * Details: T7195 https://sfx.li/IFr4y01tgqL1wg
51
- *
52
- * @param {string} oldName - Old file name that should be changed
53
- * @param {strign} newName - New file name
54
- * @param {object} [opts] - Options object
55
- * @param {boolean} [opts.ignoreChangedNameExtension=false] - If TRUE, fn will ignore extension updates
56
- *
57
- * @returns {object} - Object with validation details
48
+ /**
49
+ * Validate file name changes, to be able to control extension remove/update.
50
+ * Details: T7195 https://sfx.li/IFr4y01tgqL1wg
51
+ *
52
+ * @param {string} oldName - Old file name that should be changed
53
+ * @param {strign} newName - New file name
54
+ * @param {object} [opts] - Options object
55
+ * @param {boolean} [opts.ignoreChangedNameExtension=false] - If TRUE, fn will ignore extension updates
56
+ *
57
+ * @returns {object} - Object with validation details
58
58
  */
59
59
  var checkFileRenameValidation = function checkFileRenameValidation(oldName, newName) {
60
60
  var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
@@ -100,10 +100,10 @@ var checkFileRenameValidation = function checkFileRenameValidation(oldName, newN
100
100
  };
101
101
  };
102
102
 
103
- /**
104
- * @param {string} name - file name
105
- *
106
- * @returns {object} - Object with validation details
103
+ /**
104
+ * @param {string} name - file name
105
+ *
106
+ * @returns {object} - Object with validation details
107
107
  */
108
108
  var checkFileNameValidation = function checkFileNameValidation(name) {
109
109
  if (checkFileOrFolderNameValidation(name)) {
@@ -118,14 +118,14 @@ var checkFileNameValidation = function checkFileNameValidation(name) {
118
118
  };
119
119
  };
120
120
 
121
- /**
122
- * Change file name extension.
123
- *
124
- * @param {string} fileName - File name with extension that should be changed
125
- * @param {string} nextExtension - Extension without dot. For example: 'jpg'
126
- * @param {string} [prevExtension] - Extension without dot. For example: 'jpg'
127
- *
128
- * @returns {string} - File name with updated extension. For example: changeFileNameExtension('file-name.jpg', 'jpg', 'gif') will return file-name.gif
121
+ /**
122
+ * Change file name extension.
123
+ *
124
+ * @param {string} fileName - File name with extension that should be changed
125
+ * @param {string} nextExtension - Extension without dot. For example: 'jpg'
126
+ * @param {string} [prevExtension] - Extension without dot. For example: 'jpg'
127
+ *
128
+ * @returns {string} - File name with updated extension. For example: changeFileNameExtension('file-name.jpg', 'jpg', 'gif') will return file-name.gif
129
129
  */
130
130
  var changeFileNameExtension = function changeFileNameExtension(fileName, nextExtension) {
131
131
  var prevExtension = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;