diginet-core-ui 1.3.87 → 1.3.88
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/assets/avatar/default.svg +3 -3
- package/assets/images/icons/wifi.svg +3 -3
- package/assets/images/menu/bem/WA3F0100.svg +6 -6
- package/assets/images/menu/bem/WA3F1025.svg +10 -10
- package/assets/images/menu/bem/WA3F2000.svg +10 -10
- package/assets/images/menu/bem/WA3F2020.svg +6 -6
- package/assets/images/menu/bem/WA3F2030.svg +14 -14
- package/assets/images/menu/bem/WA3F2040.svg +8 -8
- package/assets/images/menu/bem/WA3F2100.svg +6 -6
- package/assets/images/menu/dhr/ALL.svg +6 -6
- package/assets/images/menu/dhr/D00.svg +12 -12
- package/assets/images/menu/dhr/D09.svg +8 -8
- package/assets/images/menu/dhr/D13.svg +10 -10
- package/assets/images/menu/dhr/D15.svg +10 -10
- package/assets/images/menu/dhr/D21.svg +10 -10
- package/assets/images/menu/dhr/D25.svg +11 -11
- package/assets/images/menu/dhr/D29.svg +11 -11
- package/assets/images/menu/dhr/D38.svg +6 -6
- package/assets/images/menu/dhr/D39.svg +10 -10
- package/assets/images/menu/dhr/D51.svg +12 -12
- package/assets/images/menu/dhr/D52.svg +16 -16
- package/assets/images/menu/dhr/D77.svg +16 -16
- package/assets/images/menu/dhr/D84.svg +12 -12
- package/assets/images/menu/dhr/D89.svg +8 -8
- package/assets/images/menu/dhr/Default.svg +13 -13
- package/assets/images/menu/dhr/MHRM00N0001.svg +14 -14
- package/assets/images/menu/dhr/MHRM00N0002.svg +22 -22
- package/assets/images/menu/dhr/MHRM00N0003.svg +17 -17
- package/assets/images/menu/dhr/MHRM00N0004.svg +12 -12
- package/assets/images/menu/dhr/MHRM00N0005.svg +11 -11
- package/assets/images/menu/dhr/MHRM09N0002.svg +3 -3
- package/assets/images/menu/dhr/MHRM09N0003.svg +25 -25
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -14
- package/assets/images/menu/dhr/MHRM09N0005.svg +7 -7
- package/assets/images/menu/dhr/MHRM09N1010.svg +12 -12
- package/assets/images/menu/dhr/MHRM09N1015.svg +18 -18
- package/assets/images/menu/dhr/MHRM09N1020.svg +13 -13
- package/assets/images/menu/dhr/MHRM09N1025.svg +12 -12
- package/assets/images/menu/dhr/MHRM09N1030.svg +11 -11
- package/assets/images/menu/dhr/MHRM09N1035.svg +15 -15
- package/assets/images/menu/dhr/MHRM09N1040.svg +8 -8
- package/assets/images/menu/dhr/MHRM09N1400.svg +11 -11
- package/assets/images/menu/dhr/MHRM13N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRM13N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRM13N0003.svg +12 -12
- package/assets/images/menu/dhr/MHRM13N0004.svg +21 -21
- package/assets/images/menu/dhr/MHRM25N0001.svg +26 -26
- package/assets/images/menu/dhr/MHRM29N0001.svg +30 -30
- package/assets/images/menu/dhr/MHRM29N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRM29N0003.svg +17 -17
- package/assets/images/menu/dhr/MHRM29N0004.svg +18 -18
- package/assets/images/menu/dhr/MHRM29N0005.svg +13 -13
- package/assets/images/menu/dhr/MHRM29N0015.svg +63 -63
- package/assets/images/menu/dhr/MHRM39N0012.svg +43 -43
- package/assets/images/menu/dhr/MHRM39N0013.svg +24 -24
- package/assets/images/menu/dhr/MHRM39N0014.svg +14 -14
- package/assets/images/menu/dhr/MHRM39N0015.svg +36 -36
- package/assets/images/menu/dhr/MHRM39N0016.svg +23 -23
- package/assets/images/menu/dhr/MHRM39N0017.svg +14 -14
- package/assets/images/menu/dhr/MHRM39N0018.svg +5 -5
- package/assets/images/menu/dhr/MHRM39N0019.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0020.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0021.svg +11 -11
- package/assets/images/menu/dhr/MHRM39N0022.svg +18 -18
- package/assets/images/menu/dhr/MHRM39N0023.svg +13 -13
- package/assets/images/menu/dhr/MHRM77N0001.svg +28 -28
- package/assets/images/menu/dhr/MHRM82N0001.svg +8 -8
- package/assets/images/menu/dhr/MHRM82N0002.svg +5 -5
- package/assets/images/menu/dhr/MHRM84N0001.svg +27 -27
- package/assets/images/menu/dhr/MHRM84N0002.svg +24 -24
- package/assets/images/menu/dhr/MHRM89N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRP00N0001.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0001.svg +22 -22
- package/assets/images/menu/dhr/MHRP09N0002.svg +19 -19
- package/assets/images/menu/dhr/MHRP09N0003.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0004.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0005.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0007.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0008.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0009.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0010.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0011.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0012.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0013.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP09N0015.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0016.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0017.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0018.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0019.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0020.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0021.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0022.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0023.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0024.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0025.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0026.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0027.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -14
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -4
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -5
- package/assets/images/menu/dhr/MHRP09N0032.svg +7 -7
- package/assets/images/menu/dhr/MHRP13N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP21N0001.svg +12 -12
- package/assets/images/menu/dhr/MHRP21N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP25L0101.svg +15 -15
- package/assets/images/menu/dhr/MHRP25L0501.svg +14 -14
- package/assets/images/menu/dhr/MHRP25N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP25N0002.svg +16 -16
- package/assets/images/menu/dhr/MHRP25N0003.svg +38 -38
- package/assets/images/menu/dhr/MHRP25N0004.svg +17 -17
- package/assets/images/menu/dhr/MHRP25N0005.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0001.svg +18 -18
- package/assets/images/menu/dhr/MHRP29N0002.svg +15 -15
- package/assets/images/menu/dhr/MHRP29N0003.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0004.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0005.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP29N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP29N0008.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0009.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0010.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0011.svg +12 -12
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -7
- package/assets/images/menu/dhr/MHRP29N0013.svg +27 -27
- package/assets/images/menu/dhr/MHRP29N0014.svg +32 -32
- package/assets/images/menu/dhr/MHRP29N0016.svg +54 -54
- package/assets/images/menu/dhr/MHRP29N0017.svg +24 -24
- package/assets/images/menu/dhr/MHRP29N0018.svg +44 -44
- package/assets/images/menu/dhr/MHRP29N0019.svg +17 -17
- package/assets/images/menu/dhr/MHRP29N0020.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -8
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -9
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -22
- package/assets/images/menu/dhr/MHRP29N0026.svg +13 -13
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -14
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -15
- package/assets/images/menu/dhr/MHRP38N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP38N0002.svg +14 -14
- package/assets/images/menu/dhr/MHRP39N0001.svg +15 -15
- package/assets/images/menu/dhr/MHRP39N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0004.svg +22 -22
- package/assets/images/menu/dhr/MHRP39N0005.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP39N0007.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0008.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0009.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0010.svg +7 -7
- package/assets/images/menu/dhr/MHRP39N0011.svg +7 -7
- package/assets/images/menu/dhr/MHRP39N0013.svg +10 -10
- package/assets/images/menu/dhr/MHRP39N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -5
- package/assets/images/menu/dhr/MHRP39N0017.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0018.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N1222.svg +12 -12
- package/assets/images/menu/dhr/MHRP51N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP51N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP52N0001.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0002.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP75N0001.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0002.svg +25 -25
- package/assets/images/menu/dhr/MHRP75N0003.svg +3 -3
- package/assets/images/menu/dhr/MHRP75N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP75N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0008.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0007.svg +28 -28
- package/assets/images/menu/dhr/MHRP77N0008.svg +17 -17
- package/assets/images/menu/dhr/MHRP77N0009.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0010.svg +20 -20
- package/assets/images/menu/dhr/MHRP89N1000.svg +5 -5
- package/assets/images/menu/dhr/MHRP89N1001.svg +5 -5
- package/assets/images/menu/dhr/TASK.svg +9 -9
- package/assets/images/menu/dhr/W00F0001.svg +3 -3
- package/assets/images/menu/dhr/W00F0002.svg +3 -3
- package/assets/images/menu/dhr/W00F0003.svg +3 -3
- package/assets/images/menu/dhr/W00F0004.svg +3 -3
- package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W09F2000.svg +4 -4
- package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -18
- package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -15
- package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W77F1011.svg +19 -19
- package/assets/images/menu/dhr/W77F1013.svg +22 -22
- package/assets/images/menu/erp/D05.svg +8 -8
- package/assets/images/menu/erp/D06.svg +4 -4
- package/assets/images/menu/erp/D90R.svg +9 -9
- package/assets/images/menu/erp/DBC.svg +9 -9
- package/assets/images/menu/erp/W00F0001.svg +3 -3
- package/assets/images/menu/erp/W00F0002.svg +3 -3
- package/assets/images/menu/erp/W00F0003.svg +3 -3
- package/assets/images/menu/erp/W00F0004.svg +3 -3
- package/assets/images/menu/erp/W05F0001.svg +16 -16
- package/assets/images/menu/erp/W05F0001N0000.svg +16 -16
- package/assets/images/menu/erp/W05F0004N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0006N0000.svg +30 -30
- package/assets/images/menu/erp/W05F0007N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0008N0000.svg +14 -14
- package/assets/images/menu/erp/W05F0011N0000.svg +20 -20
- package/assets/images/menu/erp/W05F0013N0000.svg +9 -9
- package/assets/images/menu/erp/W05F4000N0000.svg +9 -9
- package/assets/images/menu/erp/W06F0001.svg +17 -17
- package/assets/images/menu/erp/W06F0001N0000.svg +17 -17
- package/assets/images/menu/erp/W06F0004N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0005N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0006N0000.svg +55 -55
- package/assets/images/menu/erp/W06F0008N0000.svg +17 -17
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -9
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -9
- package/assets/images/menu/erp/WA3F1025.svg +5 -5
- package/assets/images/menu/erp/WA3F2100.svg +10 -10
- package/assets/storybook/avatar01.svg +9 -9
- package/assets/storybook/cover01.svg +9 -9
- package/components/accordion/details.js +6 -2
- package/components/accordion/group.js +9 -2
- package/components/accordion/index.js +15 -2
- package/components/accordion/summary.js +27 -4
- package/components/alert/index.js +33 -2
- package/components/alert/notify.js +22 -12
- package/components/avatar/index.js +81 -22
- package/components/badge/index.js +45 -20
- package/components/button/icon.js +56 -25
- package/components/button/index.js +65 -16
- package/components/button/more.js +35 -15
- package/components/button/ripple-effect.js +10 -0
- package/components/card/body.js +7 -2
- package/components/card/extra.js +7 -2
- package/components/card/footer.js +7 -2
- package/components/card/header.js +7 -2
- package/components/card/index.js +22 -2
- package/components/chart/Pie/Circle.js +1 -0
- package/components/chart/Pie/Sector.js +19 -2
- package/components/chart/Pie/Sectors.js +10 -0
- package/components/chart/Pie/index.js +36 -4
- package/components/chart/Pie-v2/Circle.js +1 -0
- package/components/chart/Pie-v2/Sector.js +15 -2
- package/components/chart/Pie-v2/Sectors.js +20 -0
- package/components/chart/Pie-v2/index.js +38 -11
- package/components/chart/bar/Axis.js +12 -0
- package/components/chart/bar/Bar.js +35 -13
- package/components/chart/bar/Grid.js +18 -0
- package/components/chart/bar/Labels.js +18 -0
- package/components/chart/bar/Points.js +17 -0
- package/components/chart/bar/index.js +26 -6
- package/components/chart/bar-v2/Axis.js +12 -0
- package/components/chart/bar-v2/Bar.js +36 -15
- package/components/chart/bar-v2/Grid.js +18 -0
- package/components/chart/bar-v2/Labels.js +18 -0
- package/components/chart/bar-v2/Points.js +17 -0
- package/components/chart/bar-v2/index.js +26 -6
- package/components/chart/line/Axis.js +16 -4
- package/components/chart/line/Grid.js +19 -2
- package/components/chart/line/Labels.js +18 -0
- package/components/chart/line/Path.js +33 -23
- package/components/chart/line/Point.js +40 -6
- package/components/chart/line/Title.js +3 -0
- package/components/chart/line/index.js +35 -12
- package/components/chart/line-v2/Axis.js +13 -0
- package/components/chart/line-v2/Grid.js +18 -0
- package/components/chart/line-v2/Labels.js +18 -0
- package/components/chart/line-v2/Path.js +33 -23
- package/components/chart/line-v2/Point.js +35 -6
- package/components/chart/line-v2/Title.js +3 -0
- package/components/chart/line-v2/index.js +30 -12
- package/components/check-text/index.js +8 -0
- package/components/check-text/interview-confirmation.js +7 -0
- package/components/check-text/interview-status.js +7 -0
- package/components/chip/attach.js +22 -9
- package/components/chip/index.js +33 -6
- package/components/collapse/index.js +13 -0
- package/components/divider/index.js +13 -2
- package/components/form-control/attachment/index.js +202 -41
- package/components/form-control/calendar/function.js +207 -153
- package/components/form-control/calendar/index.js +46 -21
- package/components/form-control/calendar/range.js +28 -11
- package/components/form-control/checkbox/index.js +37 -4
- package/components/form-control/control/index.js +13 -3
- package/components/form-control/date-picker/index-old.js +0 -18
- package/components/form-control/date-picker/index.js +99 -23
- package/components/form-control/date-range-picker/index.js +180 -44
- package/components/form-control/dropdown/index.js +314 -101
- package/components/form-control/dropdown-box/index.js +35 -6
- package/components/form-control/form/index.js +2 -0
- package/components/form-control/form-group/index.js +6 -1
- package/components/form-control/helper-text/index.js +9 -2
- package/components/form-control/input-base/index.js +73 -9
- package/components/form-control/label/index.js +12 -2
- package/components/form-control/money-input/index.js +143 -54
- package/components/form-control/number-input/index.js +124 -26
- package/components/form-control/number-input/index2.js +119 -78
- package/components/form-control/phone-input/index.js +85 -23
- package/components/form-control/radio/index.js +28 -9
- package/components/form-control/text-input/index.js +46 -10
- package/components/form-control/time-picker/index.js +71 -14
- package/components/form-control/time-picker/swiper.js +73 -21
- package/components/form-control/toggle/index.js +23 -8
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +14 -0
- package/components/form-view/input.js +13 -2
- package/components/form-view/label.js +2 -0
- package/components/grid/Col.js +16 -2
- package/components/grid/Container.js +21 -2
- package/components/grid/Row.js +21 -2
- package/components/grid/index.js +44 -2
- package/components/image/index.js +22 -2
- package/components/index.js +31 -62
- package/components/list/list-item-action.js +9 -0
- package/components/list/list-item-icon.js +9 -0
- package/components/list/list-item-text.js +5 -0
- package/components/list/list-item.js +11 -0
- package/components/list/list.js +13 -0
- package/components/list/sub-header.js +4 -0
- package/components/modal/body.js +6 -2
- package/components/modal/footer.js +11 -2
- package/components/modal/header.js +12 -2
- package/components/modal/index.js +10 -2
- package/components/modal/modal.js +52 -11
- package/components/others/extra/index.js +10 -3
- package/components/others/import/index.js +7 -0
- package/components/others/option-wrapper/index.js +7 -4
- package/components/others/scrollbar/index.js +3 -0
- package/components/paging/page-info.js +99 -35
- package/components/paging/page-selector.js +35 -7
- package/components/paging/page-selector2.js +74 -35
- package/components/paper/index.js +11 -0
- package/components/popover/body.js +6 -2
- package/components/popover/footer.js +11 -2
- package/components/popover/header.js +7 -2
- package/components/popover/index.js +146 -54
- package/components/popup/danger_popup.js +19 -0
- package/components/popup/index.js +48 -2
- package/components/popup/proposals_popup.js +49 -10
- package/components/popup/v2/index.js +47 -13
- package/components/progress/circular.js +48 -10
- package/components/progress/linear.js +20 -4
- package/components/rating/index.js +32 -8
- package/components/slider/slider-container.js +40 -3
- package/components/slider/slider-item.js +25 -10
- package/components/status/index.js +14 -2
- package/components/tab/tab-container.js +18 -4
- package/components/tab/tab-header.js +24 -4
- package/components/tab/tab-panel.js +16 -4
- package/components/tab/tab.js +30 -6
- package/components/tooltip/index.js +97 -12
- package/components/tooltip/portal.js +2 -0
- package/components/transfer/index.js +70 -25
- package/components/tree-view/index.js +202 -62
- package/components/typography/index.js +70 -47
- package/global/index.js +8 -0
- package/icons/basic.js +232 -0
- package/icons/effect.js +32 -15
- package/icons/general/clock/clock.js +2 -0
- package/icons/general/color-handler/background.js +2 -0
- package/icons/general/color-handler/text.js +2 -0
- package/icons/general/emoji/emoji.js +2 -0
- package/icons/general/font-properties/bold.js +2 -0
- package/icons/general/font-properties/font-family.js +2 -0
- package/icons/general/font-properties/font-size.js +2 -0
- package/icons/general/font-properties/italic.js +2 -0
- package/icons/general/font-properties/underline.js +2 -0
- package/icons/general/hyperlink/hyperlink.js +2 -0
- package/icons/general/indent/decrease.js +2 -0
- package/icons/general/indent/increase.js +2 -0
- package/icons/general/list/bullets.js +2 -0
- package/icons/general/list/numbering.js +2 -0
- package/icons/general/picture/picture.js +2 -0
- package/icons/general/steps/redo.js +2 -0
- package/icons/general/steps/undo.js +2 -0
- package/icons/general/text-align/center.js +2 -0
- package/icons/general/text-align/justify.js +2 -0
- package/icons/general/text-align/left.js +2 -0
- package/icons/general/text-align/right.js +2 -0
- package/icons/menu/dhr.js +1 -2
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +15 -2
- package/package.json +42 -42
- package/readme.md +1027 -1022
- package/styles/animation.js +58 -15
- package/styles/color-helper.js +157 -127
- package/styles/colors.js +9 -17
- package/styles/general.js +80 -18
- package/styles/typography.js +4 -4
- package/styles/utils.js +20 -19
- package/theme/createBreakpoints.js +18 -7
- package/theme/make-styles.js +5 -2
- package/theme/set-theme.js +9 -6
- package/theme/settings.js +2 -3
- package/theme/theme-provider.js +1 -0
- package/utils/array/array.js +54 -45
- package/utils/{classNames.js → classNames/index.js} +5 -0
- package/utils/console.js +6 -0
- package/utils/date.js +138 -69
- package/utils/error/error.js +11 -3
- package/utils/error/errors.js +147 -100
- package/utils/getFileType.js +9 -0
- package/utils/handleBreakpoints.js +5 -0
- package/utils/intersectionObserver.js +5 -0
- package/utils/{isMobile.js → isMobile/index.js} +0 -0
- package/utils/iterator.js +9 -0
- package/utils/map-parent.js +10 -3
- package/utils/object/extend.js +10 -0
- package/utils/object/object.js +11 -12
- package/utils/parseHTML.js +1 -0
- package/utils/promisify.js +5 -0
- package/utils/randomString.js +7 -0
- package/utils/remove-unicode.js +1 -0
- package/utils/render-portal.js +9 -1
- package/utils/renderHTML.js +6 -4
- package/utils/renderIcon.js +19 -9
- package/utils/sb-template.js +5 -6
- package/utils/string/capitalize.js +1 -0
- package/utils/string/capitalizeSentenceCase.js +2 -0
- package/utils/string/string.js +13 -0
- package/utils/type.js +21 -0
- package/utils/updatePosition.js +5 -4
- package/utils/useDelayUnmount.js +4 -0
- package/utils/useElementSize.js +3 -9
- package/utils/useEventListener.js +6 -12
- package/utils/useInput.js +6 -0
- package/utils/{useMediaQuery.js → useMediaQuery/index.js} +10 -8
- package/utils/useOnClickOutside.js +4 -2
- package/utils/usePortal.js +19 -12
- package/utils/validate.js +53 -39
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
+
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { css, jsx } from '@emotion/core';
|
|
4
5
|
import { Avatar, ButtonIcon, Checkbox, Chip, CircularProgress, HelperText, InputBase, Label, TreeView, Typography } from "../..";
|
|
@@ -38,22 +39,25 @@ const {
|
|
|
38
39
|
spacing
|
|
39
40
|
} = useTheme();
|
|
40
41
|
const timing = {},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
currentValue = {},
|
|
43
|
+
currentObjectDefault = {},
|
|
44
|
+
isSearch = {},
|
|
45
|
+
allValue = {};
|
|
45
46
|
const separatorPattern = /\{\w+\}/g;
|
|
46
47
|
const regexBetween = /[^{}]+(?=})/g;
|
|
47
48
|
const regexInclude = /{|}/g;
|
|
49
|
+
|
|
48
50
|
const checkHasValue = value => {
|
|
49
51
|
return Array.isArray(value) ? value.length > 0 : value === 0 || !!value;
|
|
50
52
|
};
|
|
53
|
+
|
|
51
54
|
const convertData = (dt, valueExpr) => {
|
|
52
55
|
let data = dt || [];
|
|
53
56
|
let valueTemp = Array.isArray(data) ? data : [data];
|
|
54
57
|
valueTemp = valueTemp.map(i => i[valueExpr] || i);
|
|
55
58
|
return valueTemp;
|
|
56
59
|
};
|
|
60
|
+
|
|
57
61
|
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
58
62
|
allowSearch,
|
|
59
63
|
children,
|
|
@@ -125,26 +129,36 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
125
129
|
const [openState, setOpenState] = useState(false);
|
|
126
130
|
const [showClear, setShowClear] = useState(false);
|
|
127
131
|
const [textValue, setTextValue] = useState('');
|
|
128
|
-
let valueTemp = valueProp || defaultValue || [];
|
|
132
|
+
let valueTemp = valueProp || defaultValue || []; // only mode multi
|
|
129
133
|
|
|
130
|
-
// only mode multi
|
|
131
134
|
if (multiple) {
|
|
132
135
|
valueTemp = convertData(valueTemp, valueExpr);
|
|
133
136
|
}
|
|
137
|
+
|
|
134
138
|
const [valueMulti, setValueMulti] = useState(valueTemp);
|
|
139
|
+
|
|
135
140
|
const _isMobile = isMobile.any();
|
|
141
|
+
|
|
136
142
|
const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
|
|
143
|
+
|
|
137
144
|
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, disabled, readOnly);
|
|
145
|
+
|
|
138
146
|
const _IconCSS = IconCSS(viewType);
|
|
147
|
+
|
|
139
148
|
const _DropdownFormCSS = DropdownFormCSS(viewType, multiple, disabled, placeholder, _DropdownInputCSS.name);
|
|
149
|
+
|
|
140
150
|
const _DropdownListCSS = DropdownListCSS(loading);
|
|
151
|
+
|
|
141
152
|
const _DropdownItemCSS = DropdownItemCSS(multiple, selectBox);
|
|
142
|
-
const _DropdownRootCSS = DropdownRootCSS(_DropdownFormCSS.name, _DropdownInputCSS.name);
|
|
143
153
|
|
|
154
|
+
const _DropdownRootCSS = DropdownRootCSS(_DropdownFormCSS.name, _DropdownInputCSS.name);
|
|
144
155
|
/* Start handler */
|
|
156
|
+
|
|
157
|
+
|
|
145
158
|
const triggerInput = e => {
|
|
146
159
|
const target = e.currentTarget;
|
|
147
160
|
target.style.pointerEvents = 'none';
|
|
161
|
+
|
|
148
162
|
if (!dropdownListRef.current) {
|
|
149
163
|
onClickInput();
|
|
150
164
|
} else {
|
|
@@ -152,38 +166,48 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
152
166
|
target: null
|
|
153
167
|
});
|
|
154
168
|
}
|
|
169
|
+
|
|
155
170
|
setTimeout(() => {
|
|
156
171
|
target.style.pointerEvents = null;
|
|
157
172
|
}, 200);
|
|
158
173
|
};
|
|
174
|
+
|
|
159
175
|
const triggerBlur = (blur = true) => {
|
|
160
176
|
if ((currentValue[unique] || currentValue[unique] === 0) && !multiple) {
|
|
161
177
|
setValueIntoInput(currentValue[unique]);
|
|
162
178
|
} else if (!multiple) {
|
|
163
179
|
setValueIntoInput('');
|
|
164
180
|
}
|
|
181
|
+
|
|
165
182
|
!!blur && inputRef.current.blur();
|
|
166
183
|
};
|
|
184
|
+
|
|
167
185
|
const onClickInput = e => {
|
|
168
186
|
if (disabled || readOnly || loading) return;
|
|
187
|
+
|
|
169
188
|
if (!dropdownListRef.current) {
|
|
170
189
|
if (!multiple || !Array.from(inputRef.current.querySelectorAll('.DGN-UI-Chip')).some(item => item.contains(e === null || e === void 0 ? void 0 : e.target))) {
|
|
171
190
|
setOpenState(true);
|
|
172
191
|
}
|
|
173
192
|
}
|
|
174
193
|
};
|
|
194
|
+
|
|
175
195
|
const onClickOutsideOfInput = event => {
|
|
176
196
|
var _inputRef$current, _iconRef$current, _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3;
|
|
197
|
+
|
|
177
198
|
if (inputRef.current && !((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.contains(event === null || event === void 0 ? void 0 : event.target)) && iconRef.current && !((_iconRef$current = iconRef.current) !== null && _iconRef$current !== void 0 && _iconRef$current.contains(event === null || event === void 0 ? void 0 : event.target)) && dropdownListRef.current && !((_dropdownListRef$curr = dropdownListRef.current) !== null && _dropdownListRef$curr !== void 0 && (_dropdownListRef$curr2 = _dropdownListRef$curr.parentNode) !== null && _dropdownListRef$curr2 !== void 0 && (_dropdownListRef$curr3 = _dropdownListRef$curr2.parentNode) !== null && _dropdownListRef$curr3 !== void 0 && _dropdownListRef$curr3.contains(event === null || event === void 0 ? void 0 : event.target))) {
|
|
178
199
|
closeDropdown();
|
|
179
200
|
triggerBlur(false);
|
|
180
201
|
}
|
|
181
202
|
};
|
|
203
|
+
|
|
182
204
|
const showDropdown = () => {
|
|
183
205
|
var _displayExpr, _searchRef$current;
|
|
206
|
+
|
|
184
207
|
if (displayExpr && Array.isArray(displayExpr)) {
|
|
185
208
|
displayExpr = displayExpr.join(' - ');
|
|
186
209
|
}
|
|
210
|
+
|
|
187
211
|
const keyArr = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.match(separatorPattern);
|
|
188
212
|
const dropdown = children ? jsx("div", {
|
|
189
213
|
css: _DropdownListCSS,
|
|
@@ -200,11 +224,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
200
224
|
left,
|
|
201
225
|
height,
|
|
202
226
|
width
|
|
203
|
-
} = formRef.current.getBoundingClientRect();
|
|
227
|
+
} = formRef.current.getBoundingClientRect(); // Calculate to set position of Dropdown box
|
|
204
228
|
|
|
205
|
-
// Calculate to set position of Dropdown box
|
|
206
229
|
const dropdownHeight = Math.min(Math.max(1, (itemMode === 'normal' ? dropdown.props.children : mapParent(dataSource, treeViewID, treeViewParentID)).length || 1), 7) * 40 + (multiple ? 43 : 0);
|
|
207
230
|
let positionTop = top + height + 4;
|
|
231
|
+
|
|
208
232
|
if (top + height + 4 + dropdownHeight + (allowSearch ? 40 : 0) > innerHeight) {
|
|
209
233
|
if (top - dropdownHeight > 0) {
|
|
210
234
|
positionTop = top - dropdownHeight;
|
|
@@ -212,8 +236,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
212
236
|
positionTop = innerHeight - dropdownHeight;
|
|
213
237
|
}
|
|
214
238
|
}
|
|
239
|
+
|
|
215
240
|
const defaultSearch = lastSearchRef.current || (onInput ? (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.value : '');
|
|
241
|
+
|
|
216
242
|
const _DropdownCSS = DropdownCSS(positionTop, left, width, _isMobile, allowSearch);
|
|
243
|
+
|
|
217
244
|
const el = jsx("div", {
|
|
218
245
|
css: _DropdownCSS,
|
|
219
246
|
ref: dropdownRef,
|
|
@@ -242,28 +269,34 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
242
269
|
}, jsx(CircularProgress, {
|
|
243
270
|
size: 24
|
|
244
271
|
})) : null);
|
|
272
|
+
|
|
245
273
|
if (!((multiple || allowSearch) && itemMode === 'normal' && !children)) {
|
|
246
274
|
inputRef.current.addEventListener('keydown', pressESCHandler);
|
|
247
275
|
}
|
|
276
|
+
|
|
248
277
|
document.documentElement.style.overflow = 'hidden';
|
|
249
278
|
setTimeout(() => {
|
|
250
279
|
window.addEventListener('resize', customizeWidthDropdown);
|
|
251
280
|
document.addEventListener('wheel', onWheelHandler);
|
|
252
281
|
document.addEventListener('mousedown', onClickOutsideOfInput);
|
|
282
|
+
|
|
253
283
|
if (onLoadMore && dataSource.length < total) {
|
|
254
284
|
dropdownListRef.current && dropdownListRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
255
285
|
}
|
|
256
286
|
}, 10);
|
|
257
287
|
return el;
|
|
258
288
|
};
|
|
289
|
+
|
|
259
290
|
const moveOnItem = e => {
|
|
260
291
|
if (e.key === 'Escape' || e.key === 'Tab') {
|
|
261
292
|
closeDropdown();
|
|
262
293
|
triggerBlur();
|
|
263
294
|
}
|
|
295
|
+
|
|
264
296
|
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
265
297
|
let activeEl = document.activeElement;
|
|
266
298
|
activeEl = e.key === 'ArrowDown' ? activeEl.nextElementSibling : activeEl.previousElementSibling;
|
|
299
|
+
|
|
267
300
|
if (activeEl) {
|
|
268
301
|
activeEl.focus();
|
|
269
302
|
activeEl.scrollIntoView({
|
|
@@ -273,6 +306,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
273
306
|
}
|
|
274
307
|
}
|
|
275
308
|
};
|
|
309
|
+
|
|
276
310
|
const pressESCHandler = e => {
|
|
277
311
|
if (e.key === 'Escape' || e.key === 'Tab') {
|
|
278
312
|
closeDropdown();
|
|
@@ -282,74 +316,94 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
282
316
|
dropdownListRef.current.firstChild.focus();
|
|
283
317
|
}
|
|
284
318
|
};
|
|
319
|
+
|
|
285
320
|
const onWheelHandler = e => {
|
|
286
321
|
var _dropdownRef$current;
|
|
322
|
+
|
|
287
323
|
if (!dropdownRef.current) {
|
|
288
324
|
document.removeEventListener('wheel', onWheelHandler);
|
|
289
325
|
return;
|
|
290
326
|
}
|
|
327
|
+
|
|
291
328
|
if (!((_dropdownRef$current = dropdownRef.current) !== null && _dropdownRef$current !== void 0 && _dropdownRef$current.contains(e.target))) {
|
|
292
329
|
closeDropdown();
|
|
293
330
|
triggerBlur();
|
|
294
331
|
}
|
|
295
332
|
};
|
|
333
|
+
|
|
296
334
|
const closeDropdown = () => {
|
|
297
335
|
if (dropdownRef.current) {
|
|
298
336
|
setOpenState(false);
|
|
299
337
|
document.removeEventListener('mousedown', onClickOutsideOfInput);
|
|
300
338
|
window.removeEventListener('resize', customizeWidthDropdown);
|
|
301
339
|
document.removeEventListener('wheel', onWheelHandler);
|
|
340
|
+
|
|
302
341
|
if (onLoadMore && dropdownListRef.current) {
|
|
303
342
|
dropdownListRef.current.removeEventListener('scroll', onLoadMoreHandler);
|
|
304
343
|
dropdownListRef.current = null;
|
|
305
344
|
}
|
|
306
345
|
}
|
|
346
|
+
|
|
307
347
|
document.documentElement.style.overflow = 'auto';
|
|
308
348
|
if (searchRef.current) lastSearchRef.current = '';
|
|
309
349
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
310
350
|
};
|
|
351
|
+
|
|
311
352
|
const renderDropdown = pattern => {
|
|
312
353
|
var _displayExpr2;
|
|
354
|
+
|
|
313
355
|
const keyArr = (_displayExpr2 = displayExpr) === null || _displayExpr2 === void 0 ? void 0 : _displayExpr2.match(separatorPattern);
|
|
314
356
|
const dropdown = mapDropdown(pattern, keyArr);
|
|
315
357
|
const el = document.createElement('div');
|
|
316
358
|
el.className = `DGN-Dropdown-Box`;
|
|
359
|
+
|
|
317
360
|
if (dropdownRef.current) {
|
|
318
361
|
var _dropdownRef$current$;
|
|
362
|
+
|
|
319
363
|
(_dropdownRef$current$ = dropdownRef.current.querySelector('.DGN-Dropdown-Box')) === null || _dropdownRef$current$ === void 0 ? void 0 : _dropdownRef$current$.remove();
|
|
320
364
|
ReactDOM.render(dropdown, dropdownRef.current.appendChild(el));
|
|
321
365
|
setTimeout(() => {
|
|
322
366
|
if (onLoadMore && dataSource.length < total) {
|
|
323
367
|
dropdownListRef.current && dropdownListRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
324
368
|
}
|
|
369
|
+
|
|
325
370
|
updatePositionDropdown();
|
|
326
371
|
}, 0);
|
|
327
372
|
}
|
|
328
373
|
};
|
|
374
|
+
|
|
329
375
|
const handleRenderBySearch = (data, searchValue) => {
|
|
330
376
|
let existExpr;
|
|
331
377
|
typeof data === 'object' ? existExpr = searchExpr.filter(value => Object.keys(data).includes(value)) : existExpr = [data];
|
|
332
378
|
return existExpr.every(key => {
|
|
333
379
|
const _data = (data === null || data === void 0 ? void 0 : data[key]) || key.toString();
|
|
380
|
+
|
|
334
381
|
if (searchMode === 'contains') {
|
|
335
382
|
if (_data.indexOf(searchValue) !== -1) return false;
|
|
336
383
|
}
|
|
384
|
+
|
|
337
385
|
if (searchMode === 'startswith') {
|
|
338
386
|
if (_data.lastIndexOf(searchValue) === 0) return false;
|
|
339
387
|
}
|
|
388
|
+
|
|
340
389
|
if (searchMode === 'equals') {
|
|
341
390
|
if (_data === searchValue) return false;
|
|
342
391
|
}
|
|
392
|
+
|
|
343
393
|
return true;
|
|
344
394
|
});
|
|
345
395
|
};
|
|
396
|
+
|
|
346
397
|
const mapDropdown = (pattern, keyArr) => {
|
|
347
398
|
var _currentObjectDefault;
|
|
399
|
+
|
|
348
400
|
const items = [];
|
|
349
401
|
const dataSourceUsable = [...dataSource];
|
|
402
|
+
|
|
350
403
|
if (currentObjectDefault[unique] && (_currentObjectDefault = currentObjectDefault[unique]) !== null && _currentObjectDefault !== void 0 && _currentObjectDefault.length) {
|
|
351
404
|
const length = currentObjectDefault[unique].length;
|
|
352
405
|
let existItemQuantity = 0;
|
|
406
|
+
|
|
353
407
|
for (let index = length - 1; index >= 0; index--) {
|
|
354
408
|
if (!dataSourceUsable.some(data => data[valueExpr] === currentObjectDefault[unique][index][valueExpr])) {
|
|
355
409
|
dataSourceUsable.unshift(currentObjectDefault[unique][index]);
|
|
@@ -358,20 +412,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
358
412
|
if (++existItemQuantity > limit) {
|
|
359
413
|
continue;
|
|
360
414
|
}
|
|
415
|
+
|
|
361
416
|
currentObjectDefault[unique].splice(index, 1);
|
|
362
417
|
}
|
|
363
418
|
}
|
|
364
419
|
}
|
|
420
|
+
|
|
365
421
|
const length = dataSourceUsable.length;
|
|
422
|
+
|
|
366
423
|
for (let index = 0; index < length; index++) {
|
|
367
424
|
var _searchExpr;
|
|
425
|
+
|
|
368
426
|
const data = dataSourceUsable[index];
|
|
369
427
|
const itemHidden = typeof data === 'object' ? data['hidden'] : false;
|
|
370
428
|
if (itemHidden) continue;
|
|
371
429
|
let displayText = typeof data === 'object' ? keyArr ? renderData(data, keyArr) : data[displayExpr] || data[valueExpr] : data;
|
|
430
|
+
|
|
372
431
|
if (((_searchExpr = searchExpr) === null || _searchExpr === void 0 ? void 0 : _searchExpr.length) > 0 && pattern) {
|
|
373
432
|
if (handleRenderBySearch(data, pattern)) continue;
|
|
374
433
|
} else if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
|
|
434
|
+
|
|
375
435
|
if (renderItem && typeof renderItem === 'function') {
|
|
376
436
|
displayText = renderItem({
|
|
377
437
|
data,
|
|
@@ -390,12 +450,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
390
450
|
index
|
|
391
451
|
}) : data[subText] || subText));
|
|
392
452
|
}
|
|
453
|
+
|
|
393
454
|
const value = typeof data === 'object' ? data[valueExpr] : data;
|
|
394
455
|
let itemDisabled = typeof data === 'object' ? data['disabled'] : false;
|
|
395
456
|
const icon = getIconFromData(data);
|
|
396
457
|
const text = jsx(Typography, {
|
|
397
458
|
type: 'p1'
|
|
398
459
|
}, displayText);
|
|
460
|
+
|
|
399
461
|
if (multiple && selectBox) {
|
|
400
462
|
const checked = Array.isArray(valueMulti) ? valueMulti.includes(value) : valueMulti.includes(value);
|
|
401
463
|
const isMaximumSelection = maximumSelectionLength === (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length);
|
|
@@ -403,8 +465,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
403
465
|
items.push(jsx("div", {
|
|
404
466
|
key: index,
|
|
405
467
|
css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
|
|
406
|
-
className: 'DGN-UI-Dropdown-Item'
|
|
407
|
-
// onClick={() => {
|
|
468
|
+
className: 'DGN-UI-Dropdown-Item' // onClick={() => {
|
|
408
469
|
// if (itemDisabled) return;
|
|
409
470
|
// onChangeValueWithCheckbox(e) & onChangeValue(displayText, value, icon, data, index);
|
|
410
471
|
// onChangeValue(displayText, value, icon, data, index);
|
|
@@ -412,10 +473,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
412
473
|
,
|
|
413
474
|
onKeyPress: e => {
|
|
414
475
|
if (itemDisabled) return;
|
|
415
|
-
if (e.key === 'Enter') e.currentTarget.firstChild.click();
|
|
416
|
-
// if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
476
|
+
if (e.key === 'Enter') e.currentTarget.firstChild.click(); // if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
417
477
|
},
|
|
418
|
-
|
|
419
478
|
tabIndex: -1
|
|
420
479
|
}, jsx(Checkbox, {
|
|
421
480
|
css: CheckBoxCSS,
|
|
@@ -443,6 +502,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
443
502
|
}, icon, text));
|
|
444
503
|
}
|
|
445
504
|
}
|
|
505
|
+
|
|
446
506
|
return jsx("div", {
|
|
447
507
|
css: _DropdownListCSS,
|
|
448
508
|
ref: dropdownListRef,
|
|
@@ -451,6 +511,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
451
511
|
tabIndex: -1
|
|
452
512
|
}, items !== null && items !== void 0 && items.length ? items : EmptyDataText);
|
|
453
513
|
};
|
|
514
|
+
|
|
454
515
|
const mapTreeView = () => {
|
|
455
516
|
return jsx("div", {
|
|
456
517
|
css: _DropdownListCSS,
|
|
@@ -477,13 +538,17 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
477
538
|
renderItem: renderItem
|
|
478
539
|
}) : EmptyDataText);
|
|
479
540
|
};
|
|
541
|
+
|
|
480
542
|
const loadMoreItemsDropdown = (i = 0, pattern) => {
|
|
481
543
|
var _currentObjectDefault2, _displayExpr3;
|
|
482
|
-
|
|
483
|
-
// Nếu có load more thì đẩy đội tượng mặc định lên đầu
|
|
544
|
+
|
|
545
|
+
const dataSourceUsable = [...dataSource]; // Nếu có load more thì đẩy đội tượng mặc định lên đầu
|
|
546
|
+
|
|
484
547
|
let notExistItem = 0;
|
|
548
|
+
|
|
485
549
|
if (onLoadMore && (_currentObjectDefault2 = currentObjectDefault[unique]) !== null && _currentObjectDefault2 !== void 0 && _currentObjectDefault2.length) {
|
|
486
550
|
const length = currentObjectDefault[unique].length;
|
|
551
|
+
|
|
487
552
|
for (let index = length - 1; index >= 0; index--) {
|
|
488
553
|
if (!dataSourceUsable.some(data => data[valueExpr] === currentObjectDefault[unique][index][valueExpr])) {
|
|
489
554
|
notExistItem++;
|
|
@@ -491,17 +556,20 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
491
556
|
}
|
|
492
557
|
}
|
|
493
558
|
}
|
|
559
|
+
|
|
494
560
|
const length = dataSourceUsable.length;
|
|
495
561
|
let num = 0;
|
|
562
|
+
|
|
496
563
|
if (displayExpr && Array.isArray(displayExpr)) {
|
|
497
564
|
displayExpr = displayExpr.join(' - ');
|
|
498
565
|
}
|
|
566
|
+
|
|
499
567
|
const keyArr = (_displayExpr3 = displayExpr) === null || _displayExpr3 === void 0 ? void 0 : _displayExpr3.match(separatorPattern);
|
|
568
|
+
|
|
500
569
|
for (i; i < length; i++) {
|
|
501
|
-
const data = {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
// Nếu đối tượng đã được hiển thị ở trên rồi thì không hiển thị ra nữa
|
|
570
|
+
const data = { ...dataSourceUsable[i]
|
|
571
|
+
}; // Nếu đối tượng đã được hiển thị ở trên rồi thì không hiển thị ra nữa
|
|
572
|
+
|
|
505
573
|
if (onLoadMore && i > notExistItem && currentObjectDefault[unique].some(valueObject => valueObject[valueExpr] === data[valueExpr])) continue;
|
|
506
574
|
let displayText = typeof data === 'object' ? keyArr ? renderData(data, keyArr) : data[displayExpr] || data[valueExpr] : data;
|
|
507
575
|
if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
|
|
@@ -510,6 +578,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
510
578
|
const text = jsx(Typography, {
|
|
511
579
|
type: 'p1'
|
|
512
580
|
}, displayText);
|
|
581
|
+
|
|
513
582
|
if (renderItem && typeof renderItem === 'function') {
|
|
514
583
|
displayText = renderItem({
|
|
515
584
|
data,
|
|
@@ -528,6 +597,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
528
597
|
index: i
|
|
529
598
|
}) : data[subText] || subText));
|
|
530
599
|
}
|
|
600
|
+
|
|
531
601
|
const dropdownItem = document.createElement('div');
|
|
532
602
|
dropdownItem.className = `DGN-UI-Dropdown-Item css-${_DropdownItemCSS.name}`;
|
|
533
603
|
dropdownItem.tabIndex = -1;
|
|
@@ -536,6 +606,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
536
606
|
if (e.key === 'Enter') dropdownItem.firstChild.click();
|
|
537
607
|
});
|
|
538
608
|
let item = null;
|
|
609
|
+
|
|
539
610
|
if (multiple && selectBox) {
|
|
540
611
|
const checked = Array.isArray(currentValue[unique]) ? currentValue[unique].includes(value) : [currentValue[unique]].includes(value);
|
|
541
612
|
item = jsx(Checkbox, {
|
|
@@ -546,10 +617,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
546
617
|
} else {
|
|
547
618
|
item = jsx(Fragment, null, icon, text);
|
|
548
619
|
}
|
|
620
|
+
|
|
549
621
|
if (!dropdownListRef.current) {
|
|
550
622
|
return;
|
|
551
623
|
}
|
|
624
|
+
|
|
552
625
|
ReactDOM.render(item, dropdownListRef.current.appendChild(dropdownItem));
|
|
626
|
+
|
|
553
627
|
if (++num === 100) {
|
|
554
628
|
timerRef.current = setTimeout(() => {
|
|
555
629
|
loadMoreItemsDropdown(i + 1, pattern);
|
|
@@ -558,26 +632,34 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
558
632
|
}
|
|
559
633
|
}
|
|
560
634
|
};
|
|
635
|
+
|
|
561
636
|
const renderData = (data, keyArr) => {
|
|
562
637
|
const pattern = keyArr.join('|').replace(/([{}])/g, '\\$1');
|
|
563
638
|
const separatorArr = displayExpr.split(new RegExp(pattern));
|
|
564
639
|
let str = '';
|
|
565
640
|
let i = 0;
|
|
641
|
+
|
|
566
642
|
for (i; i < keyArr.length; i++) {
|
|
567
643
|
str += separatorArr[i] + (data[keyArr[i].replace(/\W/g, '')] !== undefined ? data[keyArr[i].replace(/\W/g, '')] : keyArr[i]);
|
|
568
644
|
}
|
|
645
|
+
|
|
569
646
|
return str + separatorArr[i];
|
|
570
647
|
};
|
|
648
|
+
|
|
571
649
|
const getIconFromData = (data, insideChip = false) => {
|
|
572
650
|
if (!iconExpr || iconExpr === 'none') return null;
|
|
651
|
+
|
|
573
652
|
let _src;
|
|
653
|
+
|
|
574
654
|
if (typeof iconExpr === 'string') _src = data[iconExpr];else {
|
|
575
655
|
let prefix = iconExpr.prefix || '';
|
|
576
656
|
const suffix = iconExpr.suffix || '';
|
|
577
657
|
const url = data[iconExpr.key];
|
|
658
|
+
|
|
578
659
|
if (prefix && /^http/i.test(prefix) && /^http/i.test(url)) {
|
|
579
660
|
prefix = '';
|
|
580
661
|
}
|
|
662
|
+
|
|
581
663
|
_src = prefix + url + suffix;
|
|
582
664
|
}
|
|
583
665
|
return jsx(Avatar, {
|
|
@@ -585,45 +667,55 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
585
667
|
src: _src,
|
|
586
668
|
width: insideChip ? 20 : 24,
|
|
587
669
|
height: insideChip ? 20 : 24,
|
|
588
|
-
style: {
|
|
589
|
-
...iconExpr.style,
|
|
670
|
+
style: { ...iconExpr.style,
|
|
590
671
|
marginRight: spacing([insideChip ? 0 : 2])
|
|
591
672
|
}
|
|
592
673
|
});
|
|
593
674
|
};
|
|
675
|
+
|
|
594
676
|
const customizeWidthDropdown = () => {
|
|
595
677
|
if (dropdownListRef.current && _isMobile) dropdownListRef.current.style.maxHeight = `${Math.min(280, window.innerHeight) - (allowSearch ? 40 : 0)}px`;
|
|
678
|
+
|
|
596
679
|
if (!ref.current) {
|
|
597
680
|
window.removeEventListener('resize', customizeWidthDropdown);
|
|
598
681
|
return;
|
|
599
682
|
}
|
|
683
|
+
|
|
600
684
|
const {
|
|
601
685
|
width
|
|
602
686
|
} = ref.current.getBoundingClientRect();
|
|
687
|
+
|
|
603
688
|
if (dropdownRef.current) {
|
|
604
689
|
dropdownRef.current.style.width = width + 'px';
|
|
605
690
|
}
|
|
691
|
+
|
|
606
692
|
updatePositionDropdown();
|
|
607
693
|
};
|
|
694
|
+
|
|
608
695
|
const updatePositionDropdown = () => {
|
|
609
696
|
if (!formRef.current || !dropdownRef.current) {
|
|
610
697
|
document.removeEventListener('wheel', onWheelHandler);
|
|
611
698
|
return;
|
|
612
699
|
}
|
|
700
|
+
|
|
613
701
|
_isMobile ? updatePosition(formRef.current, dropdownRef.current, null) : updatePosition(formRef.current, dropdownRef.current, closeDropdown);
|
|
614
702
|
};
|
|
703
|
+
|
|
615
704
|
const onLoadMoreHandler = e => {
|
|
616
705
|
if (loadMoreTimer.current) {
|
|
617
706
|
clearTimeout(loadMoreTimer.current);
|
|
618
707
|
}
|
|
708
|
+
|
|
619
709
|
loadMoreTimer.current = setTimeout(() => {
|
|
620
710
|
const {
|
|
621
711
|
scrollTop,
|
|
622
712
|
scrollHeight,
|
|
623
713
|
offsetHeight
|
|
624
714
|
} = e.target;
|
|
715
|
+
|
|
625
716
|
if (scrollHeight === Math.ceil(scrollTop) + offsetHeight && dropdownListRef.current) {
|
|
626
717
|
var _dropdownListRef$curr4, _currentObjectDefault3;
|
|
718
|
+
|
|
627
719
|
const length = ((_dropdownListRef$curr4 = dropdownListRef.current.children) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.length) - (((_currentObjectDefault3 = currentObjectDefault[unique]) === null || _currentObjectDefault3 === void 0 ? void 0 : _currentObjectDefault3.length) || 0);
|
|
628
720
|
dropdownListRef.current.removeEventListener('scroll', onLoadMoreHandler);
|
|
629
721
|
!!onLoadMore && onLoadMore({
|
|
@@ -633,47 +725,54 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
633
725
|
}
|
|
634
726
|
});
|
|
635
727
|
};
|
|
728
|
+
|
|
636
729
|
const onPreventKeyDownHandler = e => {
|
|
637
730
|
e.preventDefault();
|
|
638
731
|
return false;
|
|
639
732
|
};
|
|
733
|
+
|
|
640
734
|
const onChangeInput = e => {
|
|
641
735
|
if (searchRef.current) lastSearchRef.current = searchRef.current.value;
|
|
642
736
|
const dataFilter = getData();
|
|
643
737
|
dataChoosen.current = [...dataFilter].filter(i => [...valueMulti].includes(i === null || i === void 0 ? void 0 : i[valueExpr]));
|
|
738
|
+
|
|
644
739
|
if (onInput) {
|
|
645
|
-
isSearch[unique] = true;
|
|
646
|
-
// const valueInput = e.target.value;
|
|
740
|
+
isSearch[unique] = true; // const valueInput = e.target.value;
|
|
647
741
|
// const text = (valueInput || e.target.textContent).normalize();
|
|
742
|
+
|
|
648
743
|
if (timeout.current) {
|
|
649
744
|
if (timing[unique]) {
|
|
650
745
|
clearTimeout(timing[unique]);
|
|
651
746
|
}
|
|
747
|
+
|
|
652
748
|
timing[unique] = setTimeout(() => {
|
|
653
749
|
// e.target.value = text;
|
|
654
|
-
onInput(e);
|
|
655
|
-
// e.target.value = valueInput;
|
|
750
|
+
onInput(e); // e.target.value = valueInput;
|
|
656
751
|
}, timeout.current || searchDelayTime);
|
|
657
752
|
} else {
|
|
658
753
|
// e.target.value = text;
|
|
659
|
-
onInput(e);
|
|
660
|
-
// e.target.value = valueInput;
|
|
754
|
+
onInput(e); // e.target.value = valueInput;
|
|
661
755
|
}
|
|
662
756
|
|
|
663
757
|
return;
|
|
664
758
|
}
|
|
759
|
+
|
|
665
760
|
const value = e.target.value || e.target.textContent;
|
|
761
|
+
|
|
666
762
|
if (typeof renderSelectedItem === 'function' && e.target.childNodes && Array.from(e.target.childNodes).some(node => node.toString() !== '[object Text]')) {
|
|
667
763
|
const cursor = document.getSelection().anchorOffset;
|
|
668
764
|
e.target.innerHTML = value;
|
|
669
765
|
document.getSelection().collapse(e.target, cursor);
|
|
670
766
|
}
|
|
767
|
+
|
|
671
768
|
if (timing[unique]) clearTimeout(timing[unique]);
|
|
672
769
|
timing[unique] = setTimeout(() => {
|
|
673
770
|
var _searchExpr2;
|
|
771
|
+
|
|
674
772
|
renderDropdown(((_searchExpr2 = searchExpr) === null || _searchExpr2 === void 0 ? void 0 : _searchExpr2.length) > 0 ? value.normalize() : new RegExp(value.normalize(), 'gim'));
|
|
675
773
|
}, timeout.current || searchDelayTime);
|
|
676
774
|
};
|
|
775
|
+
|
|
677
776
|
const onChangeValue = (displayText, value, icon, data) => {
|
|
678
777
|
if (itemMode === 'treeview') {
|
|
679
778
|
if (valueProp === undefined) {
|
|
@@ -681,6 +780,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
681
780
|
setValueIntoInput(value);
|
|
682
781
|
setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
|
|
683
782
|
}
|
|
783
|
+
|
|
684
784
|
!!onChange && onChange({
|
|
685
785
|
value
|
|
686
786
|
});
|
|
@@ -689,11 +789,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
689
789
|
}, 0);
|
|
690
790
|
} else if (multiple) {
|
|
691
791
|
if (!Array.isArray(currentValue[unique])) currentValue[unique] = [];
|
|
692
|
-
const newValueArr = [...currentValue[unique]];
|
|
693
|
-
|
|
792
|
+
const newValueArr = [...currentValue[unique]]; // const newValueArrState = [...valueMulti];
|
|
793
|
+
|
|
694
794
|
if (!currentValue[unique].some(v => JSON.stringify(v) === JSON.stringify(value))) {
|
|
695
|
-
newValueArr.push(value);
|
|
696
|
-
// newValueArrState.push(value);
|
|
795
|
+
newValueArr.push(value); // newValueArrState.push(value);
|
|
697
796
|
// if (valueProp === undefined) {
|
|
698
797
|
// let item = null;
|
|
699
798
|
// if (typeof renderSelectedItem === 'function') {
|
|
@@ -718,14 +817,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
718
817
|
// }
|
|
719
818
|
} else {
|
|
720
819
|
const index = newValueArr.indexOf(value);
|
|
721
|
-
newValueArr.splice(index, 1);
|
|
722
|
-
// newValueArrState.splice(index, 1);
|
|
820
|
+
newValueArr.splice(index, 1); // newValueArrState.splice(index, 1);
|
|
723
821
|
// if (valueProp === undefined) {
|
|
724
822
|
// const nodes = inputRef.current.querySelectorAll('.dropdown-item');
|
|
725
823
|
// nodes[index]?.remove();
|
|
726
824
|
// }
|
|
727
|
-
}
|
|
728
|
-
|
|
825
|
+
} // setValueMulti(newValueArrState);
|
|
826
|
+
|
|
827
|
+
|
|
729
828
|
!!onChange && onChange({
|
|
730
829
|
value: newValueArr,
|
|
731
830
|
data
|
|
@@ -735,12 +834,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
735
834
|
}, 0);
|
|
736
835
|
} else {
|
|
737
836
|
const isChanged = currentValue[unique] !== value;
|
|
837
|
+
|
|
738
838
|
if (isChanged) {
|
|
739
839
|
if (valueProp === undefined) {
|
|
740
840
|
allValue[unique].push(value);
|
|
741
841
|
setValueIntoInput(value);
|
|
742
842
|
setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
|
|
743
843
|
}
|
|
844
|
+
|
|
744
845
|
!!onChange && onChange({
|
|
745
846
|
value,
|
|
746
847
|
data
|
|
@@ -750,6 +851,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
750
851
|
triggerBlur(false);
|
|
751
852
|
}
|
|
752
853
|
}
|
|
854
|
+
|
|
753
855
|
if (closeAfterSelect === true || closeAfterSelect === undefined && !multiple) {
|
|
754
856
|
closeDropdown();
|
|
755
857
|
} else {
|
|
@@ -757,22 +859,22 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
757
859
|
updatePositionDropdown();
|
|
758
860
|
}, 0);
|
|
759
861
|
}
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
// const onChangeValueWithCheckbox = e => {
|
|
862
|
+
}; // const onChangeValueWithCheckbox = e => {
|
|
763
863
|
// const firstChild = e.currentTarget.firstChild;
|
|
764
864
|
// if (!firstChild.contains(e.target)) {
|
|
765
865
|
// firstChild.click();
|
|
766
866
|
// }
|
|
767
867
|
// };
|
|
768
868
|
|
|
869
|
+
|
|
769
870
|
const onRemove = (e, value) => {
|
|
770
871
|
var _ref;
|
|
872
|
+
|
|
771
873
|
if (readOnly || disabled) return;
|
|
772
874
|
const index = currentValue[unique].findIndex(v => JSON.stringify(v) === JSON.stringify(value));
|
|
875
|
+
|
|
773
876
|
if (index !== -1) {
|
|
774
|
-
currentValue[unique].splice(index, 1);
|
|
775
|
-
// setTimeout(() => {
|
|
877
|
+
currentValue[unique].splice(index, 1); // setTimeout(() => {
|
|
776
878
|
// if (dropdownListRef.current && multiple && selectBox && !children) {
|
|
777
879
|
// const input = dropdownListRef.current.querySelector(`input[value="${value}"]`);
|
|
778
880
|
// if (input) {
|
|
@@ -785,9 +887,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
785
887
|
// }, 0);
|
|
786
888
|
// setValueMulti([...valueMulti]?.filter(i=>i!==value) || []);
|
|
787
889
|
// !!onChange && onChange({ value: currentValue[unique], removed: value });
|
|
788
|
-
}
|
|
890
|
+
} // logic mới
|
|
891
|
+
|
|
789
892
|
|
|
790
|
-
// logic mới
|
|
791
893
|
const newValueArrState = ((_ref = [...valueMulti]) === null || _ref === void 0 ? void 0 : _ref.filter(i => i !== value)) || [];
|
|
792
894
|
setValueMulti(newValueArrState);
|
|
793
895
|
!!onChange && onChange({
|
|
@@ -795,25 +897,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
795
897
|
removed: value
|
|
796
898
|
});
|
|
797
899
|
};
|
|
900
|
+
|
|
798
901
|
const onClear = e => {
|
|
799
902
|
if (disabled || readOnly || loading || !clearAble) return;
|
|
800
903
|
currentValue[unique] = multiple ? [] : '';
|
|
801
|
-
|
|
802
|
-
|
|
904
|
+
|
|
905
|
+
if (inputRef.current.tagName.toLowerCase() === 'div') {// inputRef.current.innerHTML = '';
|
|
803
906
|
// if (dropdownListRef.current) {
|
|
804
907
|
// dropdownListRef.current.querySelectorAll('input').forEach(input => (input.checked = false));
|
|
805
908
|
// }
|
|
806
909
|
} else {
|
|
807
910
|
inputRef.current.value = '';
|
|
808
911
|
setTextValue('');
|
|
809
|
-
}
|
|
810
|
-
|
|
912
|
+
} // onChangeValue('', '');
|
|
913
|
+
|
|
914
|
+
|
|
811
915
|
setValueMulti([]);
|
|
812
916
|
setShowClear(false);
|
|
813
917
|
e && e.target && e.target.blur();
|
|
814
918
|
updatePositionDropdown();
|
|
815
|
-
onInput === null || onInput === void 0 ? void 0 : onInput({
|
|
816
|
-
...(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current),
|
|
919
|
+
onInput === null || onInput === void 0 ? void 0 : onInput({ ...(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current),
|
|
817
920
|
target: {
|
|
818
921
|
value: inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.value
|
|
819
922
|
}
|
|
@@ -822,10 +925,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
822
925
|
value: currentValue[unique]
|
|
823
926
|
});
|
|
824
927
|
};
|
|
928
|
+
|
|
825
929
|
const setPreviousValue = () => {
|
|
826
930
|
allValue[unique].pop();
|
|
827
931
|
setValueIntoInput(allValue[unique][allValue[unique].length - 1]);
|
|
828
932
|
};
|
|
933
|
+
|
|
829
934
|
const setValueIntoInput = source => {
|
|
830
935
|
if (!source && source !== 0) {
|
|
831
936
|
if (multiple) {
|
|
@@ -838,34 +943,45 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
838
943
|
inputRef.current.value = '';
|
|
839
944
|
setTextValue('');
|
|
840
945
|
}
|
|
946
|
+
|
|
841
947
|
currentValue[unique] = '';
|
|
842
948
|
}
|
|
949
|
+
|
|
843
950
|
return;
|
|
844
951
|
}
|
|
952
|
+
|
|
845
953
|
const length = dataSource.length;
|
|
846
954
|
const displayKey = typeof renderSelectedItem === 'string' ? renderSelectedItem : displayExpr;
|
|
955
|
+
|
|
847
956
|
if (displayKey && Array.isArray(displayKey)) {
|
|
848
957
|
displayExpr = displayExpr.join(' - ');
|
|
849
958
|
}
|
|
959
|
+
|
|
850
960
|
const keyArr = displayKey === null || displayKey === void 0 ? void 0 : displayKey.match(separatorPattern);
|
|
961
|
+
|
|
851
962
|
if (multiple) {
|
|
852
963
|
let valueArr = source;
|
|
964
|
+
|
|
853
965
|
if (!Array.isArray(valueArr)) {
|
|
854
966
|
valueArr = [valueArr];
|
|
855
967
|
}
|
|
968
|
+
|
|
856
969
|
valueArr = [...new Set(valueArr)];
|
|
857
|
-
currentValue[unique] = [];
|
|
858
|
-
|
|
970
|
+
currentValue[unique] = []; // inputRef.current.innerHTML = '';
|
|
971
|
+
|
|
859
972
|
valueArr.forEach(v => {
|
|
860
973
|
var _currentObjectDefault4;
|
|
974
|
+
|
|
861
975
|
for (let i = 0; i < length; i++) {
|
|
862
976
|
if (typeof dataSource[i] === 'object' && dataSource[i][valueExpr] === v || dataSource[i] === v) {
|
|
863
977
|
setMultipleValueHandler(dataSource[i], v, keyArr, i);
|
|
864
978
|
return;
|
|
865
979
|
}
|
|
866
980
|
}
|
|
981
|
+
|
|
867
982
|
if ((_currentObjectDefault4 = currentObjectDefault[unique]) !== null && _currentObjectDefault4 !== void 0 && _currentObjectDefault4.length) {
|
|
868
983
|
const itemOfValue = currentObjectDefault[unique].find(valueObject => valueObject[valueExpr] === v || valueObject === v);
|
|
984
|
+
|
|
869
985
|
if (itemOfValue) {
|
|
870
986
|
setMultipleValueHandler(itemOfValue, v, keyArr);
|
|
871
987
|
}
|
|
@@ -873,25 +989,31 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
873
989
|
});
|
|
874
990
|
} else {
|
|
875
991
|
var _currentObjectDefault5;
|
|
992
|
+
|
|
876
993
|
currentValue[unique] = source;
|
|
994
|
+
|
|
877
995
|
for (let i = 0; i < length; i++) {
|
|
878
996
|
if (dataSource[i][valueExpr] === source || dataSource[i] === source) {
|
|
879
997
|
setSingleValueHandler(dataSource[i], keyArr);
|
|
880
998
|
return;
|
|
881
999
|
}
|
|
882
1000
|
}
|
|
1001
|
+
|
|
883
1002
|
if ((_currentObjectDefault5 = currentObjectDefault[unique]) !== null && _currentObjectDefault5 !== void 0 && _currentObjectDefault5.length) {
|
|
884
1003
|
const itemOfValue = currentObjectDefault[unique].find(valueObject => valueObject[valueExpr] === source || valueObject === source);
|
|
1004
|
+
|
|
885
1005
|
if (itemOfValue) {
|
|
886
1006
|
setSingleValueHandler(itemOfValue, keyArr);
|
|
887
1007
|
return;
|
|
888
1008
|
}
|
|
889
1009
|
}
|
|
1010
|
+
|
|
890
1011
|
if (!isSearch[unique]) {
|
|
891
1012
|
inputRef.current.value = source;
|
|
892
1013
|
}
|
|
893
1014
|
}
|
|
894
1015
|
};
|
|
1016
|
+
|
|
895
1017
|
const setMultipleValueHandler = (data, value) => {
|
|
896
1018
|
// let item = null;
|
|
897
1019
|
// if (typeof renderSelectedItem === 'function') {
|
|
@@ -917,8 +1039,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
917
1039
|
// ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
918
1040
|
currentValue[unique].push(value);
|
|
919
1041
|
};
|
|
1042
|
+
|
|
920
1043
|
const setSingleValueHandler = (data, keyArr) => {
|
|
921
1044
|
const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr] || data[valueExpr] || data;
|
|
1045
|
+
|
|
922
1046
|
if (typeof renderSelectedItem === 'function') {
|
|
923
1047
|
inputRef.current.innerHTML = '';
|
|
924
1048
|
const item = renderSelectedItem({
|
|
@@ -944,6 +1068,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
944
1068
|
setTextValue(text);
|
|
945
1069
|
}
|
|
946
1070
|
};
|
|
1071
|
+
|
|
947
1072
|
useImperativeHandle(reference, () => {
|
|
948
1073
|
const currentRef = ref.current || {};
|
|
949
1074
|
const _instance = {
|
|
@@ -959,22 +1084,30 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
959
1084
|
if (allValue[unique][allValue[unique].length - 1] !== value) {
|
|
960
1085
|
allValue[unique].push(value);
|
|
961
1086
|
}
|
|
1087
|
+
|
|
962
1088
|
setValueIntoInput(value);
|
|
963
1089
|
}
|
|
964
1090
|
}; // methods
|
|
1091
|
+
|
|
965
1092
|
_instance.__proto__ = {}; // hidden methods
|
|
966
|
-
|
|
967
|
-
// keep old method
|
|
1093
|
+
|
|
1094
|
+
currentRef.instance = _instance; // keep old method
|
|
1095
|
+
|
|
968
1096
|
currentRef.closeDropdown = () => closeDropdown();
|
|
1097
|
+
|
|
969
1098
|
currentRef.showDropdown = () => setOpenState(true);
|
|
1099
|
+
|
|
970
1100
|
currentRef.onClear = onClear;
|
|
971
1101
|
currentRef.setPreviousValue = setPreviousValue;
|
|
1102
|
+
|
|
972
1103
|
currentRef.setValue = value => {
|
|
973
1104
|
if (allValue[unique][allValue[unique].length - 1] !== value) {
|
|
974
1105
|
allValue[unique].push(value);
|
|
975
1106
|
}
|
|
1107
|
+
|
|
976
1108
|
setValueIntoInput(value);
|
|
977
1109
|
};
|
|
1110
|
+
|
|
978
1111
|
currentRef.DOM = ref.current;
|
|
979
1112
|
return currentRef;
|
|
980
1113
|
});
|
|
@@ -991,16 +1124,19 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
991
1124
|
} else {
|
|
992
1125
|
currentObjectDefault[unique] = [];
|
|
993
1126
|
}
|
|
1127
|
+
|
|
994
1128
|
return () => {
|
|
995
1129
|
currentObjectDefault[unique] = null;
|
|
996
1130
|
};
|
|
997
1131
|
}, [valueObjectDefault]);
|
|
998
1132
|
useEffect(() => {
|
|
999
1133
|
allValue[unique] = [];
|
|
1134
|
+
|
|
1000
1135
|
if (defaultValue !== undefined && JSON.stringify(defaultValue) !== '[]') {
|
|
1001
1136
|
setValueIntoInput(defaultValue);
|
|
1002
1137
|
setShowClear(clearAble && checkHasValue(defaultValue) && !disabled && !readOnly && !loading);
|
|
1003
1138
|
}
|
|
1139
|
+
|
|
1004
1140
|
return () => {
|
|
1005
1141
|
allValue[unique] = null;
|
|
1006
1142
|
closeDropdown();
|
|
@@ -1009,6 +1145,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1009
1145
|
useEffect(() => {
|
|
1010
1146
|
if (searchDelayTime) {
|
|
1011
1147
|
var _searchDelayTime$matc, _searchDelayTime$matc2;
|
|
1148
|
+
|
|
1012
1149
|
if (searchDelayTime === true) searchDelayTime = getGlobal('delayOnInput');
|
|
1013
1150
|
const units = {
|
|
1014
1151
|
m: 60000,
|
|
@@ -1025,10 +1162,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1025
1162
|
if (allValue[unique][allValue[unique].length - 1] !== valueProp) {
|
|
1026
1163
|
allValue[unique].push(valueProp);
|
|
1027
1164
|
}
|
|
1165
|
+
|
|
1028
1166
|
if (multiple && valueProp) {
|
|
1029
1167
|
setValueMulti(convertData(valueProp, valueExpr));
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1168
|
+
} // Close dropdown treeview by children when select item
|
|
1169
|
+
|
|
1170
|
+
|
|
1032
1171
|
if (children && (closeAfterSelect === true || closeAfterSelect === undefined && !multiple)) {
|
|
1033
1172
|
closeDropdown();
|
|
1034
1173
|
}
|
|
@@ -1040,21 +1179,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1040
1179
|
}, [valueProp, dataSource]);
|
|
1041
1180
|
useEffect(() => {
|
|
1042
1181
|
inputRef.current.readOnly = readOnly || inputProps.readOnly;
|
|
1182
|
+
|
|
1043
1183
|
if (!readOnly && !disabled) {
|
|
1044
1184
|
!!onLoadMore && dropdownListRef.current && dropdownListRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
1045
1185
|
}
|
|
1186
|
+
|
|
1046
1187
|
if (disabled || readOnly || children) {
|
|
1047
1188
|
inputRef.current.addEventListener('keydown', onPreventKeyDownHandler);
|
|
1048
1189
|
} else {
|
|
1049
1190
|
inputRef.current.addEventListener('keydown', onKeyDown);
|
|
1050
1191
|
}
|
|
1192
|
+
|
|
1051
1193
|
return () => {
|
|
1052
1194
|
if (!ref.current || !inputRef.current || !iconRef.current) return;
|
|
1195
|
+
|
|
1053
1196
|
if (disabled || readOnly || children) {
|
|
1054
1197
|
inputRef.current.removeEventListener('keydown', onPreventKeyDownHandler);
|
|
1055
1198
|
} else {
|
|
1056
1199
|
inputRef.current.removeEventListener('keydown', onKeyDown);
|
|
1057
1200
|
}
|
|
1201
|
+
|
|
1058
1202
|
closeDropdown();
|
|
1059
1203
|
};
|
|
1060
1204
|
}, [disabled, readOnly, displayExpr, multiple, allowSearch, viewType, closeAfterSelect, selectBox]);
|
|
@@ -1063,6 +1207,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1063
1207
|
inputRef.current.addEventListener('click', onClickInput);
|
|
1064
1208
|
inputRef.current.addEventListener('input', onChangeInput);
|
|
1065
1209
|
}
|
|
1210
|
+
|
|
1066
1211
|
return () => {
|
|
1067
1212
|
if (!disabled && !readOnly && inputRef.current) {
|
|
1068
1213
|
inputRef.current.removeEventListener('click', onClickInput);
|
|
@@ -1074,12 +1219,16 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1074
1219
|
if (!disabled && !readOnly) {
|
|
1075
1220
|
inputRef.current.addEventListener('click', onClickInput);
|
|
1076
1221
|
}
|
|
1222
|
+
|
|
1077
1223
|
if (dropdownListRef.current) {
|
|
1078
1224
|
var _dropdownListRef$curr5, _dropdownListRef$curr6, _currentObjectDefault6;
|
|
1225
|
+
|
|
1079
1226
|
if (!disabled && !readOnly) {
|
|
1080
1227
|
inputRef.current.addEventListener('input', onChangeInput);
|
|
1081
1228
|
}
|
|
1229
|
+
|
|
1082
1230
|
const length = (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : (_dropdownListRef$curr6 = _dropdownListRef$curr5.children) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.length;
|
|
1231
|
+
|
|
1083
1232
|
if (length < dataSource.length + ((_currentObjectDefault6 = currentObjectDefault[unique]) === null || _currentObjectDefault6 === void 0 ? void 0 : _currentObjectDefault6.length) && !isSearch[unique]) {
|
|
1084
1233
|
loadMoreItemsDropdown(length);
|
|
1085
1234
|
!!onLoadMore && dataSource.length < total && dropdownListRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
@@ -1091,17 +1240,20 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1091
1240
|
inputRef.current.addEventListener('input', onChangeInput);
|
|
1092
1241
|
}
|
|
1093
1242
|
}
|
|
1243
|
+
|
|
1094
1244
|
return () => {
|
|
1095
1245
|
if (inputRef.current) {
|
|
1096
1246
|
inputRef.current.removeEventListener('input', onChangeInput);
|
|
1097
1247
|
inputRef.current.removeEventListener('click', onClickInput);
|
|
1098
1248
|
}
|
|
1249
|
+
|
|
1099
1250
|
!!dropdownListRef.current && dropdownListRef.current.removeEventListener('scroll', onLoadMoreHandler);
|
|
1100
1251
|
};
|
|
1101
1252
|
}, [dataSource]);
|
|
1102
1253
|
/* End handler */
|
|
1103
1254
|
|
|
1104
1255
|
/* Start component */
|
|
1256
|
+
|
|
1105
1257
|
const EmptyDataText = jsx("div", {
|
|
1106
1258
|
css: _DropdownItemCSS,
|
|
1107
1259
|
className: 'no-data'
|
|
@@ -1111,17 +1263,20 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1111
1263
|
disabled: disabled,
|
|
1112
1264
|
...labelProps
|
|
1113
1265
|
}, label) : null, [label, required, disabled, labelProps]);
|
|
1266
|
+
|
|
1114
1267
|
const getData = () => {
|
|
1115
1268
|
let dataFilter = JSON.parse(JSON.stringify(dataSource));
|
|
1269
|
+
|
|
1116
1270
|
if (Array.isArray(valueObjectDefault)) {
|
|
1117
1271
|
dataFilter = [...dataFilter, ...dataChoosen.current, ...valueObjectDefault];
|
|
1118
1272
|
} else if (typeof valueObjectDefault === 'object') {
|
|
1119
|
-
dataFilter = [...dataFilter, ...dataChoosen.current, {
|
|
1120
|
-
...valueObjectDefault
|
|
1273
|
+
dataFilter = [...dataFilter, ...dataChoosen.current, { ...valueObjectDefault
|
|
1121
1274
|
}];
|
|
1122
1275
|
}
|
|
1276
|
+
|
|
1123
1277
|
return dataFilter;
|
|
1124
1278
|
};
|
|
1279
|
+
|
|
1125
1280
|
const InputView = useMemo(() => {
|
|
1126
1281
|
return jsx("div", {
|
|
1127
1282
|
css: _DropdownFormCSS,
|
|
@@ -1130,8 +1285,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1130
1285
|
}, jsx("div", {
|
|
1131
1286
|
css: _InputCSS,
|
|
1132
1287
|
className: 'DGN-UI-Dropdown-Form-Input'
|
|
1133
|
-
}, multiple && valueMulti !== null && valueMulti !== void 0 && valueMulti.length ? jsx("div", {
|
|
1134
|
-
...inputProps,
|
|
1288
|
+
}, multiple && valueMulti !== null && valueMulti !== void 0 && valueMulti.length ? jsx("div", { ...inputProps,
|
|
1135
1289
|
style: {
|
|
1136
1290
|
gap: spacing(0.5),
|
|
1137
1291
|
...inputStyle
|
|
@@ -1147,19 +1301,24 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1147
1301
|
let dataFilter = getData();
|
|
1148
1302
|
const data = dataFilter.find(v => v[valueExpr] === vl);
|
|
1149
1303
|
let text = '';
|
|
1304
|
+
|
|
1150
1305
|
if (data) {
|
|
1151
1306
|
var _mask;
|
|
1307
|
+
|
|
1152
1308
|
displayExpr = typeof renderSelectedItem === 'string' ? renderSelectedItem : displayExpr || valueExpr;
|
|
1153
|
-
let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
|
|
1309
|
+
let mask = data === null || data === void 0 ? void 0 : data[displayExpr]; // convert {id} - {name} to {<data[id]>} - {<data[name]>}
|
|
1154
1310
|
|
|
1155
|
-
// convert {id} - {name} to {<data[id]>} - {<data[name]>}
|
|
1156
1311
|
if (!mask && regexBetween.test(displayExpr)) {
|
|
1157
1312
|
var _displayExpr4;
|
|
1313
|
+
|
|
1158
1314
|
mask = (_displayExpr4 = displayExpr) === null || _displayExpr4 === void 0 ? void 0 : _displayExpr4.replace(regexBetween, _ => data[_]);
|
|
1159
1315
|
}
|
|
1316
|
+
|
|
1160
1317
|
text = (_mask = mask) === null || _mask === void 0 ? void 0 : _mask.replace(regexInclude, '');
|
|
1161
1318
|
}
|
|
1319
|
+
|
|
1162
1320
|
let item;
|
|
1321
|
+
|
|
1163
1322
|
if (typeof renderSelectedItem === 'function') {
|
|
1164
1323
|
item = renderSelectedItem({
|
|
1165
1324
|
data,
|
|
@@ -1176,9 +1335,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1176
1335
|
onRemove: e => onRemove(e, vl)
|
|
1177
1336
|
});
|
|
1178
1337
|
}
|
|
1338
|
+
|
|
1179
1339
|
return item;
|
|
1180
|
-
})) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", {
|
|
1181
|
-
...inputProps,
|
|
1340
|
+
})) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", { ...inputProps,
|
|
1182
1341
|
style: inputStyle,
|
|
1183
1342
|
ref: inputRef,
|
|
1184
1343
|
css: _DropdownInputCSS,
|
|
@@ -1223,8 +1382,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1223
1382
|
}) : null));
|
|
1224
1383
|
}, [openState, showClear, textValue, valueMulti, clearAble, dataSource, disabled, displayExpr, inputProps, inputStyle, loading, multilineSelectedItem, multiple, onChange, placeholder, readOnly, renderSelectedItem, valueExpr, valueObjectDefault, viewType]);
|
|
1225
1384
|
const ErrorView = useMemo(() => {
|
|
1226
|
-
return error ? jsx(HelperText, {
|
|
1227
|
-
...helperTextProps,
|
|
1385
|
+
return error ? jsx(HelperText, { ...helperTextProps,
|
|
1228
1386
|
disabled: disabled
|
|
1229
1387
|
}, error) : null;
|
|
1230
1388
|
}, [disabled, error, helperTextProps]);
|
|
@@ -1240,13 +1398,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1240
1398
|
className: classNames('DGN-UI-Dropdown', className, error && 'error', loading && 'dgn-dropdown-loading', disabled ? 'disabled' : readOnly && 'readOnly')
|
|
1241
1399
|
}, LabelView, InputView, ErrorView), DropdownView);
|
|
1242
1400
|
}));
|
|
1243
|
-
|
|
1244
1401
|
/* Start styled */
|
|
1402
|
+
|
|
1245
1403
|
const InputCSS = (multiple, renderSelectedItem) => css`
|
|
1246
1404
|
${displayFlex};
|
|
1247
1405
|
${positionRelative};
|
|
1248
1406
|
${parseWidth(!multiple && renderSelectedItem ? 'calc(100% - 34px)' : '100%')};
|
|
1249
1407
|
`;
|
|
1408
|
+
|
|
1250
1409
|
const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) => css`
|
|
1251
1410
|
${displayFlex};
|
|
1252
1411
|
${itemsCenter};
|
|
@@ -1299,12 +1458,14 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) =
|
|
|
1299
1458
|
${disabled && `color: ${systemDisabled}`};
|
|
1300
1459
|
}
|
|
1301
1460
|
`;
|
|
1461
|
+
|
|
1302
1462
|
const IconCSS = viewType => css`
|
|
1303
1463
|
${displayFlex};
|
|
1304
1464
|
${itemsCenter};
|
|
1305
1465
|
${mgl([2])};
|
|
1306
1466
|
${mgr([viewType !== 'outlined' ? 0 : 4])};
|
|
1307
1467
|
`;
|
|
1468
|
+
|
|
1308
1469
|
const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInputCSSName) => viewType !== 'outlined' ? css`
|
|
1309
1470
|
${displayFlex};
|
|
1310
1471
|
${flexRow};
|
|
@@ -1416,6 +1577,7 @@ const DropdownFormCSS = (viewType, multiple, disabled, placeholder, DropdownInpu
|
|
|
1416
1577
|
content: '';
|
|
1417
1578
|
}
|
|
1418
1579
|
`;
|
|
1580
|
+
|
|
1419
1581
|
const DropdownListCSS = loading => css`
|
|
1420
1582
|
${displayBlock};
|
|
1421
1583
|
${positionRelative};
|
|
@@ -1443,6 +1605,7 @@ const DropdownListCSS = loading => css`
|
|
|
1443
1605
|
${pd([0.25])};
|
|
1444
1606
|
}
|
|
1445
1607
|
`;
|
|
1608
|
+
|
|
1446
1609
|
const DropdownItemCSS = (multiple, selectBox) => css`
|
|
1447
1610
|
${displayFlex};
|
|
1448
1611
|
${flexRow};
|
|
@@ -1469,6 +1632,7 @@ const DropdownItemCSS = (multiple, selectBox) => css`
|
|
|
1469
1632
|
color: ${systemActive};
|
|
1470
1633
|
}
|
|
1471
1634
|
`;
|
|
1635
|
+
|
|
1472
1636
|
const DropdownRootCSS = (DropdownFormCSSName, DropdownInputCSSName) => css`
|
|
1473
1637
|
${displayBlock};
|
|
1474
1638
|
${positionRelative};
|
|
@@ -1502,6 +1666,7 @@ const DropdownRootCSS = (DropdownFormCSSName, DropdownInputCSSName) => css`
|
|
|
1502
1666
|
}
|
|
1503
1667
|
}
|
|
1504
1668
|
`;
|
|
1669
|
+
|
|
1505
1670
|
const DropdownCSS = (top, left, width, isMobile, allowSearch) => css`
|
|
1506
1671
|
${positionFixed};
|
|
1507
1672
|
${parseWidth(width)};
|
|
@@ -1516,6 +1681,7 @@ const DropdownCSS = (top, left, width, isMobile, allowSearch) => css`
|
|
|
1516
1681
|
top: auto;
|
|
1517
1682
|
`}
|
|
1518
1683
|
`;
|
|
1684
|
+
|
|
1519
1685
|
const LoadingProgressCSS = css`
|
|
1520
1686
|
${displayFlex};
|
|
1521
1687
|
${flexRow};
|
|
@@ -1567,39 +1733,51 @@ Dropdown.defaultProps = {
|
|
|
1567
1733
|
Dropdown.propTypes = {
|
|
1568
1734
|
/** If `true`, display input box search. */
|
|
1569
1735
|
allowSearch: PropTypes.bool,
|
|
1736
|
+
|
|
1570
1737
|
/** The contents in Dropdown box (Exp: TreeView). */
|
|
1571
1738
|
children: PropTypes.node,
|
|
1739
|
+
|
|
1572
1740
|
/** Class for component. */
|
|
1573
1741
|
className: PropTypes.string,
|
|
1742
|
+
|
|
1574
1743
|
/** If `true`, display clear icon.*/
|
|
1575
1744
|
clearAble: PropTypes.bool,
|
|
1745
|
+
|
|
1576
1746
|
/** If `true`, dropdown will close after select an item. */
|
|
1577
1747
|
closeAfterSelect: PropTypes.bool,
|
|
1748
|
+
|
|
1578
1749
|
/** The array of elements that appear in the dropdown list. */
|
|
1579
1750
|
dataSource: PropTypes.array,
|
|
1751
|
+
|
|
1580
1752
|
/** Default value displayed when first render. */
|
|
1581
1753
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1754
|
+
|
|
1582
1755
|
/** If `true`, the component is disabled. */
|
|
1583
1756
|
disabled: PropTypes.bool,
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
*
|
|
1757
|
+
|
|
1758
|
+
/** Field name used for text display in dropdown list.<br/>
|
|
1759
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1760
|
+
* Note: don't use 'id - name', return undefined
|
|
1587
1761
|
*/
|
|
1588
1762
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1763
|
+
|
|
1589
1764
|
/** Style inline of dropdown items. */
|
|
1590
1765
|
dropdownItemStyle: PropTypes.object,
|
|
1766
|
+
|
|
1591
1767
|
/** Error displayed below input. */
|
|
1592
1768
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1769
|
+
|
|
1593
1770
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1594
1771
|
helperTextProps: PropTypes.object,
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1599
|
-
*  
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1772
|
+
|
|
1773
|
+
/** Field name used for icon display.<br/>
|
|
1774
|
+
* Example:<br/>
|
|
1775
|
+
* string: 'icon'<br/>
|
|
1776
|
+
* object: {<br/>
|
|
1777
|
+
* key: 'icon',<br/>
|
|
1778
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1779
|
+
* suffix: '.jpg'<br/>
|
|
1780
|
+
* }
|
|
1603
1781
|
*/
|
|
1604
1782
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1605
1783
|
key: PropTypes.string,
|
|
@@ -1607,98 +1785,133 @@ Dropdown.propTypes = {
|
|
|
1607
1785
|
suffix: PropTypes.string,
|
|
1608
1786
|
style: PropTypes.object
|
|
1609
1787
|
})]),
|
|
1788
|
+
|
|
1610
1789
|
/** Attributes applied to the input element. */
|
|
1611
1790
|
inputProps: PropTypes.object,
|
|
1791
|
+
|
|
1612
1792
|
/** Style inline of input element. */
|
|
1613
1793
|
inputStyle: PropTypes.object,
|
|
1794
|
+
|
|
1614
1795
|
/** The mode of item when rendering. */
|
|
1615
1796
|
itemMode: PropTypes.oneOf(['normal', 'table', 'treeview']),
|
|
1797
|
+
|
|
1616
1798
|
/** The label of the input. */
|
|
1617
1799
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
1800
|
+
|
|
1618
1801
|
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) of label. */
|
|
1619
1802
|
labelProps: PropTypes.object,
|
|
1803
|
+
|
|
1620
1804
|
/** Number of items that are rendered each time. */
|
|
1621
1805
|
limit: PropTypes.number,
|
|
1806
|
+
|
|
1622
1807
|
/** If `true`, the loading indicator is shown. */
|
|
1623
1808
|
loading: PropTypes.bool,
|
|
1809
|
+
|
|
1624
1810
|
/** Set restrictions regarding the maximum number of options that can be selected. (Use with prop `multiple`) */
|
|
1625
1811
|
maximumSelectionLength: PropTypes.number,
|
|
1812
|
+
|
|
1626
1813
|
/** If `true`, show multi-line selected item(s). */
|
|
1627
1814
|
multilineSelectedItem: PropTypes.bool,
|
|
1815
|
+
|
|
1628
1816
|
/** If `true`, value must be an array and the dropdown will support multiple selections. */
|
|
1629
1817
|
multiple: PropTypes.bool,
|
|
1818
|
+
|
|
1630
1819
|
/** Specifies a text string shown when there is no data. */
|
|
1631
1820
|
noDataText: PropTypes.string,
|
|
1821
|
+
|
|
1632
1822
|
/** Callback fired when the value changes. */
|
|
1633
1823
|
onChange: PropTypes.func,
|
|
1824
|
+
|
|
1634
1825
|
/** Callback fired when dropdown closed. */
|
|
1635
1826
|
onClosed: PropTypes.func,
|
|
1636
|
-
|
|
1637
|
-
|
|
1827
|
+
|
|
1828
|
+
/** Callback fired when the input value changes.<br/>
|
|
1829
|
+
* if undefined: the filter function will run (default)
|
|
1638
1830
|
*/
|
|
1639
1831
|
onInput: PropTypes.func,
|
|
1832
|
+
|
|
1640
1833
|
/** Callback fired when key down input */
|
|
1641
1834
|
onKeyDown: PropTypes.func,
|
|
1835
|
+
|
|
1642
1836
|
/** Callback fired when scroll near the end. */
|
|
1643
1837
|
onLoadMore: PropTypes.func,
|
|
1838
|
+
|
|
1644
1839
|
/** The short hint displayed in the input before the user select a value. */
|
|
1645
1840
|
placeholder: PropTypes.string,
|
|
1841
|
+
|
|
1646
1842
|
/** If `true`, the component is read-only. */
|
|
1647
1843
|
readOnly: PropTypes.bool,
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
*
|
|
1844
|
+
|
|
1845
|
+
/** Function displays items by custom.<br/>
|
|
1846
|
+
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1847
|
+
* --> such as: displayExpr={'name - role'}
|
|
1651
1848
|
*/
|
|
1652
1849
|
renderItem: PropTypes.func,
|
|
1653
|
-
|
|
1654
|
-
|
|
1850
|
+
|
|
1851
|
+
/** Function or field name used for display selected items, example:<br/>
|
|
1852
|
+
* renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
1655
1853
|
*/
|
|
1656
1854
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1855
|
+
|
|
1657
1856
|
/** If `true`, the label will indicate that the input is required. */
|
|
1658
1857
|
required: PropTypes.bool,
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
*
|
|
1662
|
-
*
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* Duration wait enter search content on search.<br/>
|
|
1861
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1862
|
+
* If `true`, used default delayOnInput.
|
|
1663
1863
|
*/
|
|
1664
1864
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1865
|
+
|
|
1665
1866
|
/** Specifies a data object's field name or an expression whose value is compared to the search string. */
|
|
1666
1867
|
searchExpr: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
1868
|
+
|
|
1667
1869
|
/** Specifies a comparison operation used to search items. */
|
|
1668
1870
|
searchMode: PropTypes.oneOf(['contains', 'startswith', 'equals']),
|
|
1871
|
+
|
|
1669
1872
|
/** If `true`, show checkbox in each dropdown item. */
|
|
1670
1873
|
selectBox: PropTypes.bool,
|
|
1874
|
+
|
|
1671
1875
|
/** Style inline of component. */
|
|
1672
1876
|
style: PropTypes.object,
|
|
1877
|
+
|
|
1673
1878
|
/** Display sub content. */
|
|
1674
1879
|
subText: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
1880
|
+
|
|
1675
1881
|
/** The total number of items in the dropdown list. */
|
|
1676
1882
|
total: PropTypes.number,
|
|
1883
|
+
|
|
1677
1884
|
/** Used to identify the parent key (only used for `itemMode` is 'treeview'). */
|
|
1678
1885
|
treeViewID: PropTypes.string,
|
|
1886
|
+
|
|
1679
1887
|
/** Used for mapping into a nested list (only used for `itemMode` is 'treeview'). */
|
|
1680
1888
|
treeViewParentID: PropTypes.string,
|
|
1889
|
+
|
|
1681
1890
|
/** The displayed value of component. */
|
|
1682
1891
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1892
|
+
|
|
1683
1893
|
/** The field name used for the returned result. */
|
|
1684
1894
|
valueExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1895
|
+
|
|
1685
1896
|
/** An object default for value (use for load more). */
|
|
1686
1897
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1898
|
+
|
|
1687
1899
|
/**The variant to use. */
|
|
1688
1900
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none']),
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
1695
|
-
*
|
|
1696
|
-
*
|
|
1697
|
-
* *
|
|
1698
|
-
* *
|
|
1699
|
-
* *
|
|
1700
|
-
* *
|
|
1701
|
-
*
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* ref methods
|
|
1904
|
+
*
|
|
1905
|
+
* how to get component element? ref.current
|
|
1906
|
+
*
|
|
1907
|
+
* how to call method? ref.current.instance.{method}
|
|
1908
|
+
*
|
|
1909
|
+
* * showDropdown(): Show dropdown
|
|
1910
|
+
* * closeDropdown(): Close dropdown
|
|
1911
|
+
* * onClear(): Clear selected value
|
|
1912
|
+
* * setPreviousValue(): Set value to previous value
|
|
1913
|
+
* * setValue(value): Set value of dropdown
|
|
1914
|
+
* * @param {value} - string || number || array
|
|
1702
1915
|
*/
|
|
1703
1916
|
reference: ref
|
|
1704
1917
|
};
|