@pinnacle0/web-ui 0.5.84 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/AdminApp/Default/NavigatorSide/index.js +14 -50
- package/admin/AdminApp/Default/NavigatorSide/index.js.map +1 -1
- package/admin/AdminApp/Default/SoundSwitch.js +15 -34
- package/admin/AdminApp/Default/SoundSwitch.js.map +1 -1
- package/admin/AdminApp/Default/SquareLogo/index.js +8 -29
- package/admin/AdminApp/Default/SquareLogo/index.js.map +1 -1
- package/admin/AdminApp/Menu.js +40 -82
- package/admin/AdminApp/Menu.js.map +1 -1
- package/admin/AdminApp/Navigator.js +57 -83
- package/admin/AdminApp/Navigator.js.map +1 -1
- package/admin/AdminApp/NotFound.js +8 -30
- package/admin/AdminApp/NotFound.js.map +1 -1
- package/admin/AdminApp/RouteSwitch.js +21 -53
- package/admin/AdminApp/RouteSwitch.js.map +1 -1
- package/admin/AdminApp/WithErrorBoundary.js +13 -33
- package/admin/AdminApp/WithErrorBoundary.js.map +1 -1
- package/admin/AdminApp/context.js +3 -3
- package/admin/AdminApp/context.js.map +1 -1
- package/admin/AdminApp/index.js +26 -43
- package/admin/AdminApp/index.js.map +1 -1
- package/admin/AdminPage/Filter.js +20 -38
- package/admin/AdminPage/Filter.js.map +1 -1
- package/admin/AdminPage/Result.js +15 -62
- package/admin/AdminPage/Result.js.map +1 -1
- package/admin/AdminPage/SaveBar.js +7 -28
- package/admin/AdminPage/SaveBar.js.map +1 -1
- package/admin/AdminPage/Summary.js +6 -27
- package/admin/AdminPage/Summary.js.map +1 -1
- package/admin/AdminPage/TopBar.js +6 -27
- package/admin/AdminPage/TopBar.js.map +1 -1
- package/admin/AdminPage/index.js +11 -32
- package/admin/AdminPage/index.js.map +1 -1
- package/admin/AdminPermissionSelector.js +147 -195
- package/admin/AdminPermissionSelector.js.map +1 -1
- package/core/Amount/AmountPercentage.js +7 -50
- package/core/Amount/AmountPercentage.js.map +1 -1
- package/core/Amount/index.js +15 -36
- package/core/Amount/index.js.map +1 -1
- package/core/AmountConditionInput.js +27 -74
- package/core/AmountConditionInput.js.map +1 -1
- package/core/AmountRangeInput.js +17 -75
- package/core/AmountRangeInput.js.map +1 -1
- package/core/Animated/AnimatePresence.js +35 -87
- package/core/Animated/AnimatePresence.js.map +1 -1
- package/core/Animated/createAnimatedComponent.js +28 -50
- package/core/Animated/createAnimatedComponent.js.map +1 -1
- package/core/Animated/index.js +5 -5
- package/core/Animated/index.js.map +1 -1
- package/core/AuthenticationCodeInput/index.js +48 -136
- package/core/AuthenticationCodeInput/index.js.map +1 -1
- package/core/AutoCompleteInput.js +6 -38
- package/core/AutoCompleteInput.js.map +1 -1
- package/core/Badge.js +2 -13
- package/core/Badge.js.map +1 -1
- package/core/BoolRadio.js +16 -64
- package/core/BoolRadio.js.map +1 -1
- package/core/BoolSelect.js +16 -63
- package/core/BoolSelect.js.map +1 -1
- package/core/BoolSwitch.js +16 -48
- package/core/BoolSwitch.js.map +1 -1
- package/core/Breadcrumb/index.js +18 -66
- package/core/Breadcrumb/index.js.map +1 -1
- package/core/Button.js +2 -25
- package/core/Button.js.map +1 -1
- package/core/Card.js +6 -38
- package/core/Card.js.map +1 -1
- package/core/Carousel.js +6 -49
- package/core/Carousel.js.map +1 -1
- package/core/Carousel3D/index.js +64 -83
- package/core/Carousel3D/index.js.map +1 -1
- package/core/Cascader/InitialNullable.js +7 -50
- package/core/Cascader/InitialNullable.js.map +1 -1
- package/core/Cascader/Nullable.js +11 -81
- package/core/Cascader/Nullable.js.map +1 -1
- package/core/Cascader/index.js +38 -109
- package/core/Cascader/index.js.map +1 -1
- package/core/Checkbox.js +9 -67
- package/core/Checkbox.js.map +1 -1
- package/core/Collapse.js +5 -37
- package/core/Collapse.js.map +1 -1
- package/core/Countdown/SlidingDigit.js +12 -32
- package/core/Countdown/SlidingDigit.js.map +1 -1
- package/core/Countdown/index.js +56 -74
- package/core/Countdown/index.js.map +1 -1
- package/core/DarkOverlay/index.js +6 -27
- package/core/DarkOverlay/index.js.map +1 -1
- package/core/DateCalendar.js +48 -96
- package/core/DateCalendar.js.map +1 -1
- package/core/DatePicker.js +26 -73
- package/core/DatePicker.js.map +1 -1
- package/core/DateRangePicker.js +44 -64
- package/core/DateRangePicker.js.map +1 -1
- package/core/DateTimePicker.js +30 -78
- package/core/DateTimePicker.js.map +1 -1
- package/core/DateTimeRangePicker/index.js +48 -68
- package/core/DateTimeRangePicker/index.js.map +1 -1
- package/core/Descriptions/index.js +11 -69
- package/core/Descriptions/index.js.map +1 -1
- package/core/DocumentTitle.js +25 -43
- package/core/DocumentTitle.js.map +1 -1
- package/core/Drawer.js +4 -36
- package/core/Drawer.js.map +1 -1
- package/core/Dropdown.js +3 -7
- package/core/Dropdown.js.map +1 -1
- package/core/EnumCheckboxGroup/Map.js +8 -51
- package/core/EnumCheckboxGroup/Map.js.map +1 -1
- package/core/EnumCheckboxGroup/index.js +8 -29
- package/core/EnumCheckboxGroup/index.js.map +1 -1
- package/core/EnumRadio/InitialNullable.js +9 -78
- package/core/EnumRadio/InitialNullable.js.map +1 -1
- package/core/EnumRadio/Map.js +8 -51
- package/core/EnumRadio/Map.js.map +1 -1
- package/core/EnumRadio/Nullable.js +13 -83
- package/core/EnumRadio/Nullable.js.map +1 -1
- package/core/EnumRadio/index.js +16 -63
- package/core/EnumRadio/index.js.map +1 -1
- package/core/EnumSelect/InitialNullable.js +7 -50
- package/core/EnumSelect/InitialNullable.js.map +1 -1
- package/core/EnumSelect/Map.js +8 -51
- package/core/EnumSelect/Map.js.map +1 -1
- package/core/EnumSelect/Nullable.js +13 -83
- package/core/EnumSelect/Nullable.js.map +1 -1
- package/core/EnumSelect/index.js +37 -86
- package/core/EnumSelect/index.js.map +1 -1
- package/core/FlatList/Content/Footer/index.js +5 -6
- package/core/FlatList/Content/Footer/index.js.map +1 -1
- package/core/FlatList/Content/index.js +28 -51
- package/core/FlatList/Content/index.js.map +1 -1
- package/core/FlatList/FloatingLoader/index.js +2 -3
- package/core/FlatList/FloatingLoader/index.js.map +1 -1
- package/core/FlatList/Refresh/index.js +2 -3
- package/core/FlatList/Refresh/index.js.map +1 -1
- package/core/FlatList/hook/useRefreshing.js +7 -23
- package/core/FlatList/hook/useRefreshing.js.map +1 -1
- package/core/FlatList/hook/useScrollListSwipe.js +22 -40
- package/core/FlatList/hook/useScrollListSwipe.js.map +1 -1
- package/core/FlatList/index.js +19 -52
- package/core/FlatList/index.js.map +1 -1
- package/core/FlatList/shared/Loader/index.js +1 -1
- package/core/FlatList/shared/Loader/index.js.map +1 -1
- package/core/Form/Item.js +31 -91
- package/core/Form/Item.js.map +1 -1
- package/core/Form/context.js +4 -4
- package/core/Form/context.js.map +1 -1
- package/core/Form/index.js +52 -124
- package/core/Form/index.js.map +1 -1
- package/core/Grid.js +2 -2
- package/core/Grid.js.map +1 -1
- package/core/HTMLContent/index.js +6 -27
- package/core/HTMLContent/index.js.map +1 -1
- package/core/Image.js +5 -37
- package/core/Image.js.map +1 -1
- package/core/ImageUploader/index.js +44 -156
- package/core/ImageUploader/index.js.map +1 -1
- package/core/Input.js +34 -120
- package/core/Input.js.map +1 -1
- package/core/LabelledSelect.js +6 -38
- package/core/LabelledSelect.js.map +1 -1
- package/core/Link.js +7 -28
- package/core/Link.js.map +1 -1
- package/core/LocalImporter.js +22 -84
- package/core/LocalImporter.js.map +1 -1
- package/core/LocaleSelect.js +17 -64
- package/core/LocaleSelect.js.map +1 -1
- package/core/Markdown/index.js +30 -78
- package/core/Markdown/index.js.map +1 -1
- package/core/Modal/index.js +11 -54
- package/core/Modal/index.js.map +1 -1
- package/core/MultipleCascader/index.js +55 -135
- package/core/MultipleCascader/index.js.map +1 -1
- package/core/MultipleEnumSelect.js +13 -60
- package/core/MultipleEnumSelect.js.map +1 -1
- package/core/MultipleSelector/TablePopover.js +37 -85
- package/core/MultipleSelector/TablePopover.js.map +1 -1
- package/core/MultipleSelector/index.js +41 -88
- package/core/MultipleSelector/index.js.map +1 -1
- package/core/MutableTable/index.js +71 -125
- package/core/MutableTable/index.js.map +1 -1
- package/core/NumberInput/NumberInputPercentage.js +24 -93
- package/core/NumberInput/NumberInputPercentage.js.map +1 -1
- package/core/NumberInput/index.js +80 -115
- package/core/NumberInput/index.js.map +1 -1
- package/core/NumberInput/util.js +9 -9
- package/core/NumberInput/util.js.map +1 -1
- package/core/OrientationContext.js +4 -21
- package/core/OrientationContext.js.map +1 -1
- package/core/OverflowableText/index.js +19 -49
- package/core/OverflowableText/index.js.map +1 -1
- package/core/PagedList/index.js +18 -35
- package/core/PagedList/index.js.map +1 -1
- package/core/Pagination/index.js +19 -66
- package/core/Pagination/index.js.map +1 -1
- package/core/Popover/index.js +7 -29
- package/core/Popover/index.js.map +1 -1
- package/core/Progress/index.js +5 -37
- package/core/Progress/index.js.map +1 -1
- package/core/Progress.js +5 -37
- package/core/Progress.js.map +1 -1
- package/core/Radio.d.ts +2 -2
- package/core/Radio.js +7 -39
- package/core/Radio.js.map +1 -1
- package/core/RelativeTime.js +27 -45
- package/core/RelativeTime.js.map +1 -1
- package/core/Resizable/Resizer.js +4 -16
- package/core/Resizable/Resizer.js.map +1 -1
- package/core/Resizable/index.js +32 -55
- package/core/Resizable/index.js.map +1 -1
- package/core/SearchableSelect.js +6 -38
- package/core/SearchableSelect.js.map +1 -1
- package/core/Select.js +7 -39
- package/core/Select.js.map +1 -1
- package/core/SignedAmountInput.js +23 -70
- package/core/SignedAmountInput.js.map +1 -1
- package/core/Skeleton.js +6 -49
- package/core/Skeleton.js.map +1 -1
- package/core/Slider/RangeSlider.js +6 -49
- package/core/Slider/RangeSlider.js.map +1 -1
- package/core/Slider/index.js +24 -94
- package/core/Slider/index.js.map +1 -1
- package/core/Space.js +6 -38
- package/core/Space.js.map +1 -1
- package/core/Spin.js +6 -49
- package/core/Spin.js.map +1 -1
- package/core/StepFormContainer/index.js +17 -64
- package/core/StepFormContainer/index.js.map +1 -1
- package/core/Steps.js +5 -37
- package/core/Steps.js.map +1 -1
- package/core/Table.js +83 -116
- package/core/Table.js.map +1 -1
- package/core/Tabs/Single.js +6 -49
- package/core/Tabs/Single.js.map +1 -1
- package/core/Tabs/index.js +29 -100
- package/core/Tabs/index.js.map +1 -1
- package/core/Tag.js +5 -37
- package/core/Tag.js.map +1 -1
- package/core/TagInput/index.js +50 -95
- package/core/TagInput/index.js.map +1 -1
- package/core/Tags.js +13 -60
- package/core/Tags.js.map +1 -1
- package/core/TimePicker.js +17 -64
- package/core/TimePicker.js.map +1 -1
- package/core/TimeRangePicker.js +28 -47
- package/core/TimeRangePicker.js.map +1 -1
- package/core/Tooltip.js +7 -29
- package/core/Tooltip.js.map +1 -1
- package/core/TypedTabs/index.js +13 -75
- package/core/TypedTabs/index.js.map +1 -1
- package/core/UIProvider.js +4 -27
- package/core/UIProvider.js.map +1 -1
- package/core/Uploader.js +54 -85
- package/core/Uploader.js.map +1 -1
- package/core/VerticalMarquee/index.js +18 -35
- package/core/VerticalMarquee/index.js.map +1 -1
- package/core/VirtualList/index.js +19 -20
- package/core/VirtualList/index.js.map +1 -1
- package/core/VirtualTable/TableHeader.js +7 -9
- package/core/VirtualTable/TableHeader.js.map +1 -1
- package/core/VirtualTable/TableRow.js +12 -13
- package/core/VirtualTable/TableRow.js.map +1 -1
- package/core/VirtualTable/hooks/useColumnWidths.js +20 -36
- package/core/VirtualTable/hooks/useColumnWidths.js.map +1 -1
- package/core/VirtualTable/hooks/useColumnsStickyPosition.js +9 -9
- package/core/VirtualTable/hooks/useColumnsStickyPosition.js.map +1 -1
- package/core/VirtualTable/hooks/useRowSelection.js +28 -54
- package/core/VirtualTable/hooks/useRowSelection.js.map +1 -1
- package/core/VirtualTable/hooks/useScroll.js +13 -29
- package/core/VirtualTable/hooks/useScroll.js.map +1 -1
- package/core/VirtualTable/hooks/useScrollBarSize.js +6 -22
- package/core/VirtualTable/hooks/useScrollBarSize.js.map +1 -1
- package/core/VirtualTable/index.js +24 -25
- package/core/VirtualTable/index.js.map +1 -1
- package/core/WithExplanation/index.js +11 -32
- package/core/WithExplanation/index.js.map +1 -1
- package/core/WithTooltipList.js +17 -66
- package/core/WithTooltipList.js.map +1 -1
- package/core/YearMonthSelector.js +28 -76
- package/core/YearMonthSelector.js.map +1 -1
- package/hooks/useAPI.js +8 -44
- package/hooks/useAPI.js.map +1 -1
- package/hooks/useBool.js +4 -21
- package/hooks/useBool.js.map +1 -1
- package/hooks/useCompositeRef.js +4 -8
- package/hooks/useCompositeRef.js.map +1 -1
- package/hooks/useDebounce.js +6 -35
- package/hooks/useDebounce.js.map +1 -1
- package/hooks/useDelayed.js +7 -8
- package/hooks/useDelayed.js.map +1 -1
- package/hooks/useDidMountEffect.js +1 -1
- package/hooks/useDidMountEffect.js.map +1 -1
- package/hooks/useDraggable/DragController.js +37 -45
- package/hooks/useDraggable/DragController.js.map +1 -1
- package/hooks/useDraggable/index.js +25 -53
- package/hooks/useDraggable/index.js.map +1 -1
- package/hooks/useDraggable/useDrag.js +5 -5
- package/hooks/useDraggable/useDrag.js.map +1 -1
- package/hooks/useExtended.js +8 -8
- package/hooks/useExtended.js.map +1 -1
- package/hooks/useForceUpdate.js +2 -18
- package/hooks/useForceUpdate.js.map +1 -1
- package/hooks/useOrientation.js +2 -18
- package/hooks/useOrientation.js.map +1 -1
- package/hooks/usePrevious.js +1 -1
- package/hooks/usePrevious.js.map +1 -1
- package/hooks/useResizeObserver.js +7 -9
- package/hooks/useResizeObserver.js.map +1 -1
- package/hooks/useSwipe/controller.js +68 -75
- package/hooks/useSwipe/controller.js.map +1 -1
- package/hooks/useSwipe/index.js +6 -14
- package/hooks/useSwipe/index.js.map +1 -1
- package/hooks/useThunk.js +9 -36
- package/hooks/useThunk.js.map +1 -1
- package/hooks/useTransform.js +18 -30
- package/hooks/useTransform.js.map +1 -1
- package/hooks/useWhyDidYouUpdate.js +10 -19
- package/hooks/useWhyDidYouUpdate.js.map +1 -1
- package/hooks/useWillUnmountEffect.js +1 -1
- package/hooks/useWillUnmountEffect.js.map +1 -1
- package/internal/ArrayUtil.js +13 -38
- package/internal/ArrayUtil.js.map +1 -1
- package/internal/ExpirableLocalStorage.js +70 -74
- package/internal/ExpirableLocalStorage.js.map +1 -1
- package/internal/NumberUtil.js +11 -11
- package/internal/NumberUtil.js.map +1 -1
- package/internal/StorageHelper.js +62 -65
- package/internal/StorageHelper.js.map +1 -1
- package/internal/TextUtil.js +6 -10
- package/internal/TextUtil.js.map +1 -1
- package/internal/i18n/admin/en.js +1 -1
- package/internal/i18n/admin/en.js.map +1 -1
- package/internal/i18n/admin/index.js +3 -3
- package/internal/i18n/admin/index.js.map +1 -1
- package/internal/i18n/admin/zh.js +1 -1
- package/internal/i18n/admin/zh.js.map +1 -1
- package/internal/i18n/core/en.js +1 -1
- package/internal/i18n/core/en.js.map +1 -1
- package/internal/i18n/core/index.js +3 -3
- package/internal/i18n/core/index.js.map +1 -1
- package/internal/i18n/core/zh.js +1 -1
- package/internal/i18n/core/zh.js.map +1 -1
- package/internal/i18n/util/en.js +1 -1
- package/internal/i18n/util/en.js.map +1 -1
- package/internal/i18n/util/index.js +3 -3
- package/internal/i18n/util/index.js.map +1 -1
- package/internal/i18n/util/zh.js +1 -1
- package/internal/i18n/util/zh.js.map +1 -1
- package/package.json +6 -6
- package/util/AdminNavigationUtil.js +22 -64
- package/util/AdminNavigationUtil.js.map +1 -1
- package/util/BrowserBookmarkUtil.js +5 -5
- package/util/BrowserBookmarkUtil.js.map +1 -1
- package/util/BrowserUtil/index.js +29 -68
- package/util/BrowserUtil/index.js.map +1 -1
- package/util/CanvasUtil.js +22 -61
- package/util/CanvasUtil.js.map +1 -1
- package/util/Clipboard.js +25 -85
- package/util/Clipboard.js.map +1 -1
- package/util/ExpirableLocalStorageUtil.js +1 -1
- package/util/ExpirableLocalStorageUtil.js.map +1 -1
- package/util/ExportUtil.js +13 -13
- package/util/ExportUtil.js.map +1 -1
- package/util/ImportUtil.js +34 -86
- package/util/ImportUtil.js.map +1 -1
- package/util/LocalStorageUtil.js +1 -1
- package/util/LocalStorageUtil.js.map +1 -1
- package/util/LocaleUtil.js +16 -19
- package/util/LocaleUtil.js.map +1 -1
- package/util/MediaUtil/index.js +15 -15
- package/util/MediaUtil/index.js.map +1 -1
- package/util/MessageUtil.js +5 -16
- package/util/MessageUtil.js.map +1 -1
- package/util/ModalUtil/index.js +46 -68
- package/util/ModalUtil/index.js.map +1 -1
- package/util/NotificationUtil.js +8 -24
- package/util/NotificationUtil.js.map +1 -1
- package/util/OrientationUtil.js +8 -8
- package/util/OrientationUtil.js.map +1 -1
- package/util/PromptUtil/PromptBody.js +24 -88
- package/util/PromptUtil/PromptBody.js.map +1 -1
- package/util/PromptUtil/index.js +20 -33
- package/util/PromptUtil/index.js.map +1 -1
- package/util/ReactUtil.js +20 -54
- package/util/ReactUtil.js.map +1 -1
- package/util/RecentUsedStorageUtil/index.js +14 -15
- package/util/RecentUsedStorageUtil/index.js.map +1 -1
- package/util/RecentUsedStorageUtil/pushToList.js +3 -28
- package/util/RecentUsedStorageUtil/pushToList.js.map +1 -1
- package/util/SessionStorageUtil.js +1 -1
- package/util/SessionStorageUtil.js.map +1 -1
- package/util/SwipeUtil.js +9 -9
- package/util/SwipeUtil.js.map +1 -1
- package/util/UploadUtil/index.js +29 -30
- package/util/UploadUtil/index.js.map +1 -1
package/core/Form/index.js
CHANGED
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
1
|
import React from "react";
|
|
53
2
|
import { classNames } from "../../util/ClassNames";
|
|
54
3
|
import { Button } from "../Button";
|
|
@@ -56,87 +5,66 @@ import { FormValidationContext } from "./context";
|
|
|
56
5
|
import { i18n } from "../../internal/i18n/core";
|
|
57
6
|
import { Item } from "./Item";
|
|
58
7
|
import "./index.less";
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_a.label = 1;
|
|
72
|
-
case 1:
|
|
73
|
-
_a.trys.push([1, , 3, 4]);
|
|
74
|
-
this.setState({ isValidating: true });
|
|
75
|
-
return [4 /*yield*/, Promise.all(this.validators.map(function (_) { return _(); }))];
|
|
76
|
-
case 2:
|
|
77
|
-
validatorResults = _a.sent();
|
|
78
|
-
if (validatorResults.every(function (_) { return _; })) {
|
|
79
|
-
// Also true even if validatorResults is []
|
|
80
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
|
|
81
|
-
return [2 /*return*/, true];
|
|
82
|
-
}
|
|
83
|
-
return [2 /*return*/, false];
|
|
84
|
-
case 3:
|
|
85
|
-
this.setState({ isValidating: false });
|
|
86
|
-
return [7 /*endfinally*/];
|
|
87
|
-
case 4: return [2 /*return*/];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}); };
|
|
91
|
-
_this.onSubmit = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
-
return __generator(this, function (_a) {
|
|
93
|
-
switch (_a.label) {
|
|
94
|
-
case 0:
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
event.stopPropagation();
|
|
97
|
-
return [4 /*yield*/, this.triggerSubmit()];
|
|
98
|
-
case 1:
|
|
99
|
-
_a.sent();
|
|
100
|
-
return [2 /*return*/];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); };
|
|
104
|
-
_this.state = {
|
|
8
|
+
export class Form extends React.PureComponent {
|
|
9
|
+
static displayName = "Form";
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
layout: "horizontal",
|
|
12
|
+
errorDisplayMode: { type: "extra" },
|
|
13
|
+
};
|
|
14
|
+
static Item = Item;
|
|
15
|
+
validationContext;
|
|
16
|
+
validators = [];
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = {
|
|
105
20
|
isValidating: false,
|
|
106
21
|
};
|
|
107
|
-
|
|
108
|
-
registerValidator:
|
|
109
|
-
unregisterValidator:
|
|
110
|
-
|
|
22
|
+
this.validationContext = {
|
|
23
|
+
registerValidator: validator => this.validators.push(validator),
|
|
24
|
+
unregisterValidator: validator => {
|
|
25
|
+
const index = this.validators.indexOf(validator);
|
|
111
26
|
if (index >= 0) {
|
|
112
|
-
|
|
27
|
+
this.validators.splice(index, 1);
|
|
113
28
|
}
|
|
114
29
|
},
|
|
115
|
-
errorDisplayMode:
|
|
30
|
+
errorDisplayMode: () => this.props.errorDisplayMode,
|
|
116
31
|
};
|
|
117
|
-
return _this;
|
|
118
32
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
33
|
+
// Exposed for outer ref use, not recommended
|
|
34
|
+
triggerSubmit = async () => {
|
|
35
|
+
const { onFinish } = this.props;
|
|
36
|
+
try {
|
|
37
|
+
this.setState({ isValidating: true });
|
|
38
|
+
const validatorResults = await Promise.all(this.validators.map(_ => _()));
|
|
39
|
+
if (validatorResults.every(_ => _)) {
|
|
40
|
+
// Also true even if validatorResults is []
|
|
41
|
+
onFinish?.();
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
this.setState({ isValidating: false });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
onSubmit = async (event) => {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
await this.triggerSubmit();
|
|
126
54
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
55
|
+
renderSubmitButton() {
|
|
56
|
+
const { loading, buttonRenderer: defaultButtonRenderer, buttonStyle, buttonText, buttonIcon, buttonDisabled } = this.props;
|
|
57
|
+
const { isValidating } = this.state;
|
|
58
|
+
const buttonRenderer = defaultButtonRenderer === undefined ? (submitButton) => submitButton : defaultButtonRenderer;
|
|
59
|
+
const t = i18n();
|
|
60
|
+
const submitButton = (React.createElement(Button, { className: "g-form-submit-button", htmlType: "submit", type: "primary", key: "submitButton", style: buttonStyle, loading: isValidating || loading, icon: buttonIcon, disabled: buttonDisabled || isValidating || loading }, buttonText || t.submit));
|
|
61
|
+
return buttonRenderer !== null ? React.createElement(Form.Item, { className: "g-form-submit-form-item" }, buttonRenderer(submitButton, isValidating, loading)) : null;
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
const { children, id, className, style, layout, allowBrowserAutoComplete } = this.props;
|
|
65
|
+
return (React.createElement("form", { autoComplete: allowBrowserAutoComplete ? undefined : "off", id: id, className: classNames("g-form", `g-form-${layout}`, className), style: style, onSubmit: this.onSubmit },
|
|
130
66
|
React.createElement(FormValidationContext.Provider, { value: this.validationContext }, children),
|
|
131
67
|
this.renderSubmitButton()));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
Form.defaultProps = {
|
|
135
|
-
layout: "horizontal",
|
|
136
|
-
errorDisplayMode: { type: "extra" },
|
|
137
|
-
};
|
|
138
|
-
Form.Item = Item;
|
|
139
|
-
return Form;
|
|
140
|
-
}(React.PureComponent));
|
|
141
|
-
export { Form };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
142
70
|
//# sourceMappingURL=index.js.map
|
package/core/Form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Form/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Form/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,cAAc,CAAC;AAuBtB,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,aAA2B;IACvD,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,YAAY,GAAwB;QACvC,MAAM,EAAE,YAAY;QACpB,gBAAgB,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC;KACpC,CAAC;IAC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AED,MAAM;QACF,MAAM,EAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACtF,OAAO,CACH,8BAAM,YAAY,EAAE,wBAAwB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ;YAC3K,oBAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,IAAG,QAAQ,CAAkC;YACzG,IAAI,CAAC,kBAAkB,EAAE,CACvB,CACV,CAAC;IACN,CAAC"}
|
package/core/Grid.js
CHANGED
package/core/Grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/core/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,GAAG,EAAC,MAAM,MAAM,CAAC;AAE9B,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/core/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,GAAG,EAAC,MAAM,MAAM,CAAC;AAE9B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,GAAG;IACH,MAAM,EAAE,GAAG;CACd,CAAC,CAAC"}
|
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
1
|
import React from "react";
|
|
17
2
|
import { classNames } from "../../util/ClassNames";
|
|
18
3
|
import "./index.less";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
HTMLContent.prototype.render = function () {
|
|
25
|
-
var _a = this.props, html = _a.html, className = _a.className;
|
|
4
|
+
export class HTMLContent extends React.PureComponent {
|
|
5
|
+
static displayName = "HTMLContent";
|
|
6
|
+
render() {
|
|
7
|
+
const { html, className } = this.props;
|
|
26
8
|
return React.createElement("div", { className: classNames("g-html-content", className), dangerouslySetInnerHTML: { __html: html } });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return HTMLContent;
|
|
30
|
-
}(React.PureComponent));
|
|
31
|
-
export { HTMLContent };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
32
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/HTMLContent/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/HTMLContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,cAAc,CAAC;AAOtB,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAAoB;IACvD,MAAM,CAAC,WAAW,GAAG,aAAa,CAAC;IAEnC,MAAM;QACF,MAAM,EAAC,IAAI,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACrC,OAAO,6BAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,uBAAuB,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,GAAI,CAAC;IAChH,CAAC"}
|
package/core/Image.js
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
1
|
import AntImage from "antd/es/image";
|
|
28
2
|
import React from "react";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
3
|
+
export class Image extends React.PureComponent {
|
|
4
|
+
static displayName = "Image";
|
|
5
|
+
render() {
|
|
6
|
+
return React.createElement(AntImage, { ...this.props });
|
|
33
7
|
}
|
|
34
|
-
|
|
35
|
-
return React.createElement(AntImage, __assign({}, this.props));
|
|
36
|
-
};
|
|
37
|
-
Image.displayName = "Image";
|
|
38
|
-
return Image;
|
|
39
|
-
}(React.PureComponent));
|
|
40
|
-
export { Image };
|
|
8
|
+
}
|
|
41
9
|
//# sourceMappingURL=Image.js.map
|
package/core/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/core/Image.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/core/Image.tsx"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,OAAO,KAAM,SAAQ,KAAK,CAAC,aAAoB;IACjD,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC;IAE7B,MAAM;QACF,OAAO,oBAAC,QAAQ,OAAK,IAAI,CAAC,KAAK,GAAI,CAAC;IACxC,CAAC"}
|
|
@@ -1,90 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
37
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
38
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
39
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
40
|
-
function step(op) {
|
|
41
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
42
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
43
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
44
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
45
|
-
switch (op[0]) {
|
|
46
|
-
case 0: case 1: t = op; break;
|
|
47
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
48
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
50
|
-
default:
|
|
51
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
52
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
53
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
54
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
55
|
-
if (t[2]) _.ops.pop();
|
|
56
|
-
_.trys.pop(); continue;
|
|
57
|
-
}
|
|
58
|
-
op = body.call(thisArg, _);
|
|
59
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
60
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
64
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
65
|
-
if (!m) return o;
|
|
66
|
-
var i = m.call(o), r, ar = [], e;
|
|
67
|
-
try {
|
|
68
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
69
|
-
}
|
|
70
|
-
catch (error) { e = { error: error }; }
|
|
71
|
-
finally {
|
|
72
|
-
try {
|
|
73
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
74
|
-
}
|
|
75
|
-
finally { if (e) throw e.error; }
|
|
76
|
-
}
|
|
77
|
-
return ar;
|
|
78
|
-
};
|
|
79
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
80
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
81
|
-
if (ar || !(i in from)) {
|
|
82
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
83
|
-
ar[i] = from[i];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
87
|
-
};
|
|
88
1
|
import React from "react";
|
|
89
2
|
import CloudUploadOutlined from "@ant-design/icons/CloudUploadOutlined";
|
|
90
3
|
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
|
@@ -96,77 +9,52 @@ import { i18n } from "../../internal/i18n/core";
|
|
|
96
9
|
import { Uploader } from "../../core/Uploader";
|
|
97
10
|
import { Tooltip } from "../../core/Tooltip";
|
|
98
11
|
import "./index.less";
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return true;
|
|
142
|
-
};
|
|
143
|
-
_this.preventUploadBehavior = function (e) {
|
|
144
|
-
if (e.target === e.currentTarget) {
|
|
145
|
-
// Only trigger for clicking "Upload" icon
|
|
146
|
-
e.stopPropagation();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
_this.onUploadSuccess = function (logEntry, response) {
|
|
150
|
-
var _a = _this.props, onChange = _a.onChange, onUploadSuccess = _a.onUploadSuccess;
|
|
151
|
-
onChange(response);
|
|
152
|
-
onUploadSuccess === null || onUploadSuccess === void 0 ? void 0 : onUploadSuccess(logEntry, response);
|
|
153
|
-
};
|
|
154
|
-
_this.renderActionIcon = function (name, icon) {
|
|
155
|
-
return (React.createElement(Tooltip, { title: name, childContainerProps: { className: "action" } }, icon));
|
|
156
|
-
};
|
|
157
|
-
return _this;
|
|
158
|
-
}
|
|
159
|
-
ImageUploader.prototype.render = function () {
|
|
160
|
-
var _a = this.props, uploadURL = _a.uploadURL, formField = _a.formField, className = _a.className, style = _a.style, imageURL = _a.imageURL, disabled = _a.disabled, width = _a.width, height = _a.height, onRemove = _a.onRemove, onUploadFailure = _a.onUploadFailure;
|
|
161
|
-
var t = i18n();
|
|
162
|
-
return (React.createElement(Uploader, { accept: "image/*", formField: formField, uploadURL: uploadURL, onUploadFailure: onUploadFailure, onUploadSuccess: this.onUploadSuccess, style: __assign(__assign({}, style), { width: width, height: height }), className: classNames("g-image-uploader", className), disabled: disabled, beforeUpload: this.beforeUpload }, imageURL ? (React.createElement("div", { className: "image-container", style: { backgroundImage: "url(".concat(imageURL, ")"), height: height } },
|
|
12
|
+
export class ImageUploader extends React.PureComponent {
|
|
13
|
+
static displayName = "ImageUploader";
|
|
14
|
+
openPreviewModal = async (e) => {
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
const { imageURL } = this.props;
|
|
17
|
+
if (imageURL) {
|
|
18
|
+
await MediaUtil.openImage(imageURL);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
removeImage = async (e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
const { onRemove } = this.props;
|
|
24
|
+
const t = i18n();
|
|
25
|
+
if (await ModalUtil.confirm(t.confirmImageRemoval)) {
|
|
26
|
+
onRemove?.();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
beforeUpload = (file) => {
|
|
30
|
+
const { fileSizeLimitMB } = this.props;
|
|
31
|
+
if (fileSizeLimitMB && file.size > 1024 * 1024 * fileSizeLimitMB) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
preventUploadBehavior = (e) => {
|
|
37
|
+
if (e.target === e.currentTarget) {
|
|
38
|
+
// Only trigger for clicking "Upload" icon
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
onUploadSuccess = (logEntry, response) => {
|
|
43
|
+
const { onChange, onUploadSuccess } = this.props;
|
|
44
|
+
onChange(response);
|
|
45
|
+
onUploadSuccess?.(logEntry, response);
|
|
46
|
+
};
|
|
47
|
+
renderActionIcon = (name, icon) => {
|
|
48
|
+
return (React.createElement(Tooltip, { title: name, childContainerProps: { className: "action" } }, icon));
|
|
49
|
+
};
|
|
50
|
+
render() {
|
|
51
|
+
const { uploadURL, formField, className, style, imageURL, disabled, width, height, onRemove, onUploadFailure } = this.props;
|
|
52
|
+
const t = i18n();
|
|
53
|
+
return (React.createElement(Uploader, { accept: "image/*", formField: formField, uploadURL: uploadURL, onUploadFailure: onUploadFailure, onUploadSuccess: this.onUploadSuccess, style: { ...style, width, height }, className: classNames("g-image-uploader", className), disabled: disabled, beforeUpload: this.beforeUpload }, imageURL ? (React.createElement("div", { className: "image-container", style: { backgroundImage: `url(${imageURL})`, height } },
|
|
163
54
|
React.createElement("div", { className: "overlay", onClick: this.preventUploadBehavior },
|
|
164
55
|
this.renderActionIcon(t.preview, React.createElement(EyeOutlined, { onClick: this.openPreviewModal })),
|
|
165
56
|
!disabled && this.renderActionIcon(t.upload, React.createElement(CloudUploadOutlined, null)),
|
|
166
57
|
!disabled && onRemove && this.renderActionIcon(t.delete, React.createElement(DeleteOutlined, { onClick: this.removeImage }))))) : (t.uploadHint)));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return ImageUploader;
|
|
170
|
-
}(React.PureComponent));
|
|
171
|
-
export { ImageUploader };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
172
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/ImageUploader/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/ImageUploader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,mBAAmB,MAAM,uCAAuC,CAAC;AACxE,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,cAAc,CAAC;AActB,MAAM,OAAO,aAAsD,SAAQ,KAAK,CAAC,aAA4D;IACzI,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC;IAErC,gBAAgB,GAAG,KAAK,EAAE,CAAmB,EAAE,EAAE;QAC7C,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;IACL,CAAC,CAAC;I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