diginet-core-ui 1.3.78 → 1.3.79
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.
- package/components/accordion/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable react/prop-types */
|
|
4
|
-
|
|
5
3
|
/** @jsxRuntime classic */
|
|
6
|
-
|
|
7
4
|
/** @jsx jsx */
|
|
8
5
|
import { useEffect, useRef } from 'react';
|
|
9
6
|
import { jsx, css } from '@emotion/core';
|
|
@@ -17,32 +14,27 @@ const easing = {
|
|
|
17
14
|
return Math.pow(pos - 1, 3) - 1;
|
|
18
15
|
}
|
|
19
16
|
};
|
|
20
|
-
|
|
21
17
|
const addZero = i => {
|
|
22
18
|
if (i < 10) {
|
|
23
19
|
i = '0' + i;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
return i;
|
|
27
|
-
};
|
|
22
|
+
};
|
|
28
23
|
|
|
24
|
+
//get hours of day
|
|
29
25
|
|
|
30
26
|
const getHours = () => {
|
|
31
27
|
let hours = [],
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
i = 0;
|
|
34
29
|
for (i; i < 24; i++) {
|
|
35
30
|
hours.push({
|
|
36
31
|
value: i,
|
|
37
32
|
text: addZero(i)
|
|
38
33
|
});
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return hours;
|
|
42
36
|
};
|
|
43
|
-
|
|
44
37
|
const gradient = 'rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0)';
|
|
45
|
-
|
|
46
38
|
const Swiper = props => {
|
|
47
39
|
//properties
|
|
48
40
|
const {
|
|
@@ -60,8 +52,9 @@ const Swiper = props => {
|
|
|
60
52
|
value,
|
|
61
53
|
width,
|
|
62
54
|
...other
|
|
63
|
-
} = props;
|
|
55
|
+
} = props;
|
|
64
56
|
|
|
57
|
+
//id + class
|
|
65
58
|
const Id = randomString({
|
|
66
59
|
allowSymbol: false,
|
|
67
60
|
allowNumber: false
|
|
@@ -73,12 +66,14 @@ const Swiper = props => {
|
|
|
73
66
|
highlightOption: 'DCUI-swiper-highlight-option' + Id,
|
|
74
67
|
mainSelector: 'DCUI-swiper-main-selector' + Id,
|
|
75
68
|
mainOption: 'DCUI-swiper-main-option' + Id
|
|
76
|
-
};
|
|
69
|
+
};
|
|
77
70
|
|
|
71
|
+
//reference
|
|
78
72
|
const containerRef = useRef(null);
|
|
79
73
|
const mainSelectorRef = useRef(null);
|
|
80
|
-
const highlightSelectorRef = useRef(null);
|
|
74
|
+
const highlightSelectorRef = useRef(null);
|
|
81
75
|
|
|
76
|
+
//variables
|
|
82
77
|
const thisCount = count - count % 4;
|
|
83
78
|
const itemAngle = 360 / thisCount;
|
|
84
79
|
const itemHeight = Math.ceil(height * 3 / thisCount);
|
|
@@ -95,8 +90,8 @@ const Swiper = props => {
|
|
|
95
90
|
touchstart: null,
|
|
96
91
|
touchmove: null,
|
|
97
92
|
touchend: null
|
|
98
|
-
};
|
|
99
|
-
|
|
93
|
+
};
|
|
94
|
+
//style
|
|
100
95
|
const styles = {
|
|
101
96
|
container: css`
|
|
102
97
|
* {
|
|
@@ -178,24 +173,18 @@ const Swiper = props => {
|
|
|
178
173
|
}
|
|
179
174
|
`
|
|
180
175
|
};
|
|
181
|
-
|
|
182
176
|
const renderSwiper = data => {
|
|
183
177
|
if (!data.length) return;
|
|
184
|
-
|
|
185
178
|
if (type === 'infinite') {
|
|
186
179
|
let concatData = [].concat(data);
|
|
187
|
-
|
|
188
180
|
while (concatData.length < data) {
|
|
189
181
|
concatData = concatData.concat(data);
|
|
190
182
|
}
|
|
191
|
-
|
|
192
183
|
data = concatData;
|
|
193
184
|
}
|
|
194
|
-
|
|
195
185
|
let lengthData = data.length,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
186
|
+
mainOptions = '',
|
|
187
|
+
highlightOptions = '';
|
|
199
188
|
for (let i in data) {
|
|
200
189
|
mainOptions += `<li
|
|
201
190
|
class="${IDs.mainOption}"
|
|
@@ -217,7 +206,6 @@ const Swiper = props => {
|
|
|
217
206
|
${data[i].text || data[i].value}
|
|
218
207
|
</li>`;
|
|
219
208
|
}
|
|
220
|
-
|
|
221
209
|
if (type === 'infinite') {
|
|
222
210
|
for (let i = 0; i < thisCount / 4; i++) {
|
|
223
211
|
mainOptions = `<li
|
|
@@ -244,7 +232,6 @@ const Swiper = props => {
|
|
|
244
232
|
data-index="${i + lengthData}">
|
|
245
233
|
${data[i].text || data[i].value}</li>`;
|
|
246
234
|
}
|
|
247
|
-
|
|
248
235
|
highlightOptions = `<li
|
|
249
236
|
class="${IDs.highlightOption}"
|
|
250
237
|
style="
|
|
@@ -260,27 +247,21 @@ const Swiper = props => {
|
|
|
260
247
|
highlightSelectorRef.current.style.top = direction === 'vertical' ? -itemHeight - 2 + 'px' : 'auto';
|
|
261
248
|
highlightSelectorRef.current.style.left = direction === 'vertical' ? 'auto' : -itemWidth - 2 + 'px';
|
|
262
249
|
}
|
|
263
|
-
|
|
264
250
|
mainSelectorRef.current.innerHTML = mainOptions;
|
|
265
251
|
highlightSelectorRef.current.innerHTML = highlightOptions;
|
|
266
252
|
};
|
|
267
|
-
|
|
268
253
|
const normalizeScroll = scroll => {
|
|
269
254
|
let normalizedScroll = scroll;
|
|
270
|
-
|
|
271
255
|
while (normalizedScroll < 0) {
|
|
272
256
|
normalizedScroll += data.length;
|
|
273
257
|
}
|
|
274
|
-
|
|
275
258
|
normalizedScroll = normalizedScroll % data.length;
|
|
276
259
|
return normalizedScroll;
|
|
277
260
|
};
|
|
278
|
-
|
|
279
261
|
const moveTo = scroll => {
|
|
280
262
|
if (type === 'infinite') {
|
|
281
263
|
scroll = normalizeScroll(scroll);
|
|
282
264
|
}
|
|
283
|
-
|
|
284
265
|
if (!mainSelectorRef.current) return;
|
|
285
266
|
mainSelectorRef.current.style.transform = `translate3d(0, 0, ${-radius}px) rotateX(${itemAngle * scroll}deg)`;
|
|
286
267
|
highlightSelectorRef.current.style.transform = `translate3d(0, ${-scroll * (direction === 'vertical' ? itemHeight : itemWidth)}px, 0)`;
|
|
@@ -294,27 +275,22 @@ const Swiper = props => {
|
|
|
294
275
|
});
|
|
295
276
|
return scroll;
|
|
296
277
|
};
|
|
297
|
-
|
|
298
278
|
const stop = () => {
|
|
299
279
|
thisMoving = false;
|
|
300
280
|
cancelAnimationFrame(thisMoveT);
|
|
301
281
|
};
|
|
302
|
-
|
|
303
282
|
const animateToScroll = (initScroll, finalScroll, t, easingName = 'easingOutCubic') => {
|
|
304
283
|
if (initScroll === finalScroll || t === 0) {
|
|
305
284
|
moveTo(initScroll);
|
|
306
285
|
return;
|
|
307
286
|
}
|
|
308
|
-
|
|
309
287
|
let start = new Date().getTime() / 1200;
|
|
310
288
|
let pass = 0;
|
|
311
289
|
let totalScrollLen = finalScroll - initScroll;
|
|
312
290
|
return new Promise(resolve => {
|
|
313
291
|
thisMoving = true;
|
|
314
|
-
|
|
315
292
|
let tick = () => {
|
|
316
293
|
pass = new Date().getTime() / 1200 - start;
|
|
317
|
-
|
|
318
294
|
if (pass < t) {
|
|
319
295
|
thisScroll = moveTo(initScroll + easing[easingName](pass / t) * totalScrollLen);
|
|
320
296
|
thisMoveT = requestAnimationFrame(tick);
|
|
@@ -324,26 +300,21 @@ const Swiper = props => {
|
|
|
324
300
|
thisScroll = moveTo(initScroll + totalScrollLen);
|
|
325
301
|
}
|
|
326
302
|
};
|
|
327
|
-
|
|
328
303
|
tick();
|
|
329
304
|
});
|
|
330
305
|
};
|
|
331
|
-
|
|
332
306
|
const selectByScroll = scroll => {
|
|
333
307
|
scroll = normalizeScroll(scroll) | 0;
|
|
334
|
-
|
|
335
308
|
if (scroll > data.length - 1) {
|
|
336
309
|
scroll = data.length - 1;
|
|
337
310
|
moveTo(scroll);
|
|
338
311
|
}
|
|
339
|
-
|
|
340
312
|
moveTo(scroll);
|
|
341
313
|
thisScroll = scroll;
|
|
342
314
|
thisSelected = data[scroll];
|
|
343
315
|
thisValue = thisSelected.value;
|
|
344
316
|
if (onChange) onChange(thisSelected);
|
|
345
317
|
};
|
|
346
|
-
|
|
347
318
|
const select = value => {
|
|
348
319
|
for (let i in data) {
|
|
349
320
|
if (data[i].value === value) {
|
|
@@ -356,10 +327,8 @@ const Swiper = props => {
|
|
|
356
327
|
return;
|
|
357
328
|
}
|
|
358
329
|
}
|
|
359
|
-
|
|
360
330
|
throw new Error(`Can not select value: ${value}, ${value} match nothing in current data`);
|
|
361
331
|
};
|
|
362
|
-
|
|
363
332
|
const animateMoveByInitV = async initV => {
|
|
364
333
|
let initScroll;
|
|
365
334
|
let finalScroll;
|
|
@@ -367,7 +336,6 @@ const Swiper = props => {
|
|
|
367
336
|
let totalScrollLen;
|
|
368
337
|
let a;
|
|
369
338
|
let t;
|
|
370
|
-
|
|
371
339
|
if (type === 'infinite') {
|
|
372
340
|
initScroll = thisScroll;
|
|
373
341
|
a = initV > 0 ? -thisA : thisA;
|
|
@@ -398,10 +366,8 @@ const Swiper = props => {
|
|
|
398
366
|
await animateToScroll(thisScroll, finalScroll, t);
|
|
399
367
|
}
|
|
400
368
|
}
|
|
401
|
-
|
|
402
369
|
selectByScroll(thisScroll);
|
|
403
370
|
};
|
|
404
|
-
|
|
405
371
|
const touchstart = (e, touchData, parent) => {
|
|
406
372
|
parent.addEventListener('touchmove', events.touchmove, {
|
|
407
373
|
passive: true
|
|
@@ -413,18 +379,14 @@ const Swiper = props => {
|
|
|
413
379
|
touchData.touchScroll = thisScroll;
|
|
414
380
|
stop();
|
|
415
381
|
};
|
|
416
|
-
|
|
417
382
|
const touchmove = (e, touchData, parent) => {
|
|
418
383
|
let event = e.clientY || e.touches[0].clientY;
|
|
419
384
|
touchData.array.push([event, new Date().getTime()]);
|
|
420
|
-
|
|
421
385
|
if (touchData.array.length > 5) {
|
|
422
386
|
touchData.array.unshift();
|
|
423
387
|
}
|
|
424
|
-
|
|
425
388
|
let scrollAdd = (touchData.start - event) / (direction === 'vertical' ? itemHeight : itemWidth);
|
|
426
389
|
let moveToScroll = scrollAdd + thisScroll;
|
|
427
|
-
|
|
428
390
|
if (type === 'infinite') {
|
|
429
391
|
moveToScroll = normalizeScroll(moveToScroll);
|
|
430
392
|
} else {
|
|
@@ -434,17 +396,14 @@ const Swiper = props => {
|
|
|
434
396
|
moveToScroll = data.length + (moveToScroll - data.length) * 0.3;
|
|
435
397
|
}
|
|
436
398
|
}
|
|
437
|
-
|
|
438
399
|
touchData.touchScroll = moveTo(moveToScroll);
|
|
439
400
|
};
|
|
440
|
-
|
|
441
401
|
const touchend = (e, touchData, parent) => {
|
|
442
402
|
parent.removeEventListener('touchmove', events.touchmove, {
|
|
443
403
|
passive: true
|
|
444
404
|
});
|
|
445
405
|
parent.removeEventListener('mousemove', events.touchmove);
|
|
446
406
|
let v;
|
|
447
|
-
|
|
448
407
|
if (touchData.array.length === 1) {
|
|
449
408
|
v = 0;
|
|
450
409
|
} else {
|
|
@@ -456,48 +415,39 @@ const Swiper = props => {
|
|
|
456
415
|
let sign = v > 0 ? 1 : -1;
|
|
457
416
|
v = Math.abs(v) > 30 ? 30 * sign : v;
|
|
458
417
|
}
|
|
459
|
-
|
|
460
418
|
thisScroll = touchData.touchScroll;
|
|
461
419
|
animateMoveByInitV(v);
|
|
462
420
|
};
|
|
463
|
-
|
|
464
421
|
const init = parent => {
|
|
465
422
|
renderSwiper(data);
|
|
466
423
|
let touchData = {
|
|
467
424
|
start: 0,
|
|
468
425
|
array: []
|
|
469
426
|
};
|
|
470
|
-
|
|
471
427
|
events.touchstart = e => {
|
|
472
428
|
if (parent.contains(e.target) || e.target === parent) {
|
|
473
429
|
e.preventDefault();
|
|
474
|
-
|
|
475
430
|
if (data.length) {
|
|
476
431
|
touchstart(e, touchData, parent);
|
|
477
432
|
}
|
|
478
433
|
}
|
|
479
434
|
};
|
|
480
|
-
|
|
481
435
|
events.touchmove = e => {
|
|
482
436
|
if (parent.contains(e.target) || e.target === parent) {
|
|
483
437
|
e.preventDefault();
|
|
484
|
-
|
|
485
438
|
if (data.length) {
|
|
486
439
|
touchmove(e, touchData, parent);
|
|
487
440
|
}
|
|
488
441
|
}
|
|
489
442
|
};
|
|
490
|
-
|
|
491
443
|
events.touchend = e => {
|
|
492
444
|
if (parent.contains(e.target) || e.target === parent) {
|
|
493
445
|
e.preventDefault();
|
|
494
|
-
|
|
495
446
|
if (data.length) {
|
|
496
447
|
touchend(e, touchData, parent);
|
|
497
448
|
}
|
|
498
449
|
}
|
|
499
450
|
};
|
|
500
|
-
|
|
501
451
|
parent.addEventListener('touchstart', events.touchstart, {
|
|
502
452
|
passive: true
|
|
503
453
|
});
|
|
@@ -506,30 +456,26 @@ const Swiper = props => {
|
|
|
506
456
|
});
|
|
507
457
|
parent.addEventListener('mousedown', events.touchstart);
|
|
508
458
|
parent.addEventListener('mouseup', events.touchend);
|
|
509
|
-
|
|
510
459
|
if (data.length) {
|
|
511
460
|
thisValue = defaultValue ? defaultValue : data[0].value;
|
|
512
461
|
select(thisValue);
|
|
513
462
|
}
|
|
514
463
|
};
|
|
515
|
-
|
|
516
464
|
const destroy = parent => {
|
|
517
465
|
stop();
|
|
518
|
-
|
|
519
466
|
for (let eventName in events) {
|
|
520
467
|
parent.removeEventListener(eventName, events[eventName]);
|
|
521
468
|
}
|
|
522
|
-
|
|
523
469
|
parent.removeEventListener('mousedown', events.touchstart);
|
|
524
470
|
parent.removeEventListener('mousemove', events.touchmove);
|
|
525
471
|
parent.removeEventListener('mouseup', events.touchend);
|
|
526
472
|
parent.innerHTML = '';
|
|
527
|
-
};
|
|
473
|
+
};
|
|
474
|
+
// useEffect(() => {
|
|
528
475
|
// const parent = (parentNode && parentNode.current) || (containerRef.current && containerRef.current.parentNode);
|
|
529
476
|
// init(parent);
|
|
530
477
|
// });
|
|
531
478
|
|
|
532
|
-
|
|
533
479
|
useEffect(() => {
|
|
534
480
|
const parent = parentNode && parentNode.current || containerRef.current && containerRef.current.parentNode;
|
|
535
481
|
init(parent);
|
|
@@ -542,17 +488,20 @@ const Swiper = props => {
|
|
|
542
488
|
select(value);
|
|
543
489
|
}
|
|
544
490
|
}, [value]);
|
|
545
|
-
return jsx("div", {
|
|
491
|
+
return jsx("div", {
|
|
492
|
+
...other,
|
|
546
493
|
className: IDs.container,
|
|
547
494
|
css: styles.container,
|
|
548
495
|
ref: containerRef,
|
|
549
|
-
style: {
|
|
496
|
+
style: {
|
|
497
|
+
...containerStyle
|
|
550
498
|
}
|
|
551
499
|
}, jsx("ul", {
|
|
552
500
|
className: IDs.mainSelector,
|
|
553
501
|
css: styles.mainSelector,
|
|
554
502
|
ref: mainSelectorRef,
|
|
555
|
-
style: {
|
|
503
|
+
style: {
|
|
504
|
+
...mainSelectorStyle
|
|
556
505
|
}
|
|
557
506
|
}), jsx("div", {
|
|
558
507
|
className: IDs.highlight,
|
|
@@ -563,7 +512,6 @@ const Swiper = props => {
|
|
|
563
512
|
ref: highlightSelectorRef
|
|
564
513
|
})));
|
|
565
514
|
};
|
|
566
|
-
|
|
567
515
|
Swiper.defaultProps = {
|
|
568
516
|
containerStyle: {},
|
|
569
517
|
count: 18,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -51,7 +50,6 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
51
50
|
if (!inputRef) {
|
|
52
51
|
inputRef = useRef(null);
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
const [checkedState, setCheckedState] = useState(Boolean(checked !== undefined ? checked : defaultChecked));
|
|
56
54
|
const padding = spacing(0.5);
|
|
57
55
|
const formCheck = css`
|
|
@@ -137,19 +135,18 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
137
135
|
allowNumber: false,
|
|
138
136
|
allowSymbol: false
|
|
139
137
|
});
|
|
140
|
-
|
|
141
138
|
const handleChange = () => {
|
|
142
139
|
if (disabled || readOnly) return;
|
|
143
140
|
setCheckedState(checked !== undefined ? Boolean(checked) : !checkedState);
|
|
144
141
|
const e = {
|
|
145
142
|
value: !checkedState,
|
|
146
|
-
target: {
|
|
143
|
+
target: {
|
|
144
|
+
...inputRef.current,
|
|
147
145
|
checked: !checkedState
|
|
148
146
|
}
|
|
149
147
|
};
|
|
150
148
|
if (onChange) onChange(e);
|
|
151
149
|
};
|
|
152
|
-
|
|
153
150
|
useEffect(() => {
|
|
154
151
|
if (checked !== undefined) setCheckedState(Boolean(checked));
|
|
155
152
|
}, [checked]);
|
|
@@ -158,7 +155,8 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
158
155
|
css: formCheck,
|
|
159
156
|
ref: ref,
|
|
160
157
|
...props
|
|
161
|
-
}, jsx("input", {
|
|
158
|
+
}, jsx("input", {
|
|
159
|
+
...inputProps,
|
|
162
160
|
ref: inputRef,
|
|
163
161
|
hidden: true,
|
|
164
162
|
name: name,
|
|
@@ -205,47 +203,34 @@ Toggle.defaultProps = {
|
|
|
205
203
|
Toggle.propTypes = {
|
|
206
204
|
/** * If `true`, the component is disabled. */
|
|
207
205
|
disabled: PropTypes.bool,
|
|
208
|
-
|
|
209
206
|
/** prevent all event if true */
|
|
210
207
|
readOnly: PropTypes.bool,
|
|
211
|
-
|
|
212
208
|
/** If `true`, the component is defaultChecked. */
|
|
213
209
|
defaultChecked: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([0, 1])]),
|
|
214
|
-
|
|
215
210
|
/** If `true`, the component is checked. */
|
|
216
211
|
checked: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([0, 1])]),
|
|
217
|
-
|
|
218
212
|
/** Id is randomized randomly to avoid duplication. */
|
|
219
213
|
id: PropTypes.string,
|
|
220
|
-
|
|
221
214
|
/** Name attribute of the `input` element. */
|
|
222
215
|
name: PropTypes.string,
|
|
223
|
-
|
|
224
216
|
/** The name of the Radio is displayed on the interface */
|
|
225
217
|
label: PropTypes.string,
|
|
226
|
-
|
|
227
218
|
/** height is a number, height of Toggle default 20 */
|
|
228
219
|
height: PropTypes.number,
|
|
229
|
-
|
|
230
220
|
/** width is a number, width of Toggle default 40 */
|
|
231
221
|
width: PropTypes.number,
|
|
232
|
-
|
|
233
222
|
/** props for input */
|
|
234
223
|
inputProps: PropTypes.object,
|
|
235
|
-
|
|
236
224
|
/** The line-clamp property truncates text at a specific number of Label. */
|
|
237
225
|
lineClamp: PropTypes.number,
|
|
238
|
-
|
|
239
226
|
/** Shows tooltip containing Label on hover */
|
|
240
227
|
hoverTooltip: PropTypes.bool,
|
|
241
|
-
|
|
242
228
|
/** * Callback fired when the state is changed.
|
|
243
229
|
*
|
|
244
230
|
* @param {object} event The event source of the callback.
|
|
245
231
|
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
246
232
|
*/
|
|
247
233
|
onChange: PropTypes.func,
|
|
248
|
-
|
|
249
234
|
/** If `true`, the label will indicate that the checkbox is required. */
|
|
250
235
|
required: PropTypes.bool
|
|
251
236
|
};
|
|
@@ -14,7 +14,8 @@ const HelperText = /*#__PURE__*/memo(({
|
|
|
14
14
|
};
|
|
15
15
|
return /*#__PURE__*/React.createElement(Typography, {
|
|
16
16
|
type: 'p3',
|
|
17
|
-
style: {
|
|
17
|
+
style: {
|
|
18
|
+
...helperText,
|
|
18
19
|
...style
|
|
19
20
|
},
|
|
20
21
|
...props
|
|
@@ -26,7 +27,6 @@ HelperText.defaultProps = {
|
|
|
26
27
|
HelperText.propTypes = {
|
|
27
28
|
/** helper text for input */
|
|
28
29
|
text: PropTypes.string,
|
|
29
|
-
|
|
30
30
|
/** style inline of helper text in HelperText component */
|
|
31
31
|
style: PropTypes.object
|
|
32
32
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx, css } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -7,7 +6,6 @@ import Input from '../form-view/input';
|
|
|
7
6
|
import Label from '../form-view/label';
|
|
8
7
|
import HelperText from '../form-view/helper-text';
|
|
9
8
|
import { dark4 } from '../../styles/colors';
|
|
10
|
-
|
|
11
9
|
const FormLabel = ({
|
|
12
10
|
label,
|
|
13
11
|
inputProps,
|
|
@@ -54,7 +52,6 @@ const FormLabel = ({
|
|
|
54
52
|
...helperTextProps
|
|
55
53
|
}));
|
|
56
54
|
};
|
|
57
|
-
|
|
58
55
|
FormLabel.defaultProps = {
|
|
59
56
|
label: '',
|
|
60
57
|
value: '',
|
|
@@ -69,37 +66,26 @@ FormLabel.defaultProps = {
|
|
|
69
66
|
FormLabel.propTypes = {
|
|
70
67
|
/** utc for Form label */
|
|
71
68
|
utc: PropTypes.bool,
|
|
72
|
-
|
|
73
69
|
/** thousandSeparator for Form label */
|
|
74
70
|
thousandSeparator: PropTypes.bool,
|
|
75
|
-
|
|
76
71
|
/** thousandChar for Form label */
|
|
77
72
|
thousandChar: PropTypes.string,
|
|
78
|
-
|
|
79
73
|
/** label for Form label */
|
|
80
74
|
label: PropTypes.string,
|
|
81
|
-
|
|
82
75
|
/** the displayed value for each change */
|
|
83
76
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
84
|
-
|
|
85
77
|
/** text for Form label */
|
|
86
78
|
text: PropTypes.string,
|
|
87
|
-
|
|
88
79
|
/** viewType for Form label */
|
|
89
80
|
viewType: PropTypes.string,
|
|
90
|
-
|
|
91
81
|
/** dataType for Form label */
|
|
92
82
|
dataType: PropTypes.string,
|
|
93
|
-
|
|
94
83
|
/** props of span in InputView comp** dataType for Form label */
|
|
95
84
|
format: PropTypes.string,
|
|
96
|
-
|
|
97
85
|
/** props of span in format component */
|
|
98
86
|
inputProps: PropTypes.object,
|
|
99
|
-
|
|
100
87
|
/** style inline of span in InputView component */
|
|
101
88
|
inputStyleProps: PropTypes.object,
|
|
102
|
-
|
|
103
89
|
/** props for helper text */
|
|
104
90
|
helperTextProps: PropTypes.object
|
|
105
91
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx, css } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -20,7 +19,6 @@ const InputView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
20
19
|
if (!ref) {
|
|
21
20
|
ref = useRef(null);
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
const inputRef = useRef(null);
|
|
25
23
|
const TextInput = viewType !== 'outlined' ? css`
|
|
26
24
|
display: flex;
|
|
@@ -71,41 +69,34 @@ const InputView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
71
69
|
pointer-events: none;
|
|
72
70
|
}
|
|
73
71
|
`;
|
|
74
|
-
|
|
75
72
|
const numberWithFormat = (x, thousandChar) => {
|
|
76
73
|
let a = '';
|
|
77
|
-
|
|
78
74
|
switch (thousandChar) {
|
|
79
75
|
case ',':
|
|
80
76
|
a = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
81
77
|
break;
|
|
82
|
-
|
|
83
78
|
case '.':
|
|
84
79
|
a = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
85
80
|
break;
|
|
86
|
-
|
|
87
81
|
default:
|
|
88
82
|
a = x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
89
83
|
}
|
|
90
|
-
|
|
91
84
|
return a;
|
|
92
85
|
};
|
|
93
|
-
|
|
94
86
|
const dateWithFormat = date => {
|
|
95
87
|
value = formatDate(date, format, utc);
|
|
96
88
|
return value;
|
|
97
89
|
};
|
|
98
|
-
|
|
99
90
|
useEffect(() => {
|
|
100
91
|
if (dataType === 'integer' && format !== null) {
|
|
101
92
|
inputRef.current.innerHTML = numberWithFormat(value, thousandChar);
|
|
102
93
|
}
|
|
103
|
-
|
|
104
94
|
if (dataType === 'date' && format !== null) {
|
|
105
95
|
inputRef.current.innerHTML = dateWithFormat(value);
|
|
106
96
|
}
|
|
107
97
|
}, [value]);
|
|
108
|
-
return useMemo(() => jsx("span", {
|
|
98
|
+
return useMemo(() => jsx("span", {
|
|
99
|
+
...inputProps,
|
|
109
100
|
style: inputStyleProps,
|
|
110
101
|
css: TextInput,
|
|
111
102
|
ref: inputRef
|
|
@@ -117,10 +108,8 @@ InputView.defaultProps = {
|
|
|
117
108
|
InputView.propTypes = {
|
|
118
109
|
/** the displayed value for each change */
|
|
119
110
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
120
|
-
|
|
121
111
|
/** props of span in InputView component */
|
|
122
112
|
inputProps: PropTypes.object,
|
|
123
|
-
|
|
124
113
|
/** style inline of span in InputView component */
|
|
125
114
|
inputStyleProps: PropTypes.object
|
|
126
115
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx, css } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -27,7 +26,6 @@ Label.defaultProps = {
|
|
|
27
26
|
Label.propTypes = {
|
|
28
27
|
/** label for input */
|
|
29
28
|
label: PropTypes.string,
|
|
30
|
-
|
|
31
29
|
/** style inline of label in Label component */
|
|
32
30
|
labelProps: PropTypes.object
|
|
33
31
|
};
|
package/components/grid/Col.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { jsx } from '@emotion/core';
|
|
@@ -28,18 +27,17 @@ const useStyles = makeStyles({
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
|
-
|
|
32
30
|
const Col = props => {
|
|
33
31
|
const classes = useStyles();
|
|
34
32
|
const {
|
|
35
33
|
className
|
|
36
34
|
} = props;
|
|
37
|
-
return jsx(Grid, {
|
|
35
|
+
return jsx(Grid, {
|
|
36
|
+
...props,
|
|
38
37
|
className: classNames(`DGN-UI-Col ${classes.customCol}`, className),
|
|
39
38
|
item: true
|
|
40
39
|
});
|
|
41
40
|
};
|
|
42
|
-
|
|
43
41
|
Col.defaultProps = {
|
|
44
42
|
className: '',
|
|
45
43
|
columns: 12,
|
|
@@ -55,37 +53,26 @@ Col.defaultProps = {
|
|
|
55
53
|
Col.propTypes = {
|
|
56
54
|
/** The content of the component. */
|
|
57
55
|
children: PropTypes.node,
|
|
58
|
-
|
|
59
56
|
/** Class for component. */
|
|
60
57
|
className: PropTypes.string,
|
|
61
|
-
|
|
62
58
|
/** The number of columns. */
|
|
63
59
|
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
|
64
|
-
|
|
65
60
|
/** Defines the `flex-direction` style property. It is applied for all screen sizes. */
|
|
66
61
|
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
67
|
-
|
|
68
62
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `lg` breakpoint and wider screens if not overridden. */
|
|
69
63
|
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
70
|
-
|
|
71
64
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `md` breakpoint and wider screens if not overridden. */
|
|
72
65
|
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
73
|
-
|
|
74
66
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `sm` breakpoint and wider screens if not overridden. */
|
|
75
67
|
sm: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
76
|
-
|
|
77
68
|
/** Style inline of component. */
|
|
78
69
|
style: PropTypes.object,
|
|
79
|
-
|
|
80
70
|
/** Defines the flex-wrap style property. It's applied for all screen sizes. */
|
|
81
71
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
|
|
82
|
-
|
|
83
72
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the `xl` breakpoint and wider screens if not overridden. */
|
|
84
73
|
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
85
|
-
|
|
86
74
|
/** If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for all the screen sizes with the lowest priority. */
|
|
87
75
|
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
88
|
-
|
|
89
76
|
/** If `true`, it sets `min-width: 0` on the item. Refer to the limitations section of the documentation to better understand the use case. */
|
|
90
77
|
zeroMinWidth: PropTypes.bool
|
|
91
78
|
};
|