@pinnacle0/web-ui 0.5.83 → 0.6.0-beta.1
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.d.ts +0 -1
- package/util/BrowserUtil/index.js +29 -80
- 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
|
@@ -1,95 +1,47 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
17
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
-
if (!m) return o;
|
|
19
|
-
var i = m.call(o), r, ar = [], e;
|
|
20
|
-
try {
|
|
21
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
-
}
|
|
23
|
-
catch (error) { e = { error: error }; }
|
|
24
|
-
finally {
|
|
25
|
-
try {
|
|
26
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
-
}
|
|
28
|
-
finally { if (e) throw e.error; }
|
|
29
|
-
}
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
33
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
34
|
-
if (ar || !(i in from)) {
|
|
35
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
36
|
-
ar[i] = from[i];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40
|
-
};
|
|
41
1
|
import React from "react";
|
|
42
2
|
import { Table } from "../Table";
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_this.rowKey = function (item) {
|
|
48
|
-
var rowKey = _this.props.rowKey;
|
|
49
|
-
return typeof rowKey === "function" ? rowKey(item) : item[rowKey];
|
|
50
|
-
};
|
|
51
|
-
_this.onChange = function (newSelectedKeys) {
|
|
52
|
-
var _a = _this.props, value = _a.value, dataSource = _a.dataSource, onChange = _a.onChange;
|
|
53
|
-
var prevSelectedKeys = value.map(_this.rowKey);
|
|
54
|
-
var newSelectedItems = newSelectedKeys
|
|
55
|
-
.filter(function (_) { return !prevSelectedKeys.includes(_); })
|
|
56
|
-
// By Ant Design, Parameter `newSelectedKeys` must exist in current data source
|
|
57
|
-
.map(function (key) { return dataSource.find(function (_) { return _this.rowKey(_) === key; }); });
|
|
58
|
-
if (newSelectedItems.length > 0) {
|
|
59
|
-
// Select
|
|
60
|
-
onChange(__spreadArray(__spreadArray([], __read(value), false), __read(newSelectedItems), false));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
// Deselect
|
|
64
|
-
var dataSourceKeys_1 = dataSource.map(_this.rowKey);
|
|
65
|
-
var deletedItems_1 = value.filter(function (_) {
|
|
66
|
-
var key = _this.rowKey(_);
|
|
67
|
-
return !newSelectedKeys.includes(key) && dataSourceKeys_1.includes(key);
|
|
68
|
-
});
|
|
69
|
-
var withoutDeletedItems = value.filter(function (_) { return !deletedItems_1.includes(_); });
|
|
70
|
-
onChange(withoutDeletedItems);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
return _this;
|
|
3
|
+
export class TablePopover extends React.PureComponent {
|
|
4
|
+
static displayName = "TablePopover";
|
|
5
|
+
componentDidMount() {
|
|
6
|
+
this.props.onFirstRender?.();
|
|
74
7
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
8
|
+
rowKey = (item) => {
|
|
9
|
+
const { rowKey } = this.props;
|
|
10
|
+
return typeof rowKey === "function" ? rowKey(item) : item[rowKey];
|
|
11
|
+
};
|
|
12
|
+
onChange = (newSelectedKeys) => {
|
|
13
|
+
const { value, dataSource, onChange } = this.props;
|
|
14
|
+
const prevSelectedKeys = value.map(this.rowKey);
|
|
15
|
+
const newSelectedItems = newSelectedKeys
|
|
16
|
+
.filter(_ => !prevSelectedKeys.includes(_))
|
|
17
|
+
// By Ant Design, Parameter `newSelectedKeys` must exist in current data source
|
|
18
|
+
.map(key => dataSource.find(_ => this.rowKey(_) === key));
|
|
19
|
+
if (newSelectedItems.length > 0) {
|
|
20
|
+
// Select
|
|
21
|
+
onChange([...value, ...newSelectedItems]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// Deselect
|
|
25
|
+
const dataSourceKeys = dataSource.map(this.rowKey);
|
|
26
|
+
const deletedItems = value.filter(_ => {
|
|
27
|
+
const key = this.rowKey(_);
|
|
28
|
+
return !newSelectedKeys.includes(key) && dataSourceKeys.includes(key);
|
|
29
|
+
});
|
|
30
|
+
const withoutDeletedItems = value.filter(_ => !deletedItems.includes(_));
|
|
31
|
+
onChange(withoutDeletedItems);
|
|
32
|
+
}
|
|
78
33
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
34
|
+
render() {
|
|
35
|
+
const { dataSource, rowKey, columns, children, selectionDisabled, scrollY, value } = this.props;
|
|
36
|
+
const selectedRowKeys = value.map(this.rowKey);
|
|
37
|
+
const rowSelection = selectionDisabled
|
|
83
38
|
? undefined
|
|
84
39
|
: {
|
|
85
|
-
selectedRowKeys
|
|
40
|
+
selectedRowKeys,
|
|
86
41
|
onChange: this.onChange,
|
|
87
42
|
};
|
|
88
|
-
|
|
43
|
+
const table = React.createElement(Table, { rowSelection: rowSelection, size: "small", dataSource: dataSource, columns: columns, rowKey: rowKey, scrollY: scrollY, scrollX: "none" });
|
|
89
44
|
return React.createElement("div", { className: "g-multiple-selector-table-popover" }, children ? children(table) : table);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return TablePopover;
|
|
93
|
-
}(React.PureComponent));
|
|
94
|
-
export { TablePopover };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
95
47
|
//# sourceMappingURL=TablePopover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePopover.js","sourceRoot":"","sources":["../../../src/core/MultipleSelector/TablePopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TablePopover.js","sourceRoot":"","sources":["../../../src/core/MultipleSelector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AAC,KAAK,CAAO,CAAC;IACzG,CAAC"}
|
|
@@ -1,43 +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 __read = (this && this.__read) || function (o, n) {
|
|
17
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
-
if (!m) return o;
|
|
19
|
-
var i = m.call(o), r, ar = [], e;
|
|
20
|
-
try {
|
|
21
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
-
}
|
|
23
|
-
catch (error) { e = { error: error }; }
|
|
24
|
-
finally {
|
|
25
|
-
try {
|
|
26
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
-
}
|
|
28
|
-
finally { if (e) throw e.error; }
|
|
29
|
-
}
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
33
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
34
|
-
if (ar || !(i in from)) {
|
|
35
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
36
|
-
ar[i] = from[i];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40
|
-
};
|
|
41
1
|
import React from "react";
|
|
42
2
|
import { Popover } from "../Popover";
|
|
43
3
|
import { Button } from "../Button";
|
|
@@ -45,59 +5,52 @@ import { Tags } from "../Tags";
|
|
|
45
5
|
import { i18n } from "../../internal/i18n/core";
|
|
46
6
|
import { TextUtil } from "../../internal/TextUtil";
|
|
47
7
|
import { TablePopover } from "./TablePopover";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
8
|
+
export class MultipleSelector extends React.PureComponent {
|
|
9
|
+
static displayName = "MultipleSelector";
|
|
10
|
+
buttonText = () => {
|
|
11
|
+
const { value, renderButtonText } = this.props;
|
|
12
|
+
const t = i18n();
|
|
13
|
+
const length = value.length;
|
|
14
|
+
if (renderButtonText) {
|
|
15
|
+
return typeof renderButtonText === "string" ? renderButtonText : renderButtonText(length);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return value.length === 0 ? t.select : TextUtil.interpolate(t.edit, value.length.toString());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
onClose = (index) => {
|
|
22
|
+
const { value, onChange } = this.props;
|
|
23
|
+
const newValue = [...value];
|
|
24
|
+
newValue.splice(index, 1);
|
|
25
|
+
onChange(newValue);
|
|
26
|
+
};
|
|
27
|
+
renderSelectedAsTags = (labels) => {
|
|
28
|
+
const { disabled } = this.props;
|
|
29
|
+
return (React.createElement("div", { className: "g-multiple-selector-selected-tags" },
|
|
30
|
+
React.createElement(Tags, { maxWidth: 600, color: "blue", items: labels, onClose: disabled ? undefined : this.onClose })));
|
|
31
|
+
};
|
|
32
|
+
renderSelectedItems = () => {
|
|
33
|
+
const { value, renderTags } = this.props;
|
|
34
|
+
if (renderTags) {
|
|
35
|
+
if (typeof renderTags === "function") {
|
|
36
|
+
const renderedResult = renderTags(value);
|
|
37
|
+
return Array.isArray(renderedResult) ? this.renderSelectedAsTags(renderedResult) : renderedResult;
|
|
58
38
|
}
|
|
59
39
|
else {
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
_this.onClose = function (index) {
|
|
64
|
-
var _a = _this.props, value = _a.value, onChange = _a.onChange;
|
|
65
|
-
var newValue = __spreadArray([], __read(value), false);
|
|
66
|
-
newValue.splice(index, 1);
|
|
67
|
-
onChange(newValue);
|
|
68
|
-
};
|
|
69
|
-
_this.renderSelectedAsTags = function (labels) {
|
|
70
|
-
var disabled = _this.props.disabled;
|
|
71
|
-
return (React.createElement("div", { className: "g-multiple-selector-selected-tags" },
|
|
72
|
-
React.createElement(Tags, { maxWidth: 600, color: "blue", items: labels, onClose: disabled ? undefined : _this.onClose })));
|
|
73
|
-
};
|
|
74
|
-
_this.renderSelectedItems = function () {
|
|
75
|
-
var _a = _this.props, value = _a.value, renderTags = _a.renderTags;
|
|
76
|
-
if (renderTags) {
|
|
77
|
-
if (typeof renderTags === "function") {
|
|
78
|
-
var renderedResult = renderTags(value);
|
|
79
|
-
return Array.isArray(renderedResult) ? _this.renderSelectedAsTags(renderedResult) : renderedResult;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
return _this.renderSelectedAsTags(value.map(function (_) { return _[renderTags]; }));
|
|
83
|
-
}
|
|
40
|
+
return this.renderSelectedAsTags(value.map(_ => _[renderTags]));
|
|
84
41
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var _a = this.props, popoverPlacement = _a.popoverPlacement, disabled = _a.disabled, popoverClassName = _a.popoverClassName, popoverStyle = _a.popoverStyle;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
renderPopover = () => {
|
|
45
|
+
const { renderPopover, value, onChange, disabled, onPopoverFirstRender, dataSource, tableColumns, rowKey, scrollY } = this.props;
|
|
46
|
+
return (React.createElement(TablePopover, { dataSource: dataSource, columns: tableColumns, rowKey: rowKey, value: value, onChange: onChange, onFirstRender: onPopoverFirstRender, selectionDisabled: disabled === "table", scrollY: scrollY || 500 }, renderPopover));
|
|
47
|
+
};
|
|
48
|
+
render() {
|
|
49
|
+
const { popoverPlacement, disabled, popoverClassName, popoverStyle } = this.props;
|
|
94
50
|
return (React.createElement("div", { className: "g-multiple-selector" },
|
|
95
51
|
this.renderSelectedItems(),
|
|
96
52
|
React.createElement(Popover, { placement: popoverPlacement || "bottomLeft", trigger: "click", content: this.renderPopover(), overlayClassName: popoverClassName, overlayStyle: popoverStyle, open: this.props.popoverOpen, onOpenChange: this.props.onPopoverOpenChange },
|
|
97
53
|
React.createElement(Button, { disabled: disabled === "button" }, this.buttonText()))));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return MultipleSelector;
|
|
101
|
-
}(React.PureComponent));
|
|
102
|
-
export { MultipleSelector };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
103
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/MultipleSelector/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/MultipleSelector/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA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QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAChF,OAAO,CACH,6BAAK,SAAS,EAAC,qBAAqB;YAC/B,IAAI,CAAC,mBAAmB,EAAE;YAC3B,oBAAC,OAAO,IACJ,SAAS,EAAE,gBAAgB,IAAI,YAAY,EAC3C,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAC5B,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB;gBAE5C,oBAAC,MAAM,IAAC,QAAQ,EAAE,QAAQ,KAAK,QAAQ,IAAG,IAAI,CAAC,UAAU,EAAE,CAAU,CAC/D,CACR,CACT,CAAC;IACN,CAAC"}
|
|
@@ -1,139 +1,85 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
28
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
29
|
-
if (!m) return o;
|
|
30
|
-
var i = m.call(o), r, ar = [], e;
|
|
31
|
-
try {
|
|
32
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33
|
-
}
|
|
34
|
-
catch (error) { e = { error: error }; }
|
|
35
|
-
finally {
|
|
36
|
-
try {
|
|
37
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
38
|
-
}
|
|
39
|
-
finally { if (e) throw e.error; }
|
|
40
|
-
}
|
|
41
|
-
return ar;
|
|
42
|
-
};
|
|
43
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
44
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
45
|
-
if (ar || !(i in from)) {
|
|
46
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
47
|
-
ar[i] = from[i];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
51
|
-
};
|
|
52
1
|
import React from "react";
|
|
53
2
|
import { Table } from "../Table";
|
|
54
3
|
import { i18n } from "../../internal/i18n/core";
|
|
55
4
|
import "./index.less";
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var finalSequenceColumn_1 = sequenceColumn === "default" ? _this.defaultSequenceColumn : __assign(__assign({}, _this.defaultSequenceColumn), sequenceColumn);
|
|
72
|
-
newColumns.unshift({
|
|
73
|
-
title: finalSequenceColumn_1.title,
|
|
74
|
-
width: finalSequenceColumn_1.width,
|
|
75
|
-
align: finalSequenceColumn_1.align,
|
|
76
|
-
fixed: scrollX === "none" ? undefined : "left",
|
|
77
|
-
renderData: function (_, index) { return finalSequenceColumn_1.renderer(index); },
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
newColumns.push({
|
|
81
|
-
title: t.action,
|
|
82
|
-
width: 100,
|
|
83
|
-
align: "center",
|
|
84
|
-
fixed: scrollX === "none" ? undefined : "right",
|
|
85
|
-
renderData: function (_, index) {
|
|
86
|
-
var dataSourceLength = dataSource.length;
|
|
87
|
-
return (React.createElement("div", { className: "operation" },
|
|
88
|
-
(!fixedRowCount || fixedRowCount <= index) && (React.createElement("button", { type: "button", disabled: disabled || dataSourceLength === 1, onClick: function () { return _this.onDeleteRow(index); } }, "\uFF0D")),
|
|
89
|
-
index === dataSourceLength - 1 && (React.createElement("button", { disabled: disabled || nextRow === undefined, type: "button", onClick: function () { return _this.onAddRow(nextRow); } }, "\uFF0B"))));
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
return newColumns;
|
|
93
|
-
};
|
|
94
|
-
_this.onDeleteRow = function (index) {
|
|
95
|
-
var _a = _this.props, dataSource = _a.dataSource, onChange = _a.onChange, onRowCountChange = _a.onRowCountChange;
|
|
96
|
-
if (onRowCountChange) {
|
|
97
|
-
onRowCountChange("remove-row");
|
|
98
|
-
}
|
|
99
|
-
if (onChange) {
|
|
100
|
-
var newData = __spreadArray([], __read(dataSource), false);
|
|
101
|
-
newData.splice(index, 1);
|
|
102
|
-
onChange(newData);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
_this.onAddRow = function (nextRow) {
|
|
106
|
-
var _a = _this.props, dataSource = _a.dataSource, onChange = _a.onChange, onRowCountChange = _a.onRowCountChange;
|
|
107
|
-
if (onRowCountChange) {
|
|
108
|
-
onRowCountChange("add-row");
|
|
109
|
-
}
|
|
110
|
-
if (nextRow !== true && onChange) {
|
|
111
|
-
var newData = __spreadArray([], __read(dataSource), false);
|
|
112
|
-
newData.push(nextRow);
|
|
113
|
-
onChange(newData);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
_this.ref = React.createRef();
|
|
117
|
-
return _this;
|
|
5
|
+
export class MutableTable extends React.PureComponent {
|
|
6
|
+
static displayName = "MutableTable";
|
|
7
|
+
static defaultProps = {
|
|
8
|
+
scrollX: "none",
|
|
9
|
+
};
|
|
10
|
+
ref;
|
|
11
|
+
defaultSequenceColumn = {
|
|
12
|
+
title: i18n().sequence,
|
|
13
|
+
renderer: (index) => (index + 1).toString(),
|
|
14
|
+
width: 90,
|
|
15
|
+
align: "center",
|
|
16
|
+
};
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.ref = React.createRef();
|
|
118
20
|
}
|
|
119
|
-
|
|
21
|
+
componentDidUpdate(prevProps) {
|
|
120
22
|
if (prevProps.dataSource.length < this.props.dataSource.length && Number(this.props.scrollY) > 0) {
|
|
121
|
-
|
|
23
|
+
const tableContainerRef = this.ref.current.querySelector(".ant-table-body");
|
|
122
24
|
if (tableContainerRef) {
|
|
123
25
|
tableContainerRef.scrollTop = tableContainerRef.scrollHeight;
|
|
124
26
|
}
|
|
125
27
|
}
|
|
28
|
+
}
|
|
29
|
+
getColumns = () => {
|
|
30
|
+
const { columns, dataSource, nextRow, fixedRowCount, scrollX, sequenceColumn, disabled } = this.props;
|
|
31
|
+
const newColumns = [...columns];
|
|
32
|
+
const t = i18n();
|
|
33
|
+
if (sequenceColumn) {
|
|
34
|
+
const finalSequenceColumn = sequenceColumn === "default" ? this.defaultSequenceColumn : { ...this.defaultSequenceColumn, ...sequenceColumn };
|
|
35
|
+
newColumns.unshift({
|
|
36
|
+
title: finalSequenceColumn.title,
|
|
37
|
+
width: finalSequenceColumn.width,
|
|
38
|
+
align: finalSequenceColumn.align,
|
|
39
|
+
fixed: scrollX === "none" ? undefined : "left",
|
|
40
|
+
renderData: (_, index) => finalSequenceColumn.renderer(index),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
newColumns.push({
|
|
44
|
+
title: t.action,
|
|
45
|
+
width: 100,
|
|
46
|
+
align: "center",
|
|
47
|
+
fixed: scrollX === "none" ? undefined : "right",
|
|
48
|
+
renderData: (_, index) => {
|
|
49
|
+
const dataSourceLength = dataSource.length;
|
|
50
|
+
return (React.createElement("div", { className: "operation" },
|
|
51
|
+
(!fixedRowCount || fixedRowCount <= index) && (React.createElement("button", { type: "button", disabled: disabled || dataSourceLength === 1, onClick: () => this.onDeleteRow(index) }, "\uFF0D")),
|
|
52
|
+
index === dataSourceLength - 1 && (React.createElement("button", { disabled: disabled || nextRow === undefined, type: "button", onClick: () => this.onAddRow(nextRow) }, "\uFF0B"))));
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return newColumns;
|
|
126
56
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
57
|
+
onDeleteRow = (index) => {
|
|
58
|
+
const { dataSource, onChange, onRowCountChange } = this.props;
|
|
59
|
+
if (onRowCountChange) {
|
|
60
|
+
onRowCountChange("remove-row");
|
|
61
|
+
}
|
|
62
|
+
if (onChange) {
|
|
63
|
+
const newData = [...dataSource];
|
|
64
|
+
newData.splice(index, 1);
|
|
65
|
+
onChange(newData);
|
|
66
|
+
}
|
|
131
67
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
68
|
+
onAddRow = (nextRow) => {
|
|
69
|
+
const { dataSource, onChange, onRowCountChange } = this.props;
|
|
70
|
+
if (onRowCountChange) {
|
|
71
|
+
onRowCountChange("add-row");
|
|
72
|
+
}
|
|
73
|
+
if (nextRow !== true && onChange) {
|
|
74
|
+
const newData = [...dataSource];
|
|
75
|
+
newData.push(nextRow);
|
|
76
|
+
onChange(newData);
|
|
77
|
+
}
|
|
135
78
|
};
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
79
|
+
render() {
|
|
80
|
+
const { dataSource, shouldRenderIfUpdate, scrollX, scrollY, bordered } = this.props;
|
|
81
|
+
return (React.createElement("div", { className: "g-mutable-table-wrapper", ref: this.ref },
|
|
82
|
+
React.createElement(Table, { className: "g-mutable-table", scrollX: scrollX, scrollY: scrollY, rowKey: "index", columns: this.getColumns(), dataSource: dataSource, shouldRenderIfUpdate: shouldRenderIfUpdate, bordered: bordered })));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
139
85
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/MutableTable/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/MutableTable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAC9C,OAAO,cAAc,CAAC;AAiCtB,MAAM,OAAO,YAAqC,SAAQ,KAAK,CAAC,aAA6B;IACzF,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;IAEpC,MAAM,CAAC,YAAY,GAA6B;QAC5C,OAAO,EAAE,MAAM;KAClB,CAAC;IAEe,GAAG,CAAkC;IACrC,qBAAqB,GAAyB;QAC3D,KAAK,EAAE,IAAI,EAAE,CAAC,QAAQ;QACtB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,QAAQ;KAClB,CAAC;IAEF,YAAY,KAAqB;QAC7B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IA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