diginet-core-ui 1.4.16-beta.2 → 1.4.17-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.
@@ -48,7 +48,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) =
48
48
  lazyLoading,
49
49
  matchType,
50
50
  maxSize,
51
- maxSizeError,
51
+ maxSizeError: maxSizeErrorProp,
52
52
  onChange,
53
53
  onClick,
54
54
  onRemove,
@@ -57,9 +57,11 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) =
57
57
  src,
58
58
  style,
59
59
  width,
60
- wrongTypeError
60
+ wrongTypeError: wrongTypeErrorProp
61
61
  } = props;
62
62
  const defaultSrc = defaultSrcProp || AvatarDefault;
63
+ const maxSizeError = maxSizeErrorProp || `File ${getGlobal(['errorDefault', 'maxSize'])}`;
64
+ const wrongTypeError = wrongTypeErrorProp || `File ${getGlobal(['errorDefault', 'fileType'])}`;
63
65
  const ref = useRef(null);
64
66
  const inputRef = useRef(null);
65
67
  const avatarRef = useRef(null);
@@ -322,14 +324,14 @@ Avatar.propTypes = {
322
324
  className: PropTypes.string,
323
325
  /** If `true`, display remove avatar icon. */
324
326
  clearAble: PropTypes.bool,
325
- /**
326
- * data to display when hoverAble is true<br />
327
- * data is an object or function return a jsx element
327
+ /**
328
+ * data to display when hoverAble is true<br />
329
+ * data is an object or function return a jsx element
328
330
  */
329
331
  data: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.node]),
330
- /**
331
- * it is used to display the default if there is no src<br />
332
- * if undefined, will display icons available in the icons store
332
+ /**
333
+ * it is used to display the default if there is no src<br />
334
+ * if undefined, will display icons available in the icons store
333
335
  */
334
336
  defaultSrc: PropTypes.string,
335
337
  /** the direction to display more info */
@@ -366,19 +368,19 @@ Avatar.propTypes = {
366
368
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
367
369
  /** the error to show on wrong type */
368
370
  wrongTypeError: PropTypes.string,
369
- /**
370
- * ref methods (ref.current.instance.*method*)
371
- *
372
- * * option(): Gets all UI component properties
373
- * * Returns value - object
374
- * * option(optionName): Gets the value of a single property
375
- * * @param {optionName} - string
376
- * * Returns value - any
377
- * * option(optionName, optionValue): Updates the value of a single property
378
- * * @param {optionName} - string
379
- * * @param {optionValue} - any
380
- * * option(options): Updates the values of several properties
381
- * * @param {options} - object
371
+ /**
372
+ * ref methods (ref.current.instance.*method*)
373
+ *
374
+ * * option(): Gets all UI component properties
375
+ * * Returns value - object
376
+ * * option(optionName): Gets the value of a single property
377
+ * * @param {optionName} - string
378
+ * * Returns value - any
379
+ * * option(optionName, optionValue): Updates the value of a single property
380
+ * * @param {optionName} - string
381
+ * * @param {optionValue} - any
382
+ * * option(options): Updates the values of several properties
383
+ * * @param {options} - object
382
384
  */
383
385
  ref: ref
384
386
  };
@@ -131,16 +131,16 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
131
131
  allowSort,
132
132
  className,
133
133
  data,
134
- deleteNotifyText,
134
+ deleteNotifyText: deleteNotifyTextProp,
135
135
  disabled,
136
136
  domain,
137
137
  error,
138
138
  height,
139
- hintText,
139
+ hintText: hintTextProp,
140
140
  id,
141
141
  inputProps,
142
142
  isStripDomain,
143
- label,
143
+ label: labelProp,
144
144
  maxFile,
145
145
  maxSize: maxSizeProp,
146
146
  multiple,
@@ -154,11 +154,21 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
154
154
  required,
155
155
  style,
156
156
  unitSize,
157
- uploadErrorInfo,
157
+ uploadErrorInfo: uploadErrorInfoProp,
158
158
  viewType
159
159
  }, reference) => {
160
160
  if (!reference) reference = useRef(null);
161
161
  if (maxFile === 1) multiple = false;
162
+ const deleteNotifyText = deleteNotifyTextProp || getGlobal('deleteNotifyText');
163
+ const hintText = hintTextProp || getGlobal('dropFileHere');
164
+ const label = labelProp || getGlobal('attachText');
165
+ const maxSize = maxSizeProp || getGlobal('maxSizeUpload');
166
+ const uploadErrorInfo = uploadErrorInfoProp || {
167
+ maxFile: getGlobal(['errorDefault', 'maxFile']),
168
+ maxSize: getGlobal(['errorDefault', 'maxSize']),
169
+ fileType: getGlobal(['errorDefault', 'fileType']),
170
+ existingFile: getGlobal(['errorDefault', 'existingFile'])
171
+ };
162
172
  const ref = useRef(null);
163
173
  const attachmentHandleIconRef = useRef(null);
164
174
  const attachmentInputRef = useRef(null);
@@ -170,7 +180,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
170
180
  const removedAttachedRef = useRef([]);
171
181
  const prevent = useRef(null);
172
182
  const existClickOutOfItem = useRef(null);
173
- const maxSize = useRef(Infinity);
183
+ const maxSizeRef = useRef(Infinity);
174
184
  const timer = useRef(null);
175
185
  const [showModal, setShowModal] = useState(false);
176
186
  const [showPopup, setShowPopup] = useState(false);
@@ -277,11 +287,11 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
277
287
  // const lengthAttached = attached.length;
278
288
  const lengthAttached = (_ref = [...dataState, ...newDataState]) === null || _ref === void 0 ? void 0 : _ref.length;
279
289
  for (let i = 0; i < files.length; i++) {
280
- if (i + 1 > maxFile - lengthAttached && !isSpecialCase || files[i].size > maxSize.current || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
290
+ if (i + 1 > maxFile - lengthAttached && !isSpecialCase || files[i].size > maxSizeRef.current || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
281
291
  if (i + 1 > maxFile - lengthAttached && !isSpecialCase) {
282
292
  var _files$i;
283
293
  notifyRef.current.instance.show(`${(_files$i = files[i]) === null || _files$i === void 0 ? void 0 : _files$i.name} - ${uploadErrorInfo['maxFile']}`);
284
- } else if (files[i].size > maxSize.current) {
294
+ } else if (files[i].size > maxSizeRef.current) {
285
295
  var _files$i2;
286
296
  notifyRef.current.instance.show(`${(_files$i2 = files[i]) === null || _files$i2 === void 0 ? void 0 : _files$i2.name} - ${uploadErrorInfo['maxSize']}`);
287
297
  } else if (!checkAcceptFileType(files[i])) {
@@ -738,19 +748,19 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
738
748
  setViewTypeState(viewType);
739
749
  }, [viewType]);
740
750
  useEffect(() => {
741
- if (maxSizeProp) {
742
- if (!isNaN(maxSizeProp)) {
743
- maxSize.current = maxSizeProp * 1024 * 1024;
751
+ if (maxSize) {
752
+ if (!isNaN(maxSize)) {
753
+ maxSizeRef.current = maxSize * 1024 * 1024;
744
754
  } else {
745
- const [numberSize = ''] = maxSizeProp.match(/\d+/) || [];
746
- const [unitMaxSize = ''] = maxSizeProp.match(/\D+/) || [];
747
- maxSize.current = getBit(numberSize, unitMaxSize);
755
+ const [numberSize = ''] = maxSize.match(/\d+/) || [];
756
+ const [unitMaxSize = ''] = maxSize.match(/\D+/) || [];
757
+ maxSizeRef.current = getBit(numberSize, unitMaxSize);
748
758
  }
749
759
  }
750
760
  return () => {
751
- maxSize.current = Infinity;
761
+ maxSizeRef.current = Infinity;
752
762
  };
753
- }, [maxSizeProp]);
763
+ }, [maxSize]);
754
764
  useEffect(() => {
755
765
  if (multiple && maxFile > 1) attachmentInputRef.current.multiple = multiple;
756
766
  }, [multiple, maxFile]);
@@ -1420,21 +1430,21 @@ Attachment.defaultProps = {
1420
1430
  allowSort: true,
1421
1431
  className: '',
1422
1432
  data: [],
1423
- deleteNotifyText: getGlobal('deleteNotifyText'),
1433
+ // deleteNotifyText: getGlobal('deleteNotifyText'),
1424
1434
  disabled: false,
1425
1435
  height: 280,
1426
- hintText: getGlobal('dropFileHere'),
1427
- label: getGlobal('attachText'),
1428
- maxSize: getGlobal('maxSizeUpload'),
1436
+ // hintText: getGlobal('dropFileHere'),
1437
+ // label: getGlobal('attachText'),
1438
+ // maxSize: getGlobal('maxSizeUpload'),
1429
1439
  maxFile: Infinity,
1430
1440
  multiple: true,
1431
1441
  style: {},
1432
- uploadErrorInfo: {
1433
- maxFile: getGlobal(['errorDefault', 'maxFile']),
1434
- maxSize: getGlobal(['errorDefault', 'maxSize']),
1435
- fileType: getGlobal(['errorDefault', 'fileType']),
1436
- existingFile: getGlobal(['errorDefault', 'existingFile'])
1437
- },
1442
+ // uploadErrorInfo: {
1443
+ // maxFile: getGlobal(['errorDefault', 'maxFile']),
1444
+ // maxSize: getGlobal(['errorDefault', 'maxSize']),
1445
+ // fileType: getGlobal(['errorDefault', 'fileType']),
1446
+ // existingFile: getGlobal(['errorDefault', 'existingFile']),
1447
+ // },
1438
1448
  viewType: 'detail'
1439
1449
  };
1440
1450
  Attachment.propTypes = {
@@ -1444,17 +1454,17 @@ Attachment.propTypes = {
1444
1454
  allowSort: PropTypes.bool,
1445
1455
  /** Class for component. */
1446
1456
  className: PropTypes.string,
1447
- /** List attachment:<br />
1448
- * [{<br />
1449
- * &nbsp;&nbsp;&nbsp;&nbsp;"AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
1450
- * &nbsp;&nbsp;&nbsp;&nbsp;"URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
1451
- * &nbsp;&nbsp;&nbsp;&nbsp;"FileName": "8a07bee1eeff17a14eee.jpg",<br />
1452
- * &nbsp;&nbsp;&nbsp;&nbsp;"FileSize": 248837,<br />
1453
- * &nbsp;&nbsp;&nbsp;&nbsp;"KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
1454
- * &nbsp;&nbsp;&nbsp;&nbsp;"CreateUserID": "LEMONADMIN",<br />
1455
- * &nbsp;&nbsp;&nbsp;&nbsp;"CreateDate": "2020-08-24T11:54:04.307Z",<br />
1456
- * &nbsp;&nbsp;&nbsp;&nbsp;"UserName": "Quản trị hệ thống"<br />
1457
- * }, ...]
1457
+ /** List attachment:<br />
1458
+ * [{<br />
1459
+ * &nbsp;&nbsp;&nbsp;&nbsp;"AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
1460
+ * &nbsp;&nbsp;&nbsp;&nbsp;"URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
1461
+ * &nbsp;&nbsp;&nbsp;&nbsp;"FileName": "8a07bee1eeff17a14eee.jpg",<br />
1462
+ * &nbsp;&nbsp;&nbsp;&nbsp;"FileSize": 248837,<br />
1463
+ * &nbsp;&nbsp;&nbsp;&nbsp;"KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
1464
+ * &nbsp;&nbsp;&nbsp;&nbsp;"CreateUserID": "LEMONADMIN",<br />
1465
+ * &nbsp;&nbsp;&nbsp;&nbsp;"CreateDate": "2020-08-24T11:54:04.307Z",<br />
1466
+ * &nbsp;&nbsp;&nbsp;&nbsp;"UserName": "Quản trị hệ thống"<br />
1467
+ * }, ...]
1458
1468
  */
1459
1469
  data: PropTypes.array,
1460
1470
  /** The message to display when deleting files. */
@@ -1485,16 +1495,16 @@ Attachment.propTypes = {
1485
1495
  onChange: PropTypes.func,
1486
1496
  /** Download attached event, if not it will use default. */
1487
1497
  onDownload: PropTypes.func,
1488
- /**
1489
- * event when removed file(s)
1490
- *
1491
- * return data: {<br/>
1492
- * &nbsp;&nbsp;&nbsp;&nbsp;attached: [Files] (insist old and all new files )<br/>
1493
- * &nbsp;&nbsp;&nbsp;&nbsp;allNewAttached: [Files]<br/>
1494
- * &nbsp;&nbsp;&nbsp;&nbsp;oldAttached: [Files]<br/>
1495
- * &nbsp;&nbsp;&nbsp;&nbsp;removedAttached: [Files]<br/>
1496
- * &nbsp;&nbsp;&nbsp;&nbsp;element: [NodeList (just removed)]<br/>
1497
- * }
1498
+ /**
1499
+ * event when removed file(s)
1500
+ *
1501
+ * return data: {<br/>
1502
+ * &nbsp;&nbsp;&nbsp;&nbsp;attached: [Files] (insist old and all new files )<br/>
1503
+ * &nbsp;&nbsp;&nbsp;&nbsp;allNewAttached: [Files]<br/>
1504
+ * &nbsp;&nbsp;&nbsp;&nbsp;oldAttached: [Files]<br/>
1505
+ * &nbsp;&nbsp;&nbsp;&nbsp;removedAttached: [Files]<br/>
1506
+ * &nbsp;&nbsp;&nbsp;&nbsp;element: [NodeList (just removed)]<br/>
1507
+ * }
1498
1508
  */
1499
1509
  onRemove: PropTypes.func,
1500
1510
  /** View attached event, if not it will use default. */
@@ -87,13 +87,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
87
87
  maximumSelectionLength,
88
88
  multilineSelectedItem,
89
89
  multiple,
90
- noDataText,
90
+ noDataText: noDataTextProp,
91
91
  onChange,
92
92
  onClosed,
93
93
  onInput,
94
94
  onKeyDown,
95
95
  onLoadMore,
96
- placeholder,
96
+ placeholder: placeholderProp,
97
97
  readOnly,
98
98
  renderItem,
99
99
  renderSelectedItem,
@@ -115,8 +115,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
115
115
  } = props;
116
116
  const selectBox = multiple && selectBoxProp === undefined ? true : selectBoxProp;
117
117
  const searchExpr = typeof searchExprProp === 'string' ? [searchExprProp] : searchExprProp;
118
- const searchDelayTime = convertSearchDelayTime(searchDelayTimeProp);
118
+ const searchDelayTime = convertSearchDelayTime(searchDelayTimeProp === undefined ? getGlobal('delayOnInput') : searchDelayTimeProp);
119
119
  let displayExpr = displayExprProp;
120
+ const noDataText = noDataTextProp || getGlobal('noDataText');
121
+ const placeholder = placeholderProp || getGlobal('dropdownPlaceholder');
120
122
  const ref = useRef(null);
121
123
  const dropdownRef = useRef(null);
122
124
  const timer = useRef(null);
@@ -360,10 +362,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
360
362
  // }
361
363
  // };
362
364
 
363
- /**
364
- * So sánh text đầu vào cáo map với txtSearch
365
- * @param text
366
- * @return {boolean}
365
+ /**
366
+ * So sánh text đầu vào cáo map với txtSearch
367
+ * @param text
368
+ * @return {boolean}
367
369
  */
368
370
  const handleRenderBySearch = (text = '') => {
369
371
  if (typeof text !== 'string') text = text.toString();
@@ -375,10 +377,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
375
377
  } else return text.toLowerCase().includes(txtSearch.toLowerCase());
376
378
  };
377
379
 
378
- /**
379
- * 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
380
- * @param data {object} rowData of dataSource
381
- * @return {string}
380
+ /**
381
+ * 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
382
+ * @param data {object} rowData of dataSource
383
+ * @return {string}
382
384
  */
383
385
  const displayValue = data => {
384
386
  let text = '';
@@ -1837,9 +1839,9 @@ Dropdown.propTypes = {
1837
1839
  defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1838
1840
  /** If `true`, the component is disabled. */
1839
1841
  disabled: PropTypes.bool,
1840
- /** Field name used for text display in dropdown list.<br/>
1841
- * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
1842
- * Note: don't use 'id - name', return undefined
1842
+ /** Field name used for text display in dropdown list.<br/>
1843
+ * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
1844
+ * Note: don't use 'id - name', return undefined
1843
1845
  */
1844
1846
  displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1845
1847
  /** Style inline of dropdown items. */
@@ -1848,14 +1850,14 @@ Dropdown.propTypes = {
1848
1850
  error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
1849
1851
  /** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
1850
1852
  helperTextProps: PropTypes.object,
1851
- /** Field name used for icon display.<br/>
1852
- * Example:<br/>
1853
- * &nbsp;&nbsp;string: 'icon'<br/>
1854
- * &nbsp;&nbsp;object: {<br/>
1855
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1856
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1857
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1858
- * &nbsp;&nbsp;}
1853
+ /** Field name used for icon display.<br/>
1854
+ * Example:<br/>
1855
+ * &nbsp;&nbsp;string: 'icon'<br/>
1856
+ * &nbsp;&nbsp;object: {<br/>
1857
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1858
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1859
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1860
+ * &nbsp;&nbsp;}
1859
1861
  */
1860
1862
  iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1861
1863
  key: PropTypes.string,
@@ -1889,8 +1891,8 @@ Dropdown.propTypes = {
1889
1891
  onChange: PropTypes.func,
1890
1892
  /** Callback fired when dropdown closed. */
1891
1893
  onClosed: PropTypes.func,
1892
- /** Callback fired when the input value changes.<br/>
1893
- * if undefined: the filter function will run (default)
1894
+ /** Callback fired when the input value changes.<br/>
1895
+ * if undefined: the filter function will run (default)
1894
1896
  */
1895
1897
  onInput: PropTypes.func,
1896
1898
  /** Callback fired when key down input */
@@ -1901,21 +1903,21 @@ Dropdown.propTypes = {
1901
1903
  placeholder: PropTypes.string,
1902
1904
  /** If `true`, the component is read-only. */
1903
1905
  readOnly: PropTypes.bool,
1904
- /** Function displays items by custom.<br/>
1905
- * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
1906
- * --> such as: displayExpr={'name - role'}
1906
+ /** Function displays items by custom.<br/>
1907
+ * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
1908
+ * --> such as: displayExpr={'name - role'}
1907
1909
  */
1908
1910
  renderItem: PropTypes.func,
1909
- /** Function or field name used for display selected items, example:<br/>
1910
- * renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
1911
+ /** Function or field name used for display selected items, example:<br/>
1912
+ * renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
1911
1913
  */
1912
1914
  renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
1913
1915
  /** If `true`, the label will indicate that the input is required. */
1914
1916
  required: PropTypes.bool,
1915
- /**
1916
- * Duration wait enter search content on search.<br/>
1917
- * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1918
- * If `true`, used default delayOnInput.
1917
+ /**
1918
+ * Duration wait enter search content on search.<br/>
1919
+ * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1920
+ * If `true`, used default delayOnInput.
1919
1921
  */
1920
1922
  searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
1921
1923
  /** Specifies a data object's field name or an expression whose value is compared to the search string. */
@@ -1942,19 +1944,19 @@ Dropdown.propTypes = {
1942
1944
  valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
1943
1945
  /**The variant to use. */
1944
1946
  viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
1945
- /**
1946
- * ref methods
1947
- *
1948
- * how to get component element? ref.current
1949
- *
1950
- * how to call method? ref.current.instance.{method}
1951
- *
1952
- * * showDropdown(): Show dropdown
1953
- * * closeDropdown(): Close dropdown
1954
- * * onClear(): Clear selected value
1955
- * * setPreviousValue(): Set value to previous value
1956
- * * setValue(value): Set value of dropdown
1957
- * * @param {value} - string || number || array
1947
+ /**
1948
+ * ref methods
1949
+ *
1950
+ * how to get component element? ref.current
1951
+ *
1952
+ * how to call method? ref.current.instance.{method}
1953
+ *
1954
+ * * showDropdown(): Show dropdown
1955
+ * * closeDropdown(): Close dropdown
1956
+ * * onClear(): Clear selected value
1957
+ * * setPreviousValue(): Set value to previous value
1958
+ * * setValue(value): Set value of dropdown
1959
+ * * @param {value} - string || number || array
1958
1960
  */
1959
1961
  };
1960
1962
 
@@ -2,6 +2,7 @@
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
4
  import { Icon, Typography } from "../..";
5
+ import { getGlobal } from "../../../global";
5
6
  import PropTypes from 'prop-types';
6
7
  import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
7
8
  import { bgColor, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, bottom, boxBorder, displayBlock, displayFlex, displayNone, fill, flexRow, inset, insetX, itemsCenter, outlineNone, parseHeight, parseMaxHeight, parseMinHeight, parseMinWidthHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, scaleX, selfEnd, textColor, textEllipsis, top, userSelectNone } from "../../../styles/general";
@@ -27,7 +28,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference
27
28
  autoWidth: autoWidthProp,
28
29
  className,
29
30
  defaultValue,
30
- delayOnChange,
31
+ delayOnChange: delayOnChangeProp,
31
32
  disabled,
32
33
  endIcon,
33
34
  endIconProps,
@@ -46,7 +47,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference
46
47
  onInput,
47
48
  onKeyDown,
48
49
  onKeyUp,
49
- placeholder,
50
+ placeholder: placeholderProp,
50
51
  readOnly,
51
52
  resize,
52
53
  rows,
@@ -59,6 +60,8 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference
59
60
  ...other
60
61
  } = props;
61
62
  const autoWidth = !autoWidthProp && inputProps !== null && inputProps !== void 0 && inputProps.autoWidth ? inputProps.autoWidth : autoWidthProp;
63
+ const delayOnChange = delayOnChangeProp || getGlobal('delayOnInput');
64
+ const placeholder = placeholderProp || getGlobal('inputPlaceholder');
62
65
  const _onChange = e => {
63
66
  onChange && onChange(e);
64
67
  dynamicWidth(e);
@@ -17,7 +17,6 @@ const getLastPage = (totalItems, itemsPerPage) => {
17
17
  }
18
18
  return _lastPage + 1;
19
19
  };
20
- const delayOnInput = getGlobal('delayOnInput');
21
20
  const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
21
  action = {},
23
22
  bgColor: bgColorProp,
@@ -36,6 +35,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
36
35
  typeShort
37
36
  }, reference) => {
38
37
  if (!reference) reference = useRef(null);
38
+ const delayOnInput = getGlobal('delayOnInput');
39
39
  const ref = useRef(null);
40
40
  const timer = useRef(null);
41
41
  const currentPageRef = useRef(currentPage);
@@ -532,22 +532,22 @@ PagingInfo.propTypes = {
532
532
  onChangePage: PropTypes.func,
533
533
  /** Callback fired when quantity on per page changed. */
534
534
  onChangePerPage: PropTypes.func,
535
- /**
536
- * Callback fired when page number is changing.
537
- *
538
- * * prevPage: Page before changed
539
- * * newPage: Page after changed
540
- * * cancel(value): Function cancel change page
541
- * * @param {value} - bool
535
+ /**
536
+ * Callback fired when page number is changing.
537
+ *
538
+ * * prevPage: Page before changed
539
+ * * newPage: Page after changed
540
+ * * cancel(value): Function cancel change page
541
+ * * @param {value} - bool
542
542
  */
543
543
  onChangingPage: PropTypes.func,
544
- /**
545
- * Callback fired when quantity on item per page is changing.
546
- *
547
- * * prevPerPage: Items per page before changed
548
- * * newPerPage: Items per page after changed
549
- * * cancel(value): Function cancel change items per page
550
- * * @param {value} - bool
544
+ /**
545
+ * Callback fired when quantity on item per page is changing.
546
+ *
547
+ * * prevPerPage: Items per page before changed
548
+ * * newPerPage: Items per page after changed
549
+ * * cancel(value): Function cancel change items per page
550
+ * * @param {value} - bool
551
551
  */
552
552
  onChangingPerPage: PropTypes.func,
553
553
  /** Style inline of component. */
@@ -556,26 +556,26 @@ PagingInfo.propTypes = {
556
556
  totalItems: PropTypes.number,
557
557
  /** Compact type for mobile. */
558
558
  typeShort: PropTypes.bool
559
- /**
560
- * ref methods (ref.current.instance.*method*)
561
- *
562
- * * onChangePage(page): Change page number
563
- * * @param {page} - number
564
- * * onChangePerPage(per): Change quantity on per page
565
- * * @param {per} - number
566
- * * setTotalItems(items): Set total items
567
- * * @param {items} - number
568
- *
569
- * * option(): Gets all UI component properties
570
- * * Returns value - object
571
- * * option(optionName): Gets the value of a single property
572
- * * @param {optionName} - string
573
- * * Returns value - any
574
- * * option(optionName, optionValue): Updates the value of a single property
575
- * * @param {optionName} - string
576
- * * @param {optionValue} - any
577
- * * option(options): Updates the values of several properties
578
- * * @param {options} - object
559
+ /**
560
+ * ref methods (ref.current.instance.*method*)
561
+ *
562
+ * * onChangePage(page): Change page number
563
+ * * @param {page} - number
564
+ * * onChangePerPage(per): Change quantity on per page
565
+ * * @param {per} - number
566
+ * * setTotalItems(items): Set total items
567
+ * * @param {items} - number
568
+ *
569
+ * * option(): Gets all UI component properties
570
+ * * Returns value - object
571
+ * * option(optionName): Gets the value of a single property
572
+ * * @param {optionName} - string
573
+ * * Returns value - any
574
+ * * option(optionName, optionValue): Updates the value of a single property
575
+ * * @param {optionName} - string
576
+ * * @param {optionValue} - any
577
+ * * option(options): Updates the values of several properties
578
+ * * @param {options} - object
579
579
  */
580
580
  };
581
581
 
@@ -17,7 +17,6 @@ const getLastPage = (totalItems, itemsPerPage) => {
17
17
  }
18
18
  return _lastPage + 1;
19
19
  };
20
- const delayOnInput = getGlobal('delayOnInput');
21
20
  const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
21
  action = {},
23
22
  className,
@@ -33,6 +32,7 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
33
32
  style,
34
33
  totalItems
35
34
  }, reference) => {
35
+ const delayOnInput = getGlobal('delayOnInput');
36
36
  const ref = useRef(null);
37
37
  const timer = useRef(null);
38
38
  const currentPageRef = useRef(currentPage);
@@ -333,48 +333,48 @@ PagingSelector.propTypes = {
333
333
  onChangePage: PropTypes.func,
334
334
  /** Callback fired when quantity on per page changed. */
335
335
  onChangePerPage: PropTypes.func,
336
- /**
337
- * Callback fired when page number is changing.
338
- *
339
- * * prevPage: Page before changed
340
- * * newPage: Page after changed
341
- * * cancel(value): Function cancel change page
342
- * * @param {value} - bool
336
+ /**
337
+ * Callback fired when page number is changing.
338
+ *
339
+ * * prevPage: Page before changed
340
+ * * newPage: Page after changed
341
+ * * cancel(value): Function cancel change page
342
+ * * @param {value} - bool
343
343
  */
344
344
  onChangingPage: PropTypes.func,
345
- /**
346
- * Callback fired when quantity on item per page is changing.
347
- *
348
- * * prevPerPage: Items per page before changed
349
- * * newPerPage: Items per page after changed
350
- * * cancel(value): Function cancel change items per page
351
- * * @param {value} - bool
345
+ /**
346
+ * Callback fired when quantity on item per page is changing.
347
+ *
348
+ * * prevPerPage: Items per page before changed
349
+ * * newPerPage: Items per page after changed
350
+ * * cancel(value): Function cancel change items per page
351
+ * * @param {value} - bool
352
352
  */
353
353
  onChangingPerPage: PropTypes.func,
354
354
  /** Style inline of component. */
355
355
  style: PropTypes.object,
356
356
  /** Total items. */
357
357
  totalItems: PropTypes.number
358
- /**
359
- * ref methods (ref.current.instance.*method*)
360
- *
361
- * * onChangePage(page): Change page number
362
- * * @param {page} - number
363
- * * onChangePerPage(per): Change quantity on per page
364
- * * @param {per} - number
365
- * * setTotalItems(items): Set total items
366
- * * @param {items} - number
367
- *
368
- * * option(): Gets all UI component properties
369
- * * Returns value - object
370
- * * option(optionName): Gets the value of a single property
371
- * * @param {optionName} - string
372
- * * Returns value - any
373
- * * option(optionName, optionValue): Updates the value of a single property
374
- * * @param {optionName} - string
375
- * * @param {optionValue} - any
376
- * * option(options): Updates the values of several properties
377
- * * @param {options} - object
358
+ /**
359
+ * ref methods (ref.current.instance.*method*)
360
+ *
361
+ * * onChangePage(page): Change page number
362
+ * * @param {page} - number
363
+ * * onChangePerPage(per): Change quantity on per page
364
+ * * @param {per} - number
365
+ * * setTotalItems(items): Set total items
366
+ * * @param {items} - number
367
+ *
368
+ * * option(): Gets all UI component properties
369
+ * * Returns value - object
370
+ * * option(optionName): Gets the value of a single property
371
+ * * @param {optionName} - string
372
+ * * Returns value - any
373
+ * * option(optionName, optionValue): Updates the value of a single property
374
+ * * @param {optionName} - string
375
+ * * @param {optionValue} - any
376
+ * * option(options): Updates the values of several properties
377
+ * * @param {options} - object
378
378
  */
379
379
  };
380
380
 
@@ -47,7 +47,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
47
47
  searchMode,
48
48
  searchProps,
49
49
  selectAll,
50
- selectAllLabel,
50
+ selectAllLabel: selectAllLabelProp,
51
51
  selectBox,
52
52
  showChildrenOfResult,
53
53
  showSelectedItems,
@@ -57,6 +57,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
57
57
  } = props;
58
58
  let searchDelayTime = searchDelayTimeProp;
59
59
  let value = valueProp;
60
+ const selectAllLabel = selectAllLabelProp || getGlobal('selectAll');
60
61
  const ref = useRef(null);
61
62
  const selectAllRef = useRef(null);
62
63
  const inputValueRef = useRef(null);
@@ -935,9 +936,9 @@ TreeView.propTypes = {
935
936
  disabledBoldResult: PropTypes.bool,
936
937
  /** If `true`, disabled parent and children item (only supported for multipleValueMode is single). */
937
938
  disabledRelevantValue: PropTypes.bool,
938
- /** Field name used for text display in dropdown list.<br/>
939
- * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
940
- * Note: don't use 'id - name', return undefined
939
+ /** Field name used for text display in dropdown list.<br/>
940
+ * Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
941
+ * Note: don't use 'id - name', return undefined
941
942
  */
942
943
  displayExpr: PropTypes.string,
943
944
  /** If `true`, expand immediate after render (shouldn't use this). */
@@ -948,14 +949,14 @@ TreeView.propTypes = {
948
949
  multiple: PropTypes.bool,
949
950
  /** Return value for the select multiple use case. */
950
951
  multipleValueMode: PropTypes.oneOf(['single', 'multiple', 'inheritance']),
951
- /**
952
- * Callback fired when the value changes.<br />
953
- * return 2 parameters (e, data)<br />
954
- * * e: element (insist {value, justSelected, data})<br/>
955
- * &nbsp;&nbsp;&nbsp;&nbsp; + value is one or an array of selected values<br />
956
- * &nbsp;&nbsp;&nbsp;&nbsp; + justSelected is value has just been selected (either true or false))<br />
957
- * &nbsp;&nbsp;&nbsp;&nbsp; + data is one or an array of selected values with full information<br />
958
- * * data: array of selected values (not recommend because it's the same e.value)
952
+ /**
953
+ * Callback fired when the value changes.<br />
954
+ * return 2 parameters (e, data)<br />
955
+ * * e: element (insist {value, justSelected, data})<br/>
956
+ * &nbsp;&nbsp;&nbsp;&nbsp; + value is one or an array of selected values<br />
957
+ * &nbsp;&nbsp;&nbsp;&nbsp; + justSelected is value has just been selected (either true or false))<br />
958
+ * &nbsp;&nbsp;&nbsp;&nbsp; + data is one or an array of selected values with full information<br />
959
+ * * data: array of selected values (not recommend because it's the same e.value)
959
960
  */
960
961
  onChange: PropTypes.func,
961
962
  /** Used for mapping into a nested list. */
@@ -964,15 +965,15 @@ TreeView.propTypes = {
964
965
  renderAsyncFromLevel: PropTypes.oneOf([2, 3, 4, 5]),
965
966
  /** Will render asynchronously if the number of elements is greater than this number. */
966
967
  renderAsyncWithLength: PropTypes.number,
967
- /** Function displays items by custom.<br/>
968
- * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
969
- * --> such as: displayExpr={'name - role'}
968
+ /** Function displays items by custom.<br/>
969
+ * renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
970
+ * --> such as: displayExpr={'name - role'}
970
971
  */
971
972
  renderItem: PropTypes.func,
972
- /**
973
- * Duration wait enter search content on search.<br/>
974
- * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
975
- * If `true`, used default delayOnInput.
973
+ /**
974
+ * Duration wait enter search content on search.<br/>
975
+ * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
976
+ * If `true`, used default delayOnInput.
976
977
  */
977
978
  searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
978
979
  /** Specifies a comparison operation used to search items. */
@@ -995,22 +996,22 @@ TreeView.propTypes = {
995
996
  value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
996
997
  /** The field name used for the returned result. */
997
998
  valueExpr: PropTypes.string
998
- /**
999
- * get ref of TreeView component, insist:<br/>
1000
- * {<br/>
1001
- * &nbsp;&nbsp;&nbsp;&nbsp;disabled: true/false,<br/>
1002
- * &nbsp;&nbsp;&nbsp;&nbsp;displayExpr: string,<br/>
1003
- * &nbsp;&nbsp;&nbsp;&nbsp;valueExpr: string,<br/>
1004
- * &nbsp;&nbsp;&nbsp;&nbsp;id: string,<br/>
1005
- * &nbsp;&nbsp;&nbsp;&nbsp;parentID: string,<br/>
1006
- * &nbsp;&nbsp;&nbsp;&nbsp;value: string/array<br/>
1007
- * &nbsp;&nbsp;&nbsp;&nbsp;getValue: get selected values (instead of onChange function),<br/>
1008
- * &nbsp;&nbsp;&nbsp;&nbsp;setValue: set array of value (only multiple),<br/>
1009
- * &nbsp;&nbsp;&nbsp;&nbsp;handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
1010
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + isChecked: checked if true (default is false) <br/>
1011
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + value: selected values, use 'all' for all values (default is 'all') <br/>
1012
- * &nbsp;&nbsp;&nbsp;&nbsp;get: get DOM of TreeView component<br/>
1013
- * }
999
+ /**
1000
+ * get ref of TreeView component, insist:<br/>
1001
+ * {<br/>
1002
+ * &nbsp;&nbsp;&nbsp;&nbsp;disabled: true/false,<br/>
1003
+ * &nbsp;&nbsp;&nbsp;&nbsp;displayExpr: string,<br/>
1004
+ * &nbsp;&nbsp;&nbsp;&nbsp;valueExpr: string,<br/>
1005
+ * &nbsp;&nbsp;&nbsp;&nbsp;id: string,<br/>
1006
+ * &nbsp;&nbsp;&nbsp;&nbsp;parentID: string,<br/>
1007
+ * &nbsp;&nbsp;&nbsp;&nbsp;value: string/array<br/>
1008
+ * &nbsp;&nbsp;&nbsp;&nbsp;getValue: get selected values (instead of onChange function),<br/>
1009
+ * &nbsp;&nbsp;&nbsp;&nbsp;setValue: set array of value (only multiple),<br/>
1010
+ * &nbsp;&nbsp;&nbsp;&nbsp;handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
1011
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + isChecked: checked if true (default is false) <br/>
1012
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + value: selected values, use 'all' for all values (default is 'all') <br/>
1013
+ * &nbsp;&nbsp;&nbsp;&nbsp;get: get DOM of TreeView component<br/>
1014
+ * }
1014
1015
  */
1015
1016
  };
1016
1017
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.16-beta.2",
3
+ "version": "1.4.17-beta.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
package/readme.md CHANGED
@@ -38,6 +38,9 @@ npm test
38
38
  ```
39
39
 
40
40
  ## Changelog
41
+ ## 1.4.17
42
+ - \[Fixed\]: Attachment – Fix attached, allNewAttached in onChange when add new attachment
43
+
41
44
  ## 1.4.16
42
45
  - \[Changed\]: IconMenu – Add MHRM15N0001
43
46
  - \[Changed\]: Dropdown – Return recent search in onClosed callback
package/utils/date.js CHANGED
@@ -107,8 +107,7 @@ export const formatDate = (value, formatOutput = 'DD/MM/YYYY', utc = false) => {
107
107
  return 'Invalid Date';
108
108
  }
109
109
  }
110
- const dateTime = (() => {
111
- var _value$toTimeString$m;
110
+ const dateTime = (_value$toTimeString$m => {
112
111
  const UTC = utc ? 'UTC' : '';
113
112
  const year = value['get' + UTC + 'FullYear']();
114
113
  const month = value['get' + UTC + 'Month']();