plain-design 1.0.0-beta.4 → 1.0.0-beta.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/plain-design.commonjs.min.js +3 -3
- package/dist/plain-design.min.css +37 -29
- package/dist/plain-design.min.js +3 -3
- package/dist/report.html +5 -5
- package/package.json +9 -8
- package/src/packages/build.ts +2 -10
- package/src/packages/components/$object/createObjectService.tsx +31 -20
- package/src/packages/components/$object/object.service.utils.ts +7 -3
- package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +108 -0
- package/src/packages/components/$previewer/image-previewer-fixed-container.scss +18 -0
- package/src/packages/components/$previewer/index.tsx +52 -0
- package/src/packages/components/Alert/alert.scss +3 -3
- package/src/packages/components/Application/service/useApplicationService.tsx +2 -0
- package/src/packages/components/Application/theme/theme.ts +3 -3
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +4 -4
- package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +2 -0
- package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +3 -3
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +4 -0
- package/src/packages/components/Badge/badge.scss +1 -1
- package/src/packages/components/Button/button.scss +2 -2
- package/src/packages/components/Card/card.scss +1 -1
- package/src/packages/components/Carousel/carousel.scss +391 -0
- package/src/packages/components/Carousel/index.tsx +569 -22
- package/src/packages/components/CarouselItem/index.tsx +77 -0
- package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +3 -3
- package/src/packages/components/CheckboxInner/checkbox-inner.scss +1 -1
- package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +8 -5
- package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +7 -4
- package/src/packages/components/DatePicker/date.scss +1 -1
- package/src/packages/components/Dialog/dialog.scss +1 -1
- package/src/packages/components/Dialog/index.tsx +4 -3
- package/src/packages/components/Dialog/useDialogMovable.tsx +7 -4
- package/src/packages/components/Dialog/utils/dialog.mouse.ts +4 -2
- package/src/packages/components/Dropdown/dropdown.public.scss +10 -0
- package/src/packages/components/Dropdown/dropdown.utils.tsx +3 -1
- package/src/packages/components/Dropdown/index.tsx +2 -2
- package/src/packages/components/DropdownOption/index.tsx +3 -3
- package/src/packages/components/DropdownSeparator/index.tsx +8 -0
- package/src/packages/components/FilterFormMultiple/index.tsx +31 -10
- package/src/packages/components/Image/image.scss +3 -3
- package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +574 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerButtonBar.tsx +140 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +54 -0
- package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +202 -0
- package/src/packages/components/ImagePreviewer/PreviewerLoading.tsx +26 -0
- package/src/packages/components/ImagePreviewer/image-previewer.scss +244 -0
- package/src/packages/components/ImagePreviewer/image-previewer.utils.tsx +135 -0
- package/src/packages/components/ImagePreviewer/index.tsx +5 -0
- package/src/packages/components/ImagePreviewer/previewer-loading.scss +52 -0
- package/src/packages/components/Input/index.scss +2 -2
- package/src/packages/components/Input/useMultipleInput.tsx +2 -76
- package/src/packages/components/Input/useTextareaInput.tsx +10 -5
- package/src/packages/components/Input/uses/useInputHooks.tsx +11 -11
- package/src/packages/components/InputNumber/NumberResize.tsx +20 -3
- package/src/packages/components/InputNumber/input-number.utils.tsx +7 -5
- package/src/packages/components/InputNumber/number.scss +10 -1
- package/src/packages/components/InputNumber/useInputNumber.public.tsx +25 -6
- package/src/packages/components/Layout/index.tsx +31 -0
- package/src/packages/components/Layout/layout.scss +227 -0
- package/src/packages/components/Layout/layout.utils.ts +3 -0
- package/src/packages/components/LayoutSection/index.tsx +67 -0
- package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +184 -0
- package/src/packages/components/LoadingMask/index.tsx +1 -1
- package/src/packages/components/PageThemeUtils/index.tsx +54 -14
- package/src/packages/components/Pagination/pagination.scss +2 -2
- package/src/packages/components/PlcOv/index.tsx +14 -4
- package/src/packages/components/Popup/index.tsx +24 -10
- package/src/packages/components/ProgressBar/progress-bar.scss +1 -1
- package/src/packages/components/Rate/index.tsx +3 -1
- package/src/packages/components/Scroll/HorizontalScrollbar.tsx +7 -3
- package/src/packages/components/Scroll/VerticalScrollbar.tsx +7 -3
- package/src/packages/components/Scroll/index.tsx +6 -6
- package/src/packages/components/Select/createPublicSelectRender.tsx +1 -1
- package/src/packages/components/Slider/slider.scss +1 -1
- package/src/packages/components/Slider/useSliderDotDragier.tsx +7 -4
- package/src/packages/components/SortList/index.tsx +191 -0
- package/src/packages/components/SortList/sort-list.scss +11 -0
- package/src/packages/components/StackCard/index.tsx +416 -0
- package/src/packages/components/StackCard/stack-card.scss +40 -0
- package/src/packages/components/StackCardItem/index.tsx +24 -0
- package/src/packages/components/StepGroup/step-group.scss +9 -9
- package/src/packages/components/TabGroup/TabsInner.tsx +5 -3
- package/src/packages/components/TabGroup/header/horizontal/tabs-header-horizontal.scss +0 -1
- package/src/packages/components/TabGroup/index.tsx +5 -1
- package/src/packages/components/TabGroup/tabs.scss +3 -0
- package/src/packages/components/Table/standard/PlcExpand.tsx +12 -20
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +1 -1
- package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +2 -0
- package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +2 -1
- package/src/packages/components/Table/table/Table.tsx +10 -3
- package/src/packages/components/Table/table/body/row.tsx +1 -1
- package/src/packages/components/Table/table/body/useCellValue.tsx +10 -6
- package/src/packages/components/Table/table/head/useHeadCellResize.ts +8 -3
- package/src/packages/components/Table/table/table.scss +2 -1
- package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +10 -5
- package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +12 -7
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +1 -1
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +1 -1
- package/src/packages/components/Table/table/utils/createTableHooks.ts +4 -2
- package/src/packages/components/Table/table/utils/table.utils.ts +6 -1
- package/src/packages/components/ThemeEditor/index.tsx +173 -0
- package/src/packages/components/ThemeEditor/theme-editor.scss +105 -0
- package/src/packages/components/ThemePrimaryColors/index.ts +5 -0
- package/src/packages/components/Tree/RenderTreeNode.tsx +8 -3
- package/src/packages/components/Tree/index.tsx +4 -3
- package/src/packages/components/Tree/tree.scss +42 -9
- package/src/packages/components/TreeCore/TreeCore.type.tsx +2 -0
- package/src/packages/components/TreeCore/createTreeCore.tsx +5 -1
- package/src/packages/components/TreeCore/createTreeDraggier.tsx +70 -56
- package/src/packages/components/TreeCore/createTreeMethods.tsx +1 -0
- package/src/packages/components/TreeCore/createTreeProps.ts +2 -1
- package/src/packages/components/TreeNodeWithMenu/index.tsx +91 -0
- package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +39 -0
- package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
- package/src/packages/components/VirtualList/index.tsx +15 -6
- package/src/packages/components/VirtualList/useVirtualList.tsx +182 -107
- package/src/packages/components/VirtualList/virtual-list.scss +31 -17
- package/src/packages/components/VirtualTable/index.tsx +7 -7
- package/src/packages/components/VirtualTable/virtual-table.scss +1 -2
- package/src/packages/components/createProvider/index.ts +5 -0
- package/src/packages/components/nextPopupId/index.ts +5 -0
- package/src/packages/components/useDialog/DialogService.tsx +13 -1
- package/src/packages/components/useDialog/index.tsx +1 -1
- package/src/packages/components/useImage/ImageService.tsx +7 -4
- package/src/packages/components/useMessage/Message.tsx +5 -1
- package/src/packages/components/useMessage/message.scss +5 -1
- package/src/packages/components/useNotice/notice.scss +2 -2
- package/src/packages/components/usePopup/PopupItem.tsx +45 -26
- package/src/packages/components/usePopup/popup-item.scss +5 -1
- package/src/packages/components/usePopup/usePopup.tsx +23 -7
- package/src/packages/components/usePopup/usePopupManager.tsx +2 -1
- package/src/packages/components/usePopup/utils/popup.utils.ts +2 -1
- package/src/packages/components/usePopupManager/index.ts +5 -0
- package/src/packages/components/usePopupTrigger/index.tsx +5 -0
- package/src/packages/components/useReferenceTrigger/index.tsx +5 -0
- package/src/packages/components/useTooltip/index.tsx +10 -2
- package/src/packages/components/useWatchAutoClear/index.ts +5 -0
- package/src/packages/entry.tsx +48 -2
- package/src/packages/i18n/lang/en-us.ts +36 -0
- package/src/packages/i18n/lang/zh-cn.ts +36 -0
- package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
- package/src/packages/uses/useEdit.ts +5 -1
- package/src/packages/uses/useStyle.tsx +10 -2
- package/src/packages/utils/ClientZoom.ts +24 -2
- package/src/packages/utils/ComponentUtils.ts +10 -0
- package/src/packages/utils/buildCycleIndexList.ts +31 -0
- package/src/packages/utils/getDeviceInfo.ts +44 -44
- package/src/packages/utils/getRectAutoFormat.ts +9 -0
- package/src/packages/utils/inheritSlots.ts +28 -0
- package/src/packages/utils/notNull.ts +9 -0
- package/src/packages/utils/useMove.tsx +10 -4
- package/src/packages/utils/watchEffectAutoClear.ts +19 -7
- package/src/packages/components/CarouselGroup/carousel.scss +0 -143
- package/src/packages/components/CarouselGroup/index.tsx +0 -274
- package/src/pages/data/address.json +0 -39317
- package/src/pages/data/data-1.json +0 -754
- package/src/pages/data/data-2.json +0 -3006
- package/src/pages/data/data-200.json +0 -5206
- package/src/pages/data/data-2000.json +0 -51954
- package/src/pages/data/data-50.json +0 -2075
- package/src/pages/data/data.json +0 -30002
- package/src/pages/data/demo.json +0 -1702
- package/src/pages/data/mock.database.js +0 -43
- package/src/pages/data/mock.js +0 -141
- package/src/pages/data/tree.data.json +0 -87
- package/src/pages/env/config/local.js +0 -3
- package/src/pages/env/config/prod.js +0 -3
- package/src/pages/env/config/undefined.js +0 -1
- package/src/pages/env/env.d.ts +0 -4
- package/src/pages/env/index.ts +0 -1
- package/src/pages/history/createHistory.ts +0 -94
- package/src/pages/history/history.utils.ts +0 -64
- package/src/pages/index/App.tsx +0 -17
- package/src/pages/index/Demo/DemoLine.tsx +0 -23
- package/src/pages/index/Demo/DemoRow.scss +0 -128
- package/src/pages/index/Demo/DemoRow.tsx +0 -71
- package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
- package/src/pages/index/Demo/DemoRowController.tsx +0 -45
- package/src/pages/index/Demo/index.ts +0 -8
- package/src/pages/index/app.scss +0 -192
- package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -51
- package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
- package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
- package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
- package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
- package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
- package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
- package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
- package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
- package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
- package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
- package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
- package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
- package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
- package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
- package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
- package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
- package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
- package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
- package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
- package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
- package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
- package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
- package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
- package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
- package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
- package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
- package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
- package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
- package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
- package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
- package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
- package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
- package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
- package/src/pages/index/components/normal/DemoButton.tsx +0 -300
- package/src/pages/index/components/normal/DemoCard.tsx +0 -176
- package/src/pages/index/components/normal/DemoCarousel.tsx +0 -125
- package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
- package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
- package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
- package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
- package/src/pages/index/components/normal/DemoColor.scss +0 -20
- package/src/pages/index/components/normal/DemoColor.tsx +0 -82
- package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
- package/src/pages/index/components/normal/DemoDate.tsx +0 -443
- package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
- package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
- package/src/pages/index/components/normal/DemoGrid.scss +0 -26
- package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
- package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
- package/src/pages/index/components/normal/DemoImage.tsx +0 -122
- package/src/pages/index/components/normal/DemoInput.scss +0 -0
- package/src/pages/index/components/normal/DemoInput.tsx +0 -790
- package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
- package/src/pages/index/components/normal/DemoList.scss +0 -15
- package/src/pages/index/components/normal/DemoList.tsx +0 -82
- package/src/pages/index/components/normal/DemoLoading.tsx +0 -83
- package/src/pages/index/components/normal/DemoNumber.tsx +0 -266
- package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
- package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
- package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
- package/src/pages/index/components/normal/DemoRadio.scss +0 -16
- package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
- package/src/pages/index/components/normal/DemoRate.tsx +0 -77
- package/src/pages/index/components/normal/DemoScroll.scss +0 -22
- package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
- package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
- package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
- package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
- package/src/pages/index/components/normal/DemoStep.scss +0 -18
- package/src/pages/index/components/normal/DemoStep.tsx +0 -291
- package/src/pages/index/components/normal/DemoTab.tsx +0 -338
- package/src/pages/index/components/normal/DemoTag.tsx +0 -100
- package/src/pages/index/components/normal/DemoTime.tsx +0 -403
- package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
- package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
- package/src/pages/index/components/normal/DemoTree.tsx +0 -1099
- package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
- package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -378
- package/src/pages/index/components/service/DemoDialogService.tsx +0 -248
- package/src/pages/index/components/service/DemoFileService.tsx +0 -110
- package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
- package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
- package/src/pages/index/components/service/DemoPopupService.tsx +0 -322
- package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
- package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
- package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
- package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
- package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
- package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
- package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
- package/src/pages/index/components/table/DemoTableExpand.tsx +0 -181
- package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
- package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
- package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
- package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
- package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
- package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
- package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
- package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
- package/src/pages/index/components/test/DemoI18n.tsx +0 -27
- package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
- package/src/pages/index/home/AppContent.tsx +0 -69
- package/src/pages/index/home/AppHead.tsx +0 -104
- package/src/pages/index/home/AppHome.tsx +0 -16
- package/src/pages/index/home/AppMenu.tsx +0 -38
- package/src/pages/index/home/menus.tsx +0 -217
- package/src/pages/index/main.tsx +0 -23
- package/src/pages/index/nav/$nav.ts +0 -41
- package/src/pages/index/pages.d.ts +0 -6
- package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
- package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
- package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
- package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
- package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
- package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
- package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
- package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
- package/src/pages/libs/iconfont-symbol/demo.css +0 -539
- package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
- package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
- package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
- package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
- package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
- package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
- package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
- package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
- package/src/pages/libs/install.iconfont-symbol.scss +0 -7
- package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
- package/src/pages/module/address.ts +0 -27
- package/src/pages/module/http.ts +0 -24
- package/src/pages/module/index.ts +0 -19
- package/src/pages/module/object.ts +0 -5
- package/src/pages/module/ov.tsx +0 -13
- package/src/pages/module/upload.ts +0 -9
- package/src/pages/module/useTableOption.ts +0 -28
@@ -1,505 +0,0 @@
|
|
1
|
-
import {computed, designPage, reactive} from "plain-design-composition";
|
2
|
-
import {DemoRow} from "../../Demo/DemoRow";
|
3
|
-
import {$message, Button, ButtonGroup, Carousel, CarouselGroup, Checkbox, CheckboxGroup, Collapse, CollapseGroup, Input, KeepAlive, Segment, SegmentGroup, Tag} from "../../../../packages";
|
4
|
-
import React, {useState} from "react";
|
5
|
-
import {iKeepAliveMeta} from "../../../../packages/components/KeepAlive/utils/keepalive.utils";
|
6
|
-
import {delay} from "plain-utils/utils/delay";
|
7
|
-
|
8
|
-
export const demo1 = designPage(() => {
|
9
|
-
|
10
|
-
const DemoInput = () => {
|
11
|
-
const [text, setText] = useState("hello world");
|
12
|
-
return <Input modelValue={text} onChange={setText}/>;
|
13
|
-
};
|
14
|
-
|
15
|
-
const publicItemStyles = {
|
16
|
-
color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '28px'
|
17
|
-
};
|
18
|
-
const DemoCarousel = () => {
|
19
|
-
return (
|
20
|
-
<CarouselGroup autoplay={0}>
|
21
|
-
<Carousel style={{ backgroundColor: '#8A2BE2', ...publicItemStyles }}>panel1</Carousel>
|
22
|
-
<Carousel style={{ backgroundColor: '#409EFF', ...publicItemStyles }}>panel2</Carousel>
|
23
|
-
<Carousel style={{ backgroundColor: '#F38585', ...publicItemStyles }}>panel3</Carousel>
|
24
|
-
<Carousel style={{ backgroundColor: '#455a64', ...publicItemStyles }}>panel4</Carousel>
|
25
|
-
</CarouselGroup>
|
26
|
-
);
|
27
|
-
};
|
28
|
-
|
29
|
-
const DemoCollapse = () => {
|
30
|
-
return (
|
31
|
-
<CollapseGroup>
|
32
|
-
<Collapse title={'专家方向'}>
|
33
|
-
<p>经过几年的技术积累,大量的项目历练,很自然地就朝着专家的方向过渡了;</p>
|
34
|
-
<p>技术人普遍具有的一个特征就是不喜欢管一些乱七八糟的事,更愿意钻研感兴趣的技术,解决一些技术难题;</p>
|
35
|
-
<p>走专家路线可能是大多数技术人的选择;</p>
|
36
|
-
</Collapse>
|
37
|
-
<Collapse title={'管理方向'}>
|
38
|
-
<p>另一个职业方向就是技术管理;</p>
|
39
|
-
<p>技术管理要求的更综合,日常的工作涉及项目管理,跨部门沟通,团队管理,技术体系建设等方面;</p>
|
40
|
-
<p>做技术管理意味着远离一线coding,渐渐失去自己的技术优势,80%的精力是帮助团队同学成长,通过团队完成既定目标;</p>
|
41
|
-
<p>技术人要经历一个心态的转变。但企业招人过去最主要的目的是解决实际面临的技术问题,所以对于技术管理来说,技术还是一个基本面,不能完全放下,还是要时刻关注技术大方向;</p>
|
42
|
-
</Collapse>
|
43
|
-
<Collapse title={'产品&业务方向'}>
|
44
|
-
<p>还有一个职业方向是转型做产品经理更多地贴近业务;</p>
|
45
|
-
<p>我身边有越来越多的前端做了几年的研发后转型做了产品;</p>
|
46
|
-
<p>技术人转型做产品,其实是比较有优势的,一方面懂技术能更好地和研发沟通,另一方面产品设计上更容易落地;</p>
|
47
|
-
</Collapse>
|
48
|
-
</CollapseGroup>
|
49
|
-
);
|
50
|
-
};
|
51
|
-
|
52
|
-
|
53
|
-
const types = ['input', 'carousel', 'collapse'] as const;
|
54
|
-
|
55
|
-
const state = reactive({ type: types[0] });
|
56
|
-
|
57
|
-
return () => (
|
58
|
-
<DemoRow title="基本用法">
|
59
|
-
|
60
|
-
<SegmentGroup v-model={state.type}>
|
61
|
-
{types.map(i => (
|
62
|
-
<Segment label={i} key={i} val={i}/>
|
63
|
-
))}
|
64
|
-
</SegmentGroup>
|
65
|
-
|
66
|
-
<div style={{ marginTop: '16px' }}>
|
67
|
-
<KeepAlive>
|
68
|
-
{{
|
69
|
-
input: () => (<DemoInput/>),
|
70
|
-
carousel: () => (<DemoCarousel/>),
|
71
|
-
collapse: () => (<DemoCollapse/>),
|
72
|
-
}[state.type]()}
|
73
|
-
</KeepAlive>
|
74
|
-
</div>
|
75
|
-
</DemoRow>
|
76
|
-
);
|
77
|
-
});
|
78
|
-
|
79
|
-
export const demo2 = designPage(() => {
|
80
|
-
|
81
|
-
const types = ['input', 'textarea', 'multiInput', 'text', 'multiText'] as const;
|
82
|
-
|
83
|
-
const state = reactive({
|
84
|
-
type: types[0]
|
85
|
-
});
|
86
|
-
|
87
|
-
const multiInputValue = ['王五', '赵六'];
|
88
|
-
|
89
|
-
return () => (
|
90
|
-
<DemoRow title="渲染纯文本">
|
91
|
-
|
92
|
-
<SegmentGroup v-model={state.type}>
|
93
|
-
{types.map(i => (
|
94
|
-
<Segment label={i} key={i} val={i}/>
|
95
|
-
))}
|
96
|
-
</SegmentGroup>
|
97
|
-
|
98
|
-
<div style={{ marginTop: '16px' }}>
|
99
|
-
<KeepAlive>
|
100
|
-
{{
|
101
|
-
input: () => (
|
102
|
-
<Input key="input" modelValue="张三"/>
|
103
|
-
),
|
104
|
-
textarea: () => (
|
105
|
-
<Input textarea key="textarea" modelValue="李四"/>
|
106
|
-
),
|
107
|
-
multiInput: () => (
|
108
|
-
<Input multiple key="multiInput" modelValue={multiInputValue}/>
|
109
|
-
),
|
110
|
-
text: () => (
|
111
|
-
"hello world text"
|
112
|
-
),
|
113
|
-
multiText: () => (
|
114
|
-
<React.Fragment key="multiText">
|
115
|
-
<span>hello</span>
|
116
|
-
<span>world</span>
|
117
|
-
<span>multiple text</span>
|
118
|
-
</React.Fragment>
|
119
|
-
),
|
120
|
-
}[state.type]()}
|
121
|
-
</KeepAlive>
|
122
|
-
</div>
|
123
|
-
</DemoRow>
|
124
|
-
);
|
125
|
-
});
|
126
|
-
|
127
|
-
export const demo3 = designPage(() => {
|
128
|
-
|
129
|
-
const DemoInput: React.FC<{ prefix: string }> = (props) => {
|
130
|
-
const [text, setText] = useState("hello world");
|
131
|
-
return <Input modelValue={text} onChange={setText} prefix={<span>{props.prefix}</span>}/>;
|
132
|
-
};
|
133
|
-
|
134
|
-
const publicItemStyles = {
|
135
|
-
color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '28px'
|
136
|
-
};
|
137
|
-
const DemoCarousel: React.FC<{ coverText: string }> = (props) => {
|
138
|
-
return (
|
139
|
-
<CarouselGroup autoplay={0} cover={
|
140
|
-
<div style={{ textAlign: 'center', color: 'white', padding: '16px' }}>
|
141
|
-
{props.coverText}
|
142
|
-
</div>
|
143
|
-
}>
|
144
|
-
<Carousel style={{ backgroundColor: '#8A2BE2', ...publicItemStyles }}>panel1</Carousel>
|
145
|
-
<Carousel style={{ backgroundColor: '#409EFF', ...publicItemStyles }}>panel2</Carousel>
|
146
|
-
<Carousel style={{ backgroundColor: '#F38585', ...publicItemStyles }}>panel3</Carousel>
|
147
|
-
<Carousel style={{ backgroundColor: '#455a64', ...publicItemStyles }}>panel4</Carousel>
|
148
|
-
</CarouselGroup>
|
149
|
-
);
|
150
|
-
};
|
151
|
-
|
152
|
-
const DemoCollapse = () => {
|
153
|
-
return (
|
154
|
-
<CollapseGroup>
|
155
|
-
<Collapse title={'专家方向'}>
|
156
|
-
<p>经过几年的技术积累,大量的项目历练,很自然地就朝着专家的方向过渡了;</p>
|
157
|
-
<p>技术人普遍具有的一个特征就是不喜欢管一些乱七八糟的事,更愿意钻研感兴趣的技术,解决一些技术难题;</p>
|
158
|
-
<p>走专家路线可能是大多数技术人的选择;</p>
|
159
|
-
</Collapse>
|
160
|
-
<Collapse title={'管理方向'}>
|
161
|
-
<p>另一个职业方向就是技术管理;</p>
|
162
|
-
<p>技术管理要求的更综合,日常的工作涉及项目管理,跨部门沟通,团队管理,技术体系建设等方面;</p>
|
163
|
-
<p>做技术管理意味着远离一线coding,渐渐失去自己的技术优势,80%的精力是帮助团队同学成长,通过团队完成既定目标;</p>
|
164
|
-
<p>技术人要经历一个心态的转变。但企业招人过去最主要的目的是解决实际面临的技术问题,所以对于技术管理来说,技术还是一个基本面,不能完全放下,还是要时刻关注技术大方向;</p>
|
165
|
-
</Collapse>
|
166
|
-
<Collapse title={'产品&业务方向'}>
|
167
|
-
<p>还有一个职业方向是转型做产品经理更多地贴近业务;</p>
|
168
|
-
<p>我身边有越来越多的前端做了几年的研发后转型做了产品;</p>
|
169
|
-
<p>技术人转型做产品,其实是比较有优势的,一方面懂技术能更好地和研发沟通,另一方面产品设计上更容易落地;</p>
|
170
|
-
</Collapse>
|
171
|
-
</CollapseGroup>
|
172
|
-
);
|
173
|
-
};
|
174
|
-
|
175
|
-
|
176
|
-
const types = ['input', 'carousel', 'collapse'] as const;
|
177
|
-
|
178
|
-
const state = reactive({
|
179
|
-
type: types[0],
|
180
|
-
publicText: '支付方式'
|
181
|
-
});
|
182
|
-
|
183
|
-
return () => (
|
184
|
-
<DemoRow title="变化属性">
|
185
|
-
|
186
|
-
<Input v-model={state.publicText}/>
|
187
|
-
|
188
|
-
<SegmentGroup v-model={state.type} style={{ marginTop: '16px' }}>
|
189
|
-
{types.map(i => (
|
190
|
-
<Segment label={i} key={i} val={i}/>
|
191
|
-
))}
|
192
|
-
</SegmentGroup>
|
193
|
-
|
194
|
-
<div style={{ marginTop: '16px' }}>
|
195
|
-
<KeepAlive>
|
196
|
-
{{
|
197
|
-
input: () => (<DemoInput prefix={state.publicText}/>),
|
198
|
-
carousel: () => (<DemoCarousel coverText={state.publicText}/>),
|
199
|
-
collapse: () => (<DemoCollapse/>),
|
200
|
-
}[state.type]()}
|
201
|
-
</KeepAlive>
|
202
|
-
</div>
|
203
|
-
</DemoRow>
|
204
|
-
);
|
205
|
-
});
|
206
|
-
|
207
|
-
export const demo4 = designPage(() => {
|
208
|
-
|
209
|
-
const types = ['input', 'textarea', 'multiInput', 'text', 'multiText'] as const;
|
210
|
-
|
211
|
-
const state = reactive({
|
212
|
-
type: types[0]
|
213
|
-
});
|
214
|
-
|
215
|
-
const multiInputValue = ['王五', '赵六'];
|
216
|
-
|
217
|
-
return () => (
|
218
|
-
<DemoRow title="组件有多个节点">
|
219
|
-
|
220
|
-
<SegmentGroup v-model={state.type}>
|
221
|
-
{types.map(i => (
|
222
|
-
<Segment label={i} key={i} val={i}/>
|
223
|
-
))}
|
224
|
-
</SegmentGroup>
|
225
|
-
|
226
|
-
<div style={{ marginTop: '16px' }}>
|
227
|
-
<KeepAlive>
|
228
|
-
{{
|
229
|
-
input: () => (
|
230
|
-
<React.Fragment key="input">
|
231
|
-
<Input modelValue="张三1"/>
|
232
|
-
<Input modelValue="张三2"/>
|
233
|
-
</React.Fragment>
|
234
|
-
),
|
235
|
-
textarea: () => (
|
236
|
-
<React.Fragment key="textarea">
|
237
|
-
<Input textarea modelValue="李四1"/>
|
238
|
-
<Input textarea modelValue="李四2"/>
|
239
|
-
</React.Fragment>
|
240
|
-
),
|
241
|
-
multiInput: () => (
|
242
|
-
<React.Fragment key="multiInput">
|
243
|
-
<Input multiple modelValue={multiInputValue}/>
|
244
|
-
<Input multiple modelValue={multiInputValue}/>
|
245
|
-
</React.Fragment>
|
246
|
-
),
|
247
|
-
text: () => (
|
248
|
-
"hello world text"
|
249
|
-
),
|
250
|
-
multiText: () => (
|
251
|
-
<>
|
252
|
-
<span>hello</span>
|
253
|
-
<span>world</span>
|
254
|
-
<span>multiple text</span>
|
255
|
-
</>
|
256
|
-
),
|
257
|
-
}[state.type]()}
|
258
|
-
</KeepAlive>
|
259
|
-
</div>
|
260
|
-
</DemoRow>
|
261
|
-
);
|
262
|
-
});
|
263
|
-
|
264
|
-
export const demo5 = designPage(() => {
|
265
|
-
|
266
|
-
const DemoInput: React.FC<{ prefix: string }> = (props) => {
|
267
|
-
const [text, setText] = useState("hello world");
|
268
|
-
return <Input modelValue={text} onChange={setText} prefix={<span>{props.prefix}</span>}/>;
|
269
|
-
};
|
270
|
-
|
271
|
-
const publicItemStyles = {
|
272
|
-
color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '28px'
|
273
|
-
};
|
274
|
-
const DemoCarousel: React.FC<{ coverText: string }> = (props) => {
|
275
|
-
return (
|
276
|
-
<CarouselGroup autoplay={0} cover={
|
277
|
-
<div style={{ textAlign: 'center', color: 'white', padding: '16px' }}>
|
278
|
-
{props.coverText}
|
279
|
-
</div>
|
280
|
-
}>
|
281
|
-
<Carousel style={{ backgroundColor: '#8A2BE2', ...publicItemStyles }}>panel1</Carousel>
|
282
|
-
<Carousel style={{ backgroundColor: '#409EFF', ...publicItemStyles }}>panel2</Carousel>
|
283
|
-
<Carousel style={{ backgroundColor: '#F38585', ...publicItemStyles }}>panel3</Carousel>
|
284
|
-
<Carousel style={{ backgroundColor: '#455a64', ...publicItemStyles }}>panel4</Carousel>
|
285
|
-
</CarouselGroup>
|
286
|
-
);
|
287
|
-
};
|
288
|
-
|
289
|
-
const DemoCollapse = () => {
|
290
|
-
return (
|
291
|
-
<CollapseGroup>
|
292
|
-
<Collapse title={'专家方向'}>
|
293
|
-
<p>经过几年的技术积累,大量的项目历练,很自然地就朝着专家的方向过渡了;</p>
|
294
|
-
<p>技术人普遍具有的一个特征就是不喜欢管一些乱七八糟的事,更愿意钻研感兴趣的技术,解决一些技术难题;</p>
|
295
|
-
<p>走专家路线可能是大多数技术人的选择;</p>
|
296
|
-
</Collapse>
|
297
|
-
<Collapse title={'管理方向'}>
|
298
|
-
<p>另一个职业方向就是技术管理;</p>
|
299
|
-
<p>技术管理要求的更综合,日常的工作涉及项目管理,跨部门沟通,团队管理,技术体系建设等方面;</p>
|
300
|
-
<p>做技术管理意味着远离一线coding,渐渐失去自己的技术优势,80%的精力是帮助团队同学成长,通过团队完成既定目标;</p>
|
301
|
-
<p>技术人要经历一个心态的转变。但企业招人过去最主要的目的是解决实际面临的技术问题,所以对于技术管理来说,技术还是一个基本面,不能完全放下,还是要时刻关注技术大方向;</p>
|
302
|
-
</Collapse>
|
303
|
-
<Collapse title={'产品&业务方向'}>
|
304
|
-
<p>还有一个职业方向是转型做产品经理更多地贴近业务;</p>
|
305
|
-
<p>我身边有越来越多的前端做了几年的研发后转型做了产品;</p>
|
306
|
-
<p>技术人转型做产品,其实是比较有优势的,一方面懂技术能更好地和研发沟通,另一方面产品设计上更容易落地;</p>
|
307
|
-
</Collapse>
|
308
|
-
</CollapseGroup>
|
309
|
-
);
|
310
|
-
};
|
311
|
-
|
312
|
-
const componentNames = ['input', 'carousel', 'collapse'] as const;
|
313
|
-
|
314
|
-
const state = reactive({
|
315
|
-
publicText: '支付方式',
|
316
|
-
components: {
|
317
|
-
input: {
|
318
|
-
count: 0,
|
319
|
-
key: () => `input_${state.components.input.count}`,
|
320
|
-
render: () => (<DemoInput key={state.components.input.key()} prefix={state.publicText}/>),
|
321
|
-
},
|
322
|
-
carousel: {
|
323
|
-
count: 0,
|
324
|
-
key: () => `carousel_${state.components.carousel.count}`,
|
325
|
-
render: () => (<DemoCarousel key={state.components.carousel.key()} coverText={state.publicText}/>),
|
326
|
-
},
|
327
|
-
collapse: {
|
328
|
-
count: 0,
|
329
|
-
key: () => `collapse_${state.components.collapse.count}`,
|
330
|
-
render: () => (<DemoCollapse key={state.components.collapse.key()}/>),
|
331
|
-
}
|
332
|
-
},
|
333
|
-
showComponent: componentNames[0],
|
334
|
-
cacheComponents: [...componentNames],
|
335
|
-
cacheKeys: computed((): string[] => {
|
336
|
-
return state.cacheComponents.map((i) => state.components[i].key());
|
337
|
-
}),
|
338
|
-
isCache: (meta: iKeepAliveMeta): boolean => !!state.cacheKeys.find((i) => i === meta.key),
|
339
|
-
});
|
340
|
-
|
341
|
-
const handleCacheChange = () => {
|
342
|
-
/*令KeepAlive render*/
|
343
|
-
state.isCache = (meta: iKeepAliveMeta) => !!state.cacheKeys.find(i => i === meta.key);
|
344
|
-
};
|
345
|
-
|
346
|
-
const handleRefresh = (componentName: typeof componentNames[number]) => {
|
347
|
-
state.components[componentName].count++;
|
348
|
-
};
|
349
|
-
|
350
|
-
return () => (
|
351
|
-
<DemoRow title="部分内容不缓存,部分内容缓存,缓存的内容手动控制重新渲染">
|
352
|
-
|
353
|
-
<Input v-model={state.publicText}/>
|
354
|
-
|
355
|
-
<div>
|
356
|
-
<SegmentGroup v-model={state.showComponent} style={{ marginTop: '16px' }}>
|
357
|
-
{componentNames.map(i => (
|
358
|
-
<Segment label={i} key={i} val={i}/>
|
359
|
-
))}
|
360
|
-
</SegmentGroup>
|
361
|
-
|
362
|
-
<div style={{ marginTop: '16px', marginLeft: '8px', display: 'inline-block' }}>
|
363
|
-
<CheckboxGroup v-model={state.cacheComponents} onChange={handleCacheChange}>
|
364
|
-
<ButtonGroup status="secondary">
|
365
|
-
{componentNames.map(i => (
|
366
|
-
<Button key={i}>
|
367
|
-
<Checkbox status="primary" val={i} label={`缓存${i}`}/>
|
368
|
-
</Button>
|
369
|
-
))}
|
370
|
-
</ButtonGroup>
|
371
|
-
</CheckboxGroup>
|
372
|
-
</div>
|
373
|
-
|
374
|
-
<div style={{ marginTop: '16px', marginLeft: '8px', display: 'inline-block' }}>
|
375
|
-
<ButtonGroup status="secondary">
|
376
|
-
{componentNames.map(i => (
|
377
|
-
<Button key={i} onClick={() => handleRefresh(i)}>刷新{i}</Button>
|
378
|
-
))}
|
379
|
-
</ButtonGroup>
|
380
|
-
</div>
|
381
|
-
</div>
|
382
|
-
|
383
|
-
<div style={{ marginTop: '16px' }}>
|
384
|
-
<KeepAlive
|
385
|
-
isCache={state.isCache}
|
386
|
-
>
|
387
|
-
{state.components[state.showComponent].render()}
|
388
|
-
</KeepAlive>
|
389
|
-
</div>
|
390
|
-
</DemoRow>
|
391
|
-
);
|
392
|
-
});
|
393
|
-
|
394
|
-
|
395
|
-
export const demo6 = designPage(() => {
|
396
|
-
|
397
|
-
const DemoInput: React.FC<{ prefix: string }> = (props) => {
|
398
|
-
const [text, setText] = useState("hello world");
|
399
|
-
return <Input modelValue={text} onChange={setText} prefix={<span>{props.prefix}</span>}/>;
|
400
|
-
};
|
401
|
-
|
402
|
-
const publicItemStyles = {
|
403
|
-
color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '28px'
|
404
|
-
};
|
405
|
-
const DemoCarousel: React.FC<{ coverText: string }> = (props) => {
|
406
|
-
return (
|
407
|
-
<CarouselGroup autoplay={0} cover={
|
408
|
-
<div style={{ textAlign: 'center', color: 'white', padding: '16px' }}>
|
409
|
-
{props.coverText}
|
410
|
-
</div>
|
411
|
-
}>
|
412
|
-
<Carousel style={{ backgroundColor: '#8A2BE2', ...publicItemStyles }}>panel1</Carousel>
|
413
|
-
<Carousel style={{ backgroundColor: '#409EFF', ...publicItemStyles }}>panel2</Carousel>
|
414
|
-
<Carousel style={{ backgroundColor: '#F38585', ...publicItemStyles }}>panel3</Carousel>
|
415
|
-
<Carousel style={{ backgroundColor: '#455a64', ...publicItemStyles }}>panel4</Carousel>
|
416
|
-
</CarouselGroup>
|
417
|
-
);
|
418
|
-
};
|
419
|
-
|
420
|
-
const DemoCollapse = () => {
|
421
|
-
return (
|
422
|
-
<CollapseGroup>
|
423
|
-
<Collapse title={'专家方向'}>
|
424
|
-
<p>经过几年的技术积累,大量的项目历练,很自然地就朝着专家的方向过渡了;</p>
|
425
|
-
<p>技术人普遍具有的一个特征就是不喜欢管一些乱七八糟的事,更愿意钻研感兴趣的技术,解决一些技术难题;</p>
|
426
|
-
<p>走专家路线可能是大多数技术人的选择;</p>
|
427
|
-
</Collapse>
|
428
|
-
<Collapse title={'管理方向'}>
|
429
|
-
<p>另一个职业方向就是技术管理;</p>
|
430
|
-
<p>技术管理要求的更综合,日常的工作涉及项目管理,跨部门沟通,团队管理,技术体系建设等方面;</p>
|
431
|
-
<p>做技术管理意味着远离一线coding,渐渐失去自己的技术优势,80%的精力是帮助团队同学成长,通过团队完成既定目标;</p>
|
432
|
-
<p>技术人要经历一个心态的转变。但企业招人过去最主要的目的是解决实际面临的技术问题,所以对于技术管理来说,技术还是一个基本面,不能完全放下,还是要时刻关注技术大方向;</p>
|
433
|
-
</Collapse>
|
434
|
-
<Collapse title={'产品&业务方向'}>
|
435
|
-
<p>还有一个职业方向是转型做产品经理更多地贴近业务;</p>
|
436
|
-
<p>我身边有越来越多的前端做了几年的研发后转型做了产品;</p>
|
437
|
-
<p>技术人转型做产品,其实是比较有优势的,一方面懂技术能更好地和研发沟通,另一方面产品设计上更容易落地;</p>
|
438
|
-
</Collapse>
|
439
|
-
</CollapseGroup>
|
440
|
-
);
|
441
|
-
};
|
442
|
-
|
443
|
-
const types = ['input', 'carousel', 'collapse'] as const;
|
444
|
-
|
445
|
-
const state = reactive({
|
446
|
-
type: types[0],
|
447
|
-
publicText: '支付方式',
|
448
|
-
initList: [] as string[],
|
449
|
-
destroyList: [] as string[],
|
450
|
-
|
451
|
-
isCache: (meta: iKeepAliveMeta) => true as boolean,
|
452
|
-
});
|
453
|
-
|
454
|
-
const onInit = (meta: iKeepAliveMeta) => state.initList.push(meta.key);
|
455
|
-
|
456
|
-
const clearCache = (key: string) => {
|
457
|
-
if (key === state.type) {
|
458
|
-
$message('不要销毁正在显示的内容');
|
459
|
-
return;
|
460
|
-
}
|
461
|
-
state.destroyList.push(key);
|
462
|
-
/*修改isCache,触发KeepAlive更新渲染*/
|
463
|
-
state.isCache = (meta: iKeepAliveMeta) => state.destroyList.indexOf(meta.key) === -1;
|
464
|
-
|
465
|
-
delay().then(() => {
|
466
|
-
/*渲染完毕之后KeepAlive已经销毁掉对应的key,此时重置destroyList,并且将initList中已经缓存的key移除,下次这个key重新初始化的时候再添加*/
|
467
|
-
state.destroyList = state.destroyList.filter(i => i !== key);
|
468
|
-
state.initList = state.initList.filter(i => i !== key);
|
469
|
-
});
|
470
|
-
};
|
471
|
-
|
472
|
-
return () => (
|
473
|
-
<DemoRow title="动态控制缓存以及销毁">
|
474
|
-
|
475
|
-
<Input v-model={state.publicText}/>
|
476
|
-
|
477
|
-
<div>
|
478
|
-
<SegmentGroup v-model={state.type} style={{ marginTop: '16px' }}>
|
479
|
-
{types.map(i => (
|
480
|
-
<Segment label={i} key={i} val={i}/>
|
481
|
-
))}
|
482
|
-
</SegmentGroup>
|
483
|
-
|
484
|
-
<div style={{ marginTop: '16px', display: 'inline-block' }}>
|
485
|
-
{state.initList.map(i => (<Tag key={i} label={`销毁${i}`} closeable onClose={() => clearCache(i)}/>))}
|
486
|
-
</div>
|
487
|
-
</div>
|
488
|
-
|
489
|
-
<div style={{ marginTop: '16px' }}>
|
490
|
-
<KeepAlive
|
491
|
-
onInit={onInit}
|
492
|
-
isCache={state.isCache}
|
493
|
-
onBeforeUnmount={() => {state.initList = [];}}
|
494
|
-
>
|
495
|
-
{{
|
496
|
-
input: () => (<DemoInput key="input" prefix={state.publicText}/>),
|
497
|
-
carousel: () => (<DemoCarousel key="carousel" coverText={state.publicText}/>),
|
498
|
-
collapse: () => (<DemoCollapse key="collapse"/>),
|
499
|
-
}[state.type]()}
|
500
|
-
</KeepAlive>
|
501
|
-
</div>
|
502
|
-
</DemoRow>
|
503
|
-
);
|
504
|
-
});
|
505
|
-
|
@@ -1,15 +0,0 @@
|
|
1
|
-
.demo-list {
|
2
|
-
.test-item {
|
3
|
-
position: relative;
|
4
|
-
height: 120px;
|
5
|
-
width: 200px;
|
6
|
-
margin-bottom: 12px;
|
7
|
-
margin-right: 12px;
|
8
|
-
border-radius: plv(border-radius);
|
9
|
-
border: solid 1px plv(border-color);
|
10
|
-
padding: 12px;
|
11
|
-
color: plv(text-1);
|
12
|
-
background-color: plv(background-lite);
|
13
|
-
display: inline-block !important;
|
14
|
-
}
|
15
|
-
}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import {designComponent, reactive} from "plain-design-composition";
|
2
|
-
import React from "react";
|
3
|
-
import './DemoList.scss';
|
4
|
-
import {shuffle} from "plain-utils/object/shuffle";
|
5
|
-
import {DemoRow} from "../../Demo/DemoRow";
|
6
|
-
import {Button, ButtonGroup, List} from "../../../../packages";
|
7
|
-
|
8
|
-
export default designComponent({
|
9
|
-
setup() {
|
10
|
-
|
11
|
-
let count = 0;
|
12
|
-
|
13
|
-
const animations = [
|
14
|
-
'elevator',
|
15
|
-
'fade',
|
16
|
-
'accordionVertical',
|
17
|
-
'accordionHorizontal',
|
18
|
-
'none',
|
19
|
-
undefined,
|
20
|
-
] as any[];
|
21
|
-
|
22
|
-
const state = reactive({
|
23
|
-
cities: [
|
24
|
-
{ id: '广州市', name: '广州市' },
|
25
|
-
{ id: '上海市', name: '上海市' },
|
26
|
-
{ id: '北京市', name: '北京市' },
|
27
|
-
{ id: '深圳市', name: '深圳市' },
|
28
|
-
{ id: '长沙市', name: '长沙市' },
|
29
|
-
{ id: '南京市', name: '南京市' },
|
30
|
-
],
|
31
|
-
animations: animations[0],
|
32
|
-
});
|
33
|
-
|
34
|
-
const handler = {
|
35
|
-
add: (index: number) => {
|
36
|
-
const item = state.cities[index];
|
37
|
-
if (!item) return;
|
38
|
-
state.cities.splice(index + 1, 0, {
|
39
|
-
id: `count_${count++}`,
|
40
|
-
name: `${item.id}_${count}`,
|
41
|
-
});
|
42
|
-
},
|
43
|
-
remove: (index: number) => {
|
44
|
-
state.cities.splice(index, 1);
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
return () => (
|
49
|
-
<div className={'demo-list'}>
|
50
|
-
<DemoRow title={'基本用法,设置动画'}>
|
51
|
-
<ButtonGroup>
|
52
|
-
<Button onClick={() => handler.add(0)}>add</Button>
|
53
|
-
<Button onClick={() => handler.remove(0)}>remove</Button>
|
54
|
-
<Button onClick={() => state.cities = shuffle(state.cities)}>shuffle</Button>
|
55
|
-
</ButtonGroup>
|
56
|
-
</DemoRow>
|
57
|
-
<DemoRow title={'动画'}>
|
58
|
-
{animations.map(ani => (
|
59
|
-
<Button label={String(ani)} active={state.animations === ani} key={String(ani)} onClick={() => state.animations = ani}/>
|
60
|
-
))}
|
61
|
-
</DemoRow>
|
62
|
-
<DemoRow>
|
63
|
-
<List enterAnimation={state.animations} leaveAnimation={state.animations}>
|
64
|
-
{state.cities.map((city, index) => (
|
65
|
-
<div className={"test-item"} key={city.name}>
|
66
|
-
<span>{city.name}</span>
|
67
|
-
<div style={{ position: 'absolute', right: '8px', bottom: '8px' }}>
|
68
|
-
<Button label={'add'} status={'success'} size={'mini'} style={{ marginRight: '8px' }}
|
69
|
-
onClick={() => handler.add(index)}
|
70
|
-
/>
|
71
|
-
<Button label={'remove'} status={'success'} size={'mini'}
|
72
|
-
onClick={() => handler.remove(index)}
|
73
|
-
/>
|
74
|
-
</div>
|
75
|
-
</div>)
|
76
|
-
)}
|
77
|
-
</List>
|
78
|
-
</DemoRow>
|
79
|
-
</div>
|
80
|
-
);
|
81
|
-
},
|
82
|
-
});
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import {designPage, getComponentCls, reactive} from "plain-design-composition";
|
2
|
-
import {DemoRow} from "../../Demo/DemoRow";
|
3
|
-
import {Button, Checkbox, Loading, LoadingMask} from "../../../../packages";
|
4
|
-
|
5
|
-
export const demo1 = designPage(() => () => (
|
6
|
-
<DemoRow title="基本用法">
|
7
|
-
<Loading/> <span>loading...</span>
|
8
|
-
</DemoRow>
|
9
|
-
));
|
10
|
-
export const demo2 = designPage(() => () => (
|
11
|
-
<DemoRow title="类型">
|
12
|
-
<Loading type="alpha"/>
|
13
|
-
<Loading type="beta"/>
|
14
|
-
<Loading type="delta"/>
|
15
|
-
<Loading type="gamma"/>
|
16
|
-
<Loading type="epsilon"/>
|
17
|
-
<Loading type="zeta"/>
|
18
|
-
<Loading type="eta"/>
|
19
|
-
<Loading type="thet"/>
|
20
|
-
<Loading type="iot"/>
|
21
|
-
<Loading type="kappa"/>
|
22
|
-
</DemoRow>
|
23
|
-
));
|
24
|
-
export const demo3 = designPage(() => () => (
|
25
|
-
<DemoRow title="控制字体大小">
|
26
|
-
<Loading type="alpha" style={{ fontSize: '32px' }}/>
|
27
|
-
<Loading type="beta" style={{ fontSize: '32px' }}/>
|
28
|
-
<Loading type="gamma" style={{ fontSize: '32px' }}/>
|
29
|
-
<Loading type="delta" style={{ fontSize: '32px' }}/>
|
30
|
-
<Loading type="epsilon" style={{ fontSize: '32px' }}/>
|
31
|
-
<Loading type="zeta" style={{ fontSize: '32px' }}/>
|
32
|
-
<Loading type="eta" style={{ fontSize: '32px' }}/>
|
33
|
-
<Loading type="thet" style={{ fontSize: '32px' }}/>
|
34
|
-
<Loading type="iot" style={{ fontSize: '32px' }}/>
|
35
|
-
<Loading type="kappa" style={{ fontSize: '32px' }}/>
|
36
|
-
</DemoRow>
|
37
|
-
));
|
38
|
-
export const demo4 = designPage(() => () => (
|
39
|
-
<DemoRow title="控制字体颜色">
|
40
|
-
<Loading type="alpha" style={{ color: '#511f9b' }}/>
|
41
|
-
<Loading type="beta" style={{ color: '#511f9b' }}/>
|
42
|
-
<Loading type="gamma" style={{ color: '#511f9b' }}/>
|
43
|
-
<Loading type="delta" style={{ color: '#511f9b' }}/>
|
44
|
-
<Loading type="epsilon" style={{ color: '#511f9b' }}/>
|
45
|
-
<Loading type="zeta" style={{ color: '#511f9b' }}/>
|
46
|
-
<Loading type="eta" style={{ color: '#511f9b' }}/>
|
47
|
-
<Loading type="thet" style={{ color: '#511f9b' }}/>
|
48
|
-
<Loading type="iot" style={{ color: '#511f9b' }}/>
|
49
|
-
<Loading type="kappa" style={{ color: '#511f9b' }}/>
|
50
|
-
</DemoRow>
|
51
|
-
));
|
52
|
-
export const demo5 = designPage(() => () => (
|
53
|
-
<DemoRow title="预定义颜色">
|
54
|
-
<Loading status="secondary"/>
|
55
|
-
<Loading status="primary"/>
|
56
|
-
<Loading status="success"/>
|
57
|
-
<Loading status="warn"/>
|
58
|
-
<Loading status="error"/>
|
59
|
-
</DemoRow>
|
60
|
-
));
|
61
|
-
export const demo6 = designPage(() => {
|
62
|
-
|
63
|
-
const state = reactive({
|
64
|
-
flag1: {
|
65
|
-
loading: true,
|
66
|
-
init: true,
|
67
|
-
},
|
68
|
-
});
|
69
|
-
|
70
|
-
return () => (
|
71
|
-
<DemoRow title={"组件调用loading-mask"}>
|
72
|
-
<Checkbox label="init content" v-model={state.flag1.init}/>
|
73
|
-
<Checkbox label="open mask" v-model={state.flag1.loading}/>
|
74
|
-
<p>如果父节点的position不为fixed、relative、absolute,loading-mask会自动将父节点的样式设置为 relative</p>
|
75
|
-
{!!state.flag1.init && (
|
76
|
-
<div style={{ height: '300px', width: '300px', backgroundColor: `var(--${getComponentCls('secondary-1')})` }}>
|
77
|
-
<Button label={'this is button'}/>
|
78
|
-
<LoadingMask v-model={state.flag1.loading} message={'loading...'}/>
|
79
|
-
</div>
|
80
|
-
)}
|
81
|
-
</DemoRow>
|
82
|
-
);
|
83
|
-
});
|