diginet-core-ui 1.4.35 → 1.4.36-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.
@@ -114,7 +114,9 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
114
114
  !controls ? onChangeValue(e) : focusedValue.current = e === null || e === void 0 ? void 0 : e.value;
115
115
  };
116
116
  const openPicker = () => {
117
- setOpenPickerState(true);
117
+ if (!readOnly) {
118
+ setOpenPickerState(true);
119
+ }
118
120
  };
119
121
  const closePicker = () => {
120
122
  var _pickerRef$current;
@@ -783,7 +783,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
783
783
  ipRef.current.removeEventListener('focus', onInputFocus);
784
784
  }
785
785
  };
786
- }, [onChange]);
786
+ }, [readOnly, onChange]);
787
787
  useEffect(() => {
788
788
  if (min) {
789
789
  let arr = [];
@@ -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;
@@ -90,10 +90,10 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
90
90
  const saveText = getGlobal(['save']);
91
91
  const nowText = getGlobal(['now']);
92
92
 
93
- /**
94
- * onChange handler with condition base on min max
95
- * @param {*} e
96
- * @param {String} key one of ['hour', 'minute', 'second']
93
+ /**
94
+ * onChange handler with condition base on min max
95
+ * @param {*} e
96
+ * @param {String} key one of ['hour', 'minute', 'second']
97
97
  */
98
98
  const onChangeHandler = (e, key) => {
99
99
  var _e$target;
@@ -149,10 +149,10 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
149
149
  }
150
150
  };
151
151
 
152
- /**
153
- *
154
- * @param {String} key
155
- * @param {Number} value
152
+ /**
153
+ *
154
+ * @param {String} key
155
+ * @param {Number} value
156
156
  */
157
157
  const setTimeAfterChange = (key, value) => {
158
158
  setTimeValue({
@@ -161,14 +161,14 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
161
161
  });
162
162
  };
163
163
 
164
- /**
165
- *
166
- * Arrow up hour input onClick in the following cases:
167
- * (1): Increase current hour by 1
168
- * (2): If current hour is equal to max hour value, set current hour equal to min hour
169
- * (3): If current hour plus 1 is equal to max hour, set current minute equal to max minute if current minute greater than max minute value
170
- * (4): If current hour plus 1 is equal to max hour, set current second equal to max second if current second greater than max second value
171
- * (5): Set current minute, second to min minute, second if current hour is greater than max hour value and current minute, second is greater than min minute, second value
164
+ /**
165
+ *
166
+ * Arrow up hour input onClick in the following cases:
167
+ * (1): Increase current hour by 1
168
+ * (2): If current hour is equal to max hour value, set current hour equal to min hour
169
+ * (3): If current hour plus 1 is equal to max hour, set current minute equal to max minute if current minute greater than max minute value
170
+ * (4): If current hour plus 1 is equal to max hour, set current second equal to max second if current second greater than max second value
171
+ * (5): Set current minute, second to min minute, second if current hour is greater than max hour value and current minute, second is greater than min minute, second value
172
172
  */
173
173
  const onIncreaseHour = () => {
174
174
  if (maxHour === currentHour + 1 && maxMinute < currentMinute) {
@@ -209,15 +209,15 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
209
209
  }
210
210
  };
211
211
 
212
- /**
213
- *
214
- * @constant {Number} minuteStep
215
- * @constant {Number} lastMinute
216
- * Arrow up minute input onClick in the following cases:
217
- * (1): Increase current minute by minute step (default 1).
218
- * (2): If current minute plus minute step is greater than lastMinute, set current minute equal to min minute.
219
- * (3): If current second greater than max second value, set current second equal to max second.
220
- * (4): (3) and current second is greater than max second value, set current second equal to max second.
212
+ /**
213
+ *
214
+ * @constant {Number} minuteStep
215
+ * @constant {Number} lastMinute
216
+ * Arrow up minute input onClick in the following cases:
217
+ * (1): Increase current minute by minute step (default 1).
218
+ * (2): If current minute plus minute step is greater than lastMinute, set current minute equal to min minute.
219
+ * (3): If current second greater than max second value, set current second equal to max second.
220
+ * (4): (3) and current second is greater than max second value, set current second equal to max second.
221
221
  */
222
222
  const onIncreaseMinute = () => {
223
223
  if (lastMinute < currentMinute + minuteStep) {
@@ -244,11 +244,11 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
244
244
  }
245
245
  };
246
246
 
247
- /**
248
- *
249
- * Arrow up second input onClick in the following cases:
250
- * (1): Increase current second by 1
251
- * (2): If current second plus 1 equal to max second value, set current second to min second
247
+ /**
248
+ *
249
+ * Arrow up second input onClick in the following cases:
250
+ * (1): Increase current second by 1
251
+ * (2): If current second plus 1 equal to max second value, set current second to min second
252
252
  */
253
253
  const onIncreaseSecond = () => {
254
254
  if (lastSecond < currentSecond + 1) {
@@ -260,15 +260,15 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
260
260
  }
261
261
  };
262
262
 
263
- /**
264
- *
265
- * Arrow down hour input onClick in the following cases:
266
- * (1): Decrease current hour by 1
267
- * (2): If current hour is equal to min hour value, set current hour equal to max hour
268
- * (3): (2) and current minute is greater than max minute value, set minute to max minute value
269
- * (4): (3) and current second is greater than min second value, set second to max second value
270
- * (5): If current hour minus 1 is equal to min hour and current minute greater than min minute value, set current minute equal to min minute
271
- * (6): (5) and current second is greater than min second value, set current second equal to min second
263
+ /**
264
+ *
265
+ * Arrow down hour input onClick in the following cases:
266
+ * (1): Decrease current hour by 1
267
+ * (2): If current hour is equal to min hour value, set current hour equal to max hour
268
+ * (3): (2) and current minute is greater than max minute value, set minute to max minute value
269
+ * (4): (3) and current second is greater than min second value, set second to max second value
270
+ * (5): If current hour minus 1 is equal to min hour and current minute greater than min minute value, set current minute equal to min minute
271
+ * (6): (5) and current second is greater than min second value, set current second equal to min second
272
272
  */
273
273
  const onDecreaseHour = () => {
274
274
  if (minHour === currentHour - 1 && minMinute > currentMinute) {
@@ -319,15 +319,15 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
319
319
  }
320
320
  };
321
321
 
322
- /**
323
- *
324
- * @constant {Number} minuteStep
325
- * @constant {Number} startMinute
326
- * @constant {Number} lastMinute
327
- * Arrow down minute input onClick in the following cases:
328
- * (1): Decrease current minute by @minuteStep
329
- * (2): If current minute minus @minuteStep is smaller than @startMinute , set current minute to @lastMinute - @lastMinute % @minuteStep
330
- * (3): (2) and current second is greater than max second, set current second to max second
322
+ /**
323
+ *
324
+ * @constant {Number} minuteStep
325
+ * @constant {Number} startMinute
326
+ * @constant {Number} lastMinute
327
+ * Arrow down minute input onClick in the following cases:
328
+ * (1): Decrease current minute by @minuteStep
329
+ * (2): If current minute minus @minuteStep is smaller than @startMinute , set current minute to @lastMinute - @lastMinute % @minuteStep
330
+ * (3): (2) and current second is greater than max second, set current second to max second
331
331
  */
332
332
  const onDecreaseMinute = () => {
333
333
  if (startMinute > currentMinute - minuteStep) {
@@ -348,13 +348,13 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
348
348
  }
349
349
  };
350
350
 
351
- /**
352
- *
353
- * @constant {Number} startSecond
354
- * @constant {Number} lastSecond
355
- * Arrow down second input onClick in the following cases:
356
- * (1): Decrease current second by 1
357
- * (2): If current second minus 1 is smaller than start second, set current second to last second
351
+ /**
352
+ *
353
+ * @constant {Number} startSecond
354
+ * @constant {Number} lastSecond
355
+ * Arrow down second input onClick in the following cases:
356
+ * (1): Decrease current second by 1
357
+ * (2): If current second minus 1 is smaller than start second, set current second to last second
358
358
  */
359
359
  const onDecreaseSecond = () => {
360
360
  if (startSecond >= currentSecond - 1) {
@@ -366,30 +366,30 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
366
366
  }
367
367
  };
368
368
 
369
- /**
370
- *
371
- * onClose Popover Timepicker when click Save button
369
+ /**
370
+ *
371
+ * onClose Popover Timepicker when click Save button
372
372
  */
373
373
  const onCloseTimePicker = () => {
374
374
  timePickerRef.current.close();
375
375
  setCurrentInputFocus(null);
376
376
  };
377
377
 
378
- /**
379
- *
380
- * Format value using date().format() in utils
381
- * @param {Date} value
382
- * @param {String} outputFormat
383
- * @returns
378
+ /**
379
+ *
380
+ * Format value using date().format() in utils
381
+ * @param {Date} value
382
+ * @param {String} outputFormat
383
+ * @returns
384
384
  */
385
385
  const formatTime = (value, outputFormat) => {
386
386
  return mode12h ? date(value).format(`hh${outputFormat.slice(2)} A`) : date(value).format(outputFormat);
387
387
  };
388
388
 
389
- /**
390
- *
391
- * Button Save onClick
392
- * @param {Boolean} now
389
+ /**
390
+ *
391
+ * Button Save onClick
392
+ * @param {Boolean} now
393
393
  */
394
394
  const onSelectTime = (now = false) => {
395
395
  let displayTimeValue = '00:00:00';
@@ -404,8 +404,8 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
404
404
  text: displayTimeValue.slice(0, 2).includes(':') ? displayTimeValue.slice(9, 11) : displayTimeValue.slice(10, 12)
405
405
  });
406
406
  } else {
407
- displayTimeValue = `${date(currentTime).format(displayFormat)} ${mode12h ? timeValue === null || timeValue === void 0 ? void 0 : timeValue.text : ''}`;
408
- returnTimeValue = `${date(currentTime).format(returnFormat)} ${mode12h ? timeValue === null || timeValue === void 0 ? void 0 : timeValue.text : ''}`;
407
+ displayTimeValue = `${date(currentTime).format(displayFormat)}${mode12h ? ` ${timeValue === null || timeValue === void 0 ? void 0 : timeValue.text}` : ''}`;
408
+ returnTimeValue = `${date(currentTime).format(returnFormat)}${mode12h ? ` ${timeValue === null || timeValue === void 0 ? void 0 : timeValue.text}` : ''}`;
409
409
  }
410
410
  if (!now) {
411
411
  setDisplayTime(displayTimeValue);
@@ -420,12 +420,22 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
420
420
  // useEffect for prop value
421
421
  useEffect(() => {
422
422
  if (!value) {
423
- setTimeValue({
424
- hour: min ? min.slice(0, 2) : mode12h ? 1 : 0,
425
- minute: min ? min.slice(3, 5) : 0,
426
- second: min ? min.slice(6, 8) : 0,
427
- text: min ? min.slice(10, 12) || 'AM' : 'AM'
428
- });
423
+ if (!mode12h) {
424
+ const timeValue = {
425
+ hour: min ? min.slice(0, 2) : mode12h ? 1 : 0,
426
+ minute: min ? min.slice(3, 5) : 0,
427
+ second: min ? min.slice(6, 8) : 0
428
+ };
429
+ setTimeValue(timeValue);
430
+ } else {
431
+ const timeValue = {
432
+ hour: min ? min.slice(0, 2) : mode12h ? 1 : 0,
433
+ minute: min ? min.slice(3, 5) : 0,
434
+ second: min ? min.slice(6, 8) : 0,
435
+ text: min ? (returnFormat === 'HH:mm:ss' ? min.slice(10, 12) : min.slice(6, 8)) || 'AM' : 'AM'
436
+ };
437
+ setTimeValue(timeValue);
438
+ }
429
439
  setDisplayTime(null);
430
440
  } else {
431
441
  let displayTimeValue = '00:00:00';
@@ -433,13 +443,22 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
433
443
  const valueMinute = Number(value.slice(3, 5)) || '00';
434
444
  const valueSecond = Number(value.slice(6, 8)) || '00';
435
445
  const valueTime = new Date(new Date().getFullYear(), 0, 1, valueHour, valueMinute, valueSecond);
436
- displayTimeValue = formatTime(valueTime, displayFormat);
437
- setTimeValue({
438
- hour: value.slice(0, 2),
439
- minute: value.slice(3, 5),
440
- second: value.slice(6, 8),
441
- text: value.slice(10, 12)
442
- });
446
+ displayTimeValue = formatTime(valueTime, displayFormat).slice(0, -3).concat(returnFormat === 'HH:mm:ss' ? ` ${value.slice(10, 12)}` : ` ${value.slice(6, 8)}`);
447
+ if (!mode12h) {
448
+ setTimeValue({
449
+ hour: value.slice(0, 2),
450
+ minute: value.slice(3, 5),
451
+ second: value.slice(6, 8)
452
+ });
453
+ } else {
454
+ const timeValue = {
455
+ hour: value.slice(0, 2),
456
+ minute: value.slice(3, 5),
457
+ second: returnFormat === 'HH:mm:ss' ? value.slice(6, 8) : '00',
458
+ text: returnFormat === 'HH:mm:ss' ? value.slice(10, 12) : value.slice(6, 8)
459
+ };
460
+ setTimeValue(timeValue);
461
+ }
443
462
  setDisplayTime(displayTimeValue);
444
463
  }
445
464
  }, [value, displayFormat, returnFormat, mode12h, min, max]);
@@ -477,7 +496,23 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
477
496
  disabled: disabled,
478
497
  required: required,
479
498
  ...labelProps
480
- }, label), jsx(Popover, {
499
+ }, label), readOnly ? jsx(InputBase, {
500
+ inputProps: {
501
+ placeholder: !readOnly && !disabled ? placeholder : '',
502
+ ...inputProps
503
+ },
504
+ disabled: disabled,
505
+ viewType: viewType,
506
+ inputStyle: {
507
+ ...inputStyle
508
+ },
509
+ value: displayTime,
510
+ endIcon: endIcon,
511
+ startIcon: startIcon,
512
+ onKeyDown: e => e.preventDefault(),
513
+ status: error ? 'danger' : 'default',
514
+ readOnly: true
515
+ }) : jsx(Popover, {
481
516
  css: _TimePickerCSS,
482
517
  anchor: jsx(InputBase, {
483
518
  inputProps: {
@@ -725,24 +760,6 @@ const TimePickerAMPMCSS = (currentText, {
725
760
  ${parseWidth(32)};
726
761
  }
727
762
  `;
728
-
729
- // TimePicker.defaultProps = {
730
- // actionIconAt: 'end',
731
- // className: '',
732
- // disabled: false,
733
- // displayFormat: 'HH:mm:ss',
734
- // mode12h: false,
735
- // readOnly: false,
736
- // required: false,
737
- // returnFormat: 'HH:mm:ss',
738
- // error: '',
739
- // minuteStep: 1,
740
- // min: '',
741
- // max: '',
742
- // label: '',
743
- // value: '',
744
- // };
745
-
746
763
  TimePicker.propTypes = {
747
764
  /** CSS class for the component. ({container: '', header: '', body: '', footer: ''}) */
748
765
  className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.35",
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.36-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
@@ -42,6 +42,17 @@ npm test
42
42
 
43
43
  ## Changelog
44
44
 
45
+ ## 1.4.36
46
+
47
+ - \[Fixed\]: TimePicker – Fix show popover when readOnly is true, fix return value contain space
48
+ - \[Changed\]: index.stories.js – Add props to components in index.stories.js
49
+ - \[Fixed\]: DatePicker – Fix still open popup when readOnly
50
+ - \[Fixed\]: DateRangePicker – Fix still open popup when readOnly
51
+
52
+ ## 1.4.35
53
+
54
+ * [Changed\]: DropdownBox - Added props allowInput, disabled, displayExpr, error, valueExpr, helperTextProps
55
+
45
56
  ## 1.4.34
46
57
 
47
58
  - \[Fixed]: DatePicker – Fix disabled navigator on first render
@@ -1367,3 +1378,5 @@ npm test
1367
1378
  - \[Added\]: Icon component for DHR/ERP
1368
1379
  - \[Changed\]: Progress/Linear component
1369
1380
  - \[Changed\]: Form/Dropdown component
1381
+
1382
+ [Added]: Adde