@douyinfe/semi-foundation 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/anchor/foundation.ts +1 -1
- package/autoComplete/autoComplete.scss +3 -2
- package/autoComplete/foundation.ts +1 -1
- package/base/foundation.ts +1 -1
- package/cascader/foundation.ts +1 -1
- package/cascader/util.ts +1 -1
- package/datePicker/_utils/getFullDateOffset.ts +1 -1
- package/datePicker/foundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +1 -1
- package/form/foundation.ts +1 -1
- package/form/utils.ts +1 -1
- package/getBabelConfig.js +36 -0
- package/gulpfile.js +27 -9
- package/input/foundation.ts +1 -1
- package/input/input.scss +2 -0
- package/input/textareaFoundation.ts +1 -1
- package/input/util/getSizingData.ts +1 -1
- package/input/variables.scss +1 -1
- package/inputNumber/foundation.ts +1 -1
- package/lib/cjs/_portal/portal.css +15 -0
- package/lib/cjs/_portal/portal.scss +17 -0
- package/lib/cjs/anchor/anchor.css +118 -0
- package/lib/cjs/anchor/anchor.scss +120 -0
- package/lib/cjs/anchor/constants.d.ts +11 -0
- package/lib/cjs/anchor/constants.js +24 -0
- package/lib/cjs/anchor/foundation.d.ts +41 -0
- package/lib/cjs/anchor/foundation.js +270 -0
- package/lib/cjs/anchor/linkFoundation.d.ts +14 -0
- package/lib/cjs/anchor/linkFoundation.js +50 -0
- package/lib/cjs/anchor/rtl.scss +18 -0
- package/lib/cjs/anchor/variables.scss +27 -0
- package/lib/cjs/autoComplete/autoComplete.css +103 -0
- package/lib/cjs/autoComplete/autoComplete.scss +38 -0
- package/lib/cjs/autoComplete/constants.d.ts +10 -0
- package/lib/cjs/autoComplete/constants.js +25 -0
- package/lib/cjs/autoComplete/foundation.d.ts +62 -0
- package/lib/cjs/autoComplete/foundation.js +465 -0
- package/lib/cjs/autoComplete/rtl.scss +8 -0
- package/lib/cjs/autoComplete/variables.scss +3 -0
- package/lib/cjs/avatar/avatar.css +426 -0
- package/lib/cjs/avatar/avatar.scss +205 -0
- package/lib/cjs/avatar/constants.d.ts +10 -0
- package/lib/cjs/avatar/constants.js +24 -0
- package/lib/cjs/avatar/foundation.d.ts +14 -0
- package/lib/cjs/avatar/foundation.js +49 -0
- package/lib/cjs/avatar/mixin.css +3 -0
- package/lib/cjs/avatar/mixin.scss +4 -0
- package/lib/cjs/avatar/rtl.scss +69 -0
- package/lib/cjs/avatar/variables.scss +45 -0
- package/lib/cjs/backtop/backtop.css +20 -0
- package/lib/cjs/backtop/backtop.scss +17 -0
- package/lib/cjs/backtop/constants.d.ts +5 -0
- package/lib/cjs/backtop/constants.js +18 -0
- package/lib/cjs/backtop/foundation.d.ts +21 -0
- package/lib/cjs/backtop/foundation.js +114 -0
- package/lib/cjs/backtop/rtl.scss +10 -0
- package/lib/cjs/backtop/variables.scss +3 -0
- package/lib/cjs/badge/badge.css +146 -0
- package/lib/cjs/badge/badge.scss +168 -0
- package/lib/cjs/badge/constants.d.ts +10 -0
- package/lib/cjs/badge/constants.js +24 -0
- package/lib/cjs/badge/rtl.scss +8 -0
- package/lib/cjs/badge/variables.scss +43 -0
- package/lib/cjs/banner/banner.css +92 -0
- package/lib/cjs/banner/banner.scss +109 -0
- package/lib/cjs/banner/constants.d.ts +7 -0
- package/lib/cjs/banner/constants.js +20 -0
- package/lib/cjs/banner/foundation.d.ts +9 -0
- package/lib/cjs/banner/foundation.js +30 -0
- package/lib/cjs/banner/rtl.scss +20 -0
- package/lib/cjs/banner/variables.scss +27 -0
- package/lib/cjs/base/base.css +24 -0
- package/lib/cjs/base/base.scss +33 -0
- package/lib/cjs/base/constants.d.ts +3 -0
- package/lib/cjs/base/constants.js +22 -0
- package/lib/cjs/base/env.d.ts +1 -0
- package/lib/cjs/base/env.js +11 -0
- package/lib/cjs/base/foundation.d.ts +59 -0
- package/lib/cjs/base/foundation.js +144 -0
- package/lib/cjs/base/index.d.ts +5 -0
- package/lib/cjs/base/index.js +18 -0
- package/lib/cjs/breadcrumb/breadcrumb.css +109 -0
- package/lib/cjs/breadcrumb/breadcrumb.scss +120 -0
- package/lib/cjs/breadcrumb/constants.d.ts +7 -0
- package/lib/cjs/breadcrumb/constants.js +20 -0
- package/lib/cjs/breadcrumb/foundation.d.ts +24 -0
- package/lib/cjs/breadcrumb/foundation.js +52 -0
- package/lib/cjs/breadcrumb/itemFoundation.d.ts +22 -0
- package/lib/cjs/breadcrumb/itemFoundation.js +31 -0
- package/lib/cjs/breadcrumb/rtl.scss +33 -0
- package/lib/cjs/breadcrumb/variables.scss +19 -0
- package/lib/cjs/button/button.css +309 -0
- package/lib/cjs/button/button.scss +219 -0
- package/lib/cjs/button/constants.d.ts +6 -0
- package/lib/cjs/button/constants.js +28 -0
- package/lib/cjs/button/iconButton.css +160 -0
- package/lib/cjs/button/iconButton.scss +70 -0
- package/lib/cjs/button/rtl.scss +128 -0
- package/lib/cjs/button/splitButtonGroup.scss +32 -0
- package/lib/cjs/button/variables.scss +128 -0
- package/lib/cjs/calendar/calendar.css +592 -0
- package/lib/cjs/calendar/calendar.scss +520 -0
- package/lib/cjs/calendar/constants.d.ts +7 -0
- package/lib/cjs/calendar/constants.js +20 -0
- package/lib/cjs/calendar/eventUtil.d.ts +93 -0
- package/lib/cjs/calendar/eventUtil.js +431 -0
- package/lib/cjs/calendar/foundation.d.ts +99 -0
- package/lib/cjs/calendar/foundation.js +483 -0
- package/lib/cjs/calendar/rtl.scss +134 -0
- package/lib/cjs/calendar/variables.scss +105 -0
- package/lib/cjs/card/card.css +148 -0
- package/lib/cjs/card/card.scss +146 -0
- package/lib/cjs/card/constants.d.ts +8 -0
- package/lib/cjs/card/constants.js +21 -0
- package/lib/cjs/card/rtl.scss +43 -0
- package/lib/cjs/card/variables.scss +30 -0
- package/lib/cjs/cascader/cascader.css +438 -0
- package/lib/cjs/cascader/cascader.scss +436 -0
- package/lib/cjs/cascader/constants.d.ts +14 -0
- package/lib/cjs/cascader/constants.js +28 -0
- package/lib/cjs/cascader/foundation.d.ts +221 -0
- package/lib/cjs/cascader/foundation.js +1061 -0
- package/lib/cjs/cascader/rtl.scss +114 -0
- package/lib/cjs/cascader/util.d.ts +4 -0
- package/lib/cjs/cascader/util.js +114 -0
- package/lib/cjs/cascader/variables.scss +117 -0
- package/lib/cjs/checkbox/checkbox.css +311 -0
- package/lib/cjs/checkbox/checkbox.scss +363 -0
- package/lib/cjs/checkbox/checkboxFoundation.d.ts +49 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +105 -0
- package/lib/cjs/checkbox/checkboxGroupFoundation.d.ts +17 -0
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +103 -0
- package/lib/cjs/checkbox/constants.d.ts +27 -0
- package/lib/cjs/checkbox/constants.js +42 -0
- package/lib/cjs/checkbox/mixin.css +3 -0
- package/lib/cjs/checkbox/mixin.scss +0 -0
- package/lib/cjs/checkbox/rtl.scss +54 -0
- package/lib/cjs/checkbox/variables.scss +62 -0
- package/lib/cjs/collapse/collapse.css +78 -0
- package/lib/cjs/collapse/collapse.scss +77 -0
- package/lib/cjs/collapse/constants.d.ts +7 -0
- package/lib/cjs/collapse/constants.js +20 -0
- package/lib/cjs/collapse/foundation.d.ts +28 -0
- package/lib/cjs/collapse/foundation.js +77 -0
- package/lib/cjs/collapse/rtl.scss +26 -0
- package/lib/cjs/collapse/variables.scss +22 -0
- package/lib/cjs/collapsible/constants.d.ts +4 -0
- package/lib/cjs/collapsible/constants.js +16 -0
- package/lib/cjs/datePicker/_utils/formatter.d.ts +14 -0
- package/lib/cjs/datePicker/_utils/formatter.js +72 -0
- package/lib/cjs/datePicker/_utils/getDayOfWeek.d.ts +11 -0
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +31 -0
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.d.ts +9 -0
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +29 -0
- package/lib/cjs/datePicker/_utils/getFullDateOffset.d.ts +7 -0
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +35 -0
- package/lib/cjs/datePicker/_utils/getMonthTable.d.ts +12 -0
- package/lib/cjs/datePicker/_utils/getMonthTable.js +97 -0
- package/lib/cjs/datePicker/_utils/getMonthsInYear.d.ts +2 -0
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +26 -0
- package/lib/cjs/datePicker/_utils/getYears.d.ts +2 -0
- package/lib/cjs/datePicker/_utils/getYears.js +24 -0
- package/lib/cjs/datePicker/_utils/index.d.ts +13 -0
- package/lib/cjs/datePicker/_utils/index.js +117 -0
- package/lib/cjs/datePicker/_utils/isAfter.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isAfter.js +21 -0
- package/lib/cjs/datePicker/_utils/isBefore.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isBefore.js +21 -0
- package/lib/cjs/datePicker/_utils/isBetween.d.ts +11 -0
- package/lib/cjs/datePicker/_utils/isBetween.js +36 -0
- package/lib/cjs/datePicker/_utils/isDate.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isDate.js +13 -0
- package/lib/cjs/datePicker/_utils/isSameDay.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isSameDay.js +21 -0
- package/lib/cjs/datePicker/_utils/isTimestamp.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isTimestamp.js +19 -0
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +19 -0
- package/lib/cjs/datePicker/_utils/isValidDate.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isValidDate.js +13 -0
- package/lib/cjs/datePicker/_utils/isWithinInterval.d.ts +4 -0
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +29 -0
- package/lib/cjs/datePicker/_utils/parser.d.ts +4 -0
- package/lib/cjs/datePicker/_utils/parser.js +46 -0
- package/lib/cjs/datePicker/constants.d.ts +50 -0
- package/lib/cjs/datePicker/constants.js +75 -0
- package/lib/cjs/datePicker/datePicker.css +810 -0
- package/lib/cjs/datePicker/datePicker.scss +1034 -0
- package/lib/cjs/datePicker/foundation.d.ts +409 -0
- package/lib/cjs/datePicker/foundation.js +1167 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +59 -0
- package/lib/cjs/datePicker/inputFoundation.js +125 -0
- package/lib/cjs/datePicker/monthFoundation.d.ts +73 -0
- package/lib/cjs/datePicker/monthFoundation.js +96 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +218 -0
- package/lib/cjs/datePicker/monthsGridFoundation.js +954 -0
- package/lib/cjs/datePicker/rtl.scss +171 -0
- package/lib/cjs/datePicker/variables.scss +169 -0
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +56 -0
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +52 -0
- package/lib/cjs/descriptions/constants.d.ts +9 -0
- package/lib/cjs/descriptions/constants.js +23 -0
- package/lib/cjs/descriptions/descriptions.css +191 -0
- package/lib/cjs/descriptions/descriptions.scss +150 -0
- package/lib/cjs/descriptions/rtl.scss +91 -0
- package/lib/cjs/descriptions/variables.scss +15 -0
- package/lib/cjs/dropdown/constants.d.ts +16 -0
- package/lib/cjs/dropdown/constants.js +32 -0
- package/lib/cjs/dropdown/dropdown.css +123 -0
- package/lib/cjs/dropdown/dropdown.scss +106 -0
- package/lib/cjs/dropdown/foundation.d.ts +8 -0
- package/lib/cjs/dropdown/foundation.js +24 -0
- package/lib/cjs/dropdown/rtl.scss +27 -0
- package/lib/cjs/dropdown/variables.scss +38 -0
- package/lib/cjs/empty/constants.d.ts +7 -0
- package/lib/cjs/empty/constants.js +20 -0
- package/lib/cjs/empty/empty.css +50 -0
- package/lib/cjs/empty/empty.scss +54 -0
- package/lib/cjs/empty/rtl.scss +15 -0
- package/lib/cjs/empty/variables.scss +8 -0
- package/lib/cjs/form/constants.d.ts +11 -0
- package/lib/cjs/form/constants.js +25 -0
- package/lib/cjs/form/form.css +250 -0
- package/lib/cjs/form/form.scss +273 -0
- package/lib/cjs/form/foundation.d.ts +86 -0
- package/lib/cjs/form/foundation.js +845 -0
- package/lib/cjs/form/interface.d.ts +121 -0
- package/lib/cjs/form/interface.js +7 -0
- package/lib/cjs/form/rtl.scss +89 -0
- package/lib/cjs/form/utils.d.ts +52 -0
- package/lib/cjs/form/utils.js +242 -0
- package/lib/cjs/form/variables.scss +44 -0
- package/lib/cjs/grid/constants.d.ts +4 -0
- package/lib/cjs/grid/constants.js +16 -0
- package/lib/cjs/grid/grid.css +6295 -0
- package/lib/cjs/grid/grid.scss +121 -0
- package/lib/cjs/grid/mixin.css +3 -0
- package/lib/cjs/grid/mixin.scss +115 -0
- package/lib/cjs/grid/rtl.scss +9 -0
- package/lib/cjs/grid/variables.scss +35 -0
- package/lib/cjs/icons/constants.d.ts +9 -0
- package/lib/cjs/icons/constants.js +24 -0
- package/lib/cjs/input/constants.d.ts +12 -0
- package/lib/cjs/input/constants.js +26 -0
- package/lib/cjs/input/foundation.d.ts +79 -0
- package/lib/cjs/input/foundation.js +379 -0
- package/lib/cjs/input/input.css +568 -0
- package/lib/cjs/input/input.scss +630 -0
- package/lib/cjs/input/rtl.scss +100 -0
- package/lib/cjs/input/textarea.css +222 -0
- package/lib/cjs/input/textarea.scss +188 -0
- package/lib/cjs/input/textareaFoundation.d.ts +63 -0
- package/lib/cjs/input/textareaFoundation.js +299 -0
- package/lib/cjs/input/util/calculateNodeHeight.d.ts +1 -0
- package/lib/cjs/input/util/calculateNodeHeight.js +101 -0
- package/lib/cjs/input/util/getSizingData.d.ts +6 -0
- package/lib/cjs/input/util/getSizingData.js +47 -0
- package/lib/cjs/input/variables.scss +109 -0
- package/lib/cjs/inputNumber/constants.d.ts +17 -0
- package/lib/cjs/inputNumber/constants.js +27 -0
- package/lib/cjs/inputNumber/foundation.d.ts +107 -0
- package/lib/cjs/inputNumber/foundation.js +692 -0
- package/lib/cjs/inputNumber/inputNumber.css +99 -0
- package/lib/cjs/inputNumber/inputNumber.scss +108 -0
- package/lib/cjs/inputNumber/rtl.scss +30 -0
- package/lib/cjs/inputNumber/variables.scss +23 -0
- package/lib/cjs/keyframes/rotate.css +11 -0
- package/lib/cjs/keyframes/rotate.scss +8 -0
- package/lib/cjs/layout/constants.d.ts +7 -0
- package/lib/cjs/layout/constants.js +20 -0
- package/lib/cjs/layout/layout.css +40 -0
- package/lib/cjs/layout/layout.scss +49 -0
- package/lib/cjs/layout/rtl.scss +8 -0
- package/lib/cjs/list/constants.d.ts +9 -0
- package/lib/cjs/list/constants.js +22 -0
- package/lib/cjs/list/list.css +121 -0
- package/lib/cjs/list/list.scss +125 -0
- package/lib/cjs/list/rtl.scss +39 -0
- package/lib/cjs/list/variables.scss +17 -0
- package/lib/cjs/modal/constants.d.ts +10 -0
- package/lib/cjs/modal/constants.js +23 -0
- package/lib/cjs/modal/modal.css +233 -0
- package/lib/cjs/modal/modal.scss +267 -0
- package/lib/cjs/modal/modalContentFoundation.d.ts +33 -0
- package/lib/cjs/modal/modalContentFoundation.js +76 -0
- package/lib/cjs/modal/modalFoundation.d.ts +68 -0
- package/lib/cjs/modal/modalFoundation.js +52 -0
- package/lib/cjs/modal/rtl.scss +48 -0
- package/lib/cjs/modal/variables.scss +69 -0
- package/lib/cjs/navigation/NavItem.d.ts +10 -0
- package/lib/cjs/navigation/NavItem.js +74 -0
- package/lib/cjs/navigation/constants.d.ts +21 -0
- package/lib/cjs/navigation/constants.js +38 -0
- package/lib/cjs/navigation/foundation.d.ts +86 -0
- package/lib/cjs/navigation/foundation.js +313 -0
- package/lib/cjs/navigation/itemFoundation.d.ts +45 -0
- package/lib/cjs/navigation/itemFoundation.js +84 -0
- package/lib/cjs/navigation/mixin.css +3 -0
- package/lib/cjs/navigation/mixin.scss +98 -0
- package/lib/cjs/navigation/navigation.css +758 -0
- package/lib/cjs/navigation/navigation.scss +683 -0
- package/lib/cjs/navigation/rtl.scss +132 -0
- package/lib/cjs/navigation/subNavFoundation.d.ts +39 -0
- package/lib/cjs/navigation/subNavFoundation.js +147 -0
- package/lib/cjs/navigation/variables.scss +132 -0
- package/lib/cjs/notification/constants.d.ts +14 -0
- package/lib/cjs/notification/constants.js +29 -0
- package/lib/cjs/notification/notification.css +154 -0
- package/lib/cjs/notification/notification.scss +168 -0
- package/lib/cjs/notification/notificationFoundation.d.ts +48 -0
- package/lib/cjs/notification/notificationFoundation.js +74 -0
- package/lib/cjs/notification/notificationListFoundation.d.ts +28 -0
- package/lib/cjs/notification/notificationListFoundation.js +61 -0
- package/lib/cjs/notification/rtl.scss +23 -0
- package/lib/cjs/notification/variables.scss +43 -0
- package/lib/cjs/overflowList/constants.d.ts +23 -0
- package/lib/cjs/overflowList/constants.js +44 -0
- package/lib/cjs/overflowList/foundation.d.ts +14 -0
- package/lib/cjs/overflowList/foundation.js +143 -0
- package/lib/cjs/overflowList/overflowList.css +23 -0
- package/lib/cjs/overflowList/overflowList.scss +20 -0
- package/lib/cjs/overflowList/rtl.scss +8 -0
- package/lib/cjs/pagination/constants.d.ts +12 -0
- package/lib/cjs/pagination/constants.js +26 -0
- package/lib/cjs/pagination/foundation.d.ts +52 -0
- package/lib/cjs/pagination/foundation.js +385 -0
- package/lib/cjs/pagination/pagination.css +155 -0
- package/lib/cjs/pagination/pagination.scss +158 -0
- package/lib/cjs/pagination/rtl.scss +18 -0
- package/lib/cjs/pagination/variables.scss +51 -0
- package/lib/cjs/popconfirm/constants.d.ts +13 -0
- package/lib/cjs/popconfirm/constants.js +27 -0
- package/lib/cjs/popconfirm/popconfirm.css +117 -0
- package/lib/cjs/popconfirm/popconfirm.scss +105 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.d.ts +16 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.js +47 -0
- package/lib/cjs/popconfirm/rtl.scss +60 -0
- package/lib/cjs/popconfirm/variables.scss +36 -0
- package/lib/cjs/popover/constants.d.ts +25 -0
- package/lib/cjs/popover/constants.js +45 -0
- package/lib/cjs/popover/popover.css +160 -0
- package/lib/cjs/popover/popover.scss +54 -0
- package/lib/cjs/popover/rtl.scss +7 -0
- package/lib/cjs/popover/variables.scss +28 -0
- package/lib/cjs/progress/constants.d.ts +14 -0
- package/lib/cjs/progress/constants.js +28 -0
- package/lib/cjs/progress/progress.css +106 -0
- package/lib/cjs/progress/progress.scss +105 -0
- package/lib/cjs/progress/rtl.scss +29 -0
- package/lib/cjs/progress/variables.scss +25 -0
- package/lib/cjs/radio/constants.d.ts +29 -0
- package/lib/cjs/radio/constants.js +44 -0
- package/lib/cjs/radio/mixin.css +3 -0
- package/lib/cjs/radio/mixin.scss +0 -0
- package/lib/cjs/radio/radio.css +346 -0
- package/lib/cjs/radio/radio.scss +379 -0
- package/lib/cjs/radio/radioFoundation.d.ts +7 -0
- package/lib/cjs/radio/radioFoundation.js +22 -0
- package/lib/cjs/radio/radioGroupFoundation.d.ts +16 -0
- package/lib/cjs/radio/radioGroupFoundation.js +91 -0
- package/lib/cjs/radio/radioInnerFoundation.d.ts +22 -0
- package/lib/cjs/radio/radioInnerFoundation.js +74 -0
- package/lib/cjs/radio/rtl.scss +78 -0
- package/lib/cjs/radio/variables.scss +91 -0
- package/lib/cjs/rating/constants.d.ts +7 -0
- package/lib/cjs/rating/constants.js +20 -0
- package/lib/cjs/rating/foundation.d.ts +28 -0
- package/lib/cjs/rating/foundation.js +202 -0
- package/lib/cjs/rating/rating.css +81 -0
- package/lib/cjs/rating/rating.scss +87 -0
- package/lib/cjs/rating/rtl.scss +21 -0
- package/lib/cjs/rating/variables.scss +14 -0
- package/lib/cjs/scrollList/constants.d.ts +12 -0
- package/lib/cjs/scrollList/constants.js +26 -0
- package/lib/cjs/scrollList/foundation.d.ts +3 -0
- package/lib/cjs/scrollList/foundation.js +17 -0
- package/lib/cjs/scrollList/itemFoundation.d.ts +74 -0
- package/lib/cjs/scrollList/itemFoundation.js +320 -0
- package/lib/cjs/scrollList/rtl.scss +47 -0
- package/lib/cjs/scrollList/scrollList.css +181 -0
- package/lib/cjs/scrollList/scrollList.scss +182 -0
- package/lib/cjs/scrollList/scrollTo.d.ts +3 -0
- package/lib/cjs/scrollList/scrollTo.js +35 -0
- package/lib/cjs/scrollList/variables.scss +48 -0
- package/lib/cjs/select/constants.d.ts +16 -0
- package/lib/cjs/select/constants.js +33 -0
- package/lib/cjs/select/foundation.d.ts +107 -0
- package/lib/cjs/select/foundation.js +1220 -0
- package/lib/cjs/select/mixin.css +3 -0
- package/lib/cjs/select/mixin.scss +6 -0
- package/lib/cjs/select/option.css +76 -0
- package/lib/cjs/select/option.scss +95 -0
- package/lib/cjs/select/optionFoundation.d.ts +21 -0
- package/lib/cjs/select/optionFoundation.js +42 -0
- package/lib/cjs/select/rtl.scss +93 -0
- package/lib/cjs/select/select.css +465 -0
- package/lib/cjs/select/select.scss +422 -0
- package/lib/cjs/select/variables.scss +100 -0
- package/lib/cjs/sideSheet/constants.d.ts +15 -0
- package/lib/cjs/sideSheet/constants.js +28 -0
- package/lib/cjs/sideSheet/rtl.scss +17 -0
- package/lib/cjs/sideSheet/sideSheet.css +143 -0
- package/lib/cjs/sideSheet/sideSheet.scss +171 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +55 -0
- package/lib/cjs/sideSheet/sideSheetFoundation.js +126 -0
- package/lib/cjs/sideSheet/variables.scss +16 -0
- package/lib/cjs/skeleton/constants.d.ts +5 -0
- package/lib/cjs/skeleton/constants.js +18 -0
- package/lib/cjs/skeleton/rtl.scss +8 -0
- package/lib/cjs/skeleton/skeleton.css +87 -0
- package/lib/cjs/skeleton/skeleton.scss +115 -0
- package/lib/cjs/skeleton/variables.scss +20 -0
- package/lib/cjs/slider/constants.d.ts +15 -0
- package/lib/cjs/slider/constants.js +28 -0
- package/lib/cjs/slider/foundation.d.ts +203 -0
- package/lib/cjs/slider/foundation.js +734 -0
- package/lib/cjs/slider/slider.css +192 -0
- package/lib/cjs/slider/slider.scss +234 -0
- package/lib/cjs/slider/variables.scss +60 -0
- package/lib/cjs/space/constants.d.ts +10 -0
- package/lib/cjs/space/constants.js +23 -0
- package/lib/cjs/space/rtl.scss +8 -0
- package/lib/cjs/space/space.css +50 -0
- package/lib/cjs/space/space.scss +58 -0
- package/lib/cjs/space/variables.scss +3 -0
- package/lib/cjs/spin/constants.d.ts +8 -0
- package/lib/cjs/spin/constants.js +23 -0
- package/lib/cjs/spin/foundation.d.ts +12 -0
- package/lib/cjs/spin/foundation.js +62 -0
- package/lib/cjs/spin/mixin.css +3 -0
- package/lib/cjs/spin/mixin.scss +5 -0
- package/lib/cjs/spin/rtl.scss +12 -0
- package/lib/cjs/spin/spin.css +104 -0
- package/lib/cjs/spin/spin.scss +104 -0
- package/lib/cjs/spin/variables.scss +18 -0
- package/lib/cjs/steps/bacisSteps.scss +344 -0
- package/lib/cjs/steps/constants.d.ts +5 -0
- package/lib/cjs/steps/constants.js +17 -0
- package/lib/cjs/steps/fillSteps.scss +193 -0
- package/lib/cjs/steps/mixin.css +3 -0
- package/lib/cjs/steps/mixin.scss +0 -0
- package/lib/cjs/steps/navSteps.scss +63 -0
- package/lib/cjs/steps/rtl.scss +46 -0
- package/lib/cjs/steps/steps.css +444 -0
- package/lib/cjs/steps/steps.scss +9 -0
- package/lib/cjs/steps/variables.scss +104 -0
- package/lib/cjs/switch/constants.d.ts +18 -0
- package/lib/cjs/switch/constants.js +31 -0
- package/lib/cjs/switch/foundation.d.ts +14 -0
- package/lib/cjs/switch/foundation.js +58 -0
- package/lib/cjs/switch/rtl.scss +103 -0
- package/lib/cjs/switch/switch.css +288 -0
- package/lib/cjs/switch/switch.scss +282 -0
- package/lib/cjs/switch/variables.scss +70 -0
- package/lib/cjs/table/bodyFoundation.d.ts +38 -0
- package/lib/cjs/table/bodyFoundation.js +164 -0
- package/lib/cjs/table/cellFoundation.d.ts +7 -0
- package/lib/cjs/table/cellFoundation.js +22 -0
- package/lib/cjs/table/constants.d.ts +77 -0
- package/lib/cjs/table/constants.js +110 -0
- package/lib/cjs/table/foundation.d.ts +351 -0
- package/lib/cjs/table/foundation.js +1167 -0
- package/lib/cjs/table/mixin.css +3 -0
- package/lib/cjs/table/mixin.scss +10 -0
- package/lib/cjs/table/operationPanel.scss +46 -0
- package/lib/cjs/table/rtl.scss +158 -0
- package/lib/cjs/table/table.css +559 -0
- package/lib/cjs/table/table.scss +552 -0
- package/lib/cjs/table/tableRowFoundation.d.ts +14 -0
- package/lib/cjs/table/tableRowFoundation.js +44 -0
- package/lib/cjs/table/tableSelectionCellFoundation.d.ts +13 -0
- package/lib/cjs/table/tableSelectionCellFoundation.js +24 -0
- package/lib/cjs/table/utils.d.ts +95 -0
- package/lib/cjs/table/utils.js +617 -0
- package/lib/cjs/table/variables.scss +84 -0
- package/lib/cjs/tabs/constants.d.ts +28 -0
- package/lib/cjs/tabs/constants.js +42 -0
- package/lib/cjs/tabs/foundation.d.ts +23 -0
- package/lib/cjs/tabs/foundation.js +95 -0
- package/lib/cjs/tabs/rtl.scss +123 -0
- package/lib/cjs/tabs/tabs.css +378 -0
- package/lib/cjs/tabs/tabs.scss +411 -0
- package/lib/cjs/tabs/variables.scss +115 -0
- package/lib/cjs/tag/constants.d.ts +10 -0
- package/lib/cjs/tag/constants.js +24 -0
- package/lib/cjs/tag/mixin.css +3 -0
- package/lib/cjs/tag/mixin.scss +21 -0
- package/lib/cjs/tag/rtl.scss +61 -0
- package/lib/cjs/tag/tag.css +444 -0
- package/lib/cjs/tag/tag.scss +181 -0
- package/lib/cjs/tag/variables.scss +48 -0
- package/lib/cjs/tagInput/constants.d.ts +8 -0
- package/lib/cjs/tagInput/constants.js +21 -0
- package/lib/cjs/tagInput/foundation.d.ts +53 -0
- package/lib/cjs/tagInput/foundation.js +267 -0
- package/lib/cjs/tagInput/rtl.scss +23 -0
- package/lib/cjs/tagInput/tagInput.css +171 -0
- package/lib/cjs/tagInput/tagInput.scss +192 -0
- package/lib/cjs/tagInput/utils/getSplitedArray.d.ts +7 -0
- package/lib/cjs/tagInput/utils/getSplitedArray.js +47 -0
- package/lib/cjs/tagInput/variables.scss +39 -0
- package/lib/cjs/timePicker/ComboxFoundation.d.ts +31 -0
- package/lib/cjs/timePicker/ComboxFoundation.js +193 -0
- package/lib/cjs/timePicker/constants.d.ts +23 -0
- package/lib/cjs/timePicker/constants.js +43 -0
- package/lib/cjs/timePicker/foundation.d.ts +53 -0
- package/lib/cjs/timePicker/foundation.js +465 -0
- package/lib/cjs/timePicker/inputFoundation.d.ts +18 -0
- package/lib/cjs/timePicker/inputFoundation.js +81 -0
- package/lib/cjs/timePicker/rtl.scss +30 -0
- package/lib/cjs/timePicker/timePicker.css +72 -0
- package/lib/cjs/timePicker/timePicker.scss +86 -0
- package/lib/cjs/timePicker/utils/index.d.ts +41 -0
- package/lib/cjs/timePicker/utils/index.js +191 -0
- package/lib/cjs/timePicker/utils/localeDate.d.ts +2 -0
- package/lib/cjs/timePicker/utils/localeDate.js +47 -0
- package/lib/cjs/timePicker/variables.scss +22 -0
- package/lib/cjs/timeline/constants.d.ts +10 -0
- package/lib/cjs/timeline/constants.js +23 -0
- package/lib/cjs/timeline/rtl.scss +92 -0
- package/lib/cjs/timeline/timeline.css +197 -0
- package/lib/cjs/timeline/timeline.scss +175 -0
- package/lib/cjs/timeline/variables.scss +46 -0
- package/lib/cjs/toast/constants.d.ts +14 -0
- package/lib/cjs/toast/constants.js +30 -0
- package/lib/cjs/toast/rtl.scss +16 -0
- package/lib/cjs/toast/toast.css +76 -0
- package/lib/cjs/toast/toast.scss +92 -0
- package/lib/cjs/toast/toastFoundation.d.ts +48 -0
- package/lib/cjs/toast/toastFoundation.js +72 -0
- package/lib/cjs/toast/toastListFoundation.d.ts +17 -0
- package/lib/cjs/toast/toastListFoundation.js +62 -0
- package/lib/cjs/toast/variables.scss +34 -0
- package/lib/cjs/tooltip/arrow.scss +141 -0
- package/lib/cjs/tooltip/constants.d.ts +22 -0
- package/lib/cjs/tooltip/constants.js +37 -0
- package/lib/cjs/tooltip/foundation.d.ts +99 -0
- package/lib/cjs/tooltip/foundation.js +819 -0
- package/lib/cjs/tooltip/rtl.scss +12 -0
- package/lib/cjs/tooltip/tooltip.css +203 -0
- package/lib/cjs/tooltip/tooltip.scss +91 -0
- package/lib/cjs/tooltip/variables.scss +31 -0
- package/lib/cjs/transfer/constants.d.ts +10 -0
- package/lib/cjs/transfer/constants.js +24 -0
- package/lib/cjs/transfer/foundation.d.ts +51 -0
- package/lib/cjs/transfer/foundation.js +314 -0
- package/lib/cjs/transfer/rtl.scss +31 -0
- package/lib/cjs/transfer/transfer.css +202 -0
- package/lib/cjs/transfer/transfer.scss +200 -0
- package/lib/cjs/transfer/transferUtlls.d.ts +4 -0
- package/lib/cjs/transfer/transferUtlls.js +128 -0
- package/lib/cjs/transfer/variables.scss +55 -0
- package/lib/cjs/tree/constants.d.ts +9 -0
- package/lib/cjs/tree/constants.js +23 -0
- package/lib/cjs/tree/foundation.d.ts +281 -0
- package/lib/cjs/tree/foundation.js +711 -0
- package/lib/cjs/tree/rtl.scss +59 -0
- package/lib/cjs/tree/tree.css +478 -0
- package/lib/cjs/tree/tree.scss +372 -0
- package/lib/cjs/tree/treeUtil.d.ts +79 -0
- package/lib/cjs/tree/treeUtil.js +804 -0
- package/lib/cjs/tree/variables.scss +54 -0
- package/lib/cjs/treeSelect/constants.d.ts +13 -0
- package/lib/cjs/treeSelect/constants.js +27 -0
- package/lib/cjs/treeSelect/foundation.d.ts +162 -0
- package/lib/cjs/treeSelect/foundation.js +792 -0
- package/lib/cjs/treeSelect/rtl.scss +62 -0
- package/lib/cjs/treeSelect/treeSelect.css +308 -0
- package/lib/cjs/treeSelect/treeSelect.scss +332 -0
- package/lib/cjs/treeSelect/variables.scss +90 -0
- package/lib/cjs/typography/constants.d.ts +10 -0
- package/lib/cjs/typography/constants.js +23 -0
- package/lib/cjs/typography/rtl.scss +34 -0
- package/lib/cjs/typography/typography.css +220 -0
- package/lib/cjs/typography/typography.scss +218 -0
- package/lib/cjs/typography/variables.scss +45 -0
- package/lib/cjs/upload/constants.d.ts +28 -0
- package/lib/cjs/upload/constants.js +49 -0
- package/lib/cjs/upload/foundation.d.ts +166 -0
- package/lib/cjs/upload/foundation.js +1067 -0
- package/lib/cjs/upload/rtl.scss +87 -0
- package/lib/cjs/upload/upload.css +493 -0
- package/lib/cjs/upload/upload.scss +522 -0
- package/lib/cjs/upload/utils.d.ts +6 -0
- package/lib/cjs/upload/utils.js +165 -0
- package/lib/cjs/upload/variables.scss +81 -0
- package/lib/cjs/utils/Event.d.ts +7 -0
- package/lib/cjs/utils/Event.js +91 -0
- package/lib/cjs/utils/Logger.d.ts +15 -0
- package/lib/cjs/utils/Logger.js +77 -0
- package/lib/cjs/utils/Store.d.ts +9 -0
- package/lib/cjs/utils/Store.js +60 -0
- package/lib/cjs/utils/array.d.ts +22 -0
- package/lib/cjs/utils/array.js +64 -0
- package/lib/cjs/utils/classnames.d.ts +4 -0
- package/lib/cjs/utils/classnames.js +54 -0
- package/lib/cjs/utils/date-fns-extra.d.ts +55 -0
- package/lib/cjs/utils/date-fns-extra.js +148 -0
- package/lib/cjs/utils/dom.d.ts +27 -0
- package/lib/cjs/utils/dom.js +92 -0
- package/lib/cjs/utils/function.d.ts +4 -0
- package/lib/cjs/utils/function.js +15 -0
- package/lib/cjs/utils/getDataAttr.d.ts +1 -0
- package/lib/cjs/utils/getDataAttr.js +27 -0
- package/lib/cjs/utils/getHighlight.d.ts +45 -0
- package/lib/cjs/utils/getHighlight.js +211 -0
- package/lib/cjs/utils/getMotionObjFromProps.d.ts +26 -0
- package/lib/cjs/utils/getMotionObjFromProps.js +77 -0
- package/lib/cjs/utils/index.d.ts +2 -0
- package/lib/cjs/utils/index.js +41 -0
- package/lib/cjs/utils/isBothNaN.d.ts +8 -0
- package/lib/cjs/utils/isBothNaN.js +25 -0
- package/lib/cjs/utils/isElement.d.ts +1 -0
- package/lib/cjs/utils/isElement.js +21 -0
- package/lib/cjs/utils/isNullOrUndefined.d.ts +6 -0
- package/lib/cjs/utils/isNullOrUndefined.js +18 -0
- package/lib/cjs/utils/isNumber.d.ts +1 -0
- package/lib/cjs/utils/isNumber.js +13 -0
- package/lib/cjs/utils/isObject.d.ts +1 -0
- package/lib/cjs/utils/isObject.js +13 -0
- package/lib/cjs/utils/isPromise.d.ts +1 -0
- package/lib/cjs/utils/isPromise.js +17 -0
- package/lib/cjs/utils/isString.d.ts +1 -0
- package/lib/cjs/utils/isString.js +13 -0
- package/lib/cjs/utils/keyCode.d.ts +427 -0
- package/lib/cjs/utils/keyCode.js +542 -0
- package/lib/cjs/utils/log.d.ts +2 -0
- package/lib/cjs/utils/log.js +26 -0
- package/lib/cjs/utils/number.d.ts +10 -0
- package/lib/cjs/utils/number.js +29 -0
- package/lib/cjs/utils/object.d.ts +17 -0
- package/lib/cjs/utils/object.js +174 -0
- package/lib/cjs/utils/set.d.ts +7 -0
- package/lib/cjs/utils/set.js +44 -0
- package/lib/cjs/utils/shallowEqualObjects.d.ts +5 -0
- package/lib/cjs/utils/shallowEqualObjects.js +41 -0
- package/lib/cjs/utils/touchPolyfill.d.ts +2 -0
- package/lib/cjs/utils/touchPolyfill.js +50 -0
- package/lib/cjs/utils/type.d.ts +31 -0
- package/lib/cjs/utils/type.js +7 -0
- package/lib/cjs/utils/uuid.d.ts +3 -0
- package/lib/cjs/utils/uuid.js +29 -0
- package/lib/cjs/utils/warning.d.ts +1 -0
- package/lib/cjs/utils/warning.js +15 -0
- package/lib/es/anchor/foundation.js +8 -5
- package/lib/es/autoComplete/autoComplete.css +5 -5
- package/lib/es/autoComplete/autoComplete.scss +3 -2
- package/lib/es/autoComplete/foundation.js +8 -5
- package/lib/es/base/foundation.js +12 -12
- package/lib/es/cascader/foundation.js +25 -17
- package/lib/es/cascader/util.js +5 -3
- package/lib/es/datePicker/_utils/getFullDateOffset.js +2 -2
- package/lib/es/datePicker/foundation.js +15 -10
- package/lib/es/datePicker/monthsGridFoundation.js +8 -6
- package/lib/es/form/foundation.js +9 -6
- package/lib/es/form/utils.js +2 -2
- package/lib/es/input/foundation.js +15 -10
- package/lib/es/input/input.css +3 -2
- package/lib/es/input/input.scss +2 -0
- package/lib/es/input/textareaFoundation.js +17 -14
- package/lib/es/input/util/getSizingData.js +3 -3
- package/lib/es/input/variables.scss +1 -1
- package/lib/es/inputNumber/foundation.js +13 -11
- package/lib/es/navigation/foundation.js +2 -2
- package/lib/es/notification/notificationFoundation.js +2 -2
- package/lib/es/overflowList/foundation.js +6 -3
- package/lib/es/scrollList/itemFoundation.js +17 -7
- package/lib/es/select/foundation.js +9 -6
- package/lib/es/sideSheet/sideSheetFoundation.js +8 -7
- package/lib/es/table/bodyFoundation.js +14 -8
- package/lib/es/table/foundation.js +87 -67
- package/lib/es/table/utils.js +65 -42
- package/lib/es/tabs/foundation.js +2 -2
- package/lib/es/tagInput/foundation.js +10 -7
- package/lib/es/tagInput/utils/getSplitedArray.js +6 -4
- package/lib/es/timePicker/foundation.js +6 -4
- package/lib/es/timePicker/utils/index.js +5 -5
- package/lib/es/toast/toastFoundation.js +2 -2
- package/lib/es/tooltip/foundation.js +15 -16
- package/lib/es/transfer/foundation.js +2 -2
- package/lib/es/transfer/transferUtlls.js +4 -4
- package/lib/es/tree/foundation.js +14 -14
- package/lib/es/tree/treeUtil.js +21 -18
- package/lib/es/treeSelect/foundation.js +16 -9
- package/lib/es/utils/classnames.js +9 -5
- package/lib/es/utils/getHighlight.js +2 -3
- package/lib/es/utils/getMotionObjFromProps.js +6 -5
- package/lib/es/utils/log.js +2 -2
- package/lib/es/utils/object.js +31 -21
- package/lib/es/utils/set.js +2 -2
- package/navigation/foundation.ts +1 -1
- package/notification/notificationFoundation.ts +1 -1
- package/overflowList/foundation.ts +1 -1
- package/package.json +6 -4
- package/scrollList/itemFoundation.ts +1 -1
- package/select/foundation.ts +1 -1
- package/sideSheet/sideSheetFoundation.ts +1 -1
- package/table/bodyFoundation.ts +1 -1
- package/table/foundation.ts +1 -1
- package/table/utils.ts +1 -1
- package/tabs/foundation.ts +1 -1
- package/tagInput/foundation.ts +1 -1
- package/tagInput/utils/getSplitedArray.ts +1 -1
- package/timePicker/foundation.ts +1 -1
- package/timePicker/utils/index.ts +1 -1
- package/toast/toastFoundation.ts +1 -1
- package/tooltip/foundation.ts +1 -1
- package/transfer/foundation.ts +1 -1
- package/transfer/transferUtlls.ts +1 -1
- package/tree/foundation.ts +1 -1
- package/tree/treeUtil.ts +1 -1
- package/treeSelect/foundation.ts +1 -1
- package/utils/classnames.ts +1 -1
- package/utils/getHighlight.ts +1 -1
- package/utils/getMotionObjFromProps.ts +1 -1
- package/utils/log.ts +1 -1
- package/utils/object.ts +1 -1
- package/utils/set.ts +1 -1
- package/babel.config.js +0 -33
- package/icons/icons.scss +0 -39
- package/icons/variables.scss +0 -7
- package/lib/es/icons/icons.css +0 -40
- package/lib/es/icons/icons.scss +0 -39
- package/lib/es/icons/variables.scss +0 -7
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _endsWithInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/ends-with");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
+
|
|
7
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
8
|
+
|
|
9
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.default = void 0;
|
|
14
|
+
|
|
15
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
16
|
+
|
|
17
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
18
|
+
|
|
19
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
20
|
+
|
|
21
|
+
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
|
22
|
+
|
|
23
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
24
|
+
|
|
25
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
26
|
+
|
|
27
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
28
|
+
|
|
29
|
+
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
30
|
+
|
|
31
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
32
|
+
|
|
33
|
+
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
34
|
+
|
|
35
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
36
|
+
|
|
37
|
+
var _url = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url"));
|
|
38
|
+
|
|
39
|
+
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
40
|
+
|
|
41
|
+
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
42
|
+
|
|
43
|
+
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
44
|
+
|
|
45
|
+
var _isPromise = _interopRequireDefault(require("../utils/isPromise"));
|
|
46
|
+
|
|
47
|
+
var _uuid = require("../utils/uuid");
|
|
48
|
+
|
|
49
|
+
var _constants = require("./constants");
|
|
50
|
+
|
|
51
|
+
var _utils = require("./utils");
|
|
52
|
+
|
|
53
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
54
|
+
function adopt(value) {
|
|
55
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
56
|
+
resolve(value);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return new (P || (P = _promise.default))(function (resolve, reject) {
|
|
61
|
+
function fulfilled(value) {
|
|
62
|
+
try {
|
|
63
|
+
step(generator.next(value));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
reject(e);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function rejected(value) {
|
|
70
|
+
try {
|
|
71
|
+
step(generator["throw"](value));
|
|
72
|
+
} catch (e) {
|
|
73
|
+
reject(e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function step(result) {
|
|
78
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const {
|
|
86
|
+
FILE_STATUS_UPLOADING,
|
|
87
|
+
FILE_STATUS_SUCCESS,
|
|
88
|
+
FILE_STATUS_UPLOAD_FAIL,
|
|
89
|
+
FILE_STATUS_VALID_FAIL,
|
|
90
|
+
FILE_STATUS_WAIT_UPLOAD,
|
|
91
|
+
DRAG_AREA_DEFAULT,
|
|
92
|
+
DRAG_AREA_LEGAL,
|
|
93
|
+
TRIGGER_AUTO
|
|
94
|
+
} = _constants.strings;
|
|
95
|
+
|
|
96
|
+
class UploadFoundation extends _foundation.default {
|
|
97
|
+
constructor(adapter) {
|
|
98
|
+
super((0, _assign.default)({}, adapter));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
destroy() {
|
|
102
|
+
this.releaseMemory();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
getError(_ref) {
|
|
106
|
+
var _context, _context2;
|
|
107
|
+
|
|
108
|
+
let {
|
|
109
|
+
action,
|
|
110
|
+
xhr,
|
|
111
|
+
message,
|
|
112
|
+
fileName
|
|
113
|
+
} = _ref;
|
|
114
|
+
const status = xhr ? xhr.status : 0;
|
|
115
|
+
const msg = message || (0, _concat.default)(_context = (0, _concat.default)(_context2 = "cannot post ".concat(fileName, " to ")).call(_context2, action, ", xhr status: ")).call(_context, status, "'");
|
|
116
|
+
const err = new Error(msg);
|
|
117
|
+
err.status = status;
|
|
118
|
+
err.method = 'post';
|
|
119
|
+
err.url = action;
|
|
120
|
+
return err;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
getBody(xhr) {
|
|
124
|
+
if (!xhr) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const text = xhr.responseText || xhr.response;
|
|
129
|
+
|
|
130
|
+
if (!text) {
|
|
131
|
+
return text;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(text);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
return text;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
checkFileSize(file) {
|
|
142
|
+
const {
|
|
143
|
+
size
|
|
144
|
+
} = file;
|
|
145
|
+
const {
|
|
146
|
+
maxSize,
|
|
147
|
+
minSize
|
|
148
|
+
} = this.getProps();
|
|
149
|
+
let isIlligal = false;
|
|
150
|
+
|
|
151
|
+
if (size > maxSize * _utils.byteKB || size < minSize * _utils.byteKB) {
|
|
152
|
+
isIlligal = true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return isIlligal;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 1. 选择文件
|
|
159
|
+
* 2. transform转换. 添加uid
|
|
160
|
+
* 3. 检查文件个数是否超出
|
|
161
|
+
* 若超出,不添加到list中,触发onExceed,中止流程
|
|
162
|
+
* 若未超出,执行以下流程
|
|
163
|
+
* 4. 检查文件尺寸,添加尺寸是否合法的标识
|
|
164
|
+
* 5. 检查uploadTrigger是否为'auto',若是执行步骤6-8
|
|
165
|
+
* 6. 遍历文件列表触发上传
|
|
166
|
+
* - 对尺寸不合适的不需要触发上传
|
|
167
|
+
* 7. beforeUpload
|
|
168
|
+
* - 对beforeUpload中设为不合法的不需要触发上传
|
|
169
|
+
* 8. TODO: check
|
|
170
|
+
* 9. afterUpload
|
|
171
|
+
*
|
|
172
|
+
* 1. Select file
|
|
173
|
+
* 2. transform, add uid
|
|
174
|
+
* 3. Check whether the number of files exceeds
|
|
175
|
+
* If it exceeds, it is not added to the list, trigger onExceed, and abort the process
|
|
176
|
+
* If it is not exceeded, execute the following process
|
|
177
|
+
* 4. check the file size, add the size is legal logo
|
|
178
|
+
* 5. Check whether the uploadTrigger is'auto ', if so, perform steps 6-8
|
|
179
|
+
* 6. Traversing the file list triggers upload
|
|
180
|
+
* - No need to trigger uploads for inappropriate sizes
|
|
181
|
+
* 7. beforeUpload
|
|
182
|
+
* - no need to trigger upload if beforeUpload is not set to be valid
|
|
183
|
+
* 8. TODO: check
|
|
184
|
+
* 9. afterUpload
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
handleChange(currentFileList) {
|
|
189
|
+
const invalidFiles = [];
|
|
190
|
+
const {
|
|
191
|
+
limit,
|
|
192
|
+
transformFile,
|
|
193
|
+
accept
|
|
194
|
+
} = this.getProps();
|
|
195
|
+
const {
|
|
196
|
+
fileList
|
|
197
|
+
} = this.getStates();
|
|
198
|
+
let files = (0, _from.default)(currentFileList); // When the selected file
|
|
199
|
+
|
|
200
|
+
if (typeof accept !== 'undefined') {
|
|
201
|
+
files = (0, _filter.default)(files).call(files, item => {
|
|
202
|
+
const isValid = this.checkFileFormat(accept, item);
|
|
203
|
+
|
|
204
|
+
if (!isValid) {
|
|
205
|
+
invalidFiles.push(item);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return isValid;
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
if (invalidFiles.length !== 0) {
|
|
212
|
+
this._adapter.notifyAcceptInvalid(invalidFiles);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (files.length === 0) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
files = (0, _map.default)(files).call(files, file => {
|
|
221
|
+
if (transformFile) {
|
|
222
|
+
file = transformFile(file);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (!file.uid) {
|
|
226
|
+
file.uid = (0, _uuid.getUuidv4)();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (this.checkFileSize(file)) {
|
|
230
|
+
file._sizeInvalid = true;
|
|
231
|
+
file.status = FILE_STATUS_VALID_FAIL;
|
|
232
|
+
|
|
233
|
+
this._adapter.notifySizeError(file, fileList);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return file;
|
|
237
|
+
});
|
|
238
|
+
const total = fileList.length + files.length;
|
|
239
|
+
|
|
240
|
+
if (typeof limit !== 'undefined') {
|
|
241
|
+
// Determine whether the limit is exceeded
|
|
242
|
+
if (total > limit) {
|
|
243
|
+
this._adapter.notifyExceed(files);
|
|
244
|
+
|
|
245
|
+
if (limit === 1) {
|
|
246
|
+
// Replace the current file with the last file
|
|
247
|
+
files = (0, _slice.default)(files).call(files, -1);
|
|
248
|
+
|
|
249
|
+
this._adapter.notifyFileSelect(files);
|
|
250
|
+
|
|
251
|
+
this._adapter.resetInput();
|
|
252
|
+
|
|
253
|
+
this.replaceFileList(files);
|
|
254
|
+
return;
|
|
255
|
+
} // If the limit is exceeded, the calculation can add a few more files and continue uploading the remaining files
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
const restNum = limit - fileList.length;
|
|
259
|
+
files = (0, _slice.default)(files).call(files, 0, restNum);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
this._adapter.notifyFileSelect(files);
|
|
264
|
+
|
|
265
|
+
this._adapter.resetInput();
|
|
266
|
+
|
|
267
|
+
this.addFilesToList(files);
|
|
268
|
+
} // Triggered when replacing a single file
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
handleReplaceChange(currentFileList) {
|
|
272
|
+
if (currentFileList.length === 0) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const {
|
|
277
|
+
transformFile,
|
|
278
|
+
uploadTrigger,
|
|
279
|
+
accept
|
|
280
|
+
} = this.getProps();
|
|
281
|
+
const {
|
|
282
|
+
replaceIdx,
|
|
283
|
+
fileList
|
|
284
|
+
} = this.getStates();
|
|
285
|
+
let newFile = (0, _from.default)(currentFileList).pop();
|
|
286
|
+
|
|
287
|
+
if (typeof accept !== 'undefined') {
|
|
288
|
+
if (!this.checkFileFormat(accept, newFile)) {
|
|
289
|
+
this._adapter.notifyAcceptInvalid([newFile]);
|
|
290
|
+
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (transformFile) {
|
|
296
|
+
newFile = transformFile(newFile);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (!newFile.uid) {
|
|
300
|
+
newFile.uid = (0, _uuid.getUuidv4)();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (this.checkFileSize(newFile)) {
|
|
304
|
+
newFile._sizeInvalid = true;
|
|
305
|
+
newFile.status = FILE_STATUS_VALID_FAIL;
|
|
306
|
+
|
|
307
|
+
this._adapter.notifySizeError(newFile, fileList);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
this._adapter.notifyFileSelect([newFile]);
|
|
311
|
+
|
|
312
|
+
const newFileItem = this.buildFileItem(newFile, uploadTrigger);
|
|
313
|
+
const newFileList = [...fileList];
|
|
314
|
+
(0, _splice.default)(newFileList).call(newFileList, replaceIdx, 1, newFileItem);
|
|
315
|
+
|
|
316
|
+
this._adapter.notifyChange({
|
|
317
|
+
currentFile: newFileItem,
|
|
318
|
+
fileList: newFileList
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
this._adapter.updateFileList(newFileList, () => {
|
|
322
|
+
this._adapter.resetReplaceInput();
|
|
323
|
+
|
|
324
|
+
this.upload(newFileItem);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
buildFileItem(fileInstance, uploadTrigger) {
|
|
329
|
+
const {
|
|
330
|
+
_sizeInvalid,
|
|
331
|
+
status
|
|
332
|
+
} = fileInstance;
|
|
333
|
+
|
|
334
|
+
try {
|
|
335
|
+
// can't use ... to get rest property on File Object
|
|
336
|
+
delete fileInstance._sizeInvalid;
|
|
337
|
+
delete fileInstance.status;
|
|
338
|
+
} catch (error) {}
|
|
339
|
+
|
|
340
|
+
const _file = {
|
|
341
|
+
status: status ? status : uploadTrigger === TRIGGER_AUTO ? FILE_STATUS_UPLOADING : FILE_STATUS_WAIT_UPLOAD,
|
|
342
|
+
name: fileInstance.name,
|
|
343
|
+
size: (0, _utils.getFileSize)(fileInstance.size),
|
|
344
|
+
uid: fileInstance.uid,
|
|
345
|
+
percent: 0,
|
|
346
|
+
fileInstance,
|
|
347
|
+
url: this._createURL(fileInstance)
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
if (_sizeInvalid) {
|
|
351
|
+
_file._sizeInvalid = true;
|
|
352
|
+
} // If it is an image, preview; if it is a pdf, you can jump to
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
if (this.isImage(fileInstance)) {
|
|
356
|
+
_file.preview = true;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return _file;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
replaceFileList(files) {
|
|
363
|
+
const {
|
|
364
|
+
uploadTrigger
|
|
365
|
+
} = this.getProps();
|
|
366
|
+
const currentFiles = (0, _map.default)(files).call(files, item => this.buildFileItem(item, uploadTrigger));
|
|
367
|
+
|
|
368
|
+
this._adapter.notifyChange({
|
|
369
|
+
fileList: currentFiles,
|
|
370
|
+
currentFile: currentFiles[0]
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
this._adapter.updateFileList(currentFiles, () => {
|
|
374
|
+
if (uploadTrigger === TRIGGER_AUTO) {
|
|
375
|
+
this.startUpload(currentFiles);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
addFilesToList(files) {
|
|
381
|
+
var _context3;
|
|
382
|
+
|
|
383
|
+
const fileList = (0, _slice.default)(_context3 = this.getState('fileList')).call(_context3);
|
|
384
|
+
const {
|
|
385
|
+
uploadTrigger
|
|
386
|
+
} = this.getProps();
|
|
387
|
+
const currentFiles = (0, _map.default)(files).call(files, item => this.buildFileItem(item, uploadTrigger));
|
|
388
|
+
(0, _forEach.default)(currentFiles).call(currentFiles, file => {
|
|
389
|
+
const index = (0, _findIndex.default)(fileList).call(fileList, item => item.uid === file.uid);
|
|
390
|
+
|
|
391
|
+
if (index !== -1) {
|
|
392
|
+
fileList[index] = file;
|
|
393
|
+
} else {
|
|
394
|
+
fileList.push(file);
|
|
395
|
+
|
|
396
|
+
this._adapter.notifyChange({
|
|
397
|
+
fileList,
|
|
398
|
+
currentFile: file
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
this._adapter.updateFileList(fileList, () => {
|
|
404
|
+
if (uploadTrigger === TRIGGER_AUTO) {
|
|
405
|
+
this.startUpload(currentFiles);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
manualUpload() {
|
|
411
|
+
var _context4;
|
|
412
|
+
|
|
413
|
+
// find the list of files that have not been uploaded
|
|
414
|
+
const waitToUploadFileList = (0, _filter.default)(_context4 = this.getState('fileList')).call(_context4, item => item.status === FILE_STATUS_WAIT_UPLOAD);
|
|
415
|
+
this.startUpload(waitToUploadFileList);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
startUpload(fileList) {
|
|
419
|
+
(0, _forEach.default)(fileList).call(fileList, file => {
|
|
420
|
+
if (!file._sizeInvalid) {
|
|
421
|
+
this.upload(file);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
upload(file) {
|
|
427
|
+
const {
|
|
428
|
+
beforeUpload
|
|
429
|
+
} = this.getProps();
|
|
430
|
+
|
|
431
|
+
if (typeof beforeUpload === 'undefined') {
|
|
432
|
+
this.post(file);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (typeof beforeUpload === 'function') {
|
|
437
|
+
const {
|
|
438
|
+
fileList
|
|
439
|
+
} = this.getStates();
|
|
440
|
+
|
|
441
|
+
const buResult = this._adapter.notifyBeforeUpload({
|
|
442
|
+
file,
|
|
443
|
+
fileList
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
switch (true) {
|
|
447
|
+
// sync valiate - boolean
|
|
448
|
+
case buResult === true:
|
|
449
|
+
{
|
|
450
|
+
this.post(file);
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
case buResult === false:
|
|
455
|
+
{
|
|
456
|
+
const newResult = {
|
|
457
|
+
shouldUpload: false,
|
|
458
|
+
status: _constants.strings.FILE_STATUS_VALID_FAIL
|
|
459
|
+
};
|
|
460
|
+
this.handleBeforeUploadResultInObject(newResult, file);
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
// async validate
|
|
464
|
+
|
|
465
|
+
case buResult && (0, _isPromise.default)(buResult):
|
|
466
|
+
{
|
|
467
|
+
_promise.default.resolve(buResult).then(resloveData => {
|
|
468
|
+
var _context5;
|
|
469
|
+
|
|
470
|
+
let newResult = {
|
|
471
|
+
shouldUpload: true
|
|
472
|
+
};
|
|
473
|
+
const typeOfResloveData = (0, _slice.default)(_context5 = Object.prototype.toString.call(resloveData)).call(_context5, 8, -1);
|
|
474
|
+
|
|
475
|
+
if (typeOfResloveData === 'Object') {
|
|
476
|
+
newResult = (0, _assign.default)((0, _assign.default)({}, newResult), resloveData);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
this.handleBeforeUploadResultInObject(newResult, file);
|
|
480
|
+
}, rejectVal => {
|
|
481
|
+
var _context6;
|
|
482
|
+
|
|
483
|
+
let newResult = {
|
|
484
|
+
shouldUpload: false,
|
|
485
|
+
status: _constants.strings.FILE_STATUS_VALID_FAIL
|
|
486
|
+
};
|
|
487
|
+
const typeOfRejectData = (0, _slice.default)(_context6 = Object.prototype.toString.call(rejectVal)).call(_context6, 8, -1);
|
|
488
|
+
|
|
489
|
+
if (typeOfRejectData === 'Object') {
|
|
490
|
+
newResult = (0, _assign.default)((0, _assign.default)({}, newResult), rejectVal);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
this.handleBeforeUploadResultInObject(newResult, file);
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
// sync validate - object
|
|
499
|
+
|
|
500
|
+
case typeof buResult === 'object':
|
|
501
|
+
// inject to fileList
|
|
502
|
+
this.handleBeforeUploadResultInObject(buResult, file);
|
|
503
|
+
break;
|
|
504
|
+
|
|
505
|
+
default:
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
} // handle beforeUpload result when it's an object
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
handleBeforeUploadResultInObject(buResult, file) {
|
|
513
|
+
var _context7;
|
|
514
|
+
|
|
515
|
+
const {
|
|
516
|
+
shouldUpload,
|
|
517
|
+
status,
|
|
518
|
+
autoRemove,
|
|
519
|
+
validateMessage,
|
|
520
|
+
fileInstance
|
|
521
|
+
} = buResult;
|
|
522
|
+
let newFileList = (0, _slice.default)(_context7 = this.getState('fileList')).call(_context7);
|
|
523
|
+
|
|
524
|
+
if (autoRemove) {
|
|
525
|
+
newFileList = (0, _filter.default)(newFileList).call(newFileList, item => item.uid !== file.uid);
|
|
526
|
+
} else {
|
|
527
|
+
const index = this._getFileIndex(file, newFileList);
|
|
528
|
+
|
|
529
|
+
if (index < 0) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
status ? newFileList[index].status = status : null;
|
|
534
|
+
validateMessage ? newFileList[index].validateMessage = validateMessage : null;
|
|
535
|
+
|
|
536
|
+
if (fileInstance) {
|
|
537
|
+
fileInstance.uid = file.uid; // reuse recent file uid
|
|
538
|
+
|
|
539
|
+
newFileList[index].fileInstance = fileInstance;
|
|
540
|
+
newFileList[index].size = (0, _utils.getFileSize)(fileInstance.size);
|
|
541
|
+
newFileList[index].name = fileInstance.name;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
newFileList[index].shouldUpload = shouldUpload;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
this._adapter.updateFileList(newFileList);
|
|
548
|
+
|
|
549
|
+
this._adapter.notifyChange({
|
|
550
|
+
fileList: newFileList,
|
|
551
|
+
currentFile: file
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
if (shouldUpload) {
|
|
555
|
+
this.post(file);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
post(file) {
|
|
560
|
+
const {
|
|
561
|
+
fileInstance
|
|
562
|
+
} = file;
|
|
563
|
+
const option = this.getProps();
|
|
564
|
+
|
|
565
|
+
if (typeof XMLHttpRequest === 'undefined') {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const xhr = new XMLHttpRequest();
|
|
570
|
+
const formData = new FormData();
|
|
571
|
+
const {
|
|
572
|
+
action
|
|
573
|
+
} = option; // add data
|
|
574
|
+
|
|
575
|
+
let {
|
|
576
|
+
data
|
|
577
|
+
} = option;
|
|
578
|
+
|
|
579
|
+
if (data) {
|
|
580
|
+
var _context8;
|
|
581
|
+
|
|
582
|
+
if (typeof data === 'function') {
|
|
583
|
+
data = data(fileInstance);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
(0, _forEach.default)(_context8 = (0, _keys.default)(data)).call(_context8, key => {
|
|
587
|
+
formData.append(key, data[key]);
|
|
588
|
+
});
|
|
589
|
+
} // add file
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
const fileName = option.name || option.fileName || fileInstance.name;
|
|
593
|
+
|
|
594
|
+
if (option.customRequest) {
|
|
595
|
+
return option.customRequest({
|
|
596
|
+
fileName,
|
|
597
|
+
data,
|
|
598
|
+
file,
|
|
599
|
+
fileInstance,
|
|
600
|
+
onProgress: e => this.handleProgress({
|
|
601
|
+
e,
|
|
602
|
+
fileInstance
|
|
603
|
+
}),
|
|
604
|
+
onError: (userXhr, e) => this.handleError({
|
|
605
|
+
e,
|
|
606
|
+
xhr: userXhr,
|
|
607
|
+
fileInstance
|
|
608
|
+
}),
|
|
609
|
+
onSuccess: (response, e) => this.handleSuccess({
|
|
610
|
+
response,
|
|
611
|
+
fileInstance,
|
|
612
|
+
e,
|
|
613
|
+
isCustomRequest: true
|
|
614
|
+
}),
|
|
615
|
+
withCredentials: option.withCredentials,
|
|
616
|
+
action: option.action
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
formData.append(fileName, fileInstance);
|
|
621
|
+
xhr.open('post', action, true);
|
|
622
|
+
|
|
623
|
+
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
624
|
+
xhr.withCredentials = true;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (xhr.upload) {
|
|
628
|
+
xhr.upload.onprogress = e => this.handleProgress({
|
|
629
|
+
e,
|
|
630
|
+
fileInstance
|
|
631
|
+
});
|
|
632
|
+
} // Callback function after upload is completed
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
xhr.onload = e => this.handleOnLoad({
|
|
636
|
+
e,
|
|
637
|
+
xhr,
|
|
638
|
+
fileInstance
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
xhr.onerror = e => this.handleError({
|
|
642
|
+
e,
|
|
643
|
+
xhr,
|
|
644
|
+
fileInstance
|
|
645
|
+
}); // add headers
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
let headers = option.headers || {};
|
|
649
|
+
|
|
650
|
+
if (typeof headers === 'function') {
|
|
651
|
+
headers = headers(fileInstance);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
for (const item in headers) {
|
|
655
|
+
if (Object.prototype.hasOwnProperty.call(headers, item) && headers[item] !== null) {
|
|
656
|
+
xhr.setRequestHeader(item, headers[item]);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
xhr.send(formData);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
handleProgress(_ref2) {
|
|
664
|
+
let {
|
|
665
|
+
e,
|
|
666
|
+
fileInstance
|
|
667
|
+
} = _ref2;
|
|
668
|
+
const {
|
|
669
|
+
fileList
|
|
670
|
+
} = this.getStates();
|
|
671
|
+
const newFileList = (0, _slice.default)(fileList).call(fileList);
|
|
672
|
+
let percent = 0;
|
|
673
|
+
|
|
674
|
+
if (e.total > 0) {
|
|
675
|
+
percent = Number((e.loaded / e.total * 100 * _constants.numbers.PROGRESS_COEFFICIENT).toFixed(0)) || 0;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const index = this._getFileIndex(fileInstance, newFileList);
|
|
679
|
+
|
|
680
|
+
if (index < 0) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
newFileList[index].percent = percent;
|
|
685
|
+
newFileList[index].status = FILE_STATUS_UPLOADING;
|
|
686
|
+
|
|
687
|
+
this._adapter.notifyProgress(percent, fileInstance, newFileList);
|
|
688
|
+
|
|
689
|
+
this._adapter.updateFileList(newFileList);
|
|
690
|
+
|
|
691
|
+
this._adapter.notifyChange({
|
|
692
|
+
fileList: newFileList,
|
|
693
|
+
currentFile: newFileList[index]
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
handleOnLoad(_ref3) {
|
|
698
|
+
let {
|
|
699
|
+
e,
|
|
700
|
+
xhr,
|
|
701
|
+
fileInstance
|
|
702
|
+
} = _ref3;
|
|
703
|
+
const {
|
|
704
|
+
fileList
|
|
705
|
+
} = this.getStates();
|
|
706
|
+
|
|
707
|
+
const index = this._getFileIndex(fileInstance, fileList);
|
|
708
|
+
|
|
709
|
+
if (index < 0) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
714
|
+
this.handleError({
|
|
715
|
+
e,
|
|
716
|
+
xhr,
|
|
717
|
+
fileInstance
|
|
718
|
+
});
|
|
719
|
+
} else {
|
|
720
|
+
this.handleSuccess({
|
|
721
|
+
e,
|
|
722
|
+
xhr,
|
|
723
|
+
fileInstance,
|
|
724
|
+
index
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
handleSuccess(_ref4) {
|
|
730
|
+
let {
|
|
731
|
+
e,
|
|
732
|
+
fileInstance,
|
|
733
|
+
isCustomRequest = false,
|
|
734
|
+
xhr,
|
|
735
|
+
response
|
|
736
|
+
} = _ref4;
|
|
737
|
+
const {
|
|
738
|
+
fileList
|
|
739
|
+
} = this.getStates();
|
|
740
|
+
let body = null;
|
|
741
|
+
|
|
742
|
+
const index = this._getFileIndex(fileInstance, fileList);
|
|
743
|
+
|
|
744
|
+
if (index < 0) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (isCustomRequest) {
|
|
749
|
+
// use when pass customRequest
|
|
750
|
+
body = response;
|
|
751
|
+
} else {
|
|
752
|
+
body = this.getBody(xhr);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
const newFileList = (0, _slice.default)(fileList).call(fileList);
|
|
756
|
+
const {
|
|
757
|
+
afterUpload
|
|
758
|
+
} = this.getProps();
|
|
759
|
+
newFileList[index].status = FILE_STATUS_SUCCESS;
|
|
760
|
+
newFileList[index].percent = 100;
|
|
761
|
+
|
|
762
|
+
this._adapter.notifyProgress(100, fileInstance, newFileList);
|
|
763
|
+
|
|
764
|
+
newFileList[index].response = body;
|
|
765
|
+
e ? newFileList[index].event = e : null;
|
|
766
|
+
|
|
767
|
+
if (afterUpload && typeof afterUpload === 'function') {
|
|
768
|
+
const {
|
|
769
|
+
autoRemove,
|
|
770
|
+
status,
|
|
771
|
+
validateMessage,
|
|
772
|
+
name
|
|
773
|
+
} = this._adapter.notifyAfterUpload({
|
|
774
|
+
response: body,
|
|
775
|
+
file: newFileList[index],
|
|
776
|
+
fileList: newFileList
|
|
777
|
+
}) || {};
|
|
778
|
+
status ? newFileList[index].status = status : null;
|
|
779
|
+
validateMessage ? newFileList[index].validateMessage = validateMessage : null;
|
|
780
|
+
name ? newFileList[index].name = name : null;
|
|
781
|
+
autoRemove ? (0, _splice.default)(newFileList).call(newFileList, index, 1) : null;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
this._adapter.notifySuccess(body, fileInstance, newFileList);
|
|
785
|
+
|
|
786
|
+
this._adapter.notifyChange({
|
|
787
|
+
fileList: newFileList,
|
|
788
|
+
currentFile: newFileList[index]
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
this._adapter.updateFileList(newFileList);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
_getFileIndex(file, fileList) {
|
|
795
|
+
return (0, _findIndex.default)(fileList).call(fileList, item => item.uid === file.uid);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
handleRemove(file) {
|
|
799
|
+
const {
|
|
800
|
+
disabled
|
|
801
|
+
} = this.getProps();
|
|
802
|
+
|
|
803
|
+
if (disabled) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
const {
|
|
808
|
+
fileList
|
|
809
|
+
} = this.getStates();
|
|
810
|
+
|
|
811
|
+
_promise.default.resolve(this._adapter.notifyBeforeRemove(file, fileList)).then(res => {
|
|
812
|
+
// prevent remove while user return false
|
|
813
|
+
if (res === false) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
const newFileList = (0, _slice.default)(fileList).call(fileList);
|
|
818
|
+
|
|
819
|
+
const index = this._getFileIndex(file, fileList);
|
|
820
|
+
|
|
821
|
+
if (index < 0) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
(0, _splice.default)(newFileList).call(newFileList, index, 1);
|
|
826
|
+
|
|
827
|
+
this._adapter.notifyRemove(file.fileInstance, newFileList, file);
|
|
828
|
+
|
|
829
|
+
this._adapter.updateFileList(newFileList);
|
|
830
|
+
|
|
831
|
+
this._adapter.notifyChange({
|
|
832
|
+
fileList: newFileList,
|
|
833
|
+
currentFile: file
|
|
834
|
+
});
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
handleError(_ref5) {
|
|
839
|
+
let {
|
|
840
|
+
e,
|
|
841
|
+
xhr,
|
|
842
|
+
fileInstance
|
|
843
|
+
} = _ref5;
|
|
844
|
+
const {
|
|
845
|
+
fileList
|
|
846
|
+
} = this.getStates();
|
|
847
|
+
|
|
848
|
+
const index = this._getFileIndex(fileInstance, fileList);
|
|
849
|
+
|
|
850
|
+
if (index < 0) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
const {
|
|
855
|
+
action
|
|
856
|
+
} = this.getProps();
|
|
857
|
+
const newFileList = (0, _slice.default)(fileList).call(fileList);
|
|
858
|
+
const error = this.getError({
|
|
859
|
+
action,
|
|
860
|
+
xhr,
|
|
861
|
+
fileName: fileInstance.name
|
|
862
|
+
});
|
|
863
|
+
newFileList[index].status = FILE_STATUS_UPLOAD_FAIL;
|
|
864
|
+
newFileList[index].response = error;
|
|
865
|
+
newFileList[index].event = e;
|
|
866
|
+
|
|
867
|
+
this._adapter.notifyError(error, fileInstance, newFileList, xhr);
|
|
868
|
+
|
|
869
|
+
this._adapter.updateFileList(newFileList);
|
|
870
|
+
|
|
871
|
+
this._adapter.notifyChange({
|
|
872
|
+
currentFile: newFileList[index],
|
|
873
|
+
fileList: newFileList
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
handleClear() {
|
|
878
|
+
const {
|
|
879
|
+
disabled
|
|
880
|
+
} = this.getProps();
|
|
881
|
+
const {
|
|
882
|
+
fileList
|
|
883
|
+
} = this.getStates();
|
|
884
|
+
|
|
885
|
+
if (disabled) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
_promise.default.resolve(this._adapter.notifyBeforeClear(fileList)).then(res => {
|
|
890
|
+
if (res === false) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
this._adapter.updateFileList([]);
|
|
895
|
+
|
|
896
|
+
this._adapter.notifyClear();
|
|
897
|
+
|
|
898
|
+
this._adapter.notifyChange({
|
|
899
|
+
fileList: []
|
|
900
|
+
});
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
_createURL(fileInstance) {
|
|
905
|
+
// https://stackoverflow.com/questions/31742072/filereader-vs-window-url-createobjecturl
|
|
906
|
+
const url = _url.default.createObjectURL(fileInstance);
|
|
907
|
+
|
|
908
|
+
const {
|
|
909
|
+
localUrls
|
|
910
|
+
} = this.getStates();
|
|
911
|
+
const newUrls = (0, _slice.default)(localUrls).call(localUrls);
|
|
912
|
+
newUrls.push(url);
|
|
913
|
+
|
|
914
|
+
this._adapter.updateLocalUrls(newUrls);
|
|
915
|
+
|
|
916
|
+
return url;
|
|
917
|
+
} // 释放预览文件所占用的内存
|
|
918
|
+
// Release memory used by preview files
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
releaseMemory() {
|
|
922
|
+
const {
|
|
923
|
+
localUrls
|
|
924
|
+
} = this.getStates();
|
|
925
|
+
(0, _forEach.default)(localUrls).call(localUrls, url => {
|
|
926
|
+
this._releaseBlob(url);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
_releaseBlob(url) {
|
|
931
|
+
try {
|
|
932
|
+
_url.default.revokeObjectURL(url);
|
|
933
|
+
} catch (error) {
|
|
934
|
+
console.log(error);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
isImage(file) {
|
|
939
|
+
return /(webp|svg|png|gif|jpg|jpeg|bmp|dpg)$/i.test(file.type);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
isMultiple() {
|
|
943
|
+
return Boolean(this.getProp('multiple'));
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
handleDragEnter(e) {
|
|
947
|
+
e.preventDefault();
|
|
948
|
+
e.stopPropagation();
|
|
949
|
+
this._dragEnterTarget = e.currentTarget;
|
|
950
|
+
const {
|
|
951
|
+
disabled
|
|
952
|
+
} = this.getProps();
|
|
953
|
+
|
|
954
|
+
if (!disabled) {
|
|
955
|
+
this._adapter.updateDragAreaStatus(DRAG_AREA_LEGAL);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
handleDirectoryDrop(e) {
|
|
960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
961
|
+
var _context9;
|
|
962
|
+
|
|
963
|
+
const fileList = (0, _slice.default)(_context9 = this.getState('fileList')).call(_context9);
|
|
964
|
+
const items = (0, _slice.default)([]).call(e.dataTransfer.items);
|
|
965
|
+
const files = yield (0, _utils.mapFileTree)(items);
|
|
966
|
+
this.handleChange(files);
|
|
967
|
+
|
|
968
|
+
this._adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
969
|
+
|
|
970
|
+
this._adapter.notifyDrop(e, files, fileList);
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
handleDrop(e) {
|
|
975
|
+
var _context10;
|
|
976
|
+
|
|
977
|
+
// Block file opening in browser
|
|
978
|
+
e.preventDefault();
|
|
979
|
+
e.stopPropagation();
|
|
980
|
+
const {
|
|
981
|
+
disabled,
|
|
982
|
+
directory
|
|
983
|
+
} = this.getProps();
|
|
984
|
+
const fileList = (0, _slice.default)(_context10 = this.getState('fileList')).call(_context10);
|
|
985
|
+
|
|
986
|
+
if (!disabled) {
|
|
987
|
+
if (directory) {
|
|
988
|
+
this.handleDirectoryDrop(e);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
const files = (0, _from.default)(e.dataTransfer.files);
|
|
992
|
+
this.handleChange(files);
|
|
993
|
+
|
|
994
|
+
this._adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
995
|
+
|
|
996
|
+
this._adapter.notifyDrop(e, files, fileList);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
handleDragOver(e) {
|
|
1001
|
+
e.preventDefault();
|
|
1002
|
+
e.stopPropagation();
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
handleDragLeave(e) {
|
|
1006
|
+
e.preventDefault();
|
|
1007
|
+
e.stopPropagation(); // 防止拖拽进入子元素时触发的dragLeave也被处理
|
|
1008
|
+
// Prevent dragLeave triggered when dragging into a child element is also handled
|
|
1009
|
+
// https://stackoverflow.com/questions/7110353/html5-dragleave-fired-when-hovering-a-child-element
|
|
1010
|
+
|
|
1011
|
+
if (this._dragEnterTarget === e.target) {
|
|
1012
|
+
this._adapter.updateDragAreaStatus(DRAG_AREA_DEFAULT);
|
|
1013
|
+
}
|
|
1014
|
+
} // 拖拽上传时,需要对文件的格式进行校验
|
|
1015
|
+
// When dragging and uploading, you need to verify the file format
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
checkFileFormat(accept, file) {
|
|
1019
|
+
var _context11, _context12;
|
|
1020
|
+
|
|
1021
|
+
const acceptTypes = (0, _filter.default)(_context11 = (0, _map.default)(_context12 = accept.split(',')).call(_context12, type => (0, _trim.default)(type).call(type))).call(_context11, type => type);
|
|
1022
|
+
const mimeType = file.type || ''; // Get the large class to which MIMEtype belongs, eg: image/jpeg = > image, application/= > application
|
|
1023
|
+
|
|
1024
|
+
const baseMimeType = mimeType.replace(/\/.*$/, '');
|
|
1025
|
+
return (0, _some.default)(acceptTypes).call(acceptTypes, type => {
|
|
1026
|
+
// When accepted as a suffix filename such as [.jpeg]
|
|
1027
|
+
if (type.charAt(0) === '.') {
|
|
1028
|
+
const fileName = file.name || '';
|
|
1029
|
+
const acceptExtension = type.split('.').pop().toLowerCase();
|
|
1030
|
+
return (0, _endsWithInstanceProperty(_utils))(fileName.toLowerCase(), acceptExtension);
|
|
1031
|
+
} // When accepted as a general class such as [image/*] or [video/*]
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
if (/\/\*$/.test(type)) {
|
|
1035
|
+
const acceptBaseMimeType = type.replace(/\/.*$/, '');
|
|
1036
|
+
return baseMimeType === acceptBaseMimeType;
|
|
1037
|
+
} // When accepted as a full MIME types string
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
if (/^[^\/]+\/[^\/]+$/.test(type)) {
|
|
1041
|
+
return mimeType === type;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
return false;
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
retry(fileItem) {
|
|
1049
|
+
const {
|
|
1050
|
+
onRetry
|
|
1051
|
+
} = this.getProps();
|
|
1052
|
+
|
|
1053
|
+
if (onRetry && typeof onRetry === 'function') {
|
|
1054
|
+
onRetry(fileItem);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
this.post(fileItem);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
handlePreviewClick(fileItem) {
|
|
1061
|
+
this._adapter.notifyPreviewClick(fileItem);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
var _default = UploadFoundation;
|
|
1067
|
+
exports.default = _default;
|