diginet-core-ui 1.4.68 → 1.4.69-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -652,7 +652,7 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
652
652
  color: 'primary',
653
653
  type: 'h3',
654
654
  ref: refs.content,
655
- format: ['lowercase']
655
+ format: ['sentence']
656
656
  }))), jsx("div", {
657
657
  className: className.navigator.around
658
658
  }, jsx(ButtonIcon, {
@@ -226,7 +226,7 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
226
226
  * START EFFECT
227
227
  */
228
228
  useEffect(() => {
229
- if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)) {
229
+ if (defaultValue && defaultValue !== '' && isValidDate(defaultValue) && !value) {
230
230
  if (isBeforeLimit(min, defaultValue)) {
231
231
  onUpdate(min);
232
232
  } else if (isAfterLimit(max, defaultValue)) {
@@ -14,6 +14,7 @@ import { capitalizeSentenceCase, classNames, isValidDate, useControlled } from "
14
14
  import Calendar from "../calendar";
15
15
  import { lowerCaseDayYear } from "../date-input/utils";
16
16
  import { parseDateString } from "../../../utils/getLang";
17
+ import { detectDateFormat } from "../../../utils/type";
17
18
  const unique = {
18
19
  footer: 'DGN-UI-DatePicker-Footer',
19
20
  cancel: 'DGN-UI-DatePicker-cancel',
@@ -141,8 +142,15 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
141
142
  // return moment(value).format(format, utc = false);
142
143
  return parseDateString(value, lowerCaseDayYear(formatStr), dateLocale);
143
144
  };
144
- const onChangeValue = e => {
145
- const vl = (e === null || e === void 0 ? void 0 : e.value) || e;
145
+ const onChangeValue = (e, type) => {
146
+ let vl = (e === null || e === void 0 ? void 0 : e.value) || e;
147
+ if (type === 'input') {
148
+ const dateval = new Date(vl);
149
+ const datemax = new Date(max);
150
+ const datemin = new Date(min);
151
+ if (dateval < datemin) vl = datemin;
152
+ if (dateval > datemax) vl = datemax;
153
+ }
146
154
  closePicker();
147
155
  setValue(vl);
148
156
  if (timer.current) clearTimeout(timer.current);
@@ -230,7 +238,11 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
230
238
  return value;
231
239
  } else if (value === null) {
232
240
  return null;
233
- } else return parse(value, lowerCaseDayYear(returnFormat), new Date());
241
+ } else {
242
+ let formatType = returnFormat;
243
+ if (detectDateFormat(value) !== returnFormat) formatType = detectDateFormat(value);
244
+ return parse(value, lowerCaseDayYear(formatType), new Date());
245
+ }
234
246
  }, [value]);
235
247
  return jsx(Fragment, null, jsx("div", {
236
248
  ref: ref,
@@ -254,7 +266,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
254
266
  format: displayFormat,
255
267
  value: valueDateInput,
256
268
  onBlur: _onBlur,
257
- onChange: onChangeValue
269
+ onChange: e => onChangeValue(e, 'input')
258
270
  }) : jsx(InputBase, {
259
271
  inputProps: {
260
272
  placeholder: !readOnly && !disabled ? placeholder : '',
@@ -110,7 +110,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
110
110
  total,
111
111
  treeViewID,
112
112
  treeViewParentID,
113
- value: valueProp = '',
113
+ value: valueProp,
114
114
  valueExpr,
115
115
  valueObjectDefault,
116
116
  viewType,
@@ -1,13 +1,15 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
4
+ import { ButtonIcon, InputBase, Label, Popover, PopoverBody, HelperText } from "../..";
5
5
  import PropTypes from 'prop-types';
6
- import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
6
+ import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useMemo } from 'react';
7
7
  import { animation, borderColor, displayBlock, overflowHidden, parseHeight, parseMinWidth, positionRelative, scaleX } from "../../../styles/general";
8
8
  import { useTheme } from "../../../theme";
9
9
  import useThemeProps from "../../../theme/utils/useThemeProps";
10
10
  import { classNames, getProp } from "../../../utils";
11
+ const regexBetween = /[^{}]+(?=})/g;
12
+ const regexInclude = /{|}/g;
11
13
  const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
12
14
  if (!reference) reference = useRef(null);
13
15
  const theme = useTheme();
@@ -22,10 +24,14 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
22
24
  });
23
25
  const {
24
26
  action = {},
27
+ allowInput,
25
28
  bgColor: bgColorProp,
26
29
  children,
27
30
  className,
28
31
  delayOnInput,
32
+ disabled,
33
+ displayExpr: displayExprProp,
34
+ error,
29
35
  endIcon,
30
36
  inputProps,
31
37
  inputRef,
@@ -39,10 +45,19 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
39
45
  placeholder,
40
46
  startIcon,
41
47
  style,
42
- value,
43
- viewType
48
+ value: valueProps,
49
+ valueExpr,
50
+ viewType,
51
+ helperTextProps
44
52
  } = props;
53
+ let displayExpr = displayExprProp;
45
54
  const bgColor = typeof bgColorProp === 'string' ? getProp(colors, bgColorProp, bgColorProp) : bgColorProp;
55
+ const ErrorView = useMemo(() => {
56
+ return error ? jsx(HelperText, {
57
+ ...helperTextProps,
58
+ disabled: disabled
59
+ }, error) : null;
60
+ }, [disabled, error, helperTextProps]);
46
61
  const ref = useRef(null);
47
62
  const dropdownBoxRef = useRef(null);
48
63
  const timer = useRef(null);
@@ -85,6 +100,28 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
85
100
  onClosed === null || onClosed === void 0 ? void 0 : onClosed();
86
101
  }
87
102
  };
103
+
104
+ /**
105
+ * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
106
+ * @param data {object} rowData of dataSource
107
+ * @return {string}
108
+ */
109
+ const displayValue = data => {
110
+ let text = '';
111
+ if (data || data === 0) {
112
+ displayExpr = displayExpr || valueExpr;
113
+ let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
114
+ // convert {id} - {name} to {<data[id]>} - {<data[name]>}
115
+ if (!mask && regexBetween.test(displayExpr)) {
116
+ var _displayExpr;
117
+ mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
118
+ } else if (!mask) {
119
+ mask = typeof data !== 'object' ? data : '';
120
+ }
121
+ text = mask.toString().replace(regexInclude, '');
122
+ }
123
+ return text;
124
+ };
88
125
  useLayoutEffect(() => {
89
126
  if (ref.current) {
90
127
  const {
@@ -130,15 +167,17 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
130
167
  onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
131
168
  }) : null;
132
169
  };
170
+ const value = displayValue(valueProps);
133
171
  return jsx(Fragment, null, jsx("div", {
134
172
  ref: ref,
135
173
  css: _DropdownBoxRootCSS,
136
- className: classNames('DGN-UI-Dropdown-Box', className),
174
+ className: classNames('DGN-UI-Dropdown-Box', className, error && 'error'),
137
175
  style: style
138
176
  }, label ? jsx(Label, {
139
177
  ...labelProps
140
178
  }, label) : null, jsx(InputBase, {
141
179
  ...inputProps,
180
+ readOnly: !allowInput,
142
181
  style: inputStyle,
143
182
  viewType: viewType,
144
183
  inputRef: inputRef,
@@ -157,7 +196,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
157
196
  anchor: ref.current,
158
197
  width: popoverWidth,
159
198
  onClose: closeDropdownBox
160
- }, jsx(PopoverBody, null, children)));
199
+ }, jsx(PopoverBody, null, children)), ErrorView);
161
200
  }));
162
201
  const DropdownBoxRootCSS = (bgColorProp, {
163
202
  colors
@@ -166,6 +205,17 @@ const DropdownBoxRootCSS = (bgColorProp, {
166
205
  ${positionRelative};
167
206
  ${parseMinWidth(150)};
168
207
  ${parseHeight('max-content')};
208
+ &.error {
209
+ .DGN-UI-InputBase {
210
+ ${borderColor(getProp(colors, 'semantic/danger'))};
211
+ &::before {
212
+ ${borderColor(getProp(colors, 'semantic/danger'))};
213
+ }
214
+ &::after {
215
+ ${borderColor(getProp(colors, 'semantic/danger'))};
216
+ }
217
+ }
218
+ }
169
219
  .DGN-UI-InputBase {
170
220
  background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
171
221
  ${openState && css`
@@ -183,20 +233,6 @@ const DropdownBoxCSS = ({
183
233
  margin-top: ${spacing([1])};
184
234
  ${overflowHidden};
185
235
  `;
186
-
187
- // DropdownBox.defaultProps = {
188
- // className: '',
189
- // label: '',
190
- // placeholder: '',
191
- // startIcon: 'Search',
192
- // endIcon: 'ArrowDown',
193
- // openOnClickAt: 'icon',
194
- // viewType: 'underlined',
195
- // inputProps: {},
196
- // delayOnInput: 700,
197
- // zIndex: zIndexCORE(1),
198
- // };
199
-
200
236
  DropdownBox.propTypes = {
201
237
  /** class for dropdown */
202
238
  className: PropTypes.string,
@@ -233,6 +269,12 @@ DropdownBox.propTypes = {
233
269
  /** the function will run after open */
234
270
  onOpened: PropTypes.func,
235
271
  /** the function will run after close */
236
- onClosed: PropTypes.func
272
+ onClosed: PropTypes.func,
273
+ /** Error message displayed below the input. */
274
+ error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
275
+ /** If `true`, the component is disabled. */
276
+ disabled: PropTypes.bool,
277
+ /** If `true`, the input is enable. */
278
+ allowInput: PropTypes.bool
237
279
  };
238
280
  export default DropdownBox;
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
49
49
  labelProps,
50
50
  max: maxProp,
51
51
  maxDigit,
52
- min,
52
+ min: minProp,
53
53
  nonStyle,
54
54
  onBlur,
55
55
  onChange,
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
69
69
  viewType
70
70
  } = props;
71
71
  let max = maxProp;
72
+ let min = minProp;
72
73
  let thousandSymbol = thousandSeparator;
73
74
  let decimalSymbol = decimalSymbolProp;
74
75
  let valueProps = valueProp;
76
+ if (!min && min !== 0) min = -Infinity;
77
+ if (!max && max !== 0) max = Infinity;
75
78
  const pos = useRef(null);
76
79
  const ref = useRef(null);
77
80
  const globalRef = useRef({});
@@ -317,13 +320,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
317
320
  const target = e.target;
318
321
  target.value = globalRef.current.valueString;
319
322
  target.valueString = globalRef.current.returnValue;
323
+ let value = globalRef.current.value;
320
324
  // eslint-disable-next-line no-extra-boolean-cast
321
- if (String(e.target.valueString).slice(-1) === decimalSymbol) {
322
- return;
323
- }
325
+ if (String(e.target.valueString).slice(-1) === decimalSymbol) return;else if (value > Number.MAX_SAFE_INTEGER) value = Number.MAX_SAFE_INTEGER;else if (value < Number.MIN_SAFE_INTEGER) value = Number.MIN_SAFE_INTEGER;
324
326
  onChange({
325
327
  ...e,
326
- value: globalRef.current.value,
328
+ value,
327
329
  target
328
330
  });
329
331
  };
@@ -201,7 +201,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
201
201
  determinateCheckbox(selectAllRef.current, false);
202
202
  }
203
203
  }
204
- selectAllRef.current.checked = true;
204
+ selectAllRef.current.checked = isCheckedAll;
205
205
  } else if (selectAllRef.current.checked) {
206
206
  selectAllRef.current.checked = false;
207
207
  }
@@ -729,7 +729,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
729
729
  }, [isChanged, isChecked]);
730
730
  useEffect(() => {
731
731
  if (selectAllRef.current) {
732
- checkedSelectAllCheckbox();
732
+ setTimeout(() => checkedSelectAllCheckbox());
733
733
  }
734
734
  if (ref.current.querySelector('.DGN-UI-Accordion-Details-Content')) {
735
735
  if (!ref.current.parentNode.classList.contains('expand-able')) {
@@ -806,7 +806,13 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
806
806
  viewType: 'outlined',
807
807
  ...searchProps
808
808
  }) : null, multiple && selectAll ? jsx(Fragment, null, jsx("div", {
809
- className: 'TreeView-All'
809
+ className: 'TreeView-All',
810
+ style: {
811
+ display: 'flex',
812
+ alignItems: 'center',
813
+ minHeight: '40px',
814
+ paddingLeft: '4px'
815
+ }
810
816
  }, jsx(Checkbox, {
811
817
  label: selectAllLabel,
812
818
  onChange: onSelectAll,
@@ -931,9 +937,6 @@ const TreeViewRootCSS = ({
931
937
  }
932
938
  }
933
939
  &.expand-able {
934
- .TreeView-All {
935
- margin-left: ${spacing([8.5])};
936
- }
937
940
  .TreeView-Item.non-child {
938
941
  padding-left: ${spacing([8.5])};
939
942
  }
package/icons/basic.js CHANGED
@@ -8064,6 +8064,34 @@ export const PaperCancel = /*#__PURE__*/memo(({
8064
8064
  fill: fillColor(color)
8065
8065
  }));
8066
8066
  });
8067
+ export const PercentDiscount = /*#__PURE__*/memo(({
8068
+ width,
8069
+ height,
8070
+ color = 'system/active',
8071
+ viewBox = false
8072
+ }) => {
8073
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
8074
+ width: width || 24,
8075
+ height: height || 24,
8076
+ viewBox: "0 0 24 24",
8077
+ fill: "none"
8078
+ }, /*#__PURE__*/React.createElement("path", {
8079
+ fillRule: "evenodd",
8080
+ clipRule: "evenodd",
8081
+ d: "M12 22C11.6 22 11.2167 21.925 10.85 21.775C10.4833 21.625 10.1583 21.4083 9.875 21.125C9.39167 20.6417 8.975 20.325 8.625 20.175C8.275 20.025 7.75 19.95 7.05 19.95C6.21667 19.95 5.50833 19.6583 4.925 19.075C4.34167 18.4917 4.05 17.7833 4.05 16.95C4.05 16.25 3.975 15.725 3.825 15.375C3.675 15.025 3.35833 14.6083 2.875 14.125C2.59167 13.8417 2.375 13.5167 2.225 13.15C2.075 12.7833 2 12.4 2 12C2 11.6 2.075 11.2167 2.225 10.85C2.375 10.4833 2.59167 10.1583 2.875 9.875C3.35833 9.39167 3.675 8.975 3.825 8.625C3.975 8.275 4.05 7.75 4.05 7.05C4.05 6.21667 4.34167 5.50833 4.925 4.925C5.50833 4.34167 6.21667 4.05 7.05 4.05C7.75 4.05 8.275 3.975 8.625 3.825C8.975 3.675 9.39167 3.35833 9.875 2.875C10.1583 2.59167 10.4833 2.375 10.85 2.225C11.2167 2.075 11.6 2 12 2C12.4 2 12.7833 2.075 13.15 2.225C13.5167 2.375 13.8417 2.59167 14.125 2.875C14.6083 3.35833 15.025 3.675 15.375 3.825C15.725 3.975 16.25 4.05 16.95 4.05C17.7833 4.05 18.4917 4.34167 19.075 4.925C19.6583 5.50833 19.95 6.21667 19.95 7.05C19.95 7.75 20.025 8.275 20.175 8.625C20.325 8.975 20.6417 9.39167 21.125 9.875C21.4083 10.1583 21.625 10.4833 21.775 10.85C21.925 11.2167 22 11.6 22 12C22 12.4 21.925 12.7833 21.775 13.15C21.625 13.5167 21.4083 13.8417 21.125 14.125C20.6417 14.6083 20.325 15.025 20.175 15.375C20.025 15.725 19.95 16.25 19.95 16.95C19.95 17.7833 19.6583 18.4917 19.075 19.075C18.4917 19.6583 17.7833 19.95 16.95 19.95C16.25 19.95 15.725 20.025 15.375 20.175C15.025 20.325 14.6083 20.6417 14.125 21.125C13.8417 21.4083 13.5167 21.625 13.15 21.775C12.7833 21.925 12.4 22 12 22ZM14.5 16C14.9167 16 15.2708 15.8542 15.5625 15.5625C15.8542 15.2708 16 14.9167 16 14.5C16 14.0833 15.8542 13.7292 15.5625 13.4375C15.2708 13.1458 14.9167 13 14.5 13C14.0833 13 13.7292 13.1458 13.4375 13.4375C13.1458 13.7292 13 14.0833 13 14.5C13 14.9167 13.1458 15.2708 13.4375 15.5625C13.7292 15.8542 14.0833 16 14.5 16ZM9.45 15.95L15.95 9.45L14.55 8.05L8.05 14.55L9.45 15.95ZM10.5625 10.5625C10.8542 10.2708 11 9.91667 11 9.5C11 9.08333 10.8542 8.72917 10.5625 8.4375C10.2708 8.14583 9.91667 8 9.5 8C9.08333 8 8.72917 8.14583 8.4375 8.4375C8.14583 8.72917 8 9.08333 8 9.5C8 9.91667 8.14583 10.2708 8.4375 10.5625C8.72917 10.8542 9.08333 11 9.5 11C9.91667 11 10.2708 10.8542 10.5625 10.5625Z",
8082
+ fill: fillColor(color)
8083
+ })) : /*#__PURE__*/React.createElement("svg", {
8084
+ width: width || 20,
8085
+ height: height || 20,
8086
+ viewBox: "0 0 20 20",
8087
+ fill: "none"
8088
+ }, /*#__PURE__*/React.createElement("path", {
8089
+ fillRule: "evenodd",
8090
+ clipRule: "evenodd",
8091
+ d: "M10 20C9.6 20 9.21667 19.925 8.85 19.775C8.48333 19.625 8.15833 19.4083 7.875 19.125C7.39167 18.6417 6.975 18.325 6.625 18.175C6.275 18.025 5.75 17.95 5.05 17.95C4.21667 17.95 3.50833 17.6583 2.925 17.075C2.34167 16.4917 2.05 15.7833 2.05 14.95C2.05 14.25 1.975 13.725 1.825 13.375C1.675 13.025 1.35833 12.6083 0.875 12.125C0.591667 11.8417 0.375 11.5167 0.225 11.15C0.075 10.7833 0 10.4 0 10C0 9.6 0.075 9.21667 0.225 8.85C0.375 8.48333 0.591667 8.15833 0.875 7.875C1.35833 7.39167 1.675 6.975 1.825 6.625C1.975 6.275 2.05 5.75 2.05 5.05C2.05 4.21667 2.34167 3.50833 2.925 2.925C3.50833 2.34167 4.21667 2.05 5.05 2.05C5.75 2.05 6.275 1.975 6.625 1.825C6.975 1.675 7.39167 1.35833 7.875 0.875C8.15833 0.591667 8.48333 0.375 8.85 0.225C9.21667 0.075 9.6 0 10 0C10.4 0 10.7833 0.075 11.15 0.225C11.5167 0.375 11.8417 0.591667 12.125 0.875C12.6083 1.35833 13.025 1.675 13.375 1.825C13.725 1.975 14.25 2.05 14.95 2.05C15.7833 2.05 16.4917 2.34167 17.075 2.925C17.6583 3.50833 17.95 4.21667 17.95 5.05C17.95 5.75 18.025 6.275 18.175 6.625C18.325 6.975 18.6417 7.39167 19.125 7.875C19.4083 8.15833 19.625 8.48333 19.775 8.85C19.925 9.21667 20 9.6 20 10C20 10.4 19.925 10.7833 19.775 11.15C19.625 11.5167 19.4083 11.8417 19.125 12.125C18.6417 12.6083 18.325 13.025 18.175 13.375C18.025 13.725 17.95 14.25 17.95 14.95C17.95 15.7833 17.6583 16.4917 17.075 17.075C16.4917 17.6583 15.7833 17.95 14.95 17.95C14.25 17.95 13.725 18.025 13.375 18.175C13.025 18.325 12.6083 18.6417 12.125 19.125C11.8417 19.4083 11.5167 19.625 11.15 19.775C10.7833 19.925 10.4 20 10 20ZM12.5 14C12.9167 14 13.2708 13.8542 13.5625 13.5625C13.8542 13.2708 14 12.9167 14 12.5C14 12.0833 13.8542 11.7292 13.5625 11.4375C13.2708 11.1458 12.9167 11 12.5 11C12.0833 11 11.7292 11.1458 11.4375 11.4375C11.1458 11.7292 11 12.0833 11 12.5C11 12.9167 11.1458 13.2708 11.4375 13.5625C11.7292 13.8542 12.0833 14 12.5 14ZM7.45 13.95L13.95 7.45L12.55 6.05L6.05 12.55L7.45 13.95ZM8.5625 8.5625C8.85417 8.27083 9 7.91667 9 7.5C9 7.08333 8.85417 6.72917 8.5625 6.4375C8.27083 6.14583 7.91667 6 7.5 6C7.08333 6 6.72917 6.14583 6.4375 6.4375C6.14583 6.72917 6 7.08333 6 7.5C6 7.91667 6.14583 8.27083 6.4375 8.5625C6.72917 8.85417 7.08333 9 7.5 9C7.91667 9 8.27083 8.85417 8.5625 8.5625Z",
8092
+ fill: fillColor(color)
8093
+ }));
8094
+ });
8067
8095
  export const SaveFilled = /*#__PURE__*/memo(({
8068
8096
  width = 24,
8069
8097
  height = 25,
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.68",
4
- "description": "The DigiNet core ui",
5
- "homepage": "https://diginet.com.vn",
6
- "main": "index.js",
7
- "scripts": {
8
- "start-js": "react-scripts start --max_old_space_size=4096",
9
- "start": "npx npm-run-all -p start-js",
10
- "build": "GENERATE_SOURCEMAP=false && react-scripts build --env=production --max_old_space_size=8192",
11
- "eject": "react-scripts eject",
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "dependencies": {
15
- "@emotion/core": "^10.0.35",
16
- "prop-types": "^15.7.2",
17
- "@emotion/css": "^11.11.0",
18
- "@emotion/react": "^11.10.6"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
23
- },
24
- "keywords": [
25
- "core ui",
26
- "diginet"
27
- ],
28
- "author": "rocachien",
29
- "contributors": [
30
- {
31
- "name": "Chien Do",
32
- "email": "rocachien@gmail.com"
33
- },
34
- {
35
- "name": "Nhat Tran",
36
- "email": "tranminhnhat1005@gmail.com"
37
- },
38
- {
39
- "name": "Thuan Nguyen",
40
- "email": "nt.thuan.hutech@gmail.com"
41
- }
42
- ],
43
- "license": "MIT"
44
- }
1
+ {
2
+ "name": "diginet-core-ui",
3
+ "version": "1.4.69-beta.2",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "license": "UNLICENSED",
7
+ "scripts": {
8
+ "start": "npm-run-all --parallel start-sb eslint-test",
9
+ "start-sb": "start-storybook -p 9050",
10
+ "build-storybook": "build-storybook -c .storybook -s src",
11
+ "build": "run-script-os",
12
+ "build:windows": "rimraf dist && mkdirp dist/components && npm run compile && sass --style=compressed src/scss:dist/css && xcopy src\\\\assets dist\\\\assets\\ /e /y",
13
+ "build:darwin:linux:default": "rm -rf dist && npm run compile && sass --style=compressed src/scss:dist/css && cp -rf src/assets dist/assets",
14
+ "compile": "babel src --out-dir dist --ignore **/*.stories.js",
15
+ "pack": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm pack",
16
+ "production-keep-version": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish",
17
+ "beta": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish --tag beta",
18
+ "production": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm publish",
19
+ "version:add": "run-script-os",
20
+ "version:add:windows": "cat package.json.tmp | sed \"s/0.0.0/%npm_package_version%/g\" > dist/package.json",
21
+ "version:add:darwin:linux:default": "VERSION=$(npm run version:extract --silent) && cat package.json.tmp | sed \"s/0.0.0/${VERSION}/g\" > dist/package.json",
22
+ "version:bump": "npm version patch --no-git-tag-version --silent",
23
+ "version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'",
24
+ "test": "echo \"Error: no test specified\" && exit 1",
25
+ "lint": "eslint --fix --config .eslintrc.js \"**/*.js\"",
26
+ "eslint-test": "onchange \"src/**/*.{js,jsx,json}\" -- eslint . --fix",
27
+ "freshtall": "npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install",
28
+ "test-storybook": "test-storybook --url http://localhost:9050",
29
+ "preinstall": "echo {} > package-lock.json"
30
+ },
31
+ "dependencies": {
32
+ "@emotion/core": "^10.0.35",
33
+ "@emotion/css": "^11.11.0",
34
+ "@emotion/react": "^11.10.6",
35
+ "babel-plugin-module-resolver": "^4.1.0",
36
+ "date-fns": "^2.30.0",
37
+ "prop-types": "^15.7.2"
38
+ },
39
+ "lint-staged": {
40
+ "*/**/*.{js,jsx,json}": [
41
+ "prettier --write",
42
+ "git add"
43
+ ]
44
+ },
45
+ "devDependencies": {
46
+ "@babel/cli": "^7.14.3",
47
+ "@babel/plugin-proposal-class-properties": "^7.13.0",
48
+ "@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
49
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
50
+ "@babel/plugin-proposal-optional-chaining": "^7.14.2",
51
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
52
+ "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
53
+ "@babel/preset-react": "^7.13.13",
54
+ "@storybook/addon-actions": "6.2.9",
55
+ "@storybook/addon-essentials": "6.2.9",
56
+ "@storybook/addon-links": "6.2.9",
57
+ "@storybook/addon-postcss": "^2.0.0",
58
+ "@storybook/react": "6.2.9",
59
+ "@storybook/test-runner": "^0.7.1",
60
+ "autoprefixer": "^10.3.1",
61
+ "babel-loader": "^8.2.2",
62
+ "eslint": "^8.4.1",
63
+ "eslint-plugin-react": "^7.27.1",
64
+ "eslint-plugin-regex": "^1.10.0",
65
+ "husky": "^7.0.4",
66
+ "jest": "^27.5.1",
67
+ "lint-staged": "^12.1.2",
68
+ "mkdirp": "^1.0.4",
69
+ "npm-run-all": "^4.1.5",
70
+ "onchange": "^7.1.0",
71
+ "postcss-flexbugs-fixes": "^5.0.2",
72
+ "react": "^17.0.1",
73
+ "react-dom": "^17.0.1",
74
+ "rimraf": "^3.0.2",
75
+ "run-script-os": "^1.1.6",
76
+ "sass": "1.58.3"
77
+ }
78
+ }
package/readme.md CHANGED
@@ -41,6 +41,17 @@ npm test
41
41
  ```
42
42
 
43
43
  ## Changelog
44
+
45
+ ## 1.4.69
46
+ - \[Fixed\]: DatePicker - Fix allow manual input in DatePicker (Fix "Invalid Date" for default value when typing + Add delayOnChange prop)
47
+ - \[Fixed\]: NumberInput - Fix NumberInput value issue when input exceeds JavaScript numeric limits
48
+ - \[Fixed\]: TreeView - Fix "Check All" display issue in TreeView Core
49
+
50
+ ## 1.4.68
51
+ - \[Added\]: Icon – Add Icon PersonEdit
52
+ - \[Fixed\]: TreeView - Fix unchecked values are restored unexpectedly
53
+ - \[Fixed\]: Dropdown - Fix Displays incorrect selected value
54
+
44
55
  ## 1.4.67
45
56
  - \[Added\]: ButtonIcon – Add the title prop to ButtonIcon to display the text as a tooltip on hover.
46
57
  - \[Added\]: Icon – Add IconMenu MHRP75N0025
package/utils/type.js CHANGED
@@ -94,4 +94,10 @@ const isDeferred = object => {
94
94
  const isEvent = object => {
95
95
  return !!(object && object.preventDefault);
96
96
  };
97
- export { isBoolean, isExponential, isDate, isDefined, isFunction, isString, isNumeric, isObject, isEmptyObject, isPlainObject, isPrimitive, isWindow, isRenderer, isPromise, isDeferred, type, isEvent, isEmpty, typeOf };
97
+ const detectDateFormat = dateStr => {
98
+ if (!dateStr || typeof dateStr !== 'string') return null;
99
+ if (/^\d{2}\/\d{2}\/\d{4}$/.test(dateStr)) return 'DD/MM/YYYY';
100
+ if (/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) return 'YYYY-MM-DD';
101
+ return null;
102
+ };
103
+ export { isBoolean, isExponential, isDate, isDefined, isFunction, isString, isNumeric, isObject, isEmptyObject, isPlainObject, isPrimitive, isWindow, isRenderer, isPromise, isDeferred, type, isEvent, isEmpty, typeOf, detectDateFormat };