plain-design 1.0.0-beta.99 → 3.0.0
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/dist/plain-design.commonjs.min.js +2 -18
- package/dist/plain-design.commonjs.min.js.LICENSE.txt +18 -0
- package/dist/plain-design.min.css +22 -21
- package/dist/plain-design.min.js +2 -18
- package/dist/plain-design.min.js.LICENSE.txt +18 -0
- package/dist/report.html +3 -3
- package/package.json +42 -40
- package/src/packages/components/$address/createAddressService.tsx +8 -3
- package/src/packages/components/$ai/index.tsx +368 -0
- package/src/packages/components/$configuration/index.tsx +4 -2
- package/src/packages/components/$file/index.tsx +44 -1
- package/src/packages/components/$imageSelector/index.tsx +56 -0
- package/src/packages/components/$message/image.service.utils.tsx +1 -1
- package/src/packages/components/$object/createObjectService.tsx +6 -6
- package/src/packages/components/$object/object.conver.ts +3 -3
- package/src/packages/components/$object/object.service.utils.ts +2 -2
- package/src/packages/components/$ov/createOvService.ts +2 -2
- package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +6 -6
- package/src/packages/components/$previewer/index.tsx +1 -1
- package/src/packages/components/$search/SearchFooter.tsx +1 -1
- package/src/packages/components/$search/SearchList.tsx +2 -2
- package/src/packages/components/$search/SearchServicePanel.tsx +4 -4
- package/src/packages/components/$search/createSearchService.tsx +1 -1
- package/src/packages/components/$search/search-service.scss +1 -0
- package/src/packages/components/$search/search.utils.tsx +1 -1
- package/src/packages/components/$upload/upload.utils.ts +7 -6
- package/src/packages/components/Address/index.tsx +2 -2
- package/src/packages/components/AddressCascade/address-cascade.utils.ts +1 -1
- package/src/packages/components/AddressCascade/createAddressCascade.hooks.ts +1 -1
- package/src/packages/components/AddressCascade/createAddressCascade.multiple.tsx +5 -6
- package/src/packages/components/AddressCascade/createAddressCascade.single.tsx +6 -7
- package/src/packages/components/AddressCascade/index.tsx +1 -1
- package/src/packages/components/AiChatBox/ai-chat-box.scss +74 -0
- package/src/packages/components/AiChatBox/index.tsx +306 -0
- package/src/packages/components/Alert/index.tsx +1 -1
- package/src/packages/components/Application/index.tsx +1 -1
- package/src/packages/components/Application/service/createApplicationService.tsx +2 -2
- package/src/packages/components/Application/service/createApplicationServiceComponent.tsx +1 -1
- package/src/packages/components/Application/service/createApplicationServiceManager.tsx +2 -2
- package/src/packages/components/Application/service/useApplicationService.tsx +3 -3
- package/src/packages/components/Application/utils/application.utils.ts +3 -4
- package/src/packages/components/Application/utils/createServiceReadyObserver.ts +1 -1
- package/src/packages/components/ArrowStep/index.tsx +1 -1
- package/src/packages/components/ArrowStepGroup/index.tsx +2 -2
- package/src/packages/components/AutoLoadingObserver/index.tsx +3 -3
- package/src/packages/components/AutoTable/AutoTable.tsx +1 -1
- package/src/packages/components/AutoTable/auto-table.scss +25 -3
- package/src/packages/components/AutoTable/createTableOptionUser.tsx +3 -1
- package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +8 -5
- package/src/packages/components/AutoTable/filter/useTableOption.filter.search.tsx +2 -2
- package/src/packages/components/AutoTable/filter/useTableOption.filter.state.ts +12 -7
- package/src/packages/components/AutoTable/setting/useTableOption.setting.all.fitler.tsx +1 -1
- package/src/packages/components/AutoTable/setting/useTableOption.setting.cache.tsx +3 -3
- package/src/packages/components/AutoTable/setting/useTableOption.setting.config.tsx +59 -17
- package/src/packages/components/AutoTable/setting/useTableOption.setting.export.tsx +5 -30
- package/src/packages/components/AutoTable/setting/useTableOption.setting.import.tsx +3 -3
- package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.filter.tsx +388 -385
- package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.sort.tsx +15 -8
- package/src/packages/components/AutoTable/setting/useTableOption.setting.tsx +109 -109
- package/src/packages/components/AutoTable/setting/useTableOption.setting.utils.ts +2 -2
- package/src/packages/components/AutoTable/use/useTableOption.ai.tsx +640 -0
- package/src/packages/components/AutoTable/use/useTableOption.buttons.tsx +27 -17
- package/src/packages/components/AutoTable/use/useTableOption.cache.ts +2 -2
- package/src/packages/components/AutoTable/use/useTableOption.check.tsx +3 -3
- package/src/packages/components/AutoTable/use/useTableOption.column.popper.tsx +5 -5
- package/src/packages/components/AutoTable/use/useTableOption.confirm.tsx +2 -2
- package/src/packages/components/AutoTable/use/useTableOption.fill.tsx +8 -8
- package/src/packages/components/AutoTable/use/useTableOption.hooks.tsx +6 -4
- package/src/packages/components/AutoTable/use/useTableOption.loading.tsx +3 -3
- package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +7 -4
- package/src/packages/components/AutoTable/use/useTableOption.pagination.tsx +3 -3
- package/src/packages/components/AutoTable/use/useTableOption.parent.tsx +5 -2
- package/src/packages/components/AutoTable/use/useTableOption.permission.tsx +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.sort.ts +8 -7
- package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -1
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +7 -5
- package/src/packages/components/AutoTable/use/useTableOption.tips.tsx +3 -3
- package/src/packages/components/AutoTable/use/useTableOptionKeyboard.tsx +13 -4
- package/src/packages/components/AutoTable/utils/AutoModule.ts +1 -1
- package/src/packages/components/AutoTable/utils/AutoTable.utils.ts +76 -1
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +10 -6
- package/src/packages/components/AutoTable/utils/TableOption.url.ts +1 -1
- package/src/packages/components/AutoTable/utils/TableOption.utils.tsx +3 -3
- package/src/packages/components/AutoTable/utils/buildPlainDefaultUrlConfig.ts +6 -6
- package/src/packages/components/AutoWidthInput/index.tsx +2 -2
- package/src/packages/components/Badge/badge.scss +4 -0
- package/src/packages/components/Badge/index.tsx +1 -1
- package/src/packages/components/Box/index.tsx +31 -30
- package/src/packages/components/Button/index.tsx +11 -4
- package/src/packages/components/ButtonGroup/index.tsx +2 -2
- package/src/packages/components/Card/index.tsx +2 -2
- package/src/packages/components/Carousel/index.tsx +8 -8
- package/src/packages/components/CarouselItem/index.tsx +3 -3
- package/src/packages/components/Cascade/CascadeKeys.tsx +158 -0
- package/src/packages/components/Cascade/cascade.utils.ts +1 -1
- package/src/packages/components/Cascade/createCascadeHooks.ts +1 -1
- package/src/packages/components/Cascade/createCascadePopper.tsx +5 -4
- package/src/packages/components/Cascade/createCascadeUtils.ts +2 -2
- package/src/packages/components/Cascade/createMultipleCascadeRender.tsx +5 -6
- package/src/packages/components/Cascade/createSingleCascadeRender.tsx +7 -7
- package/src/packages/components/Cascade/index.tsx +3 -3
- package/src/packages/components/CascadeKeys/index.tsx +5 -0
- package/src/packages/components/CascadePanel/cascade-panel.utils.ts +3 -3
- package/src/packages/components/CascadePanel/flat/CascadeFlatPanelNode.tsx +1 -1
- package/src/packages/components/CascadePanel/flat/createCascadeFlatRender.tsx +14 -9
- package/src/packages/components/CascadePanel/index.tsx +22 -4
- package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +1 -1
- package/src/packages/components/CascadePanel/list/CascadeListPanelNode.tsx +1 -1
- package/src/packages/components/CascadePanel/list/createCascadeListRender.tsx +6 -2
- package/src/packages/components/Checkbox/index.tsx +8 -10
- package/src/packages/components/CheckboxGroup/index.tsx +1 -1
- package/src/packages/components/CheckboxInner/index.tsx +1 -1
- package/src/packages/components/Collapse/index.tsx +2 -2
- package/src/packages/components/CollapseGroup/index.tsx +1 -1
- package/src/packages/components/CollapseTransition/index.tsx +5 -5
- package/src/packages/components/ColorPicker/ColorPanel.tsx +146 -125
- package/src/packages/components/ColorPicker/color-panel.scss +117 -97
- package/src/packages/components/ColorPicker/index.tsx +144 -131
- package/src/packages/components/ColorPicker/sub/ColorAlphaSlider.tsx +1 -1
- package/src/packages/components/ColorPicker/sub/ColorHueSlider.tsx +1 -1
- package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +5 -5
- package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +4 -4
- package/src/packages/components/ColorPicker/useColorPanelEditor.tsx +1 -1
- package/src/packages/components/ColorPicker/useColorPanelHistory.tsx +1 -1
- package/src/packages/components/ColorPicker/utils/color-picker.utils.tsx +1 -1
- package/src/packages/components/ConfirmPopup/index.tsx +1 -1
- package/src/packages/components/Corner/index.tsx +3 -3
- package/src/packages/components/DatePicker/createDateRender.multiple.tsx +7 -7
- package/src/packages/components/DatePicker/createDateRender.single.tsx +8 -7
- package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +3 -3
- package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +3 -3
- package/src/packages/components/DatePicker/date.utils.tsx +2 -2
- package/src/packages/components/DatePicker/index.tsx +3 -1
- package/src/packages/components/DatePicker/panel/DatePanel.tsx +1 -1
- package/src/packages/components/DatePicker/panel/DatePanelDate.tsx +2 -2
- package/src/packages/components/DatePicker/panel/DatePanelMonth.tsx +1 -1
- package/src/packages/components/DatePicker/panel/DatePanelQuarter.tsx +1 -1
- package/src/packages/components/DatePicker/panel/DatePanelRange.tsx +1 -1
- package/src/packages/components/DatePicker/panel/DatePanelWeek.tsx +1 -1
- package/src/packages/components/DatePicker/panel/DatePanelYear.tsx +1 -1
- package/src/packages/components/DatePicker/panel/useDatePanel.tsx +2 -2
- package/src/packages/components/DatePicker/panel/useDateWeek.tsx +2 -2
- package/src/packages/components/DatePicker/useRangeDateRender.tsx +8 -8
- package/src/packages/components/Dialog/index.tsx +11 -7
- package/src/packages/components/Dialog/useDialogMovable.tsx +1 -1
- package/src/packages/components/Dialog/utils/dialog.utils.ts +1 -1
- package/src/packages/components/Dropdown/dropdown.utils.tsx +2 -3
- package/src/packages/components/Dropdown/index.tsx +18 -5
- package/src/packages/components/DropdownGroup/index.tsx +1 -1
- package/src/packages/components/DropdownOption/index.tsx +2 -2
- package/src/packages/components/DropdownSeparator/index.tsx +1 -1
- package/src/packages/components/Empty/index.tsx +1 -1
- package/src/packages/components/FilterFormMultiple/index.tsx +12 -7
- package/src/packages/components/FilterFormSingle/index.tsx +178 -173
- package/src/packages/components/FilterService/filter/filter.city.tsx +4 -3
- package/src/packages/components/FilterService/filter/filter.district.tsx +4 -3
- package/src/packages/components/FilterService/filter/filter.number.tsx +2 -2
- package/src/packages/components/FilterService/filter/filter.province.tsx +1 -1
- package/src/packages/components/FilterService/filter/filter.select.tsx +3 -2
- package/src/packages/components/FilterService/filter/fitler.object.tsx +1 -1
- package/src/packages/components/FilterService/index.tsx +2 -2
- package/src/packages/components/FilterService/utils/filter.service.utils.ts +2 -2
- package/src/packages/components/FilterService/utils/mergeQueryParam.ts +3 -3
- package/src/packages/components/Form/form.scss +4 -0
- package/src/packages/components/Form/index.tsx +1 -1
- package/src/packages/components/Form/layout/useFormLayout.tsx +6 -5
- package/src/packages/components/Form/types/any.tsx +1 -1
- package/src/packages/components/Form/types/array.tsx +1 -1
- package/src/packages/components/Form/types/date.tsx +1 -1
- package/src/packages/components/Form/types/number.tsx +1 -1
- package/src/packages/components/Form/types/string.tsx +1 -1
- package/src/packages/components/Form/validate/createValidation.tsx +2 -2
- package/src/packages/components/Form/validate/useFormItemValidation.tsx +32 -31
- package/src/packages/components/Form/validate/useFormValidation.tsx +2 -2
- package/src/packages/components/Form/validate/validate.utils.tsx +4 -4
- package/src/packages/components/FormItem/FormItemValidateMessage.tsx +1 -1
- package/src/packages/components/FormItem/createFormEditor.tsx +2 -2
- package/src/packages/components/FormItem/index.tsx +8 -1
- package/src/packages/components/Grid/GridCol.tsx +1 -1
- package/src/packages/components/Grid/GridRow.tsx +3 -3
- package/src/packages/components/Icon/icon.external.tsx +117 -0
- package/src/packages/components/Icon/icon.registry.tsx +2 -2
- package/src/packages/components/Icon/index.tsx +13 -7
- package/src/packages/components/IconPicker/DefaultIcons.ts +7 -0
- package/src/packages/components/IconPicker/icon-picker.scss +43 -0
- package/src/packages/components/IconPicker/index.tsx +189 -0
- package/src/packages/components/Illustration/index.tsx +1 -1
- package/src/packages/components/Image/image.scss +9 -1
- package/src/packages/components/Image/index.tsx +15 -7
- package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +6 -6
- package/src/packages/components/ImagePreviewer/ImagePreviewerButtonBar.tsx +1 -1
- package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +2 -2
- package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +3 -3
- package/src/packages/components/ImagePreviewer/PreviewerLoading.tsx +1 -1
- package/src/packages/components/ImagePreviewer/image-previewer.utils.tsx +4 -4
- package/src/packages/components/ImageSelector/image-selector.scss +70 -0
- package/src/packages/components/ImageSelector/index.tsx +59 -0
- package/src/packages/components/ImageUploader/index.tsx +32 -16
- package/src/packages/components/Input/index.scss +14 -2
- package/src/packages/components/Input/index.tsx +3 -3
- package/src/packages/components/Input/input.utils.ts +1 -1
- package/src/packages/components/Input/useMultipleInput.tsx +11 -10
- package/src/packages/components/Input/useSingleInput.tsx +2 -2
- package/src/packages/components/Input/useSuggestionInput.tsx +9 -9
- package/src/packages/components/Input/useTextareaInput.tsx +6 -6
- package/src/packages/components/Input/uses/useInputEnterHandler.tsx +24 -13
- package/src/packages/components/Input/uses/useInputHooks.tsx +1 -1
- package/src/packages/components/Input/uses/useInputMaxLength.tsx +1 -1
- package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +2 -2
- package/src/packages/components/InputGroup/index.tsx +1 -1
- package/src/packages/components/InputGroup/input-group.scss +9 -0
- package/src/packages/components/InputNumber/NumberResize.tsx +4 -4
- package/src/packages/components/InputNumber/index.tsx +1 -1
- package/src/packages/components/InputNumber/input-number.utils.tsx +1 -1
- package/src/packages/components/InputNumber/number.scss +3 -0
- package/src/packages/components/InputNumber/number.utils.ts +1 -1
- package/src/packages/components/InputNumber/useInputNumber.multiple.tsx +2 -2
- package/src/packages/components/InputNumber/useInputNumber.public.tsx +12 -11
- package/src/packages/components/InputNumber/useInputNumber.single.tsx +2 -2
- package/src/packages/components/Layout/index.tsx +9 -2
- package/src/packages/components/Layout/layout.scss +20 -0
- package/src/packages/components/Layout/layout.utils.ts +1 -1
- package/src/packages/components/LayoutSection/index.tsx +12 -3
- package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +2 -2
- package/src/packages/components/List/index.tsx +1 -1
- package/src/packages/components/ListOption/index.tsx +20 -0
- package/src/packages/components/ListPanel/index.tsx +30 -0
- package/src/packages/components/ListPanel/list-panel.scss +20 -0
- package/src/packages/components/Loading/index.tsx +2 -2
- package/src/packages/components/LoadingMask/index.tsx +2 -2
- package/src/packages/components/NumberRange/index.tsx +94 -93
- package/src/packages/components/Object/createObjectHooks.tsx +1 -1
- package/src/packages/components/Object/createObjectRender.multiple.tsx +10 -10
- package/src/packages/components/Object/createObjectRender.single.tsx +18 -14
- package/src/packages/components/Object/index.tsx +3 -3
- package/src/packages/components/Object/object.utils.ts +5 -3
- package/src/packages/components/Ov/index.tsx +1 -1
- package/src/packages/components/Ov/ov.utils.ts +1 -1
- package/src/packages/components/Ov/usePublicOv.tsx +1 -1
- package/src/packages/components/PageCard/index.tsx +4 -1
- package/src/packages/components/PageCardContent/index.tsx +4 -1
- package/src/packages/components/PageCardTitle/index.tsx +1 -1
- package/src/packages/components/PageRenderList/index.tsx +1 -1
- package/src/packages/components/PageThemeUtils/index.tsx +3 -3
- package/src/packages/components/Pagination/index.tsx +3 -3
- package/src/packages/components/Paragraph/index.tsx +1 -1
- package/src/packages/components/ParagraphItem/index.tsx +1 -1
- package/src/packages/components/PlcImage/index.tsx +6 -6
- package/src/packages/components/PlcObject/index.tsx +2 -2
- package/src/packages/components/PlcOv/index.tsx +1 -1
- package/src/packages/components/Popup/PopupProvider.tsx +1 -2
- package/src/packages/components/Popup/index.tsx +2 -2
- package/src/packages/components/ProgressBar/index.tsx +1 -1
- package/src/packages/components/ProgressBar/progress.utils.ts +2 -2
- package/src/packages/components/ProgressCircle/index.tsx +2 -2
- package/src/packages/components/ProgressMini/index.tsx +2 -2
- package/src/packages/components/Radio/index.tsx +4 -4
- package/src/packages/components/RadioGroup/index.tsx +1 -1
- package/src/packages/components/RadioInner/index.tsx +1 -1
- package/src/packages/components/Rate/index.tsx +3 -3
- package/src/packages/components/Reference/ReferenceProvider.tsx +1 -1
- package/src/packages/components/Reference/index.tsx +1 -1
- package/src/packages/components/RollingNumber/index.tsx +2 -2
- package/src/packages/components/Scroll/HorizontalScrollbar.tsx +4 -4
- package/src/packages/components/Scroll/VerticalScrollbar.tsx +4 -4
- package/src/packages/components/Scroll/index.tsx +6 -5
- package/src/packages/components/Scroll/useAutoScroll.ts +1 -1
- package/src/packages/components/Segment/index.tsx +1 -1
- package/src/packages/components/SegmentGroup/index.tsx +1 -1
- package/src/packages/components/Select/SelectPanel.tsx +1 -1
- package/src/packages/components/Select/createMultipleSelectRender.tsx +12 -8
- package/src/packages/components/Select/createPublicSelectRender.tsx +18 -12
- package/src/packages/components/Select/createSelectOptionDecoder.tsx +1 -1
- package/src/packages/components/Select/createSingleSelectRender.tsx +13 -9
- package/src/packages/components/Select/decodeSelectRenderNode.tsx +6 -4
- package/src/packages/components/Select/index.tsx +13 -1
- package/src/packages/components/Select/select.utils.tsx +5 -4
- package/src/packages/components/SelectDisplay/index.tsx +3 -3
- package/src/packages/components/SelectGroup/index.tsx +1 -1
- package/src/packages/components/SelectOption/index.tsx +2 -2
- package/src/packages/components/Skeleton/index.tsx +44 -0
- package/src/packages/components/Skeleton/skeleton.scss +27 -0
- package/src/packages/components/Slider/index.tsx +3 -3
- package/src/packages/components/Slider/slider.utils.tsx +1 -1
- package/src/packages/components/Slider/useSlider.range.tsx +13 -10
- package/src/packages/components/Slider/useSlider.single.tsx +8 -9
- package/src/packages/components/Slider/useSliderDotDragier.tsx +4 -4
- package/src/packages/components/SortList/index.tsx +4 -4
- package/src/packages/components/Space/index.tsx +1 -1
- package/src/packages/components/StackCard/index.tsx +4 -4
- package/src/packages/components/StackCardItem/index.tsx +1 -1
- package/src/packages/components/Step/index.tsx +1 -1
- package/src/packages/components/StepGroup/index.tsx +1 -1
- package/src/packages/components/Tab/index.tsx +1 -1
- package/src/packages/components/TabGroup/TabsHeader.tsx +1 -1
- package/src/packages/components/TabGroup/TabsInner.tsx +1 -1
- package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontal.tsx +3 -3
- package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalCard.tsx +1 -1
- package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalShadow.tsx +1 -1
- package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalText.tsx +2 -2
- package/src/packages/components/TabGroup/header/vertical/TabsHeaderVertical.tsx +1 -1
- package/src/packages/components/TabGroup/index.tsx +1 -1
- package/src/packages/components/TabGroup/tabs.utils.tsx +1 -1
- package/src/packages/components/Table/editor/PlcAddress.tsx +1 -1
- package/src/packages/components/Table/editor/PlcAddressItem.tsx +1 -1
- package/src/packages/components/Table/editor/PlcCheckbox.tsx +1 -1
- package/src/packages/components/Table/editor/PlcColorPicker.tsx +1 -1
- package/src/packages/components/Table/editor/PlcDate.tsx +1 -1
- package/src/packages/components/Table/editor/PlcDate.utils.tsx +2 -2
- package/src/packages/components/Table/editor/PlcDateRange.tsx +1 -1
- package/src/packages/components/Table/editor/PlcInput.tsx +1 -1
- package/src/packages/components/Table/editor/PlcNumber.tsx +1 -1
- package/src/packages/components/Table/editor/PlcRate.tsx +1 -1
- package/src/packages/components/Table/editor/PlcSelect.tsx +2 -1
- package/src/packages/components/Table/editor/PlcTextarea.tsx +1 -1
- package/src/packages/components/Table/editor/PlcTime.tsx +1 -1
- package/src/packages/components/Table/editor/PlcTime.utils.ts +2 -2
- package/src/packages/components/Table/editor/PlcTimeRange.tsx +1 -1
- package/src/packages/components/Table/editor/PlcToggle.tsx +1 -1
- package/src/packages/components/Table/plc/group/PlcGroup.tsx +1 -1
- package/src/packages/components/Table/plc/plc/Plc.tsx +1 -1
- package/src/packages/components/Table/plc/process/copyPlcList.ts +1 -1
- package/src/packages/components/Table/plc/process/processPlcFixed.ts +1 -1
- package/src/packages/components/Table/plc/process/processPlcSort.ts +1 -1
- package/src/packages/components/Table/plc/use/useBasePlc.tsx +3 -3
- package/src/packages/components/Table/plc/use/useBasePlcGroup.tsx +1 -1
- package/src/packages/components/Table/plc/use/usePlc.tsx +1 -1
- package/src/packages/components/Table/plc/use/usePlcPropsState.tsx +2 -2
- package/src/packages/components/Table/plc/use/useTableAutoSpan.tsx +112 -0
- package/src/packages/components/Table/plc/useTablePlc.tsx +7 -4
- package/src/packages/components/Table/plc/utils/plc.render.ts +1 -1
- package/src/packages/components/Table/plc/utils/plc.scope-slots.ts +1 -1
- package/src/packages/components/Table/plc/utils/plc.utils.ts +9 -6
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.hooks.tsx +3 -3
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.multiple.tsx +7 -8
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.single.tsx +4 -5
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.tsx +2 -2
- package/src/packages/components/Table/standard/PlcCheck/PlcCheck.utils.ts +3 -3
- package/src/packages/components/Table/standard/PlcDraggier/PlcDraggier.tsx +2 -2
- package/src/packages/components/Table/standard/PlcExclusion.tsx +2 -2
- package/src/packages/components/Table/standard/PlcExpand.tsx +2 -2
- package/src/packages/components/Table/standard/PlcIndex.tsx +1 -1
- package/src/packages/components/Table/standard/PlcOperation/OuterOperation.tsx +3 -2
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +12 -6
- package/src/packages/components/Table/standard/PlcOperation/PlcOperation.utils.tsx +4 -4
- package/src/packages/components/Table/standard/PlcOperation/useOperationPermission.ts +1 -1
- package/src/packages/components/Table/standard/PlcTree/PlcTree.autoWidth.tsx +1 -1
- package/src/packages/components/Table/standard/PlcTree/PlcTree.renderNode.tsx +2 -2
- package/src/packages/components/Table/standard/PlcTree/PlcTree.tsx +4 -4
- package/src/packages/components/Table/standard/PlcTree/PlcTree.utils.ts +2 -2
- package/src/packages/components/Table/standard/PlcTree/PlcTreeHeader.tsx +3 -3
- package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +6 -5
- package/src/packages/components/Table/table/Table.tsx +14 -10
- package/src/packages/components/Table/table/body/cell.tsx +36 -5
- package/src/packages/components/Table/table/body/row.tsx +1 -1
- package/src/packages/components/Table/table/body/useCellValue.tsx +15 -6
- package/src/packages/components/Table/table/head/head-cell.tsx +8 -2
- package/src/packages/components/Table/table/head/useHeadCellResize.ts +4 -4
- package/src/packages/components/Table/table/node/useTableNode.tsx +2 -2
- package/src/packages/components/Table/table/table.scss +4 -0
- package/src/packages/components/Table/table/use/useFixedShadow.ts +2 -2
- package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +6 -6
- package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +7 -7
- package/src/packages/components/Table/table/use/useTableDraggier.tsx +3 -3
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +47 -39
- package/src/packages/components/Table/table/use/useTableLoading.tsx +2 -2
- package/src/packages/components/Table/table/use/useTableMethods.tsx +2 -2
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +12 -6
- package/src/packages/components/Table/table/use/useTableScroll.tsx +1 -1
- package/src/packages/components/Table/table/utils/createTableHooks.ts +7 -5
- package/src/packages/components/Table/table/utils/table.utils.ts +7 -5
- package/src/packages/components/Tag/index.tsx +8 -3
- package/src/packages/components/Tag/tag.scss +10 -1
- package/src/packages/components/ThemeColor/index.tsx +1 -1
- package/src/packages/components/ThemeColorSelector/index.tsx +1 -1
- package/src/packages/components/ThemeDarkSelector/index.tsx +1 -2
- package/src/packages/components/ThemeEditor/index.tsx +3 -3
- package/src/packages/components/ThemeLocaleSelector/index.tsx +1 -2
- package/src/packages/components/ThemeShapeSelector/index.tsx +1 -2
- package/src/packages/components/ThemeSizeSelector/index.tsx +1 -2
- package/src/packages/components/TimePicker/createRangeTimeRender.tsx +3 -3
- package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +3 -3
- package/src/packages/components/TimePicker/createSingleTimeRender.tsx +7 -8
- package/src/packages/components/TimePicker/index.tsx +1 -1
- package/src/packages/components/TimePicker/panel/TimeBaseColumn.tsx +4 -4
- package/src/packages/components/TimePicker/panel/TimeBasePanel.tsx +1 -1
- package/src/packages/components/TimePicker/panel/TimePanel.tsx +2 -2
- package/src/packages/components/TimePicker/panel/TimeRangePanel.tsx +1 -1
- package/src/packages/components/TimePicker/panel/time-panel.utils.ts +1 -1
- package/src/packages/components/TimePicker/time.utils.ts +1 -1
- package/src/packages/components/TimePicker/useRangeTimeRender.tsx +9 -9
- package/src/packages/components/TimePicker/useTimeHooks.ts +1 -1
- package/src/packages/components/Toggle/index.tsx +4 -4
- package/src/packages/components/Tooltip/index.tsx +2 -2
- package/src/packages/components/Transition/index.tsx +2 -2
- package/src/packages/components/Tree/RenderTreeNode.tsx +4 -3
- package/src/packages/components/Tree/index.tsx +2 -2
- package/src/packages/components/TreeCore/TreeCore.type.tsx +3 -1
- package/src/packages/components/TreeCore/createTreeCore.tsx +3 -3
- package/src/packages/components/TreeCore/createTreeDraggier.tsx +9 -9
- package/src/packages/components/TreeCore/createTreeHooks.ts +1 -1
- package/src/packages/components/TreeCore/createTreeMethods.tsx +2 -2
- package/src/packages/components/TreeCore/createTreeNode.tsx +11 -6
- package/src/packages/components/TreeCore/createTreeProps.ts +4 -3
- package/src/packages/components/TreeCore/createTreeUtils.ts +2 -2
- package/src/packages/components/TreeNodeWithMenu/index.tsx +5 -1
- package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +1 -1
- package/src/packages/components/Triangle/index.tsx +2 -2
- package/src/packages/components/Upload/index.tsx +6 -6
- package/src/packages/components/VirtualList/createVirtualDraggier.ts +7 -7
- package/src/packages/components/VirtualList/index.tsx +1 -1
- package/src/packages/components/VirtualList/useVirtualList.tsx +11 -11
- package/src/packages/components/VirtualTable/index.tsx +10 -4
- package/src/packages/components/VirtualTable/virtual-table.scss +3 -3
- package/src/packages/components/createPlainAddressService/index.tsx +2 -2
- package/src/packages/components/createRequestInterceptor/index.ts +2 -2
- package/src/packages/components/createScrollDraggier/index.ts +5 -5
- package/src/packages/components/createScrollUtils/index.tsx +1 -1
- package/src/packages/components/createSimpleDate/index.ts +49 -0
- package/src/packages/components/createTransitionHandler/index.ts +1 -1
- package/src/packages/components/useAutoScrollUtils/index.tsx +4 -4
- package/src/packages/components/useContextmenuOptions/index.tsx +40 -0
- package/src/packages/components/useDialog/DialogService.tsx +9 -9
- package/src/packages/components/useDialog/dialog.service.utils.tsx +5 -5
- package/src/packages/components/useDialog/index.tsx +4 -4
- package/src/packages/components/useImage/ImageService.tsx +5 -5
- package/src/packages/components/useLoading/LoadingService.tsx +3 -3
- package/src/packages/components/useLoading/index.tsx +1 -1
- package/src/packages/components/useLoading/loading.service.utils.tsx +2 -2
- package/src/packages/components/useMessage/Message.tsx +1 -1
- package/src/packages/components/useMessage/MessageContainer.tsx +1 -1
- package/src/packages/components/useMessage/MessageManager.tsx +1 -1
- package/src/packages/components/useMessage/index.tsx +1 -1
- package/src/packages/components/useMessage/message.service.utils.tsx +4 -4
- package/src/packages/components/useNotice/Notice.tsx +1 -1
- package/src/packages/components/useNotice/NoticeContainer.tsx +1 -1
- package/src/packages/components/useNotice/NoticeManager.tsx +1 -1
- package/src/packages/components/useNotice/index.tsx +1 -1
- package/src/packages/components/useNotice/noitice.service.utils.tsx +4 -4
- package/src/packages/components/usePageRenderContext/index.tsx +1 -1
- package/src/packages/components/usePopup/PopupItem.tsx +17 -10
- package/src/packages/components/usePopup/refresh/refreshArrow.ts +1 -1
- package/src/packages/components/usePopup/trigger/useManagerTrigger.clickOutside.tsx +19 -24
- package/src/packages/components/usePopup/trigger/usePopupTrigger.tsx +2 -2
- package/src/packages/components/usePopup/trigger/useReferenceTrigger.tsx +52 -46
- package/src/packages/components/usePopup/usePopup.tsx +2 -2
- package/src/packages/components/usePopup/usePopupManager.tsx +14 -3
- package/src/packages/components/usePopup/utils/createPopupManagerHooks.tsx +1 -1
- package/src/packages/components/usePopup/utils/ids2map.ts +1 -1
- package/src/packages/components/usePopup/utils/popup.utils.ts +3 -4
- package/src/packages/components/usePopupEditor/index.tsx +6 -9
- package/src/packages/components/usePopupEditor/popup-editor.utils.ts +1 -1
- package/src/packages/components/useTableFilter/index.ts +73 -0
- package/src/packages/components/useTooltip/index.tsx +6 -7
- package/src/packages/directives/ClickWave/index.tsx +2 -2
- package/src/packages/directives/ResizeDetector/index.tsx +2 -2
- package/src/packages/entry.tsx +326 -287
- package/src/packages/i18n/i18n.utils.ts +5 -5
- package/src/packages/i18n/lang/en-us.ts +37 -14
- package/src/packages/i18n/lang/zh-cn.ts +24 -1
- package/src/packages/styles/application/application.public.scss +7 -0
- package/src/packages/styles/global.import.scss +60 -15
- package/src/packages/uses/createInputPopperAttrs.ts +10 -3
- package/src/packages/uses/useCollapseStyles.tsx +2 -2
- package/src/packages/uses/useDragHorizontalScroll.ts +4 -5
- package/src/packages/uses/useEdit.ts +42 -15
- package/src/packages/uses/useFocusHandler.ts +26 -13
- package/src/packages/uses/useFunctionWrapper.ts +3 -1
- package/src/packages/uses/useMultipleModel.tsx +6 -4
- package/src/packages/uses/useRenderReference.tsx +1 -1
- package/src/packages/uses/useStyle.tsx +4 -4
- package/src/packages/utils/ClientZoom.ts +1 -1
- package/src/packages/utils/FixInput.ts +1 -1
- package/src/packages/utils/InnerTransition.ts +2 -2
- package/src/packages/utils/LoadingText.ts +1 -1
- package/src/packages/utils/OpenController.ts +1 -1
- package/src/packages/utils/constant.tsx +1 -1
- package/src/packages/utils/createDraggier.ts +7 -7
- package/src/packages/utils/createFlagManager.ts +1 -1
- package/src/packages/utils/findReactElement.tsx +1 -1
- package/src/packages/utils/getDeviceInfo.ts +1 -1
- package/src/packages/utils/getRowEl.ts +2 -2
- package/src/packages/utils/incrementalMerge.ts +1 -1
- package/src/packages/utils/inheritSlots.ts +3 -1
- package/src/packages/utils/installAllIcons.ts +20 -19
- package/src/packages/utils/installAllLazyIcons.ts +1 -1
- package/src/packages/utils/isObjectCommonMatch.ts +1 -1
- package/src/packages/utils/onParentElementsScroll.tsx +2 -2
- package/src/packages/utils/plainDate.ts +1 -1
- package/src/packages/utils/useMove.tsx +3 -3
- package/src/packages/utils/watchEffectAutoClear.ts +2 -2
- package/src/packages/components/KeyboardService/index.ts +0 -214
- package/src/packages/components/ThemeDarkSelector/theme-dark-selector.scss +0 -5
- package/src/packages/components/ThemeLocaleSelector/theme-locale-selector.scss +0 -5
- package/src/packages/components/ThemeShapeSelector/theme-shape-selector.scss +0 -5
- package/src/packages/components/ThemeSizeSelector/theme-size-selector.scss +0 -5
- package/src/packages/components/createProvider/index.ts +0 -5
- package/src/packages/utils/createProvider.tsx +0 -35
@@ -1,8 +1,8 @@
|
|
1
1
|
import {eFormValidateMode, eFormValidateTrigger, getRuleValue, iFormItemValidatePropsType, isRuleRequired, iValidateRule} from "./validate.utils";
|
2
|
-
import {
|
2
|
+
import {createEffectsOfReaction, globalWatch, inject, onBeforeUnmount} from "@peryl/react-compose";
|
3
3
|
import {FORM_VALIDATION_PROVIDER, useFormValidation} from "./useFormValidation";
|
4
4
|
import {Validation} from "./createValidation";
|
5
|
-
import {createEffects} from "
|
5
|
+
import {createEffects, iEffects} from "@peryl/utils/createEffects";
|
6
6
|
|
7
7
|
/**
|
8
8
|
* 抽离FormItem中的校验逻辑
|
@@ -11,6 +11,8 @@ import {createEffects} from "plain-utils/utils/createEffects";
|
|
11
11
|
*/
|
12
12
|
export function useFormItemValidation({ props }: { props: iFormItemValidatePropsType }) {
|
13
13
|
|
14
|
+
const { effects, effectComputed, effectWatchEffect } = createEffectsOfReaction();
|
15
|
+
|
14
16
|
/*Form校验*/
|
15
17
|
const formValidation = inject<ReturnType<typeof useFormValidation>>(FORM_VALIDATION_PROVIDER)!;
|
16
18
|
|
@@ -22,14 +24,14 @@ export function useFormItemValidation({ props }: { props: iFormItemValidateProps
|
|
22
24
|
* @author 韦胜健
|
23
25
|
* @date 2022.11.5 23:39
|
24
26
|
*/
|
25
|
-
const isRequired =
|
27
|
+
const isRequired = effectComputed(() => childValidation.getRules().some(rule => isRuleRequired(rule, formValidation.props.modelValue)));
|
26
28
|
|
27
29
|
/**
|
28
30
|
* 当前的校验不通过的信息
|
29
31
|
* @author 韦胜健
|
30
32
|
* @date 2022/8/22 23:48
|
31
33
|
*/
|
32
|
-
const validateMessage =
|
34
|
+
const validateMessage = effectComputed((): string | null => {
|
33
35
|
if (!props.field && !props.validateValueGetter && !props.rules) {
|
34
36
|
return null;
|
35
37
|
}
|
@@ -53,14 +55,17 @@ export function useFormItemValidation({ props }: { props: iFormItemValidateProps
|
|
53
55
|
* @author 韦胜健
|
54
56
|
* @date 2022.11.6 0:00
|
55
57
|
*/
|
56
|
-
const
|
58
|
+
const getValueByRule = (rule: iValidateRule): { label?: string | null, field?: string } | null => {
|
57
59
|
if (formValidation.props.validateMode === eFormValidateMode.table) {return null;}
|
58
|
-
const { field, label, valueGetter } = rule;
|
60
|
+
// const { field, label, valueGetter } = rule;
|
61
|
+
const { field, label } = rule;
|
59
62
|
if (!rule.field && !rule.valueGetter) {return null;}
|
60
63
|
return {
|
61
64
|
label,
|
62
65
|
field,
|
63
|
-
|
66
|
+
/*这里不能调用valueGetter,这样会导致值变化也会触发教研,设计是触发onChange才触发校验而不是值变化就触发*/
|
67
|
+
/*这里调用valueGetter的话,会导致触发watch,进而触发onFieldChange*/
|
68
|
+
// value: getRuleValue({ formData: formValidation.props.modelValue, field, validateValueGetter: valueGetter, formItemProps: props }),
|
64
69
|
};
|
65
70
|
};
|
66
71
|
|
@@ -69,12 +74,9 @@ export function useFormItemValidation({ props }: { props: iFormItemValidateProps
|
|
69
74
|
* @author 韦胜健
|
70
75
|
* @date 2022.11.6 0:58
|
71
76
|
*/
|
72
|
-
const watchRuleValueChange = (
|
73
|
-
|
74
|
-
() =>
|
75
|
-
const rule = getRule();
|
76
|
-
return !rule || rule.trigger === eFormValidateTrigger.blur ? null : getWatchData(rule);
|
77
|
-
},
|
77
|
+
const watchRuleValueChange = (rule: iValidateRule, effects: iEffects) => {
|
78
|
+
effects.push(globalWatch(
|
79
|
+
() => rule.trigger === eFormValidateTrigger.blur ? null : getValueByRule(rule),
|
78
80
|
(newValue, oldValue) => {
|
79
81
|
/*校验规则已经消失*/
|
80
82
|
if (!newValue || (!newValue.field && !newValue.label)) {
|
@@ -89,33 +91,32 @@ export function useFormItemValidation({ props }: { props: iFormItemValidateProps
|
|
89
91
|
return;
|
90
92
|
}
|
91
93
|
/*值没有变化*/
|
92
|
-
if (newValue.value == oldValue.value) {
|
94
|
+
/*if (newValue.value == oldValue.value) {
|
93
95
|
return;
|
94
|
-
}
|
96
|
+
}*/
|
95
97
|
formValidation.handler.onFieldChange({ label: newValue.label, field: newValue.field });
|
96
98
|
}
|
97
|
-
);
|
98
|
-
return () => unwatch();
|
99
|
+
));
|
99
100
|
};
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
const { effects: innerEffects } = createEffects();
|
103
|
+
effects.push(() => innerEffects.clear());
|
104
|
+
|
105
|
+
effectWatchEffect(() => {
|
106
|
+
innerEffects.clear();
|
104
107
|
[
|
108
|
+
childValidation.formItemRules.outerRule.value,
|
105
109
|
/*监听props.rules的值变化然后触发校验*/
|
106
|
-
childValidation.formItemRules.formRules,
|
110
|
+
...childValidation.formItemRules.formRules.value || [],
|
107
111
|
/*监听form.rules的值变化然后触发校验*/
|
108
|
-
childValidation.formItemRules.propsRules
|
109
|
-
].forEach(
|
110
|
-
/*当rule变化时,将上一次的watch
|
111
|
-
|
112
|
-
watchEffect(() => {
|
113
|
-
effects.clear();
|
114
|
-
item.value?.forEach(rule => {effects.push(watchRuleValueChange(() => rule));});
|
115
|
-
});
|
116
|
-
onBeforeUnmount(() => effects.clear());
|
112
|
+
...childValidation.formItemRules.propsRules.value || []
|
113
|
+
].forEach(rule => {
|
114
|
+
/*当rule变化时,将上一次的watch注销,这里重新watch*/
|
115
|
+
!!rule && watchRuleValueChange(rule, innerEffects);
|
117
116
|
});
|
118
|
-
})
|
117
|
+
});
|
118
|
+
|
119
|
+
onBeforeUnmount(effects.clear);
|
119
120
|
|
120
121
|
return { formValidation, childValidation, isRequired, validateMessage };
|
121
122
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {eFormValidateMode, eFormValidateTrigger, getValidateResultMessage, iFormValidatePropsType, iValidateState} from "./validate.utils";
|
2
|
-
import {provide, reactive} from "
|
2
|
+
import {provide, reactive} from "@peryl/react-compose";
|
3
3
|
import {$message} from "../../$message";
|
4
4
|
import {Validation} from "./createValidation";
|
5
5
|
import {AutoLoadingObserver} from "../../AutoLoadingObserver";
|
@@ -70,7 +70,7 @@ export function useFormValidation({ props }: { props: iFormValidatePropsType })
|
|
70
70
|
return parentValidation.methods.validateItem({ label, field, trigger: eFormValidateTrigger.change, state, formData: props.modelValue });
|
71
71
|
},
|
72
72
|
onEditChange: ({ label, field }: { label: string | null | undefined, field: string | undefined }) => {
|
73
|
-
if (props.validateMode !== eFormValidateMode.table) {return; }
|
73
|
+
// if (props.validateMode !== eFormValidateMode.table) {return; }
|
74
74
|
return handler.onFieldChange({ label, field });
|
75
75
|
},
|
76
76
|
onBlurChange: ({ label, field }: { label: string | null | undefined, field: string | undefined }) => {
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {PlainObject} from "
|
2
|
-
import {computed, ExtractPropTypes, PropType} from "
|
3
|
-
import {createEnum} from "
|
4
|
-
import {toArray} from "
|
1
|
+
import {PlainObject} from "@peryl/utils/event";
|
2
|
+
import {computed, ExtractPropTypes, PropType} from "@peryl/react-compose";
|
3
|
+
import {createEnum} from "@peryl/utils/createEnum";
|
4
|
+
import {toArray} from "@peryl/utils/toArray";
|
5
5
|
|
6
6
|
/**
|
7
7
|
* 表单的校验模式
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {ComponentPropsType, designComponent, ExtractPropTypes, PropType, useModel} from "
|
1
|
+
import {ComponentPropsType, designComponent, ExtractPropTypes, PropType, useModel} from "@peryl/react-compose";
|
2
2
|
import {FormItemValidateExposePropsOption} from "../Form/validate/validate.utils";
|
3
|
-
import {PlainObject} from "
|
3
|
+
import {PlainObject} from "@peryl/utils/event";
|
4
4
|
import {FormItem} from "./index";
|
5
5
|
import React from "react";
|
6
6
|
|
@@ -1,10 +1,13 @@
|
|
1
|
-
import {designComponent, Fragment, getComponentCls, useClasses, useRefs} from "
|
1
|
+
import {designComponent, Fragment, getComponentCls, useClasses, useRefs} from "@peryl/react-compose";
|
2
2
|
import {FormItemValidatePropsOption} from "../Form/validate/validate.utils";
|
3
3
|
import {EditProps, useEdit} from "../../uses/useEdit";
|
4
4
|
import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
|
5
5
|
import {FormItemLayoutPropsOption, useFormLayout} from "../Form/layout/useFormLayout";
|
6
6
|
import {useFormItemValidation} from "../Form/validate/useFormItemValidation";
|
7
7
|
import {FormItemValidateMessage} from "./FormItemValidateMessage";
|
8
|
+
import Tooltip from "../Tooltip";
|
9
|
+
import {getFunctionValue} from "@peryl/utils/getFunctionValue";
|
10
|
+
import Icon from "../Icon";
|
8
11
|
|
9
12
|
export const FormItem = designComponent({
|
10
13
|
name: '-form-item',
|
@@ -104,6 +107,10 @@ export const FormItem = designComponent({
|
|
104
107
|
{slots.labelSlot(props.label)}
|
105
108
|
{slots.labelAppend()}
|
106
109
|
{formItemLayout.colon.value && <i> :</i>}
|
110
|
+
{!!props.tip && <Tooltip v-slots={{
|
111
|
+
default: () => <Icon icon="pi-info-circle" className="form-item-cell-tip"/>,
|
112
|
+
popper: () => getFunctionValue(props.tip)
|
113
|
+
}}/>}
|
107
114
|
</div>
|
108
115
|
)}
|
109
116
|
<div className="form-item-content box-message-reference" style={formItemLayout.contentStyles.value}>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {designComponent, getComponentCls, PropType, SingleClass, useClasses, useRefs, useStyles} from "
|
1
|
+
import {designComponent, getComponentCls, PropType, SingleClass, useClasses, useRefs, useStyles} from "@peryl/react-compose";
|
2
2
|
import {GridColSize} from "./grid.utils";
|
3
3
|
import GridRow from "./GridRow";
|
4
4
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {computed, designComponent, getComponentCls, PropType, useClasses, useRefs, useStyles} from "
|
1
|
+
import {computed, designComponent, getComponentCls, PropType, useClasses, useRefs, useStyles} from "@peryl/react-compose";
|
2
2
|
import {eGridAlign, eGridJustify} from "./grid.utils";
|
3
|
-
import {unit} from '
|
4
|
-
import {removeUnit} from '
|
3
|
+
import {unit} from '@peryl/utils/unit';
|
4
|
+
import {removeUnit} from '@peryl/utils/removeUnit';
|
5
5
|
import './grid.scss';
|
6
6
|
import {ThemeSize, useStyle} from "../../uses/useStyle";
|
7
7
|
import {ApplicationConfigurationProvider} from "../ApplicationConfigurationProvider";
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import {RenderNode} from "@peryl/react-compose";
|
2
|
+
|
3
|
+
export const IconExternal: Record<string, () => RenderNode> = {
|
4
|
+
'ie-stick': () => (
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
6
|
+
<defs>
|
7
|
+
<linearGradient id="colorGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
8
|
+
<stop offset="0%" stopColor="#f18ffa"/>
|
9
|
+
<stop offset="50%" stopColor="#8dbcff"/>
|
10
|
+
<stop offset="100%" stopColor="#337cef"/>
|
11
|
+
</linearGradient>
|
12
|
+
</defs>
|
13
|
+
<path fill="url(#colorGradient)"
|
14
|
+
d="M15.2238 15.5079L13.0111 20.1581C12.8687 20.4573 12.5107 20.5844 12.2115 20.442C12.1448 20.4103 12.0845 20.3665 12.0337 20.3129L8.49229 16.5741C8.39749 16.474 8.27113 16.4096 8.13445 16.3918L3.02816 15.7243C2.69958 15.6814 2.46804 15.3802 2.51099 15.0516C2.52056 14.9784 2.54359 14.9075 2.5789 14.8426L5.04031 10.3192C5.1062 10.1981 5.12839 10.058 5.10314 9.92253L4.16 4.85991C4.09931 4.53414 4.3142 4.22086 4.63997 4.16017C4.7126 4.14664 4.78711 4.14664 4.85974 4.16017L9.92237 5.10331C10.0579 5.12855 10.198 5.10637 10.319 5.04048L14.8424 2.57907C15.1335 2.42068 15.4979 2.52825 15.6562 2.81931C15.6916 2.88421 15.7146 2.95507 15.7241 3.02833L16.3916 8.13462C16.4095 8.2713 16.4739 8.39766 16.5739 8.49245L20.3127 12.0338C20.5533 12.2617 20.5636 12.6415 20.3357 12.8821C20.2849 12.9357 20.2246 12.9795 20.1579 13.0112L15.5078 15.224C15.3833 15.2832 15.283 15.3835 15.2238 15.5079ZM16.0206 17.435L17.4348 16.0208L21.6775 20.2634L20.2633 21.6776L16.0206 17.435Z"></path>
|
15
|
+
</svg>
|
16
|
+
),
|
17
|
+
'ie-chat-ai-fill': () => (
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
19
|
+
<defs>
|
20
|
+
<linearGradient id="colorGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
21
|
+
<stop offset="0%" stopColor="#f18ffa"/>
|
22
|
+
<stop offset="50%" stopColor="#8dbcff"/>
|
23
|
+
<stop offset="100%" stopColor="#337cef"/>
|
24
|
+
</linearGradient>
|
25
|
+
</defs>
|
26
|
+
<path fill="url(#colorGradient)" d="M20.7134 8.12811L20.4668 8.69379C20.2864 9.10792 19.7136 9.10792 19.5331 8.69379L19.2866 8.12811C18.8471 7.11947 18.0555 6.31641 17.0677 5.87708L16.308 5.53922C15.8973 5.35653 15.8973 4.75881 16.308 4.57612L17.0252 4.25714C18.0384 3.80651 18.8442 2.97373 19.2761 1.93083L19.5293 1.31953C19.7058 0.893489 20.2942 0.893489 20.4706 1.31953L20.7238 1.93083C21.1558 2.97373 21.9616 3.80651 22.9748 4.25714L23.6919 4.57612C24.1027 4.75881 24.1027 5.35653 23.6919 5.53922L22.9323 5.87708C21.9445 6.31641 21.1529 7.11947 20.7134 8.12811ZM20 11C20.6986 11 21.3694 10.8806 21.9929 10.6611C21.9976 10.7735 22 10.8865 22 11C22 15.4183 18.4183 19 14 19V22.5C9 20.5 2 17.5 2 11C2 6.58172 5.58172 3 10 3H14C14.1135 3 14.2265 3.00237 14.3389 3.00705C14.1194 3.63061 14 4.30136 14 5C14 8.31371 16.6863 11 20 11Z"></path>
|
27
|
+
</svg>
|
28
|
+
),
|
29
|
+
'ie-chat-ai': () => (
|
30
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
31
|
+
<defs>
|
32
|
+
<linearGradient id="colorGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
33
|
+
<stop offset="0%" stopColor="#f18ffa"/>
|
34
|
+
<stop offset="50%" stopColor="#8dbcff"/>
|
35
|
+
<stop offset="100%" stopColor="#337cef"/>
|
36
|
+
</linearGradient>
|
37
|
+
</defs>
|
38
|
+
<path fill="url(#colorGradient)" d="M20.7134 8.12811L20.4668 8.69379C20.2864 9.10792 19.7136 9.10792 19.5331 8.69379L19.2866 8.12811C18.8471 7.11947 18.0555 6.31641 17.0677 5.87708L16.308 5.53922C15.8973 5.35653 15.8973 4.75881 16.308 4.57612L17.0252 4.25714C18.0384 3.80651 18.8442 2.97373 19.2761 1.93083L19.5293 1.31953C19.7058 0.893489 20.2942 0.893489 20.4706 1.31953L20.7238 1.93083C21.1558 2.97373 21.9616 3.80651 22.9748 4.25714L23.6919 4.57612C24.1027 4.75881 24.1027 5.35653 23.6919 5.53922L22.9323 5.87708C21.9445 6.31641 21.1529 7.11947 20.7134 8.12811ZM10 3H14V5H10C6.68629 5 4 7.68629 4 11C4 14.61 6.46208 16.9656 12 19.4798V17H14C17.3137 17 20 14.3137 20 11H22C22 15.4183 18.4183 19 14 19V22.5C9 20.5 2 17.5 2 11C2 6.58172 5.58172 3 10 3Z"></path>
|
39
|
+
</svg>
|
40
|
+
),
|
41
|
+
'ie-undo': () => (
|
42
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
43
|
+
<path d="M11 20L1 12L11 4V9C16.5228 9 21 13.4772 21 19C21 19.2727 20.9891 19.5428 20.9677 19.81C19.5055 17.0364 16.6381 15.119 13.313 15.0053L13 15H10.9999L11 20ZM8.99986 13H10.9999L13.0341 13.0003L13.3814 13.0065C14.6657 13.0504 15.9053 13.3165 17.0568 13.7734C15.5898 12.0749 13.4204 11 11 11H9V8.16125L4.20156 12L8.99992 15.8387L8.99986 13Z"></path>
|
44
|
+
</svg>
|
45
|
+
),
|
46
|
+
'ie-redo': () => (
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
48
|
+
<path d="M13 14H11C7.54202 14 4.53953 15.9502 3.03239 18.8107C3.01093 18.5433 3 18.2729 3 18C3 12.4772 7.47715 8 13 8V2.5L23.5 11L13 19.5V14ZM11 12H15V15.3078L20.3214 11L15 6.69224V10H13C10.5795 10 8.41011 11.0749 6.94312 12.7735C8.20873 12.2714 9.58041 12 11 12Z"></path>
|
49
|
+
</svg>
|
50
|
+
),
|
51
|
+
'ie-import': () => (
|
52
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
53
|
+
<path d="M3 19H21V21H3V19ZM13 5.82843V17H11V5.82843L4.92893 11.8995L3.51472 10.4853L12 2L20.4853 10.4853L19.0711 11.8995L13 5.82843Z"></path>
|
54
|
+
</svg>
|
55
|
+
),
|
56
|
+
'ie-export': () => (
|
57
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
58
|
+
<path d="M3 19H21V21H3V19ZM13 13.1716L19.0711 7.1005L20.4853 8.51472L12 17L3.51472 8.51472L4.92893 7.1005L11 13.1716V2H13V13.1716Z"></path>
|
59
|
+
</svg>
|
60
|
+
),
|
61
|
+
'ie-clear': () => (
|
62
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
63
|
+
<path d="M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 11H11V17H9V11ZM13 11H15V17H13V11ZM9 4V6H15V4H9Z"></path>
|
64
|
+
</svg>
|
65
|
+
),
|
66
|
+
'ie-external-link': () => (
|
67
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
68
|
+
<path d="M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"></path>
|
69
|
+
</svg>
|
70
|
+
),
|
71
|
+
'ie-thumbs-up': () => (
|
72
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
73
|
+
<path d="M2 8.99997H5V21H2C1.44772 21 1 20.5523 1 20V9.99997C1 9.44769 1.44772 8.99997 2 8.99997ZM7.29289 7.70708L13.6934 1.30661C13.8693 1.13066 14.1479 1.11087 14.3469 1.26016L15.1995 1.8996C15.6842 2.26312 15.9026 2.88253 15.7531 3.46966L14.5998 7.99997H21C22.1046 7.99997 23 8.8954 23 9.99997V12.1043C23 12.3656 22.9488 12.6243 22.8494 12.8658L19.755 20.3807C19.6007 20.7554 19.2355 21 18.8303 21H8C7.44772 21 7 20.5523 7 20V8.41419C7 8.14897 7.10536 7.89462 7.29289 7.70708Z"></path>
|
74
|
+
</svg>
|
75
|
+
),
|
76
|
+
'ie-thumbs-down': () => (
|
77
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
78
|
+
<path d="M22 15H19V3H22C22.5523 3 23 3.44772 23 4V14C23 14.5523 22.5523 15 22 15ZM16.7071 16.2929L10.3066 22.6934C10.1307 22.8693 9.85214 22.8891 9.65308 22.7398L8.8005 22.1004C8.3158 21.7369 8.09739 21.1174 8.24686 20.5303L9.40017 16H3C1.89543 16 1 15.1046 1 14V11.8957C1 11.6344 1.05118 11.3757 1.15064 11.1342L4.24501 3.61925C4.3993 3.24455 4.76447 3 5.16969 3H16C16.5523 3 17 3.44772 17 4V15.5858C17 15.851 16.8946 16.1054 16.7071 16.2929Z"></path>
|
79
|
+
</svg>
|
80
|
+
),
|
81
|
+
'ie-full-screen': () => (
|
82
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
83
|
+
<path d="M8 3V5H4V9H2V3H8ZM2 21V15H4V19H8V21H2ZM22 21H16V19H20V15H22V21ZM22 9H20V5H16V3H22V9Z"></path>
|
84
|
+
</svg>
|
85
|
+
),
|
86
|
+
'ie-full-screen-exit': () => (
|
87
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
88
|
+
<path d="M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z"></path>
|
89
|
+
</svg>
|
90
|
+
),
|
91
|
+
'ie-backward': () => (
|
92
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
93
|
+
<path d="M15.0001 4.99976V10.9998L21.0001 11.0001L21.0001 13.0001L15.0001 12.9998V18.9998L7.99985 12L15.0001 4.99976ZM4.00006 18.9999L4.00006 4.99993H6.00006L6.00006 18.9999H4.00006Z"></path>
|
94
|
+
</svg>
|
95
|
+
),
|
96
|
+
'ie-forward': () => (
|
97
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
98
|
+
<path d="M8.99988 4.99976L16.0002 12L8.99988 18.9998V12.9998L2.9999 13.0001L2.99988 11.0001L8.99988 10.9998V4.99976ZM17.9999 18.9999L18 4.99993H20L19.9999 18.9999H17.9999Z"></path>
|
99
|
+
</svg>
|
100
|
+
),
|
101
|
+
'ie-dropper': () => (
|
102
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
103
|
+
<path
|
104
|
+
d="M15.5355 2.80744C17.0976 1.24534 19.6303 1.24534 21.1924 2.80744C22.7545 4.36953 22.7545 6.90219 21.1924 8.46429L18.3638 11.2929L18.7175 11.6466C19.108 12.0371 19.108 12.6703 18.7175 13.0608C18.327 13.4513 17.6938 13.4513 17.3033 13.0608L16.9498 12.7073L10.7351 18.922C10.1767 19.4804 9.46547 19.861 8.6911 20.0159L6.93694 20.3667C6.54976 20.4442 6.19416 20.6345 5.91496 20.9137L4.92894 21.8997C4.53841 22.2902 3.90525 22.2902 3.51472 21.8997L2.10051 20.4855C1.70999 20.095 1.70999 19.4618 2.10051 19.0713L3.08653 18.0852C3.36574 17.806 3.55605 17.4504 3.63348 17.0633L3.98431 15.3091C4.13919 14.5347 4.51981 13.8235 5.07821 13.2651L11.2929 7.05045L10.9393 6.69686C10.5488 6.30634 10.5488 5.67317 10.9393 5.28265C11.3299 4.89212 11.963 4.89212 12.3535 5.28265L12.7069 5.63604L15.5355 2.80744ZM12.7071 8.46466L6.49242 14.6794C6.21322 14.9586 6.02291 15.3142 5.94548 15.7013L5.59464 17.4555C5.43977 18.2299 5.05915 18.9411 4.50075 19.4995C5.05915 18.9411 5.77035 18.5604 6.54471 18.4056L8.29887 18.0547C8.68605 17.9773 9.04165 17.787 9.32085 17.5078L15.5355 11.2931L12.7071 8.46466Z"></path>
|
105
|
+
</svg>
|
106
|
+
),
|
107
|
+
'ie-send': () => (
|
108
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
109
|
+
<path d="M1.94607 9.31543C1.42353 9.14125 1.4194 8.86022 1.95682 8.68108L21.043 2.31901C21.5715 2.14285 21.8746 2.43866 21.7265 2.95694L16.2733 22.0432C16.1223 22.5716 15.8177 22.59 15.5944 22.0876L11.9999 14L17.9999 6.00005L9.99992 12L1.94607 9.31543Z"></path>
|
110
|
+
</svg>
|
111
|
+
),
|
112
|
+
'ie-stop': () => (
|
113
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
114
|
+
<path d="M6 5H18C18.5523 5 19 5.44772 19 6V18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18V6C5 5.44772 5.44772 5 6 5Z"></path>
|
115
|
+
</svg>
|
116
|
+
)
|
117
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {RenderNode} from "
|
2
|
-
import {tStrokeLinecap, tStrokeLinejoin} from "
|
1
|
+
import {RenderNode} from "@peryl/react-compose";
|
2
|
+
import {tStrokeLinecap, tStrokeLinejoin} from "@peryl/icon/src/packages/component/icon/useIcon";
|
3
3
|
|
4
4
|
interface iIconGetter {(data: { props: { icon?: string | undefined, strokeWidth: number | undefined, strokeLinecap: tStrokeLinecap | undefined, strokeLinejoin: tStrokeLinejoin | undefined }, attrs: any }): RenderNode | Promise<RenderNode>;}
|
5
5
|
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import {PlainIcon} from '
|
2
|
-
import {designComponent, getComponentCls, iHTMLElement, mergeAttrs, PropType, reactive, RenderNode, useClasses, watch} from "
|
3
|
-
import {tStrokeLinecap, tStrokeLinejoin} from "
|
1
|
+
import {PlainIcon} from '@peryl/icon/src/packages/component/icon/react';
|
2
|
+
import {designComponent, getComponentCls, iHTMLElement, mergeAttrs, PropType, reactive, RenderNode, useClasses, watch} from "@peryl/react-compose";
|
3
|
+
import {tStrokeLinecap, tStrokeLinejoin} from "@peryl/icon/src/packages/component/icon/useIcon";
|
4
4
|
import './icon.scss';
|
5
5
|
import {IconRegistration} from "./icon.registry";
|
6
6
|
import {renderNothing} from "../../utils/renderNothing";
|
7
7
|
import {ThemeStatus} from "../../uses/useStyle";
|
8
|
+
import {IconExternal} from "./icon.external";
|
8
9
|
|
9
10
|
IconRegistration.registry('pi-', ({ props }) => (<PlainIcon {...mergeAttrs({ style: { verticalAlign: 'baseline' } }, props)}/>));
|
10
11
|
|
@@ -28,11 +29,16 @@ export const Icon = designComponent({
|
|
28
29
|
|
29
30
|
watch(() => props.icon, async icon => {
|
30
31
|
if (!icon) {state.renderer = renderNothing;}
|
31
|
-
|
32
|
-
if (!
|
33
|
-
state.renderer =
|
32
|
+
|
33
|
+
if (!!IconExternal[icon!]) {
|
34
|
+
state.renderer = IconExternal[icon!];
|
34
35
|
} else {
|
35
|
-
|
36
|
+
const content = await IconRegistration.getIconRenderer({ props, attrs });
|
37
|
+
if (!content) {
|
38
|
+
state.renderer = renderNothing;
|
39
|
+
} else {
|
40
|
+
state.renderer = () => content;
|
41
|
+
}
|
36
42
|
}
|
37
43
|
}, { immediate: true });
|
38
44
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
@include comp(icon-picker-panel) {
|
2
|
+
height: 15em;
|
3
|
+
width: 24em;
|
4
|
+
overflow: hidden;
|
5
|
+
.icon-picker-row {
|
6
|
+
display: flex;
|
7
|
+
align-items: center;
|
8
|
+
}
|
9
|
+
.icon-picker-item {
|
10
|
+
width: 2.5em;
|
11
|
+
height: 2.5em;
|
12
|
+
margin: 0.25em;
|
13
|
+
display: flex;
|
14
|
+
align-items: center;
|
15
|
+
justify-content: center;
|
16
|
+
transition: all ease 300ms;
|
17
|
+
cursor: pointer;
|
18
|
+
|
19
|
+
&:hover {
|
20
|
+
background-color: plv(secondary-light-2);
|
21
|
+
}
|
22
|
+
|
23
|
+
&[data-selected=true] {
|
24
|
+
background-color: plv(primary-6);
|
25
|
+
color: plv(pbfc);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
@include sizeMixin(icon-picker-panel, (font-size)) {
|
30
|
+
.icon-picker-item {
|
31
|
+
border-radius: $border-radius;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
@include comp(icon-picker) {
|
37
|
+
.icon-picker-tag {
|
38
|
+
width: 2.5em;
|
39
|
+
display: flex;
|
40
|
+
align-items: center;
|
41
|
+
justify-content: center;
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,189 @@
|
|
1
|
+
import {computed, designComponent, getComponentCls, mergeAttrs, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useClasses, useRefs} from "@peryl/react-compose";
|
2
|
+
import {EditProps, useEdit} from "../../uses/useEdit";
|
3
|
+
import {StyleProps, useStyle} from "../../uses/useStyle";
|
4
|
+
import Input from "../Input";
|
5
|
+
import {Reference} from "../Reference";
|
6
|
+
import {usePopperEditor} from "../usePopupEditor";
|
7
|
+
import {createInputPopperAttrs} from "../../uses/createInputPopperAttrs";
|
8
|
+
import {iPopupUseOption} from "../usePopup/utils/popup.utils";
|
9
|
+
import {delay} from "@peryl/utils/delay";
|
10
|
+
import Icon from "../Icon";
|
11
|
+
import i18n from "../i18n";
|
12
|
+
import {chunk} from '@peryl/utils/chunk';
|
13
|
+
import './icon-picker.scss';
|
14
|
+
import VirtualList from "../VirtualList";
|
15
|
+
import {DefaultIcons} from "./DefaultIcons";
|
16
|
+
|
17
|
+
export const IconPicker = designComponent({
|
18
|
+
name: 'icon-picker',
|
19
|
+
inheritPropsType: Input,
|
20
|
+
props: {
|
21
|
+
...EditProps,
|
22
|
+
...StyleProps,
|
23
|
+
modelValue: { type: String },
|
24
|
+
popperAttrs: { type: Object as PropType<iPopupUseOption> },
|
25
|
+
placeholder: { type: String, default: () => i18n.$it('iconPicker.placeholder').d('请选择或者输入图标') },
|
26
|
+
iconList: { type: Array as PropType<string[]> },
|
27
|
+
},
|
28
|
+
emits: {
|
29
|
+
onUpdateModelValue: (val?: string) => true,
|
30
|
+
onBlur: (e: FocusEvent) => true,
|
31
|
+
onFocus: (e: FocusEvent) => true,
|
32
|
+
},
|
33
|
+
scopeSlots: {
|
34
|
+
default: (scope: { color?: string }) => {},
|
35
|
+
},
|
36
|
+
setup({ props, event: { emit }, scopeSlots }) {
|
37
|
+
|
38
|
+
const { editComputed } = useEdit();
|
39
|
+
const { styleComputed } = useStyle();
|
40
|
+
const classes = useClasses(() => [getComponentCls('icon-picker'),]);
|
41
|
+
const { refs, onRef } = useRefs({ input: Input });
|
42
|
+
|
43
|
+
const panelClasses = useClassCache(() => [
|
44
|
+
getComponentCls('icon-picker-panel'),
|
45
|
+
`icon-picker-panel-size-${styleComputed.value.size}`
|
46
|
+
]);
|
47
|
+
|
48
|
+
const iconList = computed((): string[] => {
|
49
|
+
const list = props.iconList ?? DefaultIcons;
|
50
|
+
const filterText = filter.state.filterText?.trim();
|
51
|
+
if (!filterText?.length) {
|
52
|
+
return list;
|
53
|
+
}
|
54
|
+
return list.filter(i => i.indexOf(filterText) > -1);
|
55
|
+
});
|
56
|
+
|
57
|
+
const scopedSlotsRender = (() => {
|
58
|
+
const state = reactive({
|
59
|
+
el: null as null | HTMLElement
|
60
|
+
});
|
61
|
+
const render = (defaultRender: () => RenderNode) => {
|
62
|
+
if (scopeSlots.default.isExist()) {
|
63
|
+
const content = scopeSlots.default.isExist() ? scopeSlots.default({ color: model.value }) : null;
|
64
|
+
return (<Reference onElementDetected={el => state.el = el}>{content}</Reference>);
|
65
|
+
} else {
|
66
|
+
return defaultRender();
|
67
|
+
}
|
68
|
+
};
|
69
|
+
return { state, render };
|
70
|
+
})();
|
71
|
+
|
72
|
+
const filter = (() => {
|
73
|
+
const filterState = reactive({
|
74
|
+
isShow: false,
|
75
|
+
filterText: null as null | undefined | string,
|
76
|
+
});
|
77
|
+
return {
|
78
|
+
state: filterState
|
79
|
+
};
|
80
|
+
})();
|
81
|
+
|
82
|
+
const popper = usePopperEditor({
|
83
|
+
popperAttrs: () => ({
|
84
|
+
offset: 1,
|
85
|
+
noArrow: true,
|
86
|
+
noPadding: true,
|
87
|
+
...props.popperAttrs,
|
88
|
+
}),
|
89
|
+
reference: () => !editComputed.value.editable ? null : (scopedSlotsRender.state.el || refs.input?.refs.el),
|
90
|
+
onShow: () => {
|
91
|
+
filter.state.isShow = true;
|
92
|
+
},
|
93
|
+
onHide: () => {
|
94
|
+
filter.state.isShow = false;
|
95
|
+
},
|
96
|
+
onClose: () => {
|
97
|
+
filter.state.filterText = null;
|
98
|
+
},
|
99
|
+
popper: () => {
|
100
|
+
return (
|
101
|
+
<div
|
102
|
+
className={panelClasses.value}
|
103
|
+
onMouseDown={(e: any) => {
|
104
|
+
delay().then(() => {refs.input?.focus();});
|
105
|
+
}}>
|
106
|
+
<VirtualList
|
107
|
+
data={chunk(iconList.value, 8)}
|
108
|
+
size={24}
|
109
|
+
dynamicSize
|
110
|
+
v-slots={{
|
111
|
+
default: ({ item: subList, vIndex, vid }) => {
|
112
|
+
return (
|
113
|
+
<div
|
114
|
+
data-vid={vid}
|
115
|
+
key={vIndex}
|
116
|
+
className="icon-picker-row"
|
117
|
+
>
|
118
|
+
{(subList as string[]).map(icon => (
|
119
|
+
<div
|
120
|
+
key={icon}
|
121
|
+
className="icon-picker-item"
|
122
|
+
data-selected={String(icon === model.value)}
|
123
|
+
onClick={() => {
|
124
|
+
model.value = icon;
|
125
|
+
state.inputValue = icon;
|
126
|
+
popper.methods.hide();
|
127
|
+
}}
|
128
|
+
>
|
129
|
+
{(icon.indexOf('ie-') === 0 || icon.indexOf('pi-') === 0) ?
|
130
|
+
(<Icon icon={icon}/>) :
|
131
|
+
(<span className={icon}/>)}
|
132
|
+
</div>
|
133
|
+
))}
|
134
|
+
</div>
|
135
|
+
);
|
136
|
+
}
|
137
|
+
}}
|
138
|
+
/>
|
139
|
+
</div>
|
140
|
+
);
|
141
|
+
}
|
142
|
+
});
|
143
|
+
|
144
|
+
const { inputAttrs, state, model } = createInputPopperAttrs({
|
145
|
+
getValue: () => props.modelValue,
|
146
|
+
emitChange: emit.onUpdateModelValue,
|
147
|
+
disableHideOnBlur: true,
|
148
|
+
emit,
|
149
|
+
popper,
|
150
|
+
handleInputChange: (val) => {
|
151
|
+
filter.state.filterText = val;
|
152
|
+
if (!filter.state.isShow) {popper.methods.show();}
|
153
|
+
},
|
154
|
+
});
|
155
|
+
|
156
|
+
onBeforeUnmount(() => {popper.methods.dispose();});
|
157
|
+
|
158
|
+
return {
|
159
|
+
render: () => {
|
160
|
+
return scopedSlotsRender.render(() =>
|
161
|
+
<Input
|
162
|
+
ref={onRef.input}
|
163
|
+
{...mergeAttrs(
|
164
|
+
{
|
165
|
+
class: classes.value,
|
166
|
+
placeholder: editComputed.value.placeholder
|
167
|
+
},
|
168
|
+
inputAttrs.value,
|
169
|
+
)}
|
170
|
+
>
|
171
|
+
{{
|
172
|
+
prefix: () => (
|
173
|
+
<div className="icon-picker-tag">
|
174
|
+
{!model.value ? <Icon icon="pi-question"/> : (
|
175
|
+
model.value.indexOf('ie-') === 0 || model.value.indexOf('pi-') === 0 ?
|
176
|
+
(<Icon icon={model.value}/>) :
|
177
|
+
(<span className={model.value}/>)
|
178
|
+
)}
|
179
|
+
</div>
|
180
|
+
)
|
181
|
+
}}
|
182
|
+
</Input>
|
183
|
+
);
|
184
|
+
}
|
185
|
+
};
|
186
|
+
},
|
187
|
+
});
|
188
|
+
|
189
|
+
export default IconPicker;
|