diginet-core-ui 1.4.37 → 1.4.38-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.
@@ -0,0 +1,16 @@
1
+ <svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_1903_45)">
3
+ <path d="M36.5 35C36.5 35.8 35.9 36.5 35 36.5V39C37.2 39 39 37.2 39 35V30.5L36.5 33.3V35ZM36.5 6.7L21 0.3C20.5 0.1 20 0 19.5 0C19 0 18.5 0.1 18 0.3L2.5 6.7C1 7.3 0 8.7 0 10.4V35C0 37.2 1.8 39 4 39H23.3V36.5H4C3.2 36.5 2.5 35.8 2.5 35V10.4C2.5 9.8 2.9 9.3 3.4 9L18.9 2.6C19.1 2.5 19.3 2.5 19.5 2.5C19.7 2.5 19.9 2.5 20.1 2.6L35.6 9C36.2 9.2 36.5 9.8 36.5 10.4V23.5L39 25.8V10.4C39 8.7 38 7.3 36.5 6.7Z" fill="#FF8C00"/>
4
+ <path d="M23.6 14.7C23.6 14.8 23.6 14.9 23.6 15H9.3C8.6 15 8 14.4 8 13.8C8 13.2 8.6 12.5 9.3 12.5H24C23.7 13.2 23.6 13.9 23.6 14.7Z" fill="#FF8C00"/>
5
+ <path d="M26.2 19.5C25.6 19.8 25.1 20.1 24.6 20.6C24.4 20.8 24.2 21.1 24 21.4L23.3 22H18.9L18.7 21.7C18.2 21.1 17.5 20.8 16.7 20.7C16.6 20.7 16.5 20.7 16.4 20.7C15.9 20.7 15.5 20.8 15.1 21L11 19.5H26.2Z" fill="#FF8C00"/>
6
+ <path d="M16.9 29H9.3C8.6 29 8 28.4 8 27.8C8 27.2 8.6 26.5 9.3 26.5H14.7L14.9 26.6L16.9 29Z" fill="#FF8C00"/>
7
+ <path d="M17.9002 22.3999C17.6002 21.9999 17.1002 21.7999 16.6002 21.7999C16.1002 21.7999 15.6002 21.8999 15.2002 22.1999L6.20017 18.9999C6.00017 18.8999 5.60017 19.0999 5.50017 19.3999C5.40017 19.5999 5.50017 19.9999 5.70017 19.9999L12.9002 24.1999L15.6002 25.7999L19.0002 29.6999C19.2002 29.8999 19.4002 30.0999 19.6002 30.1999C19.8002 30.2999 20.1002 30.3999 20.3002 30.3999C20.6002 30.3999 20.8002 30.3999 21.1002 30.2999C21.3002 30.1999 21.6002 30.0999 21.8002 29.8999L23.3002 28.6999V23.4999L20.7002 25.6999L17.9002 22.3999Z" fill="#2680EB"/>
8
+ <path d="M39.0002 27.9999C39.0002 28.2999 39.0002 28.4999 38.9002 28.7999C38.8002 29.0999 38.7002 29.2999 38.5002 29.4999L34.2002 34.2999C34.0002 34.4999 33.8002 34.6999 33.6002 34.7999C33.4002 34.8999 33.1002 34.9999 32.8002 34.9999C32.5002 34.9999 32.3002 34.9999 32.0002 34.8999C31.7002 34.7999 31.5002 34.6999 31.3002 34.4999C31.1002 34.2999 31.0002 34.0999 30.8002 33.8999C30.7002 33.6999 30.6002 33.3999 30.6002 33.0999C30.6002 32.7999 30.6002 32.5999 30.7002 32.2999C30.8002 31.9999 30.9002 31.7999 31.1002 31.5999L34.0002 28.2999L30.0002 24.4999L32.4002 27.7999L30.1002 30.4999C29.8002 30.7999 29.5002 31.2999 29.4002 31.6999C29.3002 32.0999 29.2002 32.5999 29.2002 33.0999C29.2002 33.5999 29.3002 33.9999 29.5002 34.4999C29.7002 34.8999 30.0002 35.2999 30.3002 35.5999C30.8002 35.9999 31.4002 36.2999 32.0002 36.3999C32.6002 36.4999 33.3002 36.4999 33.9002 36.2999V38.9999H24.4002V24.1999C24.4002 23.6999 24.4002 23.1999 24.6002 22.6999C24.8002 22.1999 25.0002 21.7999 25.4002 21.3999C25.8002 20.9999 26.2002 20.6999 26.7002 20.4999C27.2002 20.2999 27.7002 20.1999 28.2002 20.1999H29.9002C30.5002 20.1999 31.1002 20.2999 31.7002 20.5999C32.3002 20.8999 32.7002 21.2999 33.1002 21.7999L38.3002 26.5999C38.5002 26.7999 38.7002 26.9999 38.8002 27.1999C38.9002 27.4999 39.0002 27.6999 39.0002 27.9999Z" fill="#2680EB"/>
9
+ <path d="M27.1002 18.6999C27.8002 18.9999 28.5002 19.1999 29.2002 19.1999C29.9002 19.1999 30.6002 19.0999 31.3002 18.6999C32.0002 18.2999 32.7002 17.6999 33.1002 16.9999C33.6002 16.2999 33.9002 15.4999 34.0002 14.5999C34.0002 13.3999 33.5002 12.1999 32.6002 11.2999C31.7002 10.3999 30.6002 9.8999 29.3002 9.8999C28.1002 9.8999 26.9002 10.3999 26.0002 11.2999C25.1002 12.1999 24.6002 13.3999 24.6002 14.5999C24.6002 15.3999 24.8002 16.2999 25.3002 16.9999C25.8002 17.7999 26.4002 18.3999 27.1002 18.6999Z" fill="#2680EB"/>
10
+ </g>
11
+ <defs>
12
+ <clipPath id="clip0_1903_45">
13
+ <rect width="39" height="39" fill="white"/>
14
+ </clipPath>
15
+ </defs>
16
+ </svg>
@@ -420,6 +420,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
420
420
  };
421
421
  const _onDownload = () => {
422
422
  var _ref2;
423
+ console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
423
424
  const index = chosenItems[0];
424
425
  const file = mountDomain((_ref2 = [...dataState, ...newDataState]) === null || _ref2 === void 0 ? void 0 : _ref2[index]);
425
426
  handleDownload(file === null || file === void 0 ? void 0 : file.URL, file === null || file === void 0 ? void 0 : file.FileName, onDownload);
@@ -1188,7 +1189,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
1188
1189
  const index = chosenItems[0];
1189
1190
  const data = mountDomain([...dataState, ...newDataState][index]);
1190
1191
  const dataType = getType(data);
1191
- if (isBase64URL(data === null || data === void 0 ? void 0 : data.URL) && dataType !== 'image') setShowModal(false);
1192
+ if (isBase64URL(data === null || data === void 0 ? void 0 : data.URL) && !['image', 'pdf'].includes(dataType)) setShowModal(false);
1192
1193
 
1193
1194
  // let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
1194
1195
  return jsx(ModalSample, {
@@ -1196,6 +1197,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
1196
1197
  title: data === null || data === void 0 ? void 0 : data.FileName,
1197
1198
  onClose: () => setShowModal(false)
1198
1199
  }, jsx(Slider, null, jsx(SliderItem, {
1200
+ dataType: dataType,
1199
1201
  url: data === null || data === void 0 ? void 0 : data.URL
1200
1202
  })));
1201
1203
  }, [domain, showModal]);
@@ -255,8 +255,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
255
255
  tableData = [],
256
256
  weekDateFirst = getDateOfWeek(firstDay),
257
257
  weekDateLast = getDateOfWeek(lastDay);
258
- /**
259
- * days of previous month
258
+ /**
259
+ * days of previous month
260
260
  */
261
261
  for (let i = weekDateFirst; i > 0; i--) {
262
262
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth(), 1));
@@ -268,8 +268,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
268
268
  className: unique.day.day
269
269
  })));
270
270
  }
271
- /**
272
- * days of current month
271
+ /**
272
+ * days of current month
273
273
  */
274
274
  for (let i = 0; i < lastDate; i++) {
275
275
  const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
@@ -295,8 +295,8 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, ref
295
295
  type: 'h6'
296
296
  }, i + 1)));
297
297
  }
298
- /**
299
- * days of next month
298
+ /**
299
+ * days of next month
300
300
  */
301
301
  for (let i = 0; i < 13 - weekDateLast; i++) {
302
302
  const day = Date.parse(new Date(time.getFullYear(), time.getMonth() + 1, 0));
@@ -1087,12 +1087,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
1087
1087
  css: _DropdownInputCSS,
1088
1088
  onClick: onClickInput
1089
1089
  }, jsx(Typography, {
1090
+ ...inputProps,
1090
1091
  ref: inputRef,
1091
1092
  hoverTooltip: true,
1092
1093
  lineClamp: multilineSelectedItem ? undefined : 1,
1093
1094
  type: 'p1',
1094
1095
  style: {
1095
- lineHeight: multiple ? '30px' : '24px'
1096
+ lineHeight: multiple ? '30px' : '24px',
1097
+ ...inputStyle
1096
1098
  },
1097
1099
  tabIndex: -1
1098
1100
  }, valueSingle))), jsx("div", {
@@ -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';
@@ -443,7 +443,7 @@ const TimePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
443
443
  const valueMinute = Number(value.slice(3, 5)) || '00';
444
444
  const valueSecond = Number(value.slice(6, 8)) || '00';
445
445
  const valueTime = new Date(new Date().getFullYear(), 0, 1, valueHour, valueMinute, valueSecond);
446
- displayTimeValue = formatTime(valueTime, displayFormat).slice(0, -3).concat(returnFormat === 'HH:mm:ss' ? ` ${value.slice(10, 12)}` : ` ${value.slice(6, 8)}`);
446
+ displayTimeValue = mode12h ? formatTime(valueTime, displayFormat).slice(0, -3).concat(returnFormat === 'HH:mm:ss' ? ` ${value.slice(10, 12)}` : ` ${value.slice(6, 8)}`) : formatTime(valueTime, displayFormat).concat(returnFormat === 'HH:mm:ss' ? ` ${value.slice(10, 12)}` : ` ${value.slice(6, 8)}`);
447
447
  if (!mode12h) {
448
448
  setTimeValue({
449
449
  hour: value.slice(0, 2),
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import CircularProgress from "./..";
4
+ import { CircularProgress } from "./..";
5
5
  import PropTypes from 'prop-types';
6
6
  import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
7
7
  import { animations } from "../../styles/animation";
@@ -30,6 +30,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
30
30
  animation,
31
31
  fileName,
32
32
  url,
33
+ dataType,
33
34
  ...props
34
35
  }, reference) => {
35
36
  const theme = useTheme();
@@ -79,7 +80,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
79
80
  className: IDs.frame,
80
81
  css: _FrameCSS,
81
82
  frameBorder: 0,
82
- src: getIframeLink(),
83
+ src: getIframeLink(filePath),
83
84
  title: fileName,
84
85
  onLoad: iframeLoaded,
85
86
  onError: updateIframeSrc
@@ -133,7 +134,8 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
133
134
  clearInterval(iframeTimeoutId);
134
135
  setIframeTimeoutId(null);
135
136
  };
136
- const getIframeLink = () => {
137
+ const getIframeLink = (data = '') => {
138
+ if (dataType === 'pdf' && data && data.indexOf('data:application/') > -1) return data;
137
139
  return `https://docs.google.com/gview?url=${url}&embedded=true`;
138
140
  };
139
141
  const updateIframeSrc = () => {
@@ -148,6 +150,9 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
148
150
  currentRef.instance = _instance;
149
151
  return currentRef;
150
152
  });
153
+ const handleGetViewer = () => {
154
+ return dataType === 'pdf' ? dataType : getFileType(url, undefined, false);
155
+ };
151
156
  return jsx("div", {
152
157
  className: classNames(IDs.itemContainer, active && 'active', animation && 'item-animation'),
153
158
  css: ItemContainerCSS,
@@ -157,7 +162,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
157
162
  css: LoadingCSS
158
163
  }, jsx(CircularProgress, {
159
164
  size: 'xs'
160
- })), getViewer(url, getFileType(url, undefined, false)));
165
+ })), getViewer(url, handleGetViewer()));
161
166
  }));
162
167
  const ItemContainerCSS = css`
163
168
  ${displayNone};
package/icons/basic.js CHANGED
@@ -4016,6 +4016,64 @@ export const MoneyHistory = /*#__PURE__*/memo(({
4016
4016
  fill: fillColor(color)
4017
4017
  }));
4018
4018
  });
4019
+ export const MoneyList = /*#__PURE__*/memo(({
4020
+ width,
4021
+ height,
4022
+ color = 'system/rest',
4023
+ viewBox = false
4024
+ }) => {
4025
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
4026
+ width: width || 24,
4027
+ height: height || 24,
4028
+ viewBox: "0 0 24 24",
4029
+ fill: "none"
4030
+ }, /*#__PURE__*/React.createElement("path", {
4031
+ fillRule: "evenodd",
4032
+ clipRule: "evenodd",
4033
+ d: "M14 7H21V9H14V7Z",
4034
+ fill: fillColor(color)
4035
+ }), /*#__PURE__*/React.createElement("path", {
4036
+ fillRule: "evenodd",
4037
+ clipRule: "evenodd",
4038
+ d: "M14 11H21V13H14V11Z",
4039
+ fill: fillColor(color)
4040
+ }), /*#__PURE__*/React.createElement("path", {
4041
+ fillRule: "evenodd",
4042
+ clipRule: "evenodd",
4043
+ d: "M14 15H21V17H14V15Z",
4044
+ fill: fillColor(color)
4045
+ }), /*#__PURE__*/React.createElement("path", {
4046
+ fillRule: "evenodd",
4047
+ clipRule: "evenodd",
4048
+ d: "M7.90099 10.8966C5.94059 10.3448 5.58416 9.88506 5.58416 9.24138C5.58416 8.41379 6.38614 7.86207 7.63366 7.86207C8.88119 7.86207 9.50495 8.41379 9.50495 9.42529V9.6092H11.8218V9.33333C11.7327 7.67816 10.7525 6.29885 9.14851 5.83908V4H6.11881V5.93103C4.24752 6.3908 3.17822 7.67816 3.17822 9.24138C3.17822 11.7241 5.49505 12.6437 7.27723 13.0115C9.32673 13.5632 9.59406 14.2069 9.59406 14.8506C9.59406 15.1264 9.41584 16.1379 7.54455 16.1379C6.11881 16.1379 5.31683 15.5862 5.22772 14.4828V14.2989H3V14.5747C3.08911 16.3218 4.24752 17.6092 6.11881 18.069V20H9.05941V18.069C10.9307 17.6092 12 16.4138 12 14.7586C12 12.3678 9.95049 11.4483 7.90099 10.8966Z",
4049
+ fill: fillColor(color)
4050
+ })) : /*#__PURE__*/React.createElement("svg", {
4051
+ width: width || 18,
4052
+ height: height || 16,
4053
+ viewBox: "0 0 18 16",
4054
+ fill: "none"
4055
+ }, /*#__PURE__*/React.createElement("path", {
4056
+ fillRule: "evenodd",
4057
+ clipRule: "evenodd",
4058
+ d: "M11 3H18V5H11V3Z",
4059
+ fill: fillColor(color)
4060
+ }), /*#__PURE__*/React.createElement("path", {
4061
+ fillRule: "evenodd",
4062
+ clipRule: "evenodd",
4063
+ d: "M11 7H18V9H11V7Z",
4064
+ fill: fillColor(color)
4065
+ }), /*#__PURE__*/React.createElement("path", {
4066
+ fillRule: "evenodd",
4067
+ clipRule: "evenodd",
4068
+ d: "M11 11H18V13H11V11Z",
4069
+ fill: fillColor(color)
4070
+ }), /*#__PURE__*/React.createElement("path", {
4071
+ fillRule: "evenodd",
4072
+ clipRule: "evenodd",
4073
+ d: "M4.90099 6.89655C2.94059 6.34483 2.58416 5.88506 2.58416 5.24138C2.58416 4.41379 3.38614 3.86207 4.63366 3.86207C5.88119 3.86207 6.50495 4.41379 6.50495 5.42529V5.6092H8.82178V5.33333C8.73267 3.67816 7.75247 2.29885 6.14851 1.83908V0H3.11881V1.93103C1.24752 2.3908 0.178218 3.67816 0.178218 5.24138C0.178218 7.72414 2.49505 8.64368 4.27723 9.01149C6.32673 9.56322 6.59406 10.2069 6.59406 10.8506C6.59406 11.1264 6.41584 12.1379 4.54455 12.1379C3.11881 12.1379 2.31683 11.5862 2.22772 10.4828V10.2989H0V10.5747C0.0891089 12.3218 1.24752 13.6092 3.11881 14.069V16H6.05941V14.069C7.93069 13.6092 9 12.4138 9 10.7586C9 8.36782 6.95049 7.44828 4.90099 6.89655Z",
4074
+ fill: fillColor(color)
4075
+ }));
4076
+ });
4019
4077
  export const More = /*#__PURE__*/memo(({
4020
4078
  width,
4021
4079
  height,
package/package.json CHANGED
@@ -1,44 +1,78 @@
1
- {
2
- "name": "diginet-core-ui",
3
- "version": "1.4.37",
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.38-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
@@ -42,6 +42,10 @@ npm test
42
42
 
43
43
  ## Changelog
44
44
 
45
+ ## 1.4.37
46
+ - \[Fixed\]: Attachment – Fix the bug where PDF attachments cannot be viewed
47
+ - \[Added\]: Icon – Add MoneyList
48
+
45
49
  ## 1.4.36
46
50
 
47
51
  - \[Fixed\]: TimePicker – Fix show popover when readOnly is true, fix return value contain space