foucui 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/components/QiuAffix/index.vue +186 -0
- package/components/QiuAlert/index.vue +208 -0
- package/components/QiuAnchor/context.ts +18 -0
- package/components/QiuAnchor/index.vue +180 -0
- package/components/QiuAnchorLink/index.vue +67 -0
- package/components/QiuApp/index.vue +9 -0
- package/components/QiuAutocomplete/index.vue +408 -0
- package/components/QiuAvatar/index.vue +140 -0
- package/components/QiuBacktop/index.vue +121 -0
- package/components/QiuBadge/api/index.ts +389 -0
- package/components/QiuBadge/components/BadgeImagePickerDialog.vue +243 -0
- package/components/QiuBadge/components/BadgeLibraryManagerDialog.vue +30 -0
- package/components/QiuBadge/components/BadgeLibraryPanel.vue +182 -0
- package/components/QiuBadge/composables/useTableHostHeight.ts +53 -0
- package/components/QiuBadge/index.ts +18 -0
- package/components/QiuBadge/shared/BadgeTemplateRenderer.vue +32 -0
- package/components/QiuBadge/shared/assetUrl.ts +26 -0
- package/components/QiuBadge/shared/badgeTemplate.ts +309 -0
- package/components/QiuBadge/utils/chinaAreaData.ts +44 -0
- package/components/QiuBadge/utils/hostRegion.ts +22 -0
- package/components/QiuBadge/utils/pca-code.json +1 -0
- package/components/QiuBadge/utils/pdfFromElement.ts +348 -0
- package/components/QiuBadge/views/BadgeLibraryView.vue +32 -0
- package/components/QiuBadge/views/BadgeManageView.vue +1364 -0
- package/components/QiuBadge/views/BadgeTemplateEditorView.vue +10 -0
- package/components/QiuBadge/views/BadgeTemplateListView.vue +229 -0
- package/components/QiuBadge/views/DeskLabelTemplateListView.vue +227 -0
- package/components/QiuBadge/views/DeskLabelView.vue +683 -0
- package/components/QiuBadgeDot/index.vue +87 -0
- package/components/QiuButton/index.vue +247 -0
- package/components/QiuButtonGroup/index.vue +63 -0
- package/components/QiuCanvasKit/QiuCanvasEditor.vue +5503 -0
- package/components/QiuCanvasKit/QiuCanvasRenderer.vue +348 -0
- package/components/QiuCanvasKit/assetUrl.ts +11 -0
- package/components/QiuCanvasKit/components/DataModulesPanel.vue +352 -0
- package/components/QiuCanvasKit/export/html.ts +132 -0
- package/components/QiuCanvasKit/export/pdf.ts +48 -0
- package/components/QiuCanvasKit/export/png.ts +50 -0
- package/components/QiuCanvasKit/index.ts +20 -0
- package/components/QiuCanvasKit/modules/badgeCompat.ts +84 -0
- package/components/QiuCanvasKit/modules/dataRegistry.ts +207 -0
- package/components/QiuCanvasKit/modules/merge.ts +71 -0
- package/components/QiuCanvasKit/presets/badge.ts +67 -0
- package/components/QiuCanvasKit/presets/banner.ts +79 -0
- package/components/QiuCanvasKit/types.ts +138 -0
- package/components/QiuCard/index.vue +104 -0
- package/components/QiuCarousel/context.ts +16 -0
- package/components/QiuCarousel/index.vue +343 -0
- package/components/QiuCarouselItem/index.vue +47 -0
- package/components/QiuCascader/index.vue +879 -0
- package/components/QiuCascader/types.ts +48 -0
- package/components/QiuCheckbox/QiuCheckboxGroup.vue +78 -0
- package/components/QiuCheckbox/index.vue +231 -0
- package/components/QiuCheckbox/types.ts +8 -0
- package/components/QiuCode/index.vue +64 -0
- package/components/QiuCol/col.scss +55 -0
- package/components/QiuCol/index.vue +64 -0
- package/components/QiuCollapse/context.ts +10 -0
- package/components/QiuCollapse/index.vue +70 -0
- package/components/QiuCollapseItem/index.vue +167 -0
- package/components/QiuColorField/index.vue +296 -0
- package/components/QiuColorPicker/README.md +118 -0
- package/components/QiuColorPicker/index.vue +60 -0
- package/components/QiuColorfulCard/index.vue +101 -0
- package/components/QiuCombobox/index.vue +277 -0
- package/components/QiuConfigProvider/index.vue +31 -0
- package/components/QiuContextMenu/index.vue +209 -0
- package/components/QiuDate/index.vue +1134 -0
- package/components/QiuDescriptions/context.ts +20 -0
- package/components/QiuDescriptions/index.vue +115 -0
- package/components/QiuDescriptionsItem/index.vue +103 -0
- package/components/QiuDialog/index.vue +828 -0
- package/components/QiuDigitalCard/index.vue +159 -0
- package/components/QiuDivider/index.vue +185 -0
- package/components/QiuDot/index.vue +83 -0
- package/components/QiuDrawer/index.vue +350 -0
- package/components/QiuDropdown/QiuDropdownItem.vue +74 -0
- package/components/QiuDropdown/QiuDropdownMenu.vue +22 -0
- package/components/QiuDropdown/context.ts +9 -0
- package/components/QiuDropdown/index.vue +189 -0
- package/components/QiuEmpty/index.vue +73 -0
- package/components/QiuForm/index.vue +172 -0
- package/components/QiuForm/types.ts +39 -0
- package/components/QiuFormItem/index.vue +276 -0
- package/components/QiuFullscreen/index.vue +11 -0
- package/components/QiuGrid/index.vue +408 -0
- package/components/QiuHoverCard/index.vue +192 -0
- package/components/QiuIcon/index.vue +117 -0
- package/components/QiuIconPicker/iconify.libraries.ts +182 -0
- package/components/QiuIconPicker/icons.catalog.ts +3072 -0
- package/components/QiuIconPicker/index.vue +488 -0
- package/components/QiuImage/index.vue +177 -0
- package/components/QiuInput/index.vue +328 -0
- package/components/QiuInputNumber/index.vue +295 -0
- package/components/QiuInputOtp/index.vue +190 -0
- package/components/QiuKbd/index.vue +57 -0
- package/components/QiuLayoutContainer/index.vue +50 -0
- package/components/QiuLinkPreview/index.vue +224 -0
- package/components/QiuLoading/index.ts +176 -0
- package/components/QiuLoading/spinner.vue +820 -0
- package/components/QiuLoading/types.ts +44 -0
- package/components/QiuMention/index.vue +299 -0
- package/components/QiuMenu/QiuMenuRoot.vue +241 -0
- package/components/QiuMenu/components/QiuMenuItem.vue +340 -0
- package/components/QiuMenu/components/QiuSubMenu.vue +504 -0
- package/components/QiuMenu/context.ts +21 -0
- package/components/QiuMenu/index.vue +43 -0
- package/components/QiuMenuNav/QiuMenuNavItem.vue +100 -0
- package/components/QiuMenuNav/QiuMenuNavSub.vue +120 -0
- package/components/QiuMenuNav/context.ts +14 -0
- package/components/QiuMenuNav/index.vue +148 -0
- package/components/QiuMsg/QiuMsgItem.vue +180 -0
- package/components/QiuMsg/index.ts +158 -0
- package/components/QiuMsg/types.ts +23 -0
- package/components/QiuMsgBox/index.ts +147 -0
- package/components/QiuNotification/QiuNotificationItem.vue +168 -0
- package/components/QiuNotification/index.ts +155 -0
- package/components/QiuNotification/types.ts +14 -0
- package/components/QiuPage/index.vue +12 -0
- package/components/QiuPageHeader/index.vue +115 -0
- package/components/QiuPageMain/index.vue +78 -0
- package/components/QiuPagination/index.vue +421 -0
- package/components/QiuPasswordStrength/index.vue +101 -0
- package/components/QiuPopconfirm/index.vue +196 -0
- package/components/QiuPopover/index.vue +277 -0
- package/components/QiuProgress/index.vue +235 -0
- package/components/QiuQrcode/index.vue +302 -0
- package/components/QiuQueryForm/components/QiuQueryFormBottomPanel.vue +13 -0
- package/components/QiuQueryForm/components/QiuQueryFormLeftPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormRightPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormTopPanel.vue +13 -0
- package/components/QiuQueryForm/index.vue +117 -0
- package/components/QiuRadio/QiuRadioGroup.vue +75 -0
- package/components/QiuRadio/index.vue +191 -0
- package/components/QiuRadio/types.ts +9 -0
- package/components/QiuRate/index.vue +184 -0
- package/components/QiuRefresh/index.vue +32 -0
- package/components/QiuResult/index.vue +103 -0
- package/components/QiuRow/index.vue +60 -0
- package/components/QiuRow/types.ts +5 -0
- package/components/QiuScrollbar/index.vue +107 -0
- package/components/QiuSearchBar/index.vue +154 -0
- package/components/QiuSegmented/index.vue +120 -0
- package/components/QiuSelect/QiuOption.vue +93 -0
- package/components/QiuSelect/index.vue +452 -0
- package/components/QiuSelect/types.ts +15 -0
- package/components/QiuSkeleton/index.vue +78 -0
- package/components/QiuSlider/index.vue +266 -0
- package/components/QiuSpace/index.vue +95 -0
- package/components/QiuSparkline/index.vue +92 -0
- package/components/QiuStatistic/index.vue +4 -0
- package/components/QiuStatistics/index.vue +123 -0
- package/components/QiuStep/index.vue +220 -0
- package/components/QiuSteps/context.ts +25 -0
- package/components/QiuSteps/index.vue +84 -0
- package/components/QiuSwitch/index.vue +145 -0
- package/components/QiuTabBar/index.vue +218 -0
- package/components/QiuTabBar/types.ts +19 -0
- package/components/QiuTabPane/index.vue +82 -0
- package/components/QiuTable/columns.ts +16 -0
- package/components/QiuTable/export.ts +102 -0
- package/components/QiuTable/index.ts +24 -0
- package/components/QiuTable/index.vue +3503 -0
- package/components/QiuTable/registry.ts +75 -0
- package/components/QiuTable/styles/table.scss +1230 -0
- package/components/QiuTable/types.ts +413 -0
- package/components/QiuTable/useArea.ts +202 -0
- package/components/QiuTable/useColumns.ts +325 -0
- package/components/QiuTable/useEdit.ts +136 -0
- package/components/QiuTable/useExtras.ts +115 -0
- package/components/QiuTable/useHistory.ts +77 -0
- package/components/QiuTable/useMerge.ts +105 -0
- package/components/QiuTable/useResize.ts +86 -0
- package/components/QiuTable/useScrollSync.ts +152 -0
- package/components/QiuTable/useVirtual.ts +97 -0
- package/components/QiuTable/utils.ts +165 -0
- package/components/QiuTableColumn/index.vue +101 -0
- package/components/QiuTag/index.vue +143 -0
- package/components/QiuText/index.vue +99 -0
- package/components/QiuTime/index.vue +548 -0
- package/components/QiuTimeAgo/index.vue +103 -0
- package/components/QiuTimeline/index.vue +54 -0
- package/components/QiuTimelineItem/index.vue +140 -0
- package/components/QiuTips/index.vue +323 -0
- package/components/QiuTooltip/index.vue +237 -0
- package/components/QiuTransfer/index.vue +277 -0
- package/components/QiuTree/QiuTreeNode.vue +146 -0
- package/components/QiuTree/index.vue +143 -0
- package/components/QiuTree/types.ts +30 -0
- package/components/QiuTreeSelect/index.vue +259 -0
- package/components/QiuTrend/index.vue +92 -0
- package/components/QiuUpload/index.vue +628 -0
- package/components/QiuUploadCrop/index.vue +1267 -0
- package/components/QiuWatermark/index.vue +121 -0
- package/components/useBodyScrollLock.ts +28 -0
- package/dist/components/QiuAnchor/context.d.ts +15 -0
- package/dist/components/QiuAnchorLink/index.vue.d.ts +23 -0
- package/dist/components/QiuBadge/api/index.d.ts +110 -0
- package/dist/components/QiuBadge/components/BadgeImagePickerDialog.vue.d.ts +16 -0
- package/dist/components/QiuBadge/components/BadgeLibraryManagerDialog.vue.d.ts +9 -0
- package/dist/components/QiuBadge/components/BadgeLibraryPanel.vue.d.ts +5 -0
- package/dist/components/QiuBadge/composables/useTableHostHeight.d.ts +7 -0
- package/dist/components/QiuBadge/index.d.ts +18 -0
- package/dist/components/QiuBadge/shared/BadgeTemplateRenderer.vue.d.ts +14 -0
- package/dist/components/QiuBadge/shared/assetUrl.d.ts +1 -0
- package/dist/components/QiuBadge/shared/badgeTemplate.d.ts +132 -0
- package/dist/components/QiuBadge/utils/chinaAreaData.d.ts +9 -0
- package/dist/components/QiuBadge/utils/hostRegion.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pca-code.json.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pdfFromElement.d.ts +14 -0
- package/dist/components/QiuBadge/views/BadgeLibraryView.vue.d.ts +2 -0
- package/dist/components/QiuBadge/views/BadgeManageView.vue.d.ts +7 -0
- package/dist/components/QiuBadge/views/BadgeTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelView.vue.d.ts +4 -0
- package/dist/components/QiuButton/index.vue.d.ts +52 -0
- package/dist/components/QiuCanvasKit/QiuCanvasEditor.vue.d.ts +24 -0
- package/dist/components/QiuCanvasKit/QiuCanvasRenderer.vue.d.ts +13 -0
- package/dist/components/QiuCanvasKit/assetUrl.d.ts +7 -0
- package/dist/components/QiuCanvasKit/components/DataModulesPanel.vue.d.ts +23 -0
- package/dist/components/QiuCanvasKit/export/html.d.ts +12 -0
- package/dist/components/QiuCanvasKit/export/pdf.d.ts +9 -0
- package/dist/components/QiuCanvasKit/export/png.d.ts +8 -0
- package/dist/components/QiuCanvasKit/index.d.ts +19 -0
- package/dist/components/QiuCanvasKit/modules/badgeCompat.d.ts +8 -0
- package/dist/components/QiuCanvasKit/modules/dataRegistry.d.ts +23 -0
- package/dist/components/QiuCanvasKit/modules/merge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/badge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/banner.d.ts +4 -0
- package/dist/components/QiuCanvasKit/types.d.ts +119 -0
- package/dist/components/QiuCarousel/context.d.ts +13 -0
- package/dist/components/QiuCarouselItem/index.vue.d.ts +20 -0
- package/dist/components/QiuCascader/types.d.ts +25 -0
- package/dist/components/QiuCheckbox/QiuCheckboxGroup.vue.d.ts +33 -0
- package/dist/components/QiuCheckbox/index.vue.d.ts +38 -0
- package/dist/components/QiuCheckbox/types.d.ts +7 -0
- package/dist/components/QiuCode/index.vue.d.ts +15 -0
- package/dist/components/QiuCollapse/context.d.ts +8 -0
- package/dist/components/QiuCollapseItem/index.vue.d.ts +30 -0
- package/dist/components/QiuColorField/index.vue.d.ts +23 -0
- package/dist/components/QiuColorPicker/index.vue.d.ts +21 -0
- package/dist/components/QiuCombobox/index.vue.d.ts +54 -0
- package/dist/components/QiuContextMenu/index.vue.d.ts +46 -0
- package/dist/components/QiuDescriptions/context.d.ts +16 -0
- package/dist/components/QiuDescriptionsItem/index.vue.d.ts +25 -0
- package/dist/components/QiuDigitalCard/index.vue.d.ts +45 -0
- package/dist/components/QiuDropdown/QiuDropdownItem.vue.d.ts +30 -0
- package/dist/components/QiuDropdown/QiuDropdownMenu.vue.d.ts +17 -0
- package/dist/components/QiuDropdown/context.d.ts +7 -0
- package/dist/components/QiuDropdown/index.vue.d.ts +46 -0
- package/dist/components/QiuForm/types.d.ts +31 -0
- package/dist/components/QiuHoverCard/index.vue.d.ts +44 -0
- package/dist/components/QiuIcon/index.vue.d.ts +18 -0
- package/dist/components/QiuIconPicker/iconify.libraries.d.ts +18 -0
- package/dist/components/QiuIconPicker/icons.catalog.d.ts +12 -0
- package/dist/components/QiuInput/index.vue.d.ts +71 -0
- package/dist/components/QiuInputNumber/index.vue.d.ts +38 -0
- package/dist/components/QiuInputOtp/index.vue.d.ts +28 -0
- package/dist/components/QiuKbd/index.vue.d.ts +22 -0
- package/dist/components/QiuLayoutContainer/index.vue.d.ts +29 -0
- package/dist/components/QiuLinkPreview/index.vue.d.ts +43 -0
- package/dist/components/QiuLoading/index.d.ts +26 -0
- package/dist/components/QiuLoading/spinner.vue.d.ts +14 -0
- package/dist/components/QiuLoading/types.d.ts +2 -0
- package/dist/components/QiuMention/index.vue.d.ts +35 -0
- package/dist/components/QiuMenu/QiuMenuRoot.vue.d.ts +36 -0
- package/dist/components/QiuMenu/context.d.ts +19 -0
- package/dist/components/QiuMenuNav/QiuMenuNavItem.vue.d.ts +26 -0
- package/dist/components/QiuMenuNav/QiuMenuNavSub.vue.d.ts +25 -0
- package/dist/components/QiuMenuNav/context.d.ts +12 -0
- package/dist/components/QiuMenuNav/index.vue.d.ts +35 -0
- package/dist/components/QiuMsg/QiuMsgItem.vue.d.ts +15 -0
- package/dist/components/QiuMsg/index.d.ts +30 -0
- package/dist/components/QiuMsg/types.d.ts +12 -0
- package/dist/components/QiuMsgBox/index.d.ts +14 -0
- package/dist/components/QiuNotification/QiuNotificationItem.vue.d.ts +16 -0
- package/dist/components/QiuNotification/index.d.ts +30 -0
- package/dist/components/QiuNotification/types.d.ts +12 -0
- package/dist/components/QiuPageMain/index.vue.d.ts +27 -0
- package/dist/components/QiuPagination/index.vue.d.ts +44 -0
- package/dist/components/QiuPasswordStrength/index.vue.d.ts +9 -0
- package/dist/components/QiuQrcode/index.vue.d.ts +20 -0
- package/dist/components/QiuRadio/QiuRadioGroup.vue.d.ts +33 -0
- package/dist/components/QiuRadio/types.d.ts +8 -0
- package/dist/components/QiuRow/types.d.ts +4 -0
- package/dist/components/QiuSearchBar/index.vue.d.ts +38 -0
- package/dist/components/QiuSelect/QiuOption.vue.d.ts +24 -0
- package/dist/components/QiuSelect/index.vue.d.ts +52 -0
- package/dist/components/QiuSelect/types.d.ts +13 -0
- package/dist/components/QiuSparkline/index.vue.d.ts +18 -0
- package/dist/components/QiuStep/index.vue.d.ts +31 -0
- package/dist/components/QiuSteps/context.d.ts +21 -0
- package/dist/components/QiuSwitch/index.vue.d.ts +25 -0
- package/dist/components/QiuTabBar/index.vue.d.ts +32 -0
- package/dist/components/QiuTabBar/types.d.ts +16 -0
- package/dist/components/QiuTabPane/index.vue.d.ts +25 -0
- package/dist/components/QiuTable/columns.d.ts +1 -0
- package/dist/components/QiuTable/export.d.ts +18 -0
- package/dist/components/QiuTable/index.d.ts +3 -0
- package/dist/components/QiuTable/index.vue.d.ts +322 -0
- package/dist/components/QiuTable/registry.d.ts +39 -0
- package/dist/components/QiuTable/types.d.ts +353 -0
- package/dist/components/QiuTable/useArea.d.ts +51 -0
- package/dist/components/QiuTable/useColumns.d.ts +67 -0
- package/dist/components/QiuTable/useEdit.d.ts +36 -0
- package/dist/components/QiuTable/useExtras.d.ts +38 -0
- package/dist/components/QiuTable/useHistory.d.ts +44 -0
- package/dist/components/QiuTable/useMerge.d.ts +28 -0
- package/dist/components/QiuTable/useResize.d.ts +19 -0
- package/dist/components/QiuTable/useScrollSync.d.ts +25 -0
- package/dist/components/QiuTable/useVirtual.d.ts +30 -0
- package/dist/components/QiuTable/utils.d.ts +54 -0
- package/dist/components/QiuTime/index.vue.d.ts +43 -0
- package/dist/components/QiuTimeAgo/index.vue.d.ts +35 -0
- package/dist/components/QiuTimelineItem/index.vue.d.ts +35 -0
- package/dist/components/QiuTooltip/index.vue.d.ts +38 -0
- package/dist/components/QiuTree/types.d.ts +13 -0
- package/dist/components/QiuTrend/index.vue.d.ts +34 -0
- package/dist/components/QiuUpload/index.vue.d.ts +86 -0
- package/dist/components/QiuUploadCrop/index.vue.d.ts +136 -0
- package/dist/components/useBodyScrollLock.d.ts +4 -0
- package/dist/foucui.css +1 -0
- package/dist/foucui.js +26509 -0
- package/dist/foucui.umd.cjs +125 -0
- package/dist/index.d.ts +46 -0
- package/dist/src/bridge/@/api/media.d.ts +7 -0
- package/dist/src/bridge/@/api/notice.d.ts +5 -0
- package/dist/src/bridge/@/config/index.d.ts +29 -0
- package/dist/src/bridge/@/config/media.config.d.ts +15 -0
- package/dist/src/bridge/@/config/security.config.d.ts +7 -0
- package/dist/src/bridge/@/i18n/index.d.ts +7 -0
- package/dist/src/bridge/@/store/modules/bing.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/errorLog.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/media.d.ts +4 -0
- package/dist/src/bridge/@/store/modules/routes.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/settings.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/tabs.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/user.d.ts +3 -0
- package/dist/src/bridge/@/utils/convertToCamelCase.d.ts +2 -0
- package/dist/src/bridge/@/utils/index.d.ts +5 -0
- package/dist/src/bridge/@/utils/pageTitle.d.ts +1 -0
- package/dist/src/bridge/@/utils/routes.d.ts +11 -0
- package/dist/src/bridge/@/utils/validate.d.ts +13 -0
- package/dist/src/bridge/@qiu/plugins/shortcuts.d.ts +2 -0
- package/dist/src/i18n.d.ts +2 -0
- package/package.json +83 -0
- package/plugins/qiu.ts +83 -0
- package/plugins/shortcuts.ts +69 -0
- package/src/bridge/@/api/media.ts +8 -0
- package/src/bridge/@/api/notice.ts +5 -0
- package/src/bridge/@/config/index.ts +38 -0
- package/src/bridge/@/config/media.config.ts +37 -0
- package/src/bridge/@/config/security.config.ts +8 -0
- package/src/bridge/@/i18n/index.ts +6 -0
- package/src/bridge/@/store/modules/bing.ts +9 -0
- package/src/bridge/@/store/modules/errorLog.ts +9 -0
- package/src/bridge/@/store/modules/media.ts +10 -0
- package/src/bridge/@/store/modules/routes.ts +10 -0
- package/src/bridge/@/store/modules/settings.ts +9 -0
- package/src/bridge/@/store/modules/tabs.ts +9 -0
- package/src/bridge/@/store/modules/user.ts +9 -0
- package/src/bridge/@/utils/convertToCamelCase.ts +11 -0
- package/src/bridge/@/utils/index.ts +9 -0
- package/src/bridge/@/utils/pageTitle.ts +4 -0
- package/src/bridge/@/utils/routes.ts +14 -0
- package/src/bridge/@/utils/validate.ts +17 -0
- package/src/bridge/@qiu/plugins/shortcuts.ts +3 -0
- package/src/i18n.ts +8 -0
- package/src/icons/qiu-logo.svg +1 -0
- package/styles/dark.scss +194 -0
- package/styles/normalize.css +349 -0
- package/styles/plain.scss +423 -0
- package/styles/qiu-tokens.scss +40 -0
- package/styles/qiu.scss +1149 -0
- package/styles/technology.scss +452 -0
- package/styles/var.scss +382 -0
- package/styles/variables.scss +77 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 画布渲染器(预览 / 套打 / Banner;支持 link 热区)
|
|
4
|
+
* @author qiuye
|
|
5
|
+
* @email yjk150@qq.com
|
|
6
|
+
* @date 2026-08-16
|
|
7
|
+
*/
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
import type {
|
|
10
|
+
CanvasKitDoc,
|
|
11
|
+
CanvasKitElement,
|
|
12
|
+
CanvasKitShapeElement,
|
|
13
|
+
CanvasKitTextElement,
|
|
14
|
+
MergeContext,
|
|
15
|
+
} from './types'
|
|
16
|
+
import { mergeTemplateText, sortCanvasElements } from './modules/merge'
|
|
17
|
+
import { resolveAssetUrl } from './assetUrl'
|
|
18
|
+
|
|
19
|
+
defineOptions({ name: 'QiuCanvasRenderer' })
|
|
20
|
+
|
|
21
|
+
const CSS_MM_TO_PX = 96 / 25.4
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(
|
|
24
|
+
defineProps<{
|
|
25
|
+
doc: CanvasKitDoc | null
|
|
26
|
+
mergeData?: MergeContext | Record<string, string>
|
|
27
|
+
screenScale?: number
|
|
28
|
+
enableLinks?: boolean
|
|
29
|
+
}>(),
|
|
30
|
+
{ screenScale: 1, mergeData: () => ({}), enableLinks: true }
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const sorted = computed(() => {
|
|
34
|
+
if (!props.doc?.elements?.length) return []
|
|
35
|
+
return sortCanvasElements(props.doc.elements)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const canvasStyle = computed(() => {
|
|
39
|
+
const d = props.doc
|
|
40
|
+
if (!d?.canvas) return {}
|
|
41
|
+
const showBorder = d.canvas.showBorder !== false && d.mode !== 'banner'
|
|
42
|
+
const borderColor = d.canvas.borderColor || '#334155'
|
|
43
|
+
const bw = Number(d.canvas.borderWidthMm)
|
|
44
|
+
const borderWidthMm = Number.isFinite(bw) && bw > 0 ? bw : 0.35
|
|
45
|
+
const usePx = d.canvas.unit === 'px' || (d.mode === 'banner' && !!d.canvas.widthPx)
|
|
46
|
+
const style: Record<string, string> = {
|
|
47
|
+
width: usePx
|
|
48
|
+
? `${d.canvas.widthPx ?? Math.round(d.canvas.widthMm * CSS_MM_TO_PX)}px`
|
|
49
|
+
: `${d.canvas.widthMm}mm`,
|
|
50
|
+
height: usePx
|
|
51
|
+
? `${d.canvas.heightPx ?? Math.round(d.canvas.heightMm * CSS_MM_TO_PX)}px`
|
|
52
|
+
: `${d.canvas.heightMm}mm`,
|
|
53
|
+
position: 'relative',
|
|
54
|
+
boxSizing: 'border-box',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
backgroundColor: d.canvas.background || 'transparent',
|
|
57
|
+
border: showBorder ? `${borderWidthMm}mm solid ${borderColor}` : '0 solid transparent',
|
|
58
|
+
}
|
|
59
|
+
return style
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const backgroundImageUrl = computed(() => {
|
|
63
|
+
const src = props.doc?.canvas?.backgroundImage
|
|
64
|
+
return src ? resolveAssetUrl(src) : ''
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const wrapStyle = computed(() => ({
|
|
68
|
+
transform: `scale(${props.screenScale})`,
|
|
69
|
+
transformOrigin: 'top left',
|
|
70
|
+
}))
|
|
71
|
+
|
|
72
|
+
const layoutClipStyle = computed(() => {
|
|
73
|
+
const d = props.doc?.canvas
|
|
74
|
+
if (!d) return {}
|
|
75
|
+
const usePx = d.unit === 'px' || (props.doc?.mode === 'banner' && !!d.widthPx)
|
|
76
|
+
const w = usePx
|
|
77
|
+
? (d.widthPx ?? d.widthMm * CSS_MM_TO_PX) * props.screenScale
|
|
78
|
+
: d.widthMm * CSS_MM_TO_PX * props.screenScale
|
|
79
|
+
const h = usePx
|
|
80
|
+
? (d.heightPx ?? d.heightMm * CSS_MM_TO_PX) * props.screenScale
|
|
81
|
+
: d.heightMm * CSS_MM_TO_PX * props.screenScale
|
|
82
|
+
return {
|
|
83
|
+
width: `${w}px`,
|
|
84
|
+
height: `${h}px`,
|
|
85
|
+
overflow: 'hidden',
|
|
86
|
+
lineHeight: 0,
|
|
87
|
+
display: 'inline-block',
|
|
88
|
+
verticalAlign: 'top',
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
function textMerged(el: CanvasKitTextElement) {
|
|
93
|
+
return mergeTemplateText(el.text, props.mergeData || {})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function linkHref(el: CanvasKitElement) {
|
|
97
|
+
if (!el.link?.href) return ''
|
|
98
|
+
return mergeTemplateText(el.link.href, props.mergeData || {})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function flexForAlign(align?: string) {
|
|
102
|
+
switch (align) {
|
|
103
|
+
case 'center':
|
|
104
|
+
return { justifyContent: 'center', alignItems: 'center', textAlign: 'center' as const }
|
|
105
|
+
case 'top-center':
|
|
106
|
+
return { justifyContent: 'center', alignItems: 'flex-start', textAlign: 'center' as const }
|
|
107
|
+
case 'bottom-center':
|
|
108
|
+
return { justifyContent: 'center', alignItems: 'flex-end', textAlign: 'center' as const }
|
|
109
|
+
case 'middle-left':
|
|
110
|
+
return { justifyContent: 'flex-start', alignItems: 'center', textAlign: 'left' as const }
|
|
111
|
+
case 'middle-right':
|
|
112
|
+
return { justifyContent: 'flex-end', alignItems: 'center', textAlign: 'right' as const }
|
|
113
|
+
default:
|
|
114
|
+
return { justifyContent: 'flex-start', alignItems: 'flex-start', textAlign: 'left' as const }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function elBase(el: CanvasKitElement) {
|
|
119
|
+
const transforms: string[] = []
|
|
120
|
+
if (el.rotation) transforms.push(`rotate(${el.rotation}deg)`)
|
|
121
|
+
if (el.flipX) transforms.push('scaleX(-1)')
|
|
122
|
+
if (el.flipY) transforms.push('scaleY(-1)')
|
|
123
|
+
return {
|
|
124
|
+
position: 'absolute' as const,
|
|
125
|
+
left: `${el.xMm}mm`,
|
|
126
|
+
top: `${el.yMm}mm`,
|
|
127
|
+
width: `${el.wMm}mm`,
|
|
128
|
+
height: `${el.hMm}mm`,
|
|
129
|
+
zIndex: el.zIndex ?? 1,
|
|
130
|
+
transform: transforms.join(' ') || undefined,
|
|
131
|
+
transformOrigin: 'center center',
|
|
132
|
+
pointerEvents: props.enableLinks && el.link?.href ? ('auto' as const) : ('none' as const),
|
|
133
|
+
textDecoration: 'none' as const,
|
|
134
|
+
color: undefined as string | undefined,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function textElStyle(el: CanvasKitTextElement) {
|
|
139
|
+
const flex = flexForAlign(el.align)
|
|
140
|
+
const vertical = el.textDirection === 'vertical'
|
|
141
|
+
const base = elBase(el)
|
|
142
|
+
return {
|
|
143
|
+
...base,
|
|
144
|
+
display: 'flex',
|
|
145
|
+
...flex,
|
|
146
|
+
fontSize: `${el.fontSize}pt`,
|
|
147
|
+
fontFamily: el.fontFamily,
|
|
148
|
+
color: el.color,
|
|
149
|
+
lineHeight: 1.25,
|
|
150
|
+
whiteSpace: 'pre-wrap' as const,
|
|
151
|
+
wordBreak: 'break-word' as const,
|
|
152
|
+
overflow: 'hidden',
|
|
153
|
+
writingMode: vertical ? ('vertical-rl' as const) : ('horizontal-tb' as const),
|
|
154
|
+
textOrientation: vertical ? ('upright' as const) : ('mixed' as const),
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function imgElStyle(el: CanvasKitElement) {
|
|
159
|
+
if (el.type !== 'image' && el.type !== 'seal') return {}
|
|
160
|
+
return {
|
|
161
|
+
...elBase(el),
|
|
162
|
+
display: 'flex',
|
|
163
|
+
justifyContent: 'center',
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
padding: '0.5mm',
|
|
166
|
+
boxSizing: 'border-box' as const,
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function shapeElStyle(el: CanvasKitShapeElement) {
|
|
171
|
+
return {
|
|
172
|
+
...elBase(el),
|
|
173
|
+
boxSizing: 'border-box' as const,
|
|
174
|
+
opacity: el.opacity != null ? String(el.opacity) : undefined,
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function shapeStroke(el: CanvasKitShapeElement) {
|
|
179
|
+
return el.showStroke === false ? 'none' : el.strokeColor || '#606266'
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function shapeStrokeWidth(el: CanvasKitShapeElement) {
|
|
183
|
+
return Math.max(0, Number(el.strokeWidthMm ?? 0.6))
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function shapeFill(el: CanvasKitShapeElement) {
|
|
187
|
+
return el.background || 'transparent'
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function polygonPoints(el: CanvasKitShapeElement) {
|
|
191
|
+
const sides = Math.max(3, Math.min(12, Math.round(Number(el.polygonSides ?? 5))))
|
|
192
|
+
const pts: string[] = []
|
|
193
|
+
for (let i = 0; i < sides; i++) {
|
|
194
|
+
const angle = -Math.PI / 2 + (Math.PI * 2 * i) / sides
|
|
195
|
+
pts.push(`${50 + Math.cos(angle) * 44},${50 + Math.sin(angle) * 44}`)
|
|
196
|
+
}
|
|
197
|
+
return pts.join(' ')
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<template>
|
|
202
|
+
<div v-if="doc?.canvas" class="qck-layout-clip" :style="layoutClipStyle">
|
|
203
|
+
<div class="qck-screen-wrap" :style="wrapStyle">
|
|
204
|
+
<div class="qiu-canvas-root qck-print-root" :style="canvasStyle">
|
|
205
|
+
<img
|
|
206
|
+
v-if="backgroundImageUrl"
|
|
207
|
+
class="qiu-canvas-bg"
|
|
208
|
+
:src="backgroundImageUrl"
|
|
209
|
+
alt=""
|
|
210
|
+
crossorigin="anonymous"
|
|
211
|
+
/>
|
|
212
|
+
<div
|
|
213
|
+
v-for="region in doc.regions || []"
|
|
214
|
+
:key="region.id"
|
|
215
|
+
class="qiu-canvas-region"
|
|
216
|
+
:style="{
|
|
217
|
+
left: `${region.xMm}mm`,
|
|
218
|
+
top: `${region.yMm}mm`,
|
|
219
|
+
width: `${region.wMm}mm`,
|
|
220
|
+
height: `${region.hMm}mm`,
|
|
221
|
+
backgroundColor: region.background || 'transparent',
|
|
222
|
+
backgroundImage: region.backgroundImage
|
|
223
|
+
? `url(${resolveAssetUrl(region.backgroundImage)})`
|
|
224
|
+
: undefined,
|
|
225
|
+
backgroundSize: region.backgroundImage ? 'cover' : undefined,
|
|
226
|
+
backgroundPosition: region.backgroundImage ? 'center' : undefined,
|
|
227
|
+
}"
|
|
228
|
+
/>
|
|
229
|
+
<template v-for="el in sorted" :key="el.id">
|
|
230
|
+
<component
|
|
231
|
+
:is="enableLinks && linkHref(el) ? 'a' : 'div'"
|
|
232
|
+
v-if="el.type === 'text'"
|
|
233
|
+
:href="enableLinks && linkHref(el) ? linkHref(el) : undefined"
|
|
234
|
+
:target="el.link?.target || '_blank'"
|
|
235
|
+
:rel="el.link?.target === '_self' ? undefined : 'noopener noreferrer'"
|
|
236
|
+
:style="textElStyle(el)"
|
|
237
|
+
>
|
|
238
|
+
{{ textMerged(el) }}
|
|
239
|
+
</component>
|
|
240
|
+
<component
|
|
241
|
+
:is="enableLinks && linkHref(el) ? 'a' : 'div'"
|
|
242
|
+
v-else-if="el.type === 'image' || el.type === 'seal'"
|
|
243
|
+
:href="enableLinks && linkHref(el) ? linkHref(el) : undefined"
|
|
244
|
+
:target="el.link?.target || '_blank'"
|
|
245
|
+
:rel="el.link?.target === '_self' ? undefined : 'noopener noreferrer'"
|
|
246
|
+
:style="imgElStyle(el)"
|
|
247
|
+
>
|
|
248
|
+
<img
|
|
249
|
+
:src="resolveAssetUrl(el.src)"
|
|
250
|
+
alt=""
|
|
251
|
+
style="max-width: 100%; max-height: 100%; object-fit: contain"
|
|
252
|
+
/>
|
|
253
|
+
</component>
|
|
254
|
+
<component
|
|
255
|
+
:is="enableLinks && linkHref(el) ? 'a' : 'div'"
|
|
256
|
+
v-else-if="el.type === 'shape'"
|
|
257
|
+
:href="enableLinks && linkHref(el) ? linkHref(el) : undefined"
|
|
258
|
+
:target="el.link?.target || '_blank'"
|
|
259
|
+
:rel="el.link?.target === '_self' ? undefined : 'noopener noreferrer'"
|
|
260
|
+
:style="shapeElStyle(el)"
|
|
261
|
+
>
|
|
262
|
+
<svg class="qiu-canvas-shape-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
|
|
263
|
+
<line
|
|
264
|
+
v-if="el.shape === 'line'"
|
|
265
|
+
x1="4"
|
|
266
|
+
y1="50"
|
|
267
|
+
x2="96"
|
|
268
|
+
y2="50"
|
|
269
|
+
:stroke="shapeStroke(el)"
|
|
270
|
+
:stroke-width="Math.max(shapeStrokeWidth(el) * 3.2, 1)"
|
|
271
|
+
stroke-linecap="round"
|
|
272
|
+
/>
|
|
273
|
+
<rect
|
|
274
|
+
v-else-if="el.shape === 'rect'"
|
|
275
|
+
x="4"
|
|
276
|
+
y="4"
|
|
277
|
+
width="92"
|
|
278
|
+
height="92"
|
|
279
|
+
:fill="shapeFill(el)"
|
|
280
|
+
:stroke="shapeStroke(el)"
|
|
281
|
+
:stroke-width="shapeStrokeWidth(el) * 3.2"
|
|
282
|
+
/>
|
|
283
|
+
<ellipse
|
|
284
|
+
v-else-if="el.shape === 'circle'"
|
|
285
|
+
cx="50"
|
|
286
|
+
cy="50"
|
|
287
|
+
rx="46"
|
|
288
|
+
ry="46"
|
|
289
|
+
:fill="shapeFill(el)"
|
|
290
|
+
:stroke="shapeStroke(el)"
|
|
291
|
+
:stroke-width="shapeStrokeWidth(el) * 3.2"
|
|
292
|
+
/>
|
|
293
|
+
<polygon
|
|
294
|
+
v-else-if="el.shape === 'triangle'"
|
|
295
|
+
points="50,4 96,96 4,96"
|
|
296
|
+
:fill="shapeFill(el)"
|
|
297
|
+
:stroke="shapeStroke(el)"
|
|
298
|
+
:stroke-width="shapeStrokeWidth(el) * 3.2"
|
|
299
|
+
stroke-linejoin="round"
|
|
300
|
+
/>
|
|
301
|
+
<polygon
|
|
302
|
+
v-else
|
|
303
|
+
:points="polygonPoints(el)"
|
|
304
|
+
:fill="shapeFill(el)"
|
|
305
|
+
:stroke="shapeStroke(el)"
|
|
306
|
+
:stroke-width="shapeStrokeWidth(el) * 3.2"
|
|
307
|
+
stroke-linejoin="round"
|
|
308
|
+
/>
|
|
309
|
+
</svg>
|
|
310
|
+
</component>
|
|
311
|
+
</template>
|
|
312
|
+
</div>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</template>
|
|
316
|
+
|
|
317
|
+
<style scoped>
|
|
318
|
+
.qck-layout-clip {
|
|
319
|
+
box-sizing: border-box;
|
|
320
|
+
}
|
|
321
|
+
.qck-screen-wrap {
|
|
322
|
+
display: inline-block;
|
|
323
|
+
}
|
|
324
|
+
.qiu-canvas-root {
|
|
325
|
+
border: 1px solid #dcdfe6;
|
|
326
|
+
}
|
|
327
|
+
.qiu-canvas-bg {
|
|
328
|
+
position: absolute;
|
|
329
|
+
inset: 0;
|
|
330
|
+
width: 100%;
|
|
331
|
+
height: 100%;
|
|
332
|
+
object-fit: cover;
|
|
333
|
+
pointer-events: none;
|
|
334
|
+
user-select: none;
|
|
335
|
+
z-index: 0;
|
|
336
|
+
}
|
|
337
|
+
.qiu-canvas-region {
|
|
338
|
+
position: absolute;
|
|
339
|
+
box-sizing: border-box;
|
|
340
|
+
pointer-events: none;
|
|
341
|
+
z-index: 0;
|
|
342
|
+
}
|
|
343
|
+
.qiu-canvas-shape-svg {
|
|
344
|
+
width: 100%;
|
|
345
|
+
height: 100%;
|
|
346
|
+
display: block;
|
|
347
|
+
}
|
|
348
|
+
</style>
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* 数据模块配置面板:启用/增删字段、插入 {{module.key}}、预览样例
|
|
4
|
+
* @author qiuye
|
|
5
|
+
* @email yjk150@qq.com
|
|
6
|
+
* @date 2026-08-16
|
|
7
|
+
*/
|
|
8
|
+
import { computed, ref, watch } from 'vue'
|
|
9
|
+
import type { DataModuleDef } from '../types'
|
|
10
|
+
import {
|
|
11
|
+
createCustomModule,
|
|
12
|
+
listInsertableFields,
|
|
13
|
+
resolveDataModules,
|
|
14
|
+
sampleContextFromModules,
|
|
15
|
+
} from '../modules/dataRegistry'
|
|
16
|
+
|
|
17
|
+
defineOptions({ name: 'QiuCanvasDataModulesPanel' })
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
modelValue: DataModuleDef[]
|
|
21
|
+
extraModules?: DataModuleDef[]
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits<{
|
|
25
|
+
'update:modelValue': [DataModuleDef[]]
|
|
26
|
+
insert: [token: string, meta: { moduleId: string; key: string; label: string }]
|
|
27
|
+
'preview-context': [ctx: Record<string, Record<string, string> | string>]
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const activeId = ref('')
|
|
31
|
+
const previewJson = ref('')
|
|
32
|
+
const showLabel = ref(true)
|
|
33
|
+
|
|
34
|
+
const modules = computed({
|
|
35
|
+
get: () => resolveDataModules(props.extraModules, props.modelValue),
|
|
36
|
+
set: (v) => emit('update:modelValue', v),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
watch(
|
|
40
|
+
modules,
|
|
41
|
+
(list) => {
|
|
42
|
+
if (!activeId.value && list[0]) activeId.value = list[0].id
|
|
43
|
+
if (activeId.value && !list.find((m) => m.id === activeId.value)) {
|
|
44
|
+
activeId.value = list[0]?.id || ''
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{ immediate: true, deep: true }
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const active = computed(() => modules.value.find((m) => m.id === activeId.value) || null)
|
|
51
|
+
|
|
52
|
+
const fieldRows = computed(() => listInsertableFields(modules.value))
|
|
53
|
+
|
|
54
|
+
function patchModules(next: DataModuleDef[]) {
|
|
55
|
+
emit('update:modelValue', next)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function toggleEnabled(m: DataModuleDef, enabled: boolean) {
|
|
59
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
60
|
+
const idx = base.findIndex((x) => x.id === m.id)
|
|
61
|
+
if (idx >= 0) {
|
|
62
|
+
base[idx] = { ...base[idx], enabled }
|
|
63
|
+
} else {
|
|
64
|
+
base.push({ ...m, enabled })
|
|
65
|
+
}
|
|
66
|
+
patchModules(base)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function addModule() {
|
|
70
|
+
const m = createCustomModule('自定义模块')
|
|
71
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
72
|
+
base.push(m)
|
|
73
|
+
patchModules(base)
|
|
74
|
+
activeId.value = m.id
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function removeModule(m: DataModuleDef) {
|
|
78
|
+
if (m.builtin) return
|
|
79
|
+
const base = (props.modelValue || []).filter((x) => x.id !== m.id)
|
|
80
|
+
patchModules(base)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function addField() {
|
|
84
|
+
if (!active.value) return
|
|
85
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
86
|
+
let idx = base.findIndex((x) => x.id === active.value!.id)
|
|
87
|
+
if (idx < 0) {
|
|
88
|
+
base.push({ ...active.value })
|
|
89
|
+
idx = base.length - 1
|
|
90
|
+
}
|
|
91
|
+
const key = `field_${Date.now().toString(36).slice(-4)}`
|
|
92
|
+
base[idx] = {
|
|
93
|
+
...base[idx],
|
|
94
|
+
fields: [...base[idx].fields, { key, label: '新字段', type: 'string' }],
|
|
95
|
+
sample: { ...(base[idx].sample || {}), [key]: '样例' },
|
|
96
|
+
}
|
|
97
|
+
patchModules(base)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function updateField(i: number, patch: Partial<{ key: string; label: string }>) {
|
|
101
|
+
if (!active.value) return
|
|
102
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
103
|
+
let idx = base.findIndex((x) => x.id === active.value!.id)
|
|
104
|
+
if (idx < 0) {
|
|
105
|
+
base.push({ ...active.value })
|
|
106
|
+
idx = base.length - 1
|
|
107
|
+
}
|
|
108
|
+
const fields = base[idx].fields.map((f, j) => (j === i ? { ...f, ...patch } : f))
|
|
109
|
+
base[idx] = { ...base[idx], fields }
|
|
110
|
+
patchModules(base)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function updateSample(key: string, val: string) {
|
|
114
|
+
if (!active.value) return
|
|
115
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
116
|
+
let idx = base.findIndex((x) => x.id === active.value!.id)
|
|
117
|
+
if (idx < 0) {
|
|
118
|
+
base.push({ ...active.value })
|
|
119
|
+
idx = base.length - 1
|
|
120
|
+
}
|
|
121
|
+
base[idx] = {
|
|
122
|
+
...base[idx],
|
|
123
|
+
sample: { ...(base[idx].sample || {}), [key]: val },
|
|
124
|
+
}
|
|
125
|
+
patchModules(base)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function insertField(row: { moduleId: string; key: string; label: string; token: string }) {
|
|
129
|
+
const token = showLabel.value ? `${row.label}:${row.token}` : row.token
|
|
130
|
+
emit('insert', token, { moduleId: row.moduleId, key: row.key, label: row.label })
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function applyPreview() {
|
|
134
|
+
let ctx = sampleContextFromModules(modules.value)
|
|
135
|
+
if (previewJson.value.trim()) {
|
|
136
|
+
try {
|
|
137
|
+
const parsed = JSON.parse(previewJson.value)
|
|
138
|
+
ctx = { ...ctx, ...parsed }
|
|
139
|
+
} catch {
|
|
140
|
+
/* ignore */
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
emit('preview-context', ctx)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function renameActive(label: string) {
|
|
147
|
+
if (!active.value) return
|
|
148
|
+
const base = props.modelValue?.length ? [...props.modelValue] : resolveDataModules(props.extraModules)
|
|
149
|
+
let idx = base.findIndex((x) => x.id === active.value!.id)
|
|
150
|
+
if (idx < 0) {
|
|
151
|
+
base.push({ ...active.value, label })
|
|
152
|
+
} else {
|
|
153
|
+
base[idx] = { ...base[idx], label }
|
|
154
|
+
}
|
|
155
|
+
patchModules(base)
|
|
156
|
+
}
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<template>
|
|
160
|
+
<div class="qck-data-modules">
|
|
161
|
+
<div class="qck-dm-head">
|
|
162
|
+
<span class="qck-dm-title">数据模块</span>
|
|
163
|
+
<qiu-button size="small" type="primary" plain @click="addModule">添加模块</qiu-button>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="qck-dm-list">
|
|
166
|
+
<button
|
|
167
|
+
v-for="m in modules"
|
|
168
|
+
:key="m.id"
|
|
169
|
+
type="button"
|
|
170
|
+
class="qck-dm-chip"
|
|
171
|
+
:class="{ active: m.id === activeId, off: m.enabled === false }"
|
|
172
|
+
@click="activeId = m.id"
|
|
173
|
+
>
|
|
174
|
+
<qiu-switch
|
|
175
|
+
:model-value="m.enabled !== false"
|
|
176
|
+
size="small"
|
|
177
|
+
@click.stop
|
|
178
|
+
@update:model-value="(v: boolean) => toggleEnabled(m, v)"
|
|
179
|
+
/>
|
|
180
|
+
<span>{{ m.label }}</span>
|
|
181
|
+
</button>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
<template v-if="active">
|
|
185
|
+
<div class="qck-dm-row">
|
|
186
|
+
<span class="label">模块名</span>
|
|
187
|
+
<qiu-input
|
|
188
|
+
:model-value="active.label"
|
|
189
|
+
size="small"
|
|
190
|
+
:disabled="!!active.builtin"
|
|
191
|
+
@update:model-value="renameActive"
|
|
192
|
+
/>
|
|
193
|
+
<qiu-button
|
|
194
|
+
v-if="!active.builtin"
|
|
195
|
+
size="small"
|
|
196
|
+
type="danger"
|
|
197
|
+
link
|
|
198
|
+
@click="removeModule(active)"
|
|
199
|
+
>
|
|
200
|
+
删除
|
|
201
|
+
</qiu-button>
|
|
202
|
+
</div>
|
|
203
|
+
<div class="qck-dm-fields">
|
|
204
|
+
<div class="qck-dm-field-head">
|
|
205
|
+
<span>字段</span>
|
|
206
|
+
<qiu-button size="small" @click="addField">增字段</qiu-button>
|
|
207
|
+
</div>
|
|
208
|
+
<div v-for="(f, i) in active.fields" :key="`${active.id}-${i}-${f.key}`" class="qck-dm-field">
|
|
209
|
+
<qiu-input
|
|
210
|
+
:model-value="f.key"
|
|
211
|
+
size="small"
|
|
212
|
+
placeholder="key"
|
|
213
|
+
@update:model-value="(v: string) => updateField(i, { key: v })"
|
|
214
|
+
/>
|
|
215
|
+
<qiu-input
|
|
216
|
+
:model-value="f.label"
|
|
217
|
+
size="small"
|
|
218
|
+
placeholder="标签"
|
|
219
|
+
@update:model-value="(v: string) => updateField(i, { label: v })"
|
|
220
|
+
/>
|
|
221
|
+
<qiu-input
|
|
222
|
+
:model-value="active.sample?.[f.key] || ''"
|
|
223
|
+
size="small"
|
|
224
|
+
placeholder="样例"
|
|
225
|
+
@update:model-value="(v: string) => updateSample(f.key, v)"
|
|
226
|
+
/>
|
|
227
|
+
<qiu-button
|
|
228
|
+
size="small"
|
|
229
|
+
type="primary"
|
|
230
|
+
link
|
|
231
|
+
@click="
|
|
232
|
+
insertField({
|
|
233
|
+
moduleId: active.id,
|
|
234
|
+
key: f.key,
|
|
235
|
+
label: f.label,
|
|
236
|
+
token: `{{${active.id}.${f.key}}}`,
|
|
237
|
+
})
|
|
238
|
+
"
|
|
239
|
+
>
|
|
240
|
+
插入
|
|
241
|
+
</qiu-button>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
</template>
|
|
245
|
+
|
|
246
|
+
<div class="qck-dm-insert">
|
|
247
|
+
<div class="qck-dm-row">
|
|
248
|
+
<span class="label">插入带标签</span>
|
|
249
|
+
<qiu-switch v-model="showLabel" size="small" />
|
|
250
|
+
</div>
|
|
251
|
+
<div class="qck-dm-quick">
|
|
252
|
+
<qiu-button
|
|
253
|
+
v-for="row in fieldRows.slice(0, 12)"
|
|
254
|
+
:key="row.token"
|
|
255
|
+
size="small"
|
|
256
|
+
@click="insertField(row)"
|
|
257
|
+
>
|
|
258
|
+
{{ row.moduleLabel }}.{{ row.label }}
|
|
259
|
+
</qiu-button>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div class="qck-dm-preview">
|
|
264
|
+
<div class="qck-dm-field-head">
|
|
265
|
+
<span>预览数据(JSON)</span>
|
|
266
|
+
<qiu-button size="small" type="primary" @click="applyPreview">应用到画布</qiu-button>
|
|
267
|
+
</div>
|
|
268
|
+
<qiu-input
|
|
269
|
+
v-model="previewJson"
|
|
270
|
+
type="textarea"
|
|
271
|
+
:rows="4"
|
|
272
|
+
placeholder='{"student":{"name":"李四"},"classroom":{"name":"教室A"}}'
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</template>
|
|
277
|
+
|
|
278
|
+
<style scoped>
|
|
279
|
+
.qck-data-modules {
|
|
280
|
+
display: flex;
|
|
281
|
+
flex-direction: column;
|
|
282
|
+
gap: 10px;
|
|
283
|
+
font-size: 12px;
|
|
284
|
+
}
|
|
285
|
+
.qck-dm-head {
|
|
286
|
+
display: flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
justify-content: space-between;
|
|
289
|
+
}
|
|
290
|
+
.qck-dm-title {
|
|
291
|
+
font-weight: 600;
|
|
292
|
+
color: #0f172a;
|
|
293
|
+
}
|
|
294
|
+
.qck-dm-list {
|
|
295
|
+
display: flex;
|
|
296
|
+
flex-wrap: wrap;
|
|
297
|
+
gap: 6px;
|
|
298
|
+
}
|
|
299
|
+
.qck-dm-chip {
|
|
300
|
+
display: inline-flex;
|
|
301
|
+
align-items: center;
|
|
302
|
+
gap: 6px;
|
|
303
|
+
border: 1px solid #e2e8f0;
|
|
304
|
+
background: #fff;
|
|
305
|
+
border-radius: 6px;
|
|
306
|
+
padding: 4px 8px;
|
|
307
|
+
cursor: pointer;
|
|
308
|
+
}
|
|
309
|
+
.qck-dm-chip.active {
|
|
310
|
+
border-color: #0d9488;
|
|
311
|
+
background: #f0fdfa;
|
|
312
|
+
}
|
|
313
|
+
.qck-dm-chip.off {
|
|
314
|
+
opacity: 0.55;
|
|
315
|
+
}
|
|
316
|
+
.qck-dm-row {
|
|
317
|
+
display: flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
gap: 8px;
|
|
320
|
+
}
|
|
321
|
+
.qck-dm-row .label {
|
|
322
|
+
color: #64748b;
|
|
323
|
+
min-width: 64px;
|
|
324
|
+
}
|
|
325
|
+
.qck-dm-fields {
|
|
326
|
+
display: flex;
|
|
327
|
+
flex-direction: column;
|
|
328
|
+
gap: 6px;
|
|
329
|
+
}
|
|
330
|
+
.qck-dm-field-head {
|
|
331
|
+
display: flex;
|
|
332
|
+
justify-content: space-between;
|
|
333
|
+
align-items: center;
|
|
334
|
+
color: #475569;
|
|
335
|
+
}
|
|
336
|
+
.qck-dm-field {
|
|
337
|
+
display: grid;
|
|
338
|
+
grid-template-columns: 1fr 1fr 1fr auto;
|
|
339
|
+
gap: 4px;
|
|
340
|
+
align-items: center;
|
|
341
|
+
}
|
|
342
|
+
.qck-dm-quick {
|
|
343
|
+
display: flex;
|
|
344
|
+
flex-wrap: wrap;
|
|
345
|
+
gap: 4px;
|
|
346
|
+
}
|
|
347
|
+
.qck-dm-preview {
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
gap: 6px;
|
|
351
|
+
}
|
|
352
|
+
</style>
|