diginet-core-ui 1.3.80-beta.2 → 1.3.80-beta.3

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.
@@ -76,7 +76,7 @@ const isAfter = (max, time) => {
76
76
  const parseDate = day => {
77
77
  return Date.parse(new Date(day));
78
78
  };
79
- const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
79
+ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
80
80
  action = {},
81
81
  actionIconAt,
82
82
  clearAble,
@@ -185,7 +185,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
185
185
  return '';
186
186
  };
187
187
  const countDay = v => {
188
- if (v && Array.isArray(v) && v.length === 2) {
188
+ if ((v === null || v === void 0 ? void 0 : v.length) === 2) {
189
189
  return Number(+moment(v[1]).diff(v[0]) + (startFromZero ? 0 : 1));
190
190
  }
191
191
  return Number(startFromZero ? 0 : 1);
@@ -273,7 +273,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
273
273
  tableData.push(jsx("td", {
274
274
  key: `this_month-${i + 1}`,
275
275
  "data-time": Date.parse(day),
276
- className: classNames(unique.table.data, 'this_month', isToday(day), isActive(day), (max && max !== undefined || min && min !== undefined) && isLimit(day, new Date(max).setHours(0, 0, 0, 0), new Date(min).setHours(0, 0, 0, 0)), isBetween(Date.parse(day))),
276
+ className: classNames(unique.table.data, 'this_month', isToday(day), isActive(day), (max || min) && isLimit(day, new Date(max).setHours(0, 0, 0, 0), new Date(min).setHours(0, 0, 0, 0)), isBetween(Date.parse(day))),
277
277
  onClick: onDayClick
278
278
  }, jsx(Typography, {
279
279
  className: unique.day.day,
@@ -421,7 +421,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
421
421
  };
422
422
  const setPrevTime = (e, level, time, type) => {
423
423
  if (!valueFr.current || !time) return;
424
- const firstDayOfMin = min && min !== null && new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
424
+ const firstDayOfMin = min && new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
425
425
  const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
426
426
  if (level === 'month') {
427
427
  if (firstDayOfMin) {
@@ -461,7 +461,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
461
461
  };
462
462
  const setNextTime = (e, level, time, type) => {
463
463
  if (!valueTo.current || !time) return;
464
- const firstDayOfMax = max && max !== null && new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
464
+ const firstDayOfMax = max && new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
465
465
  const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
466
466
  if (level === 'month') {
467
467
  if (firstDayOfMax) {
@@ -780,8 +780,8 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
780
780
  };
781
781
  }, [onChange]);
782
782
  useEffect(() => {
783
- if (min && min !== null) {
784
- let arr = new Array();
783
+ if (min) {
784
+ let arr = [];
785
785
  const newMin = new Date(min).setHours(0, 0, 0, 0);
786
786
  if (isBefore(newMin, values.current[0])) {
787
787
  arr.push(newMin);
@@ -793,7 +793,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
793
793
  update(arr);
794
794
  }
795
795
  }
796
- if (max && max !== null) {
796
+ if (max) {
797
797
  let arr = [];
798
798
  const newMax = max && new Date(max).setHours(0, 0, 0, 0);
799
799
  if (isAfter(newMax, values.current[1])) {
@@ -853,7 +853,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
853
853
  currentRef.instance = _instance;
854
854
  return currentRef;
855
855
  });
856
- const iconComp = isEnable && jsx("div", {
856
+ const iconComp = isEnable ? jsx("div", {
857
857
  css: IconAreaCSS,
858
858
  ref: iconRef
859
859
  }, jsx(ButtonIcon, {
@@ -868,7 +868,7 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
868
868
  className: `${unique.icon} ${unique.icon}-cancel`,
869
869
  viewBox: true,
870
870
  name: 'Close'
871
- }));
871
+ })) : null;
872
872
  const endIcon = actionIconAt === 'end' && iconComp;
873
873
  const startIcon = actionIconAt === 'start' && iconComp;
874
874
  const footerMemo = jsx("div", {
@@ -927,18 +927,18 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
927
927
  height: '226px',
928
928
  margin: spacing([4.5, 0.5, 0])
929
929
  }
930
- }), rightCalendarComp), tooltipComp, !!controls && footerMemo);
930
+ }), rightCalendarComp), tooltipComp, controls ? footerMemo : null);
931
931
  return jsx(ControlComp, {
932
932
  ...props,
933
933
  disabled: disabled,
934
934
  error: error,
935
935
  ref: ref,
936
936
  style: style
937
- }, !!label && jsx(Label, {
937
+ }, label ? jsx(Label, {
938
938
  ...labelProps,
939
939
  disabled: disabled,
940
940
  required: required
941
- }, label), jsx(InputBase, {
941
+ }, label) : null, jsx(InputBase, {
942
942
  inputProps: {
943
943
  placeholder: !readOnly && !disabled ? placeholder : '',
944
944
  ...inputProps
@@ -958,49 +958,49 @@ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
958
958
  className: 'non-effect allow-disabled'
959
959
  },
960
960
  endIcon: endIcon
961
- }), !!error && jsx(HelperText, {
961
+ }), error ? jsx(HelperText, {
962
962
  ...helperTextProps,
963
963
  disabled: disabled
964
- }, error));
964
+ }, error) : null);
965
965
  }));
966
966
  const unique = {
967
967
  backGr: 'DGN-UI-Portal',
968
- close: 'DGN-UI-DateRangePickerV2-close',
969
- cancel: 'DGN-UI-DateRangePickerV2-cancel',
970
- confirm: 'DGN-UI-DateRangePickerV2-confirm',
971
- divider: 'DGN-UI-DateRangePickerV2-Divider',
972
- disabled: 'DGN-UI-DateRangePickerV2-disabled',
973
- error: 'DGN-UI-DateRangePickerV2-error',
974
- focus: 'DGN-UI-DateRangePickerV2-focus',
975
- footer: 'DGN-UI-DateRangePickerV2-Footer',
976
- picker: 'DGN-UI-DateRangePickerV2-Picker-' + randomString(6, {
968
+ close: 'DGN-UI-DateRangePicker-close',
969
+ cancel: 'DGN-UI-DateRangePicker-cancel',
970
+ confirm: 'DGN-UI-DateRangePicker-confirm',
971
+ divider: 'DGN-UI-DateRangePicker-Divider',
972
+ disabled: 'DGN-UI-DateRangePicker-disabled',
973
+ error: 'DGN-UI-DateRangePicker-error',
974
+ focus: 'DGN-UI-DateRangePicker-focus',
975
+ footer: 'DGN-UI-DateRangePicker-Footer',
976
+ picker: 'DGN-UI-DateRangePicker-Picker-' + randomString(6, {
977
977
  allowSymbol: false
978
978
  }),
979
- wrapper: 'DGN-UI-DateRangePickerV2-Wrapper',
980
- container: 'DGN-UI-DateRangePickerV2',
981
- icon: 'DGN-UI-DateRangePickerV2-Icon',
982
- tooltip: 'DGN-UI-DateRangePickerV2-Tooltip',
979
+ wrapper: 'DGN-UI-DateRangePicker-Wrapper',
980
+ container: 'DGN-UI-DateRangePicker',
981
+ icon: 'DGN-UI-DateRangePicker-Icon',
982
+ tooltip: 'DGN-UI-DateRangePicker-Tooltip',
983
983
  navigator: {
984
- navigator: 'DGN-UI-DateRangePickerV2-Navigator',
985
- around: 'DGN-UI-DateRangePickerV2-Navigator-Around',
986
- center: 'DGN-UI-DateRangePickerV2-Navigator-Center'
984
+ navigator: 'DGN-UI-DateRangePicker-Navigator',
985
+ around: 'DGN-UI-DateRangePicker-Navigator-Around',
986
+ center: 'DGN-UI-DateRangePicker-Navigator-Center'
987
987
  },
988
988
  table: {
989
- container: 'DGN-UI-DateRangePickerV2-Table-Container',
990
- table: 'DGN-UI-DateRangePickerV2-Table-Table',
991
- header: 'DGN-UI-DateRangePickerV2-Table-Header',
992
- raw: 'DGN-UI-DateRangePickerV2-Table-Raw',
993
- data: 'DGN-UI-DateRangePickerV2-Table-Data'
989
+ container: 'DGN-UI-DateRangePicker-Table-Container',
990
+ table: 'DGN-UI-DateRangePicker-Table-Table',
991
+ header: 'DGN-UI-DateRangePicker-Table-Header',
992
+ raw: 'DGN-UI-DateRangePicker-Table-Raw',
993
+ data: 'DGN-UI-DateRangePicker-Table-Data'
994
994
  },
995
995
  day: {
996
- day: 'DGN-UI-DateRangePickerV2-Day',
997
- week: 'DGN-UI-DateRangePickerV2-Week',
998
- today: 'DGN-UI-DateRangePickerV2-Day-today',
999
- active: 'DGN-UI-DateRangePickerV2-Day-active',
1000
- limit: 'DGN-UI-DateRangePickerV2-Day-limit',
1001
- from: 'DGN-UI-DateRangePickerV2-Day-from',
1002
- to: 'DGN-UI-DateRangePickerV2-Day-to',
1003
- between: 'DGN-UI-DateRangePickerV2-Day-between'
996
+ day: 'DGN-UI-DateRangePicker-Day',
997
+ week: 'DGN-UI-DateRangePicker-Week',
998
+ today: 'DGN-UI-DateRangePicker-Day-today',
999
+ active: 'DGN-UI-DateRangePicker-Day-active',
1000
+ limit: 'DGN-UI-DateRangePicker-Day-limit',
1001
+ from: 'DGN-UI-DateRangePicker-Day-from',
1002
+ to: 'DGN-UI-DateRangePicker-Day-to',
1003
+ between: 'DGN-UI-DateRangePicker-Day-between'
1004
1004
  }
1005
1005
  };
1006
1006
  const hiddenStyle = {
@@ -1078,10 +1078,10 @@ const pickerCSS = {
1078
1078
  z-index: ${zIndexCORE(3)};
1079
1079
  }
1080
1080
  @media only screen and (max-width: 599px) {
1081
- max-width: 400px;
1081
+ ${parseMaxWidth(400)};
1082
1082
  .${unique.wrapper} {
1083
1083
  flex-direction: column;
1084
- min-width: 260px;
1084
+ ${parseMinWidth(260)};
1085
1085
  }
1086
1086
  .${unique.divider} {
1087
1087
  height: 1px !important;
@@ -1096,9 +1096,9 @@ const pickerCSS = {
1096
1096
  ${parseWidthHeight(width, 'max-content')};
1097
1097
  ${parseMinWidth(window.innerWidth <= 633 ? 300 : 633)};
1098
1098
  ${parseMaxWidth(805)};
1099
+ top: ${position.top}px;
1099
1100
  left: ${position.left}px;
1100
1101
  opacity: 0;
1101
- top: ${position.top}px;
1102
1102
  transform: scale(0);
1103
1103
  transform-origin: ${position.transformOrigin};
1104
1104
  transition: opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
@@ -1114,7 +1114,7 @@ const pickerCSS = {
1114
1114
  transform: 'scale(0)'
1115
1115
  }
1116
1116
  };
1117
- DateRangePickerV2.defaultProps = {
1117
+ DateRangePicker.defaultProps = {
1118
1118
  actionIconAt: 'end',
1119
1119
  clearAble: false,
1120
1120
  controls: false,
@@ -1131,7 +1131,7 @@ DateRangePickerV2.defaultProps = {
1131
1131
  unitCount: 'day',
1132
1132
  viewType: 'underlined'
1133
1133
  };
1134
- DateRangePickerV2.propTypes = {
1134
+ DateRangePicker.propTypes = {
1135
1135
  /** Position of action icons. */
1136
1136
  actionIconAt: PropTypes.oneOf(['end', 'start']),
1137
1137
  /** If `true`, display the clear icon. */
@@ -1187,4 +1187,4 @@ DateRangePickerV2.propTypes = {
1187
1187
  /** The variant to use. */
1188
1188
  viewType: PropTypes.oneOf(['outlined', 'underlined'])
1189
1189
  };
1190
- export default DateRangePickerV2;
1190
+ export default DateRangePicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.80-beta.2",
3
+ "version": "1.3.80-beta.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",