hrm_ui_lib 1.4.13 → 1.5.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/components/DatePicker/RangeDatePicker/RangeDatePicker.js +3 -0
- package/components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js +3 -0
- package/components/DatePicker/RangeDatePicker/index.js +3 -0
- package/components/DatePicker/index.js +3 -0
- package/components/Select/Select/Select.js +12 -2
- package/components/Select/index.js +2 -2
- package/helpers/format-date.d.ts +1 -1
- package/helpers/format-date.js +8 -3
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +3 -0
- package/helpers/locale.d.ts +3 -0
- package/helpers/locale.js +16 -0
- package/helpers/storage.d.ts +2 -0
- package/helpers/storage.js +20 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/type/index.d.ts +1 -0
- package/type/index.js +1 -0
- package/type/locale.d.ts +10 -0
- package/type/locale.js +14 -0
|
@@ -85,6 +85,9 @@ import '../../../hooks/useChangePositionsOnScroll.js';
|
|
|
85
85
|
import '../../Select/MultiSelect/MobileWrapper.js';
|
|
86
86
|
import '../../Select/MultiSelect/DesktopWrapper.js';
|
|
87
87
|
import '../../../helpers/format-date.js';
|
|
88
|
+
import '../../../helpers/locale.js';
|
|
89
|
+
import '../../../type/locale.js';
|
|
90
|
+
import '../../../helpers/storage.js';
|
|
88
91
|
|
|
89
92
|
var RangeDatePicker = function RangeDatePicker(props) {
|
|
90
93
|
var isMobile = useIsMobile();
|
|
@@ -83,6 +83,9 @@ import '../../../hooks/useGetHasBottomSpace.js';
|
|
|
83
83
|
import '../../../hooks/useChangePositionsOnScroll.js';
|
|
84
84
|
import '../../Select/MultiSelect/MobileWrapper.js';
|
|
85
85
|
import '../../Select/MultiSelect/DesktopWrapper.js';
|
|
86
|
+
import '../../../helpers/locale.js';
|
|
87
|
+
import '../../../type/locale.js';
|
|
88
|
+
import '../../../helpers/storage.js';
|
|
86
89
|
|
|
87
90
|
var _excluded = ["value", "currentDates", "setFieldValue", "name", "changeHandler", "dataId", "format", "maxDate", "minDate", "locale", "dayjsLocale", "disabled", "placeholderText", "months", "dataIdPrefix", "modalOptions"];
|
|
88
91
|
var RangeDatePickerMobile = /*#__PURE__*/forwardRef(function (props) {
|
|
@@ -86,3 +86,6 @@ import '../../../hooks/useChangePositionsOnScroll.js';
|
|
|
86
86
|
import '../../Select/MultiSelect/MobileWrapper.js';
|
|
87
87
|
import '../../Select/MultiSelect/DesktopWrapper.js';
|
|
88
88
|
import '../../../helpers/format-date.js';
|
|
89
|
+
import '../../../helpers/locale.js';
|
|
90
|
+
import '../../../type/locale.js';
|
|
91
|
+
import '../../../helpers/storage.js';
|
|
@@ -96,3 +96,6 @@ import './RangeDatePicker/RangeDatePickerDesktop.js';
|
|
|
96
96
|
import './types.js';
|
|
97
97
|
import './RangeDatePicker/RangeDatePickerMobile.js';
|
|
98
98
|
import '../../helpers/format-date.js';
|
|
99
|
+
import '../../helpers/locale.js';
|
|
100
|
+
import '../../type/locale.js';
|
|
101
|
+
import '../../helpers/storage.js';
|
|
@@ -9,6 +9,8 @@ import { Input } from '../../Input/Input.js';
|
|
|
9
9
|
import { noop } from '../../../utils/helpers.js';
|
|
10
10
|
import { SELECTED_VISIBLE_MIN_COUNT } from '../constants.js';
|
|
11
11
|
import { SelectMobile } from './SelectMobile/index.js';
|
|
12
|
+
import { IconCaretUpFilled } from '../../SVGIcons/IconCaretUpFilled.js';
|
|
13
|
+
import { IconCaretDownFilled } from '../../SVGIcons/IconCaretDownFilled.js';
|
|
12
14
|
import '../../../consts/index.js';
|
|
13
15
|
import '../../../defineProperty-0885e8cf.js';
|
|
14
16
|
import '../../../typeof-8ef57f3d.js';
|
|
@@ -92,8 +94,16 @@ var Select = function Select(props) {
|
|
|
92
94
|
outerHelperText = props.outerHelperText,
|
|
93
95
|
isRequiredField = props.isRequiredField,
|
|
94
96
|
placeHolder = props.placeHolder,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
_props$selectRightIco = props.selectRightIconProps,
|
|
98
|
+
selectRightIconProps = _props$selectRightIco === void 0 ? {
|
|
99
|
+
Component: IconCaretDownFilled,
|
|
100
|
+
size: 'xsmall'
|
|
101
|
+
} : _props$selectRightIco,
|
|
102
|
+
_props$selectRightIco2 = props.selectRightIconOpenedProps,
|
|
103
|
+
selectRightIconOpenedProps = _props$selectRightIco2 === void 0 ? {
|
|
104
|
+
Component: IconCaretUpFilled,
|
|
105
|
+
size: 'xsmall'
|
|
106
|
+
} : _props$selectRightIco2,
|
|
97
107
|
options = props.options,
|
|
98
108
|
withSearch = props.withSearch,
|
|
99
109
|
setSelectedItem = props.setSelectedItem,
|
|
@@ -82,10 +82,10 @@ import './constants.js';
|
|
|
82
82
|
import './Select/helpers.js';
|
|
83
83
|
import './Select/SelectMobile/index.js';
|
|
84
84
|
import './Select/SelectMobile/MobileTopContent.js';
|
|
85
|
+
import '../SVGIcons/IconCaretUpFilled.js';
|
|
86
|
+
import '../SVGIcons/IconCaretDownFilled.js';
|
|
85
87
|
import './MultiSelect/OptionsWrapper.js';
|
|
86
88
|
import './MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js';
|
|
87
|
-
import '../SVGIcons/IconCaretDownFilled.js';
|
|
88
|
-
import '../SVGIcons/IconCaretUpFilled.js';
|
|
89
89
|
import './MultiSelect/MultiBase/MultiBase.js';
|
|
90
90
|
import './MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js';
|
|
91
91
|
import '../Tab/Tab.js';
|
package/helpers/format-date.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const formatDate: (value: string | Date | null | undefined, format: string) => string;
|
|
1
|
+
export declare const formatDate: (value: string | Date | null | undefined, format: string, defaultValue?: string) => string;
|
package/helpers/format-date.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
import { getDayJSLocale } from './locale.js';
|
|
3
|
+
import '../type/locale.js';
|
|
4
|
+
import './storage.js';
|
|
2
5
|
|
|
3
6
|
var formatDate = function formatDate(value, format) {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
8
|
+
var isValid = dayjs(value).isValid();
|
|
9
|
+
if (!isValid) {
|
|
10
|
+
return defaultValue;
|
|
6
11
|
}
|
|
7
|
-
return dayjs(value).format(format);
|
|
12
|
+
return dayjs(value).locale(getDayJSLocale()).format(format);
|
|
8
13
|
};
|
|
9
14
|
|
|
10
15
|
export { formatDate };
|
package/helpers/index.d.ts
CHANGED
package/helpers/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TranslationLocale, DayJSLocale } from '../type/locale.js';
|
|
2
|
+
import { getLocalStorageItem } from './storage.js';
|
|
3
|
+
|
|
4
|
+
var getActiveLanguageCode = function getActiveLanguageCode() {
|
|
5
|
+
return getLocalStorageItem('selectedLanguage') || 'en-US';
|
|
6
|
+
};
|
|
7
|
+
var getTranslationLocale = function getTranslationLocale() {
|
|
8
|
+
var activeLangCode = getActiveLanguageCode();
|
|
9
|
+
return TranslationLocale[activeLangCode] || 'en';
|
|
10
|
+
};
|
|
11
|
+
var getDayJSLocale = function getDayJSLocale() {
|
|
12
|
+
var activeLangCode = getActiveLanguageCode();
|
|
13
|
+
return DayJSLocale[activeLangCode] || 'en';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { getActiveLanguageCode, getDayJSLocale, getTranslationLocale };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var getLocalStorageItem = function getLocalStorageItem(key) {
|
|
2
|
+
var storedValue = localStorage.getItem(key);
|
|
3
|
+
if (!storedValue) {
|
|
4
|
+
return storedValue;
|
|
5
|
+
}
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(storedValue);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
return storedValue;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var setLocalStorageItem = function setLocalStorageItem(key, value) {
|
|
13
|
+
if (typeof value === 'string') {
|
|
14
|
+
localStorage.setItem(key, value);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { getLocalStorageItem, setLocalStorageItem };
|
package/index.js
CHANGED
|
@@ -408,6 +408,9 @@ import './components/DatePicker/RangeDatePicker/RangeDatePickerDesktop.js';
|
|
|
408
408
|
import './components/DatePicker/types.js';
|
|
409
409
|
import './components/DatePicker/RangeDatePicker/RangeDatePickerMobile.js';
|
|
410
410
|
import './helpers/format-date.js';
|
|
411
|
+
import './helpers/locale.js';
|
|
412
|
+
import './type/locale.js';
|
|
413
|
+
import './helpers/storage.js';
|
|
411
414
|
import '@hookform/resolvers';
|
|
412
415
|
import '@hookform/error-message';
|
|
413
416
|
import 'react-paginate';
|
package/package.json
CHANGED
package/type/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './locale';
|
package/type/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DayJSLocale, TranslationLocale } from './locale.js';
|
package/type/locale.d.ts
ADDED
package/type/locale.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var TranslationLocale = /*#__PURE__*/function (TranslationLocale) {
|
|
2
|
+
TranslationLocale["en-US"] = "en";
|
|
3
|
+
TranslationLocale["hy-AM"] = "hy";
|
|
4
|
+
TranslationLocale["ru-RU"] = "ru";
|
|
5
|
+
return TranslationLocale;
|
|
6
|
+
}({});
|
|
7
|
+
var DayJSLocale = /*#__PURE__*/function (DayJSLocale) {
|
|
8
|
+
DayJSLocale["en-US"] = "en";
|
|
9
|
+
DayJSLocale["hy-AM"] = "hy-am";
|
|
10
|
+
DayJSLocale["ru-RU"] = "ru";
|
|
11
|
+
return DayJSLocale;
|
|
12
|
+
}({});
|
|
13
|
+
|
|
14
|
+
export { DayJSLocale, TranslationLocale };
|