diginet-core-ui 1.4.67 → 1.4.68-beta.1

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',
@@ -230,7 +231,11 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
230
231
  return value;
231
232
  } else if (value === null) {
232
233
  return null;
233
- } else return parse(value, lowerCaseDayYear(returnFormat), new Date());
234
+ } else {
235
+ let formatType = returnFormat;
236
+ if (detectDateFormat(value) !== returnFormat) formatType = detectDateFormat(value);
237
+ return parse(value, lowerCaseDayYear(formatType), new Date());
238
+ }
234
239
  }, [value]);
235
240
  return jsx(Fragment, null, jsx("div", {
236
241
  ref: ref,
@@ -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({});
@@ -95,13 +98,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
95
98
 
96
99
  // if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
97
100
 
98
- /**
99
- * Convert number to format money
100
- * @param vl {number} - value
101
- * @type {function}
102
- * @return {string}
103
- * @example 1200300.123 => 1,200,300.123
104
- * @example 1200300,123 => 1.200.300,123
101
+ /**
102
+ * Convert number to format money
103
+ * @param vl {number} - value
104
+ * @type {function}
105
+ * @return {string}
106
+ * @example 1200300.123 => 1,200,300.123
107
+ * @example 1200300,123 => 1.200.300,123
105
108
  */
106
109
  const parseNumberToMoney = useCallback((vl, isNumber) => {
107
110
  var _number, _number2, _number$, _number3;
@@ -149,13 +152,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
149
152
  return number;
150
153
  }, [decimalSymbol, max, value, decimalDigit, fixedDecimalDigit]);
151
154
 
152
- /**
153
- * Convert money to format number
154
- * @param vl {string} - value
155
- * @type {function}
156
- * @return {number}
157
- * @example 1,200,300.123 => 1200300.123
158
- * @example 1.200.300,123 => 1200300.123
155
+ /**
156
+ * Convert money to format number
157
+ * @param vl {string} - value
158
+ * @type {function}
159
+ * @return {number}
160
+ * @example 1,200,300.123 => 1200300.123
161
+ * @example 1.200.300,123 => 1200300.123
159
162
  */
160
163
  const convertMoneyToNumber = useCallback((vl, isNumber) => {
161
164
  var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
@@ -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
  };
@@ -515,10 +517,10 @@ NumberInput.propTypes = {
515
517
  style: PropTypes.object,
516
518
  /** Thousand separator character. */
517
519
  thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
518
- /** Validation value, argument can:<br/>
519
- * * string: the validation rule. Example required.<br/>
520
- * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
521
- * * array: the validation rule list, insist object/string
520
+ /** Validation value, argument can:<br/>
521
+ * * string: the validation rule. Example required.<br/>
522
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
523
+ * * array: the validation rule list, insist object/string
522
524
  */
523
525
  validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
524
526
  /** The value of the input element, required for a controlled component. */
@@ -97,21 +97,19 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
97
97
  const checkedParentFollowValue = nodes => {
98
98
  if (nodes && nodes !== null && nodes !== void 0 && nodes.length) {
99
99
  nodes.forEach(node => {
100
+ const checkedLeastOfOne = Array.from(node.querySelectorAll('input')).slice(1).some(el => el.checked);
101
+ const checkedAll = Array.from(node.querySelectorAll('input')).slice(1).every(el => el.checked);
100
102
  if (!node.classList.contains('non-child')) {
101
103
  const input = node.firstChild.querySelector('input');
102
104
  if (input.checked) {
103
- if (!input.classList.contains('determinate')) {
105
+ if (checkedAll) {
104
106
  determinateCheckbox(input, true);
107
+ } else if (checkedLeastOfOne) {
108
+ determinateCheckbox(input, false);
105
109
  }
106
- Array.from(node.querySelectorAll('input')).forEach(el => {
107
- el.checked = true;
108
- if (!el.classList.contains('determinate')) {
109
- determinateCheckbox(el, true);
110
- }
111
- });
110
+ checkedParentFollowValue(Array.from(node.querySelectorAll('div.TreeView-Item non-child, div.DGN-UI-Accordion')));
112
111
  } else {
113
112
  var _node$lastChild, _node$lastChild$first;
114
- const checkedLeastOfOne = Array.from(node.querySelectorAll('input')).some(el => el.checked);
115
113
  if (checkedLeastOfOne) {
116
114
  input.checked = checkedLeastOfOne;
117
115
  if (input.classList.contains('determinate')) {
@@ -203,7 +201,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
203
201
  determinateCheckbox(selectAllRef.current, false);
204
202
  }
205
203
  }
206
- selectAllRef.current.checked = true;
204
+ selectAllRef.current.checked = isCheckedAll;
207
205
  } else if (selectAllRef.current.checked) {
208
206
  selectAllRef.current.checked = false;
209
207
  }
@@ -731,7 +729,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
731
729
  }, [isChanged, isChecked]);
732
730
  useEffect(() => {
733
731
  if (selectAllRef.current) {
734
- checkedSelectAllCheckbox();
732
+ setTimeout(() => checkedSelectAllCheckbox());
735
733
  }
736
734
  if (ref.current.querySelector('.DGN-UI-Accordion-Details-Content')) {
737
735
  if (!ref.current.parentNode.classList.contains('expand-able')) {
@@ -808,7 +806,13 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
808
806
  viewType: 'outlined',
809
807
  ...searchProps
810
808
  }) : null, multiple && selectAll ? jsx(Fragment, null, jsx("div", {
811
- className: 'TreeView-All'
809
+ className: 'TreeView-All',
810
+ style: {
811
+ display: 'flex',
812
+ alignItems: 'center',
813
+ minHeight: '40px',
814
+ paddingLeft: '4px'
815
+ }
812
816
  }, jsx(Checkbox, {
813
817
  label: selectAllLabel,
814
818
  onChange: onSelectAll,
@@ -933,9 +937,6 @@ const TreeViewRootCSS = ({
933
937
  }
934
938
  }
935
939
  &.expand-able {
936
- .TreeView-All {
937
- margin-left: ${spacing([8.5])};
938
- }
939
940
  .TreeView-Item.non-child {
940
941
  padding-left: ${spacing([8.5])};
941
942
  }
package/icons/basic.js CHANGED
@@ -5296,6 +5296,34 @@ export const PersonArrowRight = /*#__PURE__*/memo(({
5296
5296
  fill: fillColor(color)
5297
5297
  }));
5298
5298
  });
5299
+ export const PersonEdit = /*#__PURE__*/memo(({
5300
+ width,
5301
+ height,
5302
+ color = 'system/rest',
5303
+ viewBox = false
5304
+ }) => {
5305
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
5306
+ width: width || 24,
5307
+ height: height || 24,
5308
+ viewBox: "0 0 24 24",
5309
+ fill: "none"
5310
+ }, /*#__PURE__*/React.createElement("path", {
5311
+ fillRule: "evenodd",
5312
+ clipRule: "evenodd",
5313
+ d: "M14 21V17.925L19.525 12.425C19.675 12.275 19.8417 12.1667 20.025 12.1C20.2083 12.0333 20.3917 12 20.575 12C20.775 12 20.9667 12.0375 21.15 12.1125C21.3333 12.1875 21.5 12.3 21.65 12.45L22.575 13.375C22.7083 13.525 22.8125 13.6917 22.8875 13.875C22.9625 14.0583 23 14.2417 23 14.425C23 14.6083 22.9667 14.7958 22.9 14.9875C22.8333 15.1792 22.725 15.35 22.575 15.5L17.075 21H14ZM4 20V17.2C4 16.6333 4.14583 16.1125 4.4375 15.6375C4.72917 15.1625 5.11667 14.8 5.6 14.55C6.63333 14.0333 7.68333 13.6458 8.75 13.3875C9.81667 13.1292 10.9 13 12 13C12.6167 13 13.225 13.0375 13.825 13.1125C14.425 13.1875 15.025 13.3083 15.625 13.475L12 17.1V20H4ZM20.575 15.4L21.5 14.425L20.575 13.5L19.625 14.45L20.575 15.4ZM9.175 10.825C8.39167 10.0417 8 9.1 8 8C8 6.9 8.39167 5.95833 9.175 5.175C9.95833 4.39167 10.9 4 12 4C13.1 4 14.0417 4.39167 14.825 5.175C15.6083 5.95833 16 6.9 16 8C16 9.1 15.6083 10.0417 14.825 10.825C14.0417 11.6083 13.1 12 12 12C10.9 12 9.95833 11.6083 9.175 10.825Z",
5314
+ fill: fillColor(color)
5315
+ })) : /*#__PURE__*/React.createElement("svg", {
5316
+ width: width || 19,
5317
+ height: height || 17,
5318
+ viewBox: "0 0 19 17",
5319
+ fill: "none"
5320
+ }, /*#__PURE__*/React.createElement("path", {
5321
+ fillRule: "evenodd",
5322
+ clipRule: "evenodd",
5323
+ d: "M10 17V13.925L15.525 8.425C15.675 8.275 15.8417 8.16667 16.025 8.1C16.2083 8.03333 16.3917 8 16.575 8C16.775 8 16.9667 8.0375 17.15 8.1125C17.3333 8.1875 17.5 8.3 17.65 8.45L18.575 9.375C18.7083 9.525 18.8125 9.69167 18.8875 9.875C18.9625 10.0583 19 10.2417 19 10.425C19 10.6083 18.9667 10.7958 18.9 10.9875C18.8333 11.1792 18.725 11.35 18.575 11.5L13.075 17H10ZM0 16V13.2C0 12.6333 0.145833 12.1125 0.4375 11.6375C0.729167 11.1625 1.11667 10.8 1.6 10.55C2.63333 10.0333 3.68333 9.64583 4.75 9.3875C5.81667 9.12917 6.9 9 8 9C8.61667 9 9.225 9.0375 9.825 9.1125C10.425 9.1875 11.025 9.30833 11.625 9.475L8 13.1V16H0ZM16.575 11.4L17.5 10.425L16.575 9.5L15.625 10.45L16.575 11.4ZM5.175 6.825C4.39167 6.04167 4 5.1 4 4C4 2.9 4.39167 1.95833 5.175 1.175C5.95833 0.391667 6.9 0 8 0C9.1 0 10.0417 0.391667 10.825 1.175C11.6083 1.95833 12 2.9 12 4C12 5.1 11.6083 6.04167 10.825 6.825C10.0417 7.60833 9.1 8 8 8C6.9 8 5.95833 7.60833 5.175 6.825Z",
5324
+ fill: fillColor(color)
5325
+ }));
5326
+ });
5299
5327
  export const PersonGroup = /*#__PURE__*/memo(({
5300
5328
  width,
5301
5329
  height,
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.67",
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.68-beta.1",
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,12 @@ npm test
41
41
  ```
42
42
 
43
43
  ## Changelog
44
+
45
+ ## 1.4.68
46
+ - \[Added\]: Icon – Add Icon PersonEdit
47
+ - \[Fixed\]: TreeView - Fix unchecked values are restored unexpectedly
48
+ - \[Fixed\]: Dropdown - Fix Displays incorrect selected value
49
+
44
50
  ## 1.4.67
45
51
  - \[Added\]: ButtonIcon – Add the title prop to ButtonIcon to display the text as a tooltip on hover.
46
52
  - \[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 };