@yh-ui/components 0.1.10 → 0.1.15
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/ai-action-group/__tests__/ai-action-group.ssr.test.cjs +55 -0
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.d.ts +1 -0
- package/dist/ai-action-group/__tests__/ai-action-group.ssr.test.mjs +39 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.cjs +149 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.d.ts +1 -0
- package/dist/ai-action-group/__tests__/ai-action-group.test.mjs +104 -0
- package/dist/ai-action-group/index.cjs +26 -0
- package/dist/ai-action-group/index.d.ts +3 -0
- package/dist/ai-action-group/index.mjs +5 -0
- package/dist/ai-action-group/src/ai-action-group.cjs +50 -0
- package/dist/ai-action-group/src/ai-action-group.css +517 -0
- package/dist/ai-action-group/src/ai-action-group.d.ts +55 -0
- package/dist/ai-action-group/src/ai-action-group.d.vue.ts +40 -0
- package/dist/ai-action-group/src/ai-action-group.mjs +44 -0
- package/dist/ai-action-group/src/ai-action-group.vue +602 -0
- package/dist/ai-action-group/src/ai-action-group.vue.d.ts +40 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.cjs +61 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.d.ts +1 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.ssr.test.mjs +65 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.cjs +70 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.d.ts +1 -0
- package/dist/ai-agent-card/__tests__/ai-agent-card.test.mjs +64 -0
- package/dist/ai-agent-card/index.cjs +26 -0
- package/dist/ai-agent-card/index.d.ts +3 -0
- package/dist/ai-agent-card/index.mjs +5 -0
- package/dist/ai-agent-card/src/ai-agent-card.cjs +74 -0
- package/dist/ai-agent-card/src/ai-agent-card.css +859 -0
- package/dist/ai-agent-card/src/ai-agent-card.d.ts +122 -0
- package/dist/ai-agent-card/src/ai-agent-card.d.vue.ts +62 -0
- package/dist/ai-agent-card/src/ai-agent-card.mjs +68 -0
- package/dist/ai-agent-card/src/ai-agent-card.vue +1029 -0
- package/dist/ai-agent-card/src/ai-agent-card.vue.d.ts +62 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.cjs +73 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.d.ts +1 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.ssr.test.mjs +68 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.cjs +128 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.d.ts +1 -0
- package/dist/ai-artifacts/__tests__/ai-artifacts.test.mjs +109 -0
- package/dist/ai-artifacts/index.cjs +26 -0
- package/dist/ai-artifacts/index.d.ts +3 -0
- package/dist/ai-artifacts/index.mjs +5 -0
- package/dist/ai-artifacts/src/ai-artifacts.cjs +55 -0
- package/dist/ai-artifacts/src/ai-artifacts.css +633 -0
- package/dist/ai-artifacts/src/ai-artifacts.d.ts +93 -0
- package/dist/ai-artifacts/src/ai-artifacts.d.vue.ts +50 -0
- package/dist/ai-artifacts/src/ai-artifacts.mjs +49 -0
- package/dist/ai-artifacts/src/ai-artifacts.vue +831 -0
- package/dist/ai-artifacts/src/ai-artifacts.vue.d.ts +50 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.cjs +87 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.d.ts +1 -0
- package/dist/ai-bubble/__tests__/ai-bubble.ssr.test.mjs +58 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.cjs +227 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.d.ts +1 -0
- package/dist/ai-bubble/__tests__/ai-bubble.test.mjs +123 -0
- package/dist/ai-bubble/index.cjs +26 -0
- package/dist/ai-bubble/index.d.ts +3 -0
- package/dist/ai-bubble/index.mjs +5 -0
- package/dist/ai-bubble/src/ai-bubble.cjs +86 -0
- package/dist/ai-bubble/src/ai-bubble.css +932 -0
- package/dist/ai-bubble/src/ai-bubble.d.ts +126 -0
- package/dist/ai-bubble/src/ai-bubble.d.vue.ts +110 -0
- package/dist/ai-bubble/src/ai-bubble.mjs +80 -0
- package/dist/ai-bubble/src/ai-bubble.vue +1300 -0
- package/dist/ai-bubble/src/ai-bubble.vue.d.ts +110 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.cjs +82 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.d.ts +1 -0
- package/dist/ai-chat/__tests__/ai-chat.ssr.test.mjs +69 -0
- package/dist/ai-chat/__tests__/ai-chat.test.cjs +169 -0
- package/dist/ai-chat/__tests__/ai-chat.test.d.ts +1 -0
- package/dist/ai-chat/__tests__/ai-chat.test.mjs +121 -0
- package/dist/ai-chat/index.cjs +26 -0
- package/dist/ai-chat/index.d.ts +3 -0
- package/dist/ai-chat/index.mjs +5 -0
- package/dist/ai-chat/src/ai-chat.cjs +41 -0
- package/dist/ai-chat/src/ai-chat.css +503 -0
- package/dist/ai-chat/src/ai-chat.d.ts +57 -0
- package/dist/ai-chat/src/ai-chat.d.vue.ts +43 -0
- package/dist/ai-chat/src/ai-chat.mjs +35 -0
- package/dist/ai-chat/src/ai-chat.vue +606 -0
- package/dist/ai-chat/src/ai-chat.vue.d.ts +43 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.cjs +66 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.d.ts +1 -0
- package/dist/ai-code-block/__tests__/ai-code-block.ssr.test.mjs +48 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.cjs +174 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.d.ts +1 -0
- package/dist/ai-code-block/__tests__/ai-code-block.test.mjs +108 -0
- package/dist/ai-code-block/index.cjs +26 -0
- package/dist/ai-code-block/index.d.ts +3 -0
- package/dist/ai-code-block/index.mjs +5 -0
- package/dist/ai-code-block/src/ai-code-block.cjs +79 -0
- package/dist/ai-code-block/src/ai-code-block.css +589 -0
- package/dist/ai-code-block/src/ai-code-block.d.ts +76 -0
- package/dist/ai-code-block/src/ai-code-block.d.vue.ts +63 -0
- package/dist/ai-code-block/src/ai-code-block.mjs +73 -0
- package/dist/ai-code-block/src/ai-code-block.vue +706 -0
- package/dist/ai-code-block/src/ai-code-block.vue.d.ts +63 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.cjs +50 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.d.ts +1 -0
- package/dist/ai-conversations/__tests__/ai-conversations.ssr.test.mjs +42 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.cjs +67 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.d.ts +1 -0
- package/dist/ai-conversations/__tests__/ai-conversations.test.mjs +51 -0
- package/dist/ai-conversations/index.cjs +26 -0
- package/dist/ai-conversations/index.d.ts +3 -0
- package/dist/ai-conversations/index.mjs +5 -0
- package/dist/ai-conversations/src/ai-conversations.cjs +69 -0
- package/dist/ai-conversations/src/ai-conversations.css +679 -0
- package/dist/ai-conversations/src/ai-conversations.d.ts +67 -0
- package/dist/ai-conversations/src/ai-conversations.d.vue.ts +52 -0
- package/dist/ai-conversations/src/ai-conversations.mjs +63 -0
- package/dist/ai-conversations/src/ai-conversations.vue +949 -0
- package/dist/ai-conversations/src/ai-conversations.vue.d.ts +52 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.cjs +62 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.d.ts +1 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.ssr.test.mjs +50 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.cjs +315 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.d.ts +1 -0
- package/dist/ai-editor-sender/__tests__/ai-editor-sender.test.mjs +226 -0
- package/dist/ai-editor-sender/index.cjs +26 -0
- package/dist/ai-editor-sender/index.d.ts +3 -0
- package/dist/ai-editor-sender/index.mjs +5 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.cjs +66 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.css +566 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.d.ts +70 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.d.vue.ts +70 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.mjs +60 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.vue +713 -0
- package/dist/ai-editor-sender/src/ai-editor-sender.vue.d.ts +70 -0
- package/dist/ai-mention/__tests__/ai-mention.ssr.test.cjs +38 -0
- package/dist/ai-mention/__tests__/ai-mention.ssr.test.d.ts +1 -0
- package/dist/ai-mention/__tests__/ai-mention.ssr.test.mjs +37 -0
- package/dist/ai-mention/__tests__/ai-mention.test.cjs +113 -0
- package/dist/ai-mention/__tests__/ai-mention.test.d.ts +1 -0
- package/dist/ai-mention/__tests__/ai-mention.test.mjs +84 -0
- package/dist/ai-mention/index.cjs +26 -0
- package/dist/ai-mention/index.d.ts +29 -0
- package/dist/ai-mention/index.mjs +5 -0
- package/dist/ai-mention/src/ai-mention.cjs +95 -0
- package/dist/ai-mention/src/ai-mention.css +545 -0
- package/dist/ai-mention/src/ai-mention.d.ts +99 -0
- package/dist/ai-mention/src/ai-mention.d.vue.ts +68 -0
- package/dist/ai-mention/src/ai-mention.mjs +89 -0
- package/dist/ai-mention/src/ai-mention.vue +650 -0
- package/dist/ai-mention/src/ai-mention.vue.d.ts +68 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.cjs +49 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.d.ts +1 -0
- package/dist/ai-prompts/__tests__/ai-prompts.ssr.test.mjs +41 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.cjs +54 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.d.ts +1 -0
- package/dist/ai-prompts/__tests__/ai-prompts.test.mjs +38 -0
- package/dist/ai-prompts/index.cjs +26 -0
- package/dist/ai-prompts/index.d.ts +3 -0
- package/dist/ai-prompts/index.mjs +5 -0
- package/dist/ai-prompts/src/ai-prompts.cjs +42 -0
- package/dist/ai-prompts/src/ai-prompts.css +572 -0
- package/dist/ai-prompts/src/ai-prompts.d.ts +45 -0
- package/dist/ai-prompts/src/ai-prompts.d.vue.ts +44 -0
- package/dist/ai-prompts/src/ai-prompts.mjs +36 -0
- package/dist/ai-prompts/src/ai-prompts.vue +646 -0
- package/dist/ai-prompts/src/ai-prompts.vue.d.ts +44 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.cjs +33 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.d.ts +1 -0
- package/dist/ai-provider/__tests__/ai-provider.ssr.test.mjs +34 -0
- package/dist/ai-provider/__tests__/ai-provider.test.cjs +38 -0
- package/dist/ai-provider/__tests__/ai-provider.test.d.ts +1 -0
- package/dist/ai-provider/__tests__/ai-provider.test.mjs +33 -0
- package/dist/ai-provider/index.cjs +38 -0
- package/dist/ai-provider/index.d.ts +4 -0
- package/dist/ai-provider/index.mjs +6 -0
- package/dist/ai-provider/src/ai-provider.cjs +7 -0
- package/dist/ai-provider/src/ai-provider.d.ts +88 -0
- package/dist/ai-provider/src/ai-provider.d.vue.ts +48 -0
- package/dist/ai-provider/src/ai-provider.mjs +1 -0
- package/dist/ai-provider/src/ai-provider.vue +24 -0
- package/dist/ai-provider/src/ai-provider.vue.d.ts +48 -0
- package/dist/ai-provider/src/use-ai-provider.cjs +11 -0
- package/dist/ai-provider/src/use-ai-provider.d.ts +10 -0
- package/dist/ai-provider/src/use-ai-provider.mjs +5 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.cjs +46 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.d.ts +1 -0
- package/dist/ai-sender/__tests__/ai-sender.ssr.test.mjs +37 -0
- package/dist/ai-sender/__tests__/ai-sender.test.cjs +395 -0
- package/dist/ai-sender/__tests__/ai-sender.test.d.ts +1 -0
- package/dist/ai-sender/__tests__/ai-sender.test.mjs +255 -0
- package/dist/ai-sender/index.cjs +26 -0
- package/dist/ai-sender/index.d.ts +3 -0
- package/dist/ai-sender/index.mjs +5 -0
- package/dist/ai-sender/src/ai-sender.cjs +98 -0
- package/dist/ai-sender/src/ai-sender.css +754 -0
- package/dist/ai-sender/src/ai-sender.d.ts +147 -0
- package/dist/ai-sender/src/ai-sender.d.vue.ts +74 -0
- package/dist/ai-sender/src/ai-sender.mjs +92 -0
- package/dist/ai-sender/src/ai-sender.vue +1039 -0
- package/dist/ai-sender/src/ai-sender.vue.d.ts +74 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.cjs +72 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.d.ts +1 -0
- package/dist/ai-sources/__tests__/ai-sources.ssr.test.mjs +82 -0
- package/dist/ai-sources/__tests__/ai-sources.test.cjs +93 -0
- package/dist/ai-sources/__tests__/ai-sources.test.d.ts +1 -0
- package/dist/ai-sources/__tests__/ai-sources.test.mjs +89 -0
- package/dist/ai-sources/index.cjs +26 -0
- package/dist/ai-sources/index.d.ts +3 -0
- package/dist/ai-sources/index.mjs +5 -0
- package/dist/ai-sources/src/ai-sources.cjs +59 -0
- package/dist/ai-sources/src/ai-sources.css +830 -0
- package/dist/ai-sources/src/ai-sources.d.ts +79 -0
- package/dist/ai-sources/src/ai-sources.d.vue.ts +45 -0
- package/dist/ai-sources/src/ai-sources.mjs +53 -0
- package/dist/ai-sources/src/ai-sources.vue +1093 -0
- package/dist/ai-sources/src/ai-sources.vue.d.ts +45 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.cjs +56 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.d.ts +1 -0
- package/dist/ai-thinking/__tests__/ai-thinking.ssr.test.mjs +42 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.cjs +151 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.d.ts +1 -0
- package/dist/ai-thinking/__tests__/ai-thinking.test.mjs +96 -0
- package/dist/ai-thinking/index.cjs +26 -0
- package/dist/ai-thinking/index.d.ts +3 -0
- package/dist/ai-thinking/index.mjs +5 -0
- package/dist/ai-thinking/src/ai-thinking.cjs +44 -0
- package/dist/ai-thinking/src/ai-thinking.css +543 -0
- package/dist/ai-thinking/src/ai-thinking.d.ts +42 -0
- package/dist/ai-thinking/src/ai-thinking.d.vue.ts +33 -0
- package/dist/ai-thinking/src/ai-thinking.mjs +38 -0
- package/dist/ai-thinking/src/ai-thinking.vue +631 -0
- package/dist/ai-thinking/src/ai-thinking.vue.d.ts +33 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.cjs +83 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.d.ts +1 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.ssr.test.mjs +52 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.cjs +204 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.d.ts +1 -0
- package/dist/ai-thought-chain/__tests__/ai-thought-chain.test.mjs +134 -0
- package/dist/ai-thought-chain/index.cjs +26 -0
- package/dist/ai-thought-chain/index.d.ts +3 -0
- package/dist/ai-thought-chain/index.mjs +5 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.cjs +68 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.css +668 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.d.ts +82 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.d.vue.ts +83 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.mjs +62 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.vue +813 -0
- package/dist/ai-thought-chain/src/ai-thought-chain.vue.d.ts +83 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.cjs +32 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.d.ts +1 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.ssr.test.mjs +25 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.cjs +130 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.d.ts +1 -0
- package/dist/ai-voice-trigger/__tests__/ai-voice-trigger.test.mjs +103 -0
- package/dist/ai-voice-trigger/index.cjs +26 -0
- package/dist/ai-voice-trigger/index.d.ts +3 -0
- package/dist/ai-voice-trigger/index.mjs +5 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.cjs +67 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.css +702 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.d.ts +69 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.d.vue.ts +49 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.mjs +61 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.vue +859 -0
- package/dist/ai-voice-trigger/src/ai-voice-trigger.vue.d.ts +49 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.cjs +57 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.d.ts +1 -0
- package/dist/ai-welcome/__tests__/ai-welcome.ssr.test.mjs +39 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.cjs +169 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.d.ts +1 -0
- package/dist/ai-welcome/__tests__/ai-welcome.test.mjs +113 -0
- package/dist/ai-welcome/index.cjs +26 -0
- package/dist/ai-welcome/index.d.ts +3 -0
- package/dist/ai-welcome/index.mjs +5 -0
- package/dist/ai-welcome/src/ai-welcome.cjs +56 -0
- package/dist/ai-welcome/src/ai-welcome.css +591 -0
- package/dist/ai-welcome/src/ai-welcome.d.ts +59 -0
- package/dist/ai-welcome/src/ai-welcome.d.vue.ts +51 -0
- package/dist/ai-welcome/src/ai-welcome.mjs +50 -0
- package/dist/ai-welcome/src/ai-welcome.vue +655 -0
- package/dist/ai-welcome/src/ai-welcome.vue.d.ts +51 -0
- package/dist/alert/src/alert.d.vue.ts +6 -6
- package/dist/alert/src/alert.vue.d.ts +6 -6
- package/dist/autocomplete/src/autocomplete.d.vue.ts +4 -4
- package/dist/autocomplete/src/autocomplete.vue.d.ts +4 -4
- package/dist/avatar/index.d.ts +39 -1
- package/dist/back-top/src/back-top.d.vue.ts +1 -1
- package/dist/back-top/src/back-top.vue.d.ts +1 -1
- package/dist/button/index.d.ts +3 -3
- package/dist/button/src/button.css +3 -3
- package/dist/button/src/button.d.vue.ts +1 -1
- package/dist/button/src/button.vue +3 -3
- package/dist/button/src/button.vue.d.ts +1 -1
- package/dist/calendar/src/calendar.d.vue.ts +3 -3
- package/dist/calendar/src/calendar.vue.d.ts +3 -3
- package/dist/cascader/src/cascader-panel.d.vue.ts +2 -2
- package/dist/cascader/src/cascader-panel.vue.d.ts +2 -2
- package/dist/checkbox/index.d.ts +3 -3
- package/dist/checkbox/src/checkbox-group.d.vue.ts +1 -1
- package/dist/checkbox/src/checkbox-group.vue +13 -1
- package/dist/checkbox/src/checkbox-group.vue.d.ts +1 -1
- package/dist/checkbox/src/checkbox.d.ts +12 -0
- package/dist/col/src/col.d.vue.ts +4 -4
- package/dist/col/src/col.vue.d.ts +4 -4
- package/dist/color-picker/src/color-picker.d.vue.ts +1 -1
- package/dist/color-picker/src/color-picker.vue.d.ts +1 -1
- package/dist/component.d.ts +63 -0
- package/dist/date-picker/src/date-picker.d.vue.ts +6 -6
- package/dist/date-picker/src/date-picker.vue.d.ts +6 -6
- package/dist/descriptions/src/description-item.d.vue.ts +1 -1
- package/dist/descriptions/src/description-item.vue.d.ts +1 -1
- package/dist/dialog/src/dialog.d.vue.ts +12 -12
- package/dist/dialog/src/dialog.vue.d.ts +12 -12
- package/dist/drawer/index.d.ts +42 -1
- package/dist/drawer/src/drawer.d.vue.ts +6 -6
- package/dist/drawer/src/drawer.vue.d.ts +6 -6
- package/dist/dropdown/src/dropdown-item.d.vue.ts +1 -1
- package/dist/dropdown/src/dropdown-item.vue.d.ts +1 -1
- package/dist/dropdown/src/dropdown.d.vue.ts +8 -8
- package/dist/dropdown/src/dropdown.vue.d.ts +8 -8
- package/dist/form/__tests__/form-schema.test.cjs +477 -24
- package/dist/form/__tests__/form-schema.test.mjs +277 -57
- package/dist/form/index.cjs +12 -0
- package/dist/form/index.d.ts +1 -2
- package/dist/form/index.mjs +1 -0
- package/dist/form/src/form-item.d.vue.ts +2 -1
- package/dist/form/src/form-item.vue +3 -1
- package/dist/form/src/form-item.vue.d.ts +2 -1
- package/dist/form/src/form-schema.cjs +2 -1
- package/dist/form/src/form-schema.d.ts +124 -19
- package/dist/form/src/form-schema.d.vue.ts +69 -19
- package/dist/form/src/form-schema.mjs +2 -1
- package/dist/form/src/form-schema.vue +522 -160
- package/dist/form/src/form-schema.vue.d.ts +69 -19
- package/dist/form/src/form.cjs +7 -0
- package/dist/form/src/form.d.ts +20 -0
- package/dist/form/src/form.d.vue.ts +10 -1
- package/dist/form/src/form.mjs +7 -0
- package/dist/form/src/form.vue +22 -10
- package/dist/form/src/form.vue.d.ts +10 -1
- package/dist/grid/src/grid.d.vue.ts +1 -1
- package/dist/grid/src/grid.vue.d.ts +1 -1
- package/dist/icon/src/icons/index.cjs +127 -2
- package/dist/icon/src/icons/index.d.ts +25 -0
- package/dist/icon/src/icons/index.mjs +151 -1
- package/dist/image/index.d.ts +356 -2
- package/dist/image/src/image-viewer.d.vue.ts +3 -3
- package/dist/image/src/image-viewer.vue.d.ts +3 -3
- package/dist/image/src/image.d.vue.ts +4 -4
- package/dist/image/src/image.vue.d.ts +4 -4
- package/dist/index.cjs +205 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.mjs +52 -1
- package/dist/infinite-scroll/src/infinite-scroll.d.vue.ts +1 -1
- package/dist/infinite-scroll/src/infinite-scroll.vue.d.ts +1 -1
- package/dist/input/index.d.ts +21 -21
- package/dist/input/src/input.d.vue.ts +7 -7
- package/dist/input/src/input.vue.d.ts +7 -7
- package/dist/input-number/index.d.ts +3 -3
- package/dist/input-number/src/input-number.d.vue.ts +1 -1
- package/dist/input-number/src/input-number.vue.d.ts +1 -1
- package/dist/input-tag/src/input-tag.d.vue.ts +3 -3
- package/dist/input-tag/src/input-tag.vue.d.ts +3 -3
- package/dist/mention/index.d.ts +181 -1
- package/dist/mention/src/mention.d.vue.ts +9 -9
- package/dist/mention/src/mention.vue +6 -2
- package/dist/mention/src/mention.vue.d.ts +9 -9
- package/dist/menu/src/menu.d.vue.ts +4 -4
- package/dist/menu/src/menu.vue.d.ts +4 -4
- package/dist/message/src/message.d.vue.ts +1 -1
- package/dist/message/src/message.vue.d.ts +1 -1
- package/dist/notification/src/notification.d.vue.ts +1 -1
- package/dist/notification/src/notification.vue.d.ts +1 -1
- package/dist/popconfirm/src/popconfirm.d.vue.ts +5 -5
- package/dist/popconfirm/src/popconfirm.vue.d.ts +5 -5
- package/dist/popover/src/popover.d.vue.ts +4 -4
- package/dist/popover/src/popover.vue.d.ts +4 -4
- package/dist/progress/src/progress.d.vue.ts +1 -1
- package/dist/progress/src/progress.vue.d.ts +1 -1
- package/dist/radio/src/radio-group.d.vue.ts +1 -1
- package/dist/radio/src/radio-group.vue +25 -4
- package/dist/radio/src/radio-group.vue.d.ts +1 -1
- package/dist/radio/src/radio.d.ts +12 -0
- package/dist/rate/src/rate.d.vue.ts +1 -1
- package/dist/rate/src/rate.vue.d.ts +1 -1
- package/dist/select/src/select.d.vue.ts +4 -4
- package/dist/select/src/select.vue.d.ts +4 -4
- package/dist/slider/src/slider.d.vue.ts +1 -1
- package/dist/slider/src/slider.vue.d.ts +1 -1
- package/dist/steps/src/step.d.vue.ts +1 -1
- package/dist/steps/src/step.vue.d.ts +1 -1
- package/dist/switch/src/switch.d.vue.ts +2 -2
- package/dist/switch/src/switch.vue.d.ts +2 -2
- package/dist/table/__tests__/table.perf.test.cjs +2 -2
- package/dist/table/__tests__/table.perf.test.mjs +2 -2
- package/dist/table/__tests__/table.test.cjs +18 -0
- package/dist/table/__tests__/table.test.mjs +18 -0
- package/dist/table/__tests__/use-table-import.test.cjs +6 -0
- package/dist/table/__tests__/use-table-import.test.mjs +8 -1
- package/dist/table/src/table-column.d.vue.ts +2 -2
- package/dist/table/src/table-column.vue.d.ts +2 -2
- package/dist/table/src/table.d.vue.ts +3 -3
- package/dist/table/src/table.vue.d.ts +3 -3
- package/dist/tabs/src/tab-pane.d.vue.ts +1 -1
- package/dist/tabs/src/tab-pane.vue.d.ts +1 -1
- package/dist/tabs/src/tabs.d.vue.ts +2 -2
- package/dist/tabs/src/tabs.vue.d.ts +2 -2
- package/dist/time-picker/src/time-picker.d.vue.ts +1 -1
- package/dist/time-picker/src/time-picker.vue.d.ts +1 -1
- package/dist/tooltip/index.d.ts +7 -7
- package/dist/tooltip/src/tooltip.d.vue.ts +7 -7
- package/dist/tooltip/src/tooltip.vue.d.ts +7 -7
- package/dist/tree/src/tree.d.vue.ts +1 -1
- package/dist/tree/src/tree.vue.d.ts +1 -1
- package/dist/tree-select/src/tree-select.d.vue.ts +3 -3
- package/dist/tree-select/src/tree-select.vue.d.ts +3 -3
- package/dist/upload/src/upload.d.vue.ts +1 -1
- package/dist/upload/src/upload.vue.d.ts +1 -1
- package/package.json +8 -5
|
@@ -4,16 +4,33 @@ import YhFormSchema from "../src/form-schema.vue";
|
|
|
4
4
|
import { nextTick, h } from "vue";
|
|
5
5
|
const YhInput = {
|
|
6
6
|
name: "YhInput",
|
|
7
|
-
props: ["modelValue", "placeholder"],
|
|
8
|
-
template: `<input class="yh-input" :value="modelValue" @input="$emit('update:modelValue', $event.target.value)" :placeholder="placeholder" />`
|
|
7
|
+
props: ["modelValue", "placeholder", "disabled"],
|
|
8
|
+
template: `<input class="yh-input" :value="modelValue" @input="$emit('update:modelValue', $event.target.value)" :placeholder="placeholder" :disabled="disabled" />`
|
|
9
9
|
};
|
|
10
10
|
const YhSelect = {
|
|
11
11
|
name: "YhSelect",
|
|
12
|
-
props: ["modelValue", "options"],
|
|
12
|
+
props: ["modelValue", "options", "loading"],
|
|
13
13
|
template: `<select class="yh-select" :value="modelValue" @change="$emit('update:modelValue', $event.target.value)"><option v-for="opt in options" :key="opt.value" :value="opt.value">{{opt.label}}</option></select>`
|
|
14
14
|
};
|
|
15
|
+
const YhSwitch = {
|
|
16
|
+
name: "YhSwitch",
|
|
17
|
+
props: ["modelValue"],
|
|
18
|
+
template: `<input type="checkbox" class="yh-switch" :checked="modelValue" @change="$emit('update:modelValue', $event.target.checked)" />`
|
|
19
|
+
};
|
|
20
|
+
const YhButton = {
|
|
21
|
+
name: "YhButton",
|
|
22
|
+
props: ["type", "text", "disabled"],
|
|
23
|
+
emits: ["click"],
|
|
24
|
+
template: `<button class="yh-button" :disabled="disabled" @click="$emit('click')"><slot /></button>`
|
|
25
|
+
};
|
|
26
|
+
const globalComponents = {
|
|
27
|
+
"yh-input": YhInput,
|
|
28
|
+
"yh-select": YhSelect,
|
|
29
|
+
"yh-switch": YhSwitch,
|
|
30
|
+
"yh-button": YhButton
|
|
31
|
+
};
|
|
15
32
|
describe("FormSchema", () => {
|
|
16
|
-
it("
|
|
33
|
+
it("\u57FA\u7840\u6E32\u67D3 - \u6309 schema \u6E32\u67D3\u8868\u5355\u9879", async () => {
|
|
17
34
|
const model = { username: "ant", role: "" };
|
|
18
35
|
const schema = [
|
|
19
36
|
{
|
|
@@ -24,29 +41,19 @@ describe("FormSchema", () => {
|
|
|
24
41
|
}
|
|
25
42
|
];
|
|
26
43
|
const wrapper = mount(YhFormSchema, {
|
|
27
|
-
props: {
|
|
28
|
-
|
|
29
|
-
schema
|
|
30
|
-
},
|
|
31
|
-
global: {
|
|
32
|
-
components: {
|
|
33
|
-
"yh-input": YhInput
|
|
34
|
-
}
|
|
35
|
-
}
|
|
44
|
+
props: { modelValue: model, schema },
|
|
45
|
+
global: { components: globalComponents }
|
|
36
46
|
});
|
|
37
47
|
expect(wrapper.find(".yh-form").exists()).toBe(true);
|
|
38
48
|
const input = wrapper.find("input");
|
|
39
49
|
expect(input.attributes("placeholder")).toBe("Enter username");
|
|
40
50
|
});
|
|
41
|
-
it("
|
|
51
|
+
it("\u53CC\u5411\u7ED1\u5B9A - v-model \u540C\u6B65\u66F4\u65B0", async () => {
|
|
42
52
|
const model = { username: "" };
|
|
43
53
|
const schema = [{ field: "username", component: "input" }];
|
|
44
54
|
const wrapper = mount(YhFormSchema, {
|
|
45
|
-
props: {
|
|
46
|
-
|
|
47
|
-
schema
|
|
48
|
-
},
|
|
49
|
-
global: { components: { "yh-input": YhInput } }
|
|
55
|
+
props: { modelValue: model, schema },
|
|
56
|
+
global: { components: globalComponents }
|
|
50
57
|
});
|
|
51
58
|
const input = wrapper.find("input");
|
|
52
59
|
await input.setValue("new_user");
|
|
@@ -54,7 +61,18 @@ describe("FormSchema", () => {
|
|
|
54
61
|
const lastEmitted = wrapper.emitted("update:modelValue").slice(-1)[0][0];
|
|
55
62
|
expect(lastEmitted.username).toBe("new_user");
|
|
56
63
|
});
|
|
57
|
-
it("
|
|
64
|
+
it("change \u4E8B\u4EF6 - \u89E6\u53D1 change \u5E76\u5305\u542B field \u548C val", async () => {
|
|
65
|
+
const wrapper = mount(YhFormSchema, {
|
|
66
|
+
props: { modelValue: { name: "" }, schema: [{ field: "name", component: "input" }] },
|
|
67
|
+
global: { components: globalComponents }
|
|
68
|
+
});
|
|
69
|
+
await wrapper.find("input").setValue("test");
|
|
70
|
+
const changeEvents = wrapper.emitted("change");
|
|
71
|
+
expect(changeEvents.length).toBeGreaterThan(0);
|
|
72
|
+
expect(changeEvents[0][0]).toBe("name");
|
|
73
|
+
expect(changeEvents[0][1]).toBe("test");
|
|
74
|
+
});
|
|
75
|
+
it("\u52A8\u6001\u663E\u9690 - hidden \u51FD\u6570\u652F\u6301\u8054\u52A8", async () => {
|
|
58
76
|
const schema = [
|
|
59
77
|
{ field: "showExtra", component: "input" },
|
|
60
78
|
{
|
|
@@ -65,20 +83,36 @@ describe("FormSchema", () => {
|
|
|
65
83
|
}
|
|
66
84
|
];
|
|
67
85
|
const wrapper = mount(YhFormSchema, {
|
|
68
|
-
props: {
|
|
69
|
-
|
|
70
|
-
schema
|
|
71
|
-
},
|
|
72
|
-
global: { components: { "yh-input": YhInput } }
|
|
86
|
+
props: { modelValue: { showExtra: false, extra: "" }, schema },
|
|
87
|
+
global: { components: globalComponents }
|
|
73
88
|
});
|
|
74
89
|
expect(wrapper.text()).not.toContain("Extra Label");
|
|
75
|
-
await wrapper.setProps({
|
|
76
|
-
modelValue: { showExtra: true, extra: "visible" }
|
|
77
|
-
});
|
|
90
|
+
await wrapper.setProps({ modelValue: { showExtra: true, extra: "visible" } });
|
|
78
91
|
await nextTick();
|
|
79
92
|
expect(wrapper.text()).toContain("Extra Label");
|
|
80
93
|
});
|
|
81
|
-
it("
|
|
94
|
+
it("\u52A8\u6001\u8054\u52A8 - required \u548C rules \u652F\u6301\u4F20\u5165\u51FD\u6570\u8BA1\u7B97", async () => {
|
|
95
|
+
const schema = [
|
|
96
|
+
{ field: "type", component: "input" },
|
|
97
|
+
{
|
|
98
|
+
field: "reason",
|
|
99
|
+
component: "input",
|
|
100
|
+
required: (model) => model.type === "other",
|
|
101
|
+
rules: (model) => {
|
|
102
|
+
return model.type === "other" ? [{ min: 5, message: "\u81F3\u5C11 5 \u4E2A\u5B57\u7B26", trigger: "blur" }] : [];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
const wrapper = mount(YhFormSchema, {
|
|
107
|
+
props: { modelValue: { type: "normal", reason: "" }, schema },
|
|
108
|
+
global: { components: globalComponents }
|
|
109
|
+
});
|
|
110
|
+
const reasonItem = wrapper.findAll(".yh-form-item")[1];
|
|
111
|
+
expect(reasonItem.classes()).not.toContain("is-required");
|
|
112
|
+
await wrapper.setProps({ modelValue: { type: "other", reason: "" } });
|
|
113
|
+
expect(reasonItem.classes()).toContain("is-required");
|
|
114
|
+
});
|
|
115
|
+
it("\u5206\u7EC4\u6E32\u67D3 - \u5C55\u793A group title \u5E76\u652F\u6301\u6298\u53E0", async () => {
|
|
82
116
|
const schema = [
|
|
83
117
|
{
|
|
84
118
|
title: "Basic Info",
|
|
@@ -87,38 +121,28 @@ describe("FormSchema", () => {
|
|
|
87
121
|
}
|
|
88
122
|
];
|
|
89
123
|
const wrapper = mount(YhFormSchema, {
|
|
90
|
-
props: {
|
|
91
|
-
|
|
92
|
-
schema
|
|
93
|
-
}
|
|
124
|
+
props: { modelValue: { name: "" }, schema },
|
|
125
|
+
global: { components: globalComponents }
|
|
94
126
|
});
|
|
95
127
|
expect(wrapper.find(".yh-form-schema__group-title").text()).toContain("Basic Info");
|
|
96
128
|
await wrapper.find(".yh-form-schema__group-title").trigger("click");
|
|
97
129
|
expect(wrapper.find(".yh-form-schema__group").classes()).toContain("is-collapsed");
|
|
98
130
|
});
|
|
99
|
-
it("
|
|
131
|
+
it("\u5F02\u6B65\u9009\u9879 - asyncOptions \u81EA\u52A8\u52A0\u8F7D\u5E76\u6CE8\u5165", async () => {
|
|
100
132
|
const asyncOptions = vi.fn().mockResolvedValue([{ label: "Option A", value: "a" }]);
|
|
101
|
-
const schema = [
|
|
102
|
-
{
|
|
103
|
-
field: "type",
|
|
104
|
-
component: "select",
|
|
105
|
-
asyncOptions
|
|
106
|
-
}
|
|
107
|
-
];
|
|
133
|
+
const schema = [{ field: "type", component: "select", asyncOptions }];
|
|
108
134
|
const wrapper = mount(YhFormSchema, {
|
|
109
|
-
props: {
|
|
110
|
-
|
|
111
|
-
schema
|
|
112
|
-
},
|
|
113
|
-
global: { components: { "yh-select": YhSelect } }
|
|
135
|
+
props: { modelValue: { type: "" }, schema },
|
|
136
|
+
global: { components: globalComponents }
|
|
114
137
|
});
|
|
115
138
|
await nextTick();
|
|
116
139
|
await nextTick();
|
|
117
140
|
await nextTick();
|
|
141
|
+
expect(asyncOptions).toHaveBeenCalled();
|
|
118
142
|
const options = wrapper.findAll("option");
|
|
119
143
|
expect(options.length).toBeGreaterThan(0);
|
|
120
144
|
});
|
|
121
|
-
it("
|
|
145
|
+
it("render \u51FD\u6570 - \u81EA\u5B9A\u4E49\u6E32\u67D3", () => {
|
|
122
146
|
const schema = [
|
|
123
147
|
{
|
|
124
148
|
field: "custom",
|
|
@@ -126,21 +150,217 @@ describe("FormSchema", () => {
|
|
|
126
150
|
}
|
|
127
151
|
];
|
|
128
152
|
const wrapper = mount(YhFormSchema, {
|
|
129
|
-
props: {
|
|
130
|
-
|
|
131
|
-
schema
|
|
132
|
-
}
|
|
153
|
+
props: { modelValue: { custom: "hello" }, schema },
|
|
154
|
+
global: { components: globalComponents }
|
|
133
155
|
});
|
|
134
156
|
expect(wrapper.find(".custom-render").text()).toBe("Val: hello");
|
|
135
157
|
});
|
|
136
|
-
it("
|
|
158
|
+
it("\u66B4\u9732 API - validate/resetFields/clearValidate/getModel/setFieldValue", () => {
|
|
159
|
+
const wrapper = mount(YhFormSchema, {
|
|
160
|
+
props: { modelValue: {}, schema: [] },
|
|
161
|
+
global: { components: globalComponents }
|
|
162
|
+
});
|
|
163
|
+
const vm = wrapper.vm;
|
|
164
|
+
expect(typeof vm.validate).toBe("function");
|
|
165
|
+
expect(typeof vm.resetFields).toBe("function");
|
|
166
|
+
expect(typeof vm.clearValidate).toBe("function");
|
|
167
|
+
expect(typeof vm.getModel).toBe("function");
|
|
168
|
+
expect(typeof vm.setFieldValue).toBe("function");
|
|
169
|
+
});
|
|
170
|
+
it("getModel - \u8FD4\u56DE\u5F53\u524D\u5B8C\u6574 model \u5FEB\u7167", async () => {
|
|
137
171
|
const wrapper = mount(YhFormSchema, {
|
|
138
|
-
props: {
|
|
139
|
-
|
|
140
|
-
|
|
172
|
+
props: { modelValue: { city: "BJ" }, schema: [{ field: "city", component: "input" }] },
|
|
173
|
+
global: { components: globalComponents }
|
|
174
|
+
});
|
|
175
|
+
const model = wrapper.vm.getModel();
|
|
176
|
+
expect(model.city).toBe("BJ");
|
|
177
|
+
});
|
|
178
|
+
it("setFieldValue - \u52A8\u6001\u66F4\u65B0\u5355\u5B57\u6BB5\u503C", async () => {
|
|
179
|
+
const wrapper = mount(YhFormSchema, {
|
|
180
|
+
props: { modelValue: { city: "" }, schema: [{ field: "city", component: "input" }] },
|
|
181
|
+
global: { components: globalComponents }
|
|
182
|
+
});
|
|
183
|
+
wrapper.vm.setFieldValue("city", "SH");
|
|
184
|
+
await nextTick();
|
|
185
|
+
const emitted = wrapper.emitted("update:modelValue");
|
|
186
|
+
const last = emitted[emitted.length - 1][0];
|
|
187
|
+
expect(last.city).toBe("SH");
|
|
188
|
+
});
|
|
189
|
+
it("required \u7B80\u5199 - \u81EA\u52A8\u6DFB\u52A0\u5FC5\u586B\u89C4\u5219\u5E76\u89E6\u53D1\u6821\u9A8C", async () => {
|
|
190
|
+
const schema = [{ field: "name", label: "\u59D3\u540D", component: "input", required: true }];
|
|
191
|
+
const wrapper = mount(YhFormSchema, {
|
|
192
|
+
props: { modelValue: { name: "" }, schema },
|
|
193
|
+
global: { components: globalComponents }
|
|
194
|
+
});
|
|
195
|
+
let isValid = true;
|
|
196
|
+
try {
|
|
197
|
+
isValid = await wrapper.vm.validate();
|
|
198
|
+
} catch (_) {
|
|
199
|
+
isValid = false;
|
|
200
|
+
}
|
|
201
|
+
expect(isValid).toBe(false);
|
|
202
|
+
});
|
|
203
|
+
it("type divider - \u6E32\u67D3\u5206\u9694\u7EBF", () => {
|
|
204
|
+
const schema = [{ type: "divider", label: "\u57FA\u672C\u4FE1\u606F", field: "_d" }];
|
|
205
|
+
const wrapper = mount(YhFormSchema, {
|
|
206
|
+
props: { modelValue: {}, schema },
|
|
207
|
+
global: { components: globalComponents }
|
|
208
|
+
});
|
|
209
|
+
expect(wrapper.find(".yh-form-schema__divider").exists()).toBe(true);
|
|
210
|
+
expect(wrapper.find(".yh-form-schema__divider-label").text()).toBe("\u57FA\u672C\u4FE1\u606F");
|
|
211
|
+
});
|
|
212
|
+
it("type text - \u53EA\u8BFB\u663E\u793A\u5B57\u6BB5\u503C", () => {
|
|
213
|
+
const schema = [{ type: "text", label: "\u59D3\u540D", field: "name" }];
|
|
214
|
+
const wrapper = mount(YhFormSchema, {
|
|
215
|
+
props: { modelValue: { name: "Alice" }, schema },
|
|
216
|
+
global: { components: globalComponents }
|
|
217
|
+
});
|
|
218
|
+
expect(wrapper.find(".yh-form-schema__text-value").text()).toBe("Alice");
|
|
219
|
+
});
|
|
220
|
+
it("type text - emptyValue \u7A7A\u6001\u5360\u4F4D\u7B26", async () => {
|
|
221
|
+
const schema = [
|
|
222
|
+
{ type: "text", label: "\u7535\u8BDD", field: "phone", emptyValue: "\u6682\u65E0" },
|
|
223
|
+
{ type: "text", label: "\u5730\u5740", field: "addr" }
|
|
224
|
+
];
|
|
225
|
+
const wrapper = mount(YhFormSchema, {
|
|
226
|
+
props: { modelValue: { phone: null, addr: void 0 }, schema },
|
|
227
|
+
global: { components: globalComponents }
|
|
228
|
+
});
|
|
229
|
+
await nextTick();
|
|
230
|
+
const items = wrapper.findAll(".yh-form-schema__text-value");
|
|
231
|
+
expect(items[0].text()).toBe("\u6682\u65E0");
|
|
232
|
+
expect(items[1].text()).toBe("-");
|
|
233
|
+
});
|
|
234
|
+
it("defaultValue - \u672A\u8BBE\u7F6E\u5B57\u6BB5\u65F6\u586B\u5145\u9ED8\u8BA4\u503C", async () => {
|
|
235
|
+
const schema = [{ field: "city", component: "input", defaultValue: "Beijing" }];
|
|
236
|
+
const wrapper = mount(YhFormSchema, {
|
|
237
|
+
props: { modelValue: {}, schema },
|
|
238
|
+
global: { components: globalComponents }
|
|
239
|
+
});
|
|
240
|
+
await nextTick();
|
|
241
|
+
const emitted = wrapper.emitted("update:modelValue");
|
|
242
|
+
expect(emitted).toBeTruthy();
|
|
243
|
+
const last = emitted[emitted.length - 1][0];
|
|
244
|
+
expect(last.city).toBe("Beijing");
|
|
245
|
+
});
|
|
246
|
+
it("disabled \u51FD\u6570 - \u6839\u636E model \u52A8\u6001\u7981\u7528\u5B57\u6BB5", async () => {
|
|
247
|
+
const schema = [
|
|
248
|
+
{ field: "toggle", component: "switch" },
|
|
249
|
+
{
|
|
250
|
+
field: "target",
|
|
251
|
+
component: "input",
|
|
252
|
+
disabled: (m) => !m.toggle
|
|
141
253
|
}
|
|
254
|
+
];
|
|
255
|
+
const wrapper = mount(YhFormSchema, {
|
|
256
|
+
props: { modelValue: { toggle: false, target: "" }, schema },
|
|
257
|
+
global: { components: globalComponents }
|
|
258
|
+
});
|
|
259
|
+
const input = wrapper.find('input[type="text"], input:not([type="checkbox"])').element;
|
|
260
|
+
expect(input.disabled).toBe(true);
|
|
261
|
+
});
|
|
262
|
+
it("\u5916\u90E8 modelValue \u66F4\u65B0 - localModel \u540C\u6B65\u54CD\u5E94", async () => {
|
|
263
|
+
const wrapper = mount(YhFormSchema, {
|
|
264
|
+
props: { modelValue: { name: "old" }, schema: [{ field: "name", component: "input" }] },
|
|
265
|
+
global: { components: globalComponents }
|
|
266
|
+
});
|
|
267
|
+
await wrapper.setProps({ modelValue: { name: "new" } });
|
|
268
|
+
await nextTick();
|
|
269
|
+
const input = wrapper.find("input");
|
|
270
|
+
expect(input.element.value).toBe("new");
|
|
271
|
+
});
|
|
272
|
+
describe("type list - \u52A8\u6001\u589E\u51CF\u5217\u8868", () => {
|
|
273
|
+
const listSchema = [
|
|
274
|
+
{ field: "name", label: "\u59D3\u540D", component: "input" },
|
|
275
|
+
{ field: "phone", label: "\u7535\u8BDD", component: "input" }
|
|
276
|
+
];
|
|
277
|
+
it("\u521D\u59CB\u6E32\u67D3 - \u6309\u5DF2\u6709\u5217\u8868\u6570\u636E\u6E32\u67D3\u884C", async () => {
|
|
278
|
+
const schema = [
|
|
279
|
+
{ field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
|
|
280
|
+
];
|
|
281
|
+
const wrapper = mount(YhFormSchema, {
|
|
282
|
+
props: {
|
|
283
|
+
modelValue: {
|
|
284
|
+
contacts: [
|
|
285
|
+
{ name: "Alice", phone: "111" },
|
|
286
|
+
{ name: "Bob", phone: "222" }
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
schema
|
|
290
|
+
},
|
|
291
|
+
global: { components: globalComponents }
|
|
292
|
+
});
|
|
293
|
+
await nextTick();
|
|
294
|
+
expect(wrapper.findAll(".yh-form-schema__list-row").length).toBe(2);
|
|
295
|
+
});
|
|
296
|
+
it("\u6DFB\u52A0\u5217\u8868\u9879 - \u70B9\u51FB\u6DFB\u52A0\u6309\u94AE\u589E\u52A0\u4E00\u884C", async () => {
|
|
297
|
+
const schema = [
|
|
298
|
+
{ field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
|
|
299
|
+
];
|
|
300
|
+
const wrapper = mount(YhFormSchema, {
|
|
301
|
+
props: { modelValue: { contacts: [] }, schema },
|
|
302
|
+
global: { components: globalComponents }
|
|
303
|
+
});
|
|
304
|
+
await wrapper.find(".yh-form-schema__list-add").trigger("click");
|
|
305
|
+
await nextTick();
|
|
306
|
+
const emitted = wrapper.emitted("update:modelValue");
|
|
307
|
+
const last = emitted[emitted.length - 1][0];
|
|
308
|
+
expect(last.contacts.length).toBe(1);
|
|
309
|
+
});
|
|
310
|
+
it("\u5220\u9664\u5217\u8868\u9879 - \u70B9\u51FB\u5220\u9664\u6309\u94AE\u79FB\u9664\u5BF9\u5E94\u884C", async () => {
|
|
311
|
+
const schema = [
|
|
312
|
+
{ field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: {} }
|
|
313
|
+
];
|
|
314
|
+
const wrapper = mount(YhFormSchema, {
|
|
315
|
+
props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
|
|
316
|
+
global: { components: globalComponents }
|
|
317
|
+
});
|
|
318
|
+
await nextTick();
|
|
319
|
+
await wrapper.find(".yh-form-schema__list-delete").trigger("click");
|
|
320
|
+
await nextTick();
|
|
321
|
+
const emitted = wrapper.emitted("update:modelValue");
|
|
322
|
+
const last = emitted[emitted.length - 1][0];
|
|
323
|
+
expect(last.contacts.length).toBe(0);
|
|
324
|
+
});
|
|
325
|
+
it("max \u9650\u5236 - \u8D85\u51FA\u6700\u5927\u6570\u91CF\u65F6\u7981\u7528\u6DFB\u52A0\u6309\u94AE", async () => {
|
|
326
|
+
const schema = [
|
|
327
|
+
{ field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: { max: 1 } }
|
|
328
|
+
];
|
|
329
|
+
const wrapper = mount(YhFormSchema, {
|
|
330
|
+
props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
|
|
331
|
+
global: { components: globalComponents }
|
|
332
|
+
});
|
|
333
|
+
await nextTick();
|
|
334
|
+
const addBtn = wrapper.find(".yh-form-schema__list-add");
|
|
335
|
+
expect(addBtn.attributes("disabled")).toBeDefined();
|
|
336
|
+
});
|
|
337
|
+
it("min \u9650\u5236 - \u672A\u8FBE\u5230\u6700\u5C0F\u6570\u91CF\u65F6\u7981\u7528\u5220\u9664\u6309\u94AE", async () => {
|
|
338
|
+
const schema = [
|
|
339
|
+
{ field: "contacts", label: "\u8054\u7CFB\u4EBA", type: "list", listSchema, listProps: { min: 1 } }
|
|
340
|
+
];
|
|
341
|
+
const wrapper = mount(YhFormSchema, {
|
|
342
|
+
props: { modelValue: { contacts: [{ name: "Alice", phone: "111" }] }, schema },
|
|
343
|
+
global: { components: globalComponents }
|
|
344
|
+
});
|
|
345
|
+
await nextTick();
|
|
346
|
+
const delBtn = wrapper.find(".yh-form-schema__list-delete");
|
|
347
|
+
expect(delBtn.attributes("disabled")).toBeDefined();
|
|
348
|
+
});
|
|
349
|
+
it("addButtonText - \u81EA\u5B9A\u4E49\u6DFB\u52A0\u6309\u94AE\u6587\u6848", async () => {
|
|
350
|
+
const schema = [
|
|
351
|
+
{
|
|
352
|
+
field: "contacts",
|
|
353
|
+
label: "\u8054\u7CFB\u4EBA",
|
|
354
|
+
type: "list",
|
|
355
|
+
listSchema,
|
|
356
|
+
listProps: { addButtonText: "\u65B0\u589E\u8054\u7CFB\u4EBA" }
|
|
357
|
+
}
|
|
358
|
+
];
|
|
359
|
+
const wrapper = mount(YhFormSchema, {
|
|
360
|
+
props: { modelValue: { contacts: [] }, schema },
|
|
361
|
+
global: { components: globalComponents }
|
|
362
|
+
});
|
|
363
|
+
expect(wrapper.find(".yh-form-schema__list-add").text()).toContain("\u65B0\u589E\u8054\u7CFB\u4EBA");
|
|
142
364
|
});
|
|
143
|
-
expect(typeof wrapper.vm.validate).toBe("function");
|
|
144
|
-
expect(typeof wrapper.vm.resetFields).toBe("function");
|
|
145
365
|
});
|
|
146
366
|
});
|
package/dist/form/index.cjs
CHANGED
|
@@ -38,6 +38,18 @@ Object.keys(_formItem2).forEach(function (key) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
+
var _formSchema2 = require("./src/form-schema.cjs");
|
|
42
|
+
Object.keys(_formSchema2).forEach(function (key) {
|
|
43
|
+
if (key === "default" || key === "__esModule") return;
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
45
|
+
if (key in exports && exports[key] === _formSchema2[key]) return;
|
|
46
|
+
Object.defineProperty(exports, key, {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _formSchema2[key];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
41
53
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
54
|
const YhForm = exports.YhForm = (0, _utils.withInstall)(_form.default);
|
|
43
55
|
const YhFormItem = exports.YhFormItem = (0, _utils.withInstall)(_formItem.default);
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import Form from './src/form.vue';
|
|
2
2
|
import FormItem from './src/form-item.vue';
|
|
3
|
-
import FormSchema from './src/form-schema.vue';
|
|
4
3
|
import './src/form.scss';
|
|
5
4
|
export * from './src/form';
|
|
6
5
|
export * from './src/form-item';
|
|
6
|
+
export * from './src/form-schema';
|
|
7
7
|
export declare const YhForm: any;
|
|
8
8
|
export declare const YhFormItem: any;
|
|
9
9
|
export declare const YhFormSchema: any;
|
|
10
10
|
export default YhForm;
|
|
11
11
|
export type FormInstance = InstanceType<typeof Form>;
|
|
12
12
|
export type FormItemInstance = InstanceType<typeof FormItem>;
|
|
13
|
-
export type FormSchemaInstance = InstanceType<typeof FormSchema>;
|
package/dist/form/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import FormSchema from "./src/form-schema.vue";
|
|
|
5
5
|
import "./src/form.scss";
|
|
6
6
|
export * from "./src/form.mjs";
|
|
7
7
|
export * from "./src/form-item.mjs";
|
|
8
|
+
export * from "./src/form-schema.mjs";
|
|
8
9
|
export const YhForm = withInstall(Form);
|
|
9
10
|
export const YhFormItem = withInstall(FormItem);
|
|
10
11
|
export const YhFormSchema = withInstall(FormSchema);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FormRule } from './form';
|
|
2
2
|
import type { ValidateStatus } from './form-item';
|
|
3
|
+
import { type ComponentThemeVars } from '@yh-ui/theme';
|
|
3
4
|
declare var __VLS_1: {}, __VLS_3: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
5
6
|
label?: (props: typeof __VLS_1) => any;
|
|
@@ -121,7 +122,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
121
122
|
};
|
|
122
123
|
}>> & Readonly<{}>, {
|
|
123
124
|
readonly disabled: boolean;
|
|
124
|
-
readonly themeOverrides:
|
|
125
|
+
readonly themeOverrides: ComponentThemeVars;
|
|
125
126
|
readonly size: "small" | "default" | "large";
|
|
126
127
|
readonly label: string;
|
|
127
128
|
readonly error: string;
|
|
@@ -16,7 +16,9 @@ const formContext = inject(FormContextKey, null);
|
|
|
16
16
|
const { globalSize } = useConfig();
|
|
17
17
|
const { themeStyle } = useComponentTheme(
|
|
18
18
|
"form-item",
|
|
19
|
-
computed(
|
|
19
|
+
computed(
|
|
20
|
+
() => props.themeOverrides || formContext?.themeOverrides
|
|
21
|
+
)
|
|
20
22
|
);
|
|
21
23
|
const id = useId().value;
|
|
22
24
|
const labelId = `yh-label-${id}`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FormRule } from './form';
|
|
2
2
|
import type { ValidateStatus } from './form-item';
|
|
3
|
+
import { type ComponentThemeVars } from '@yh-ui/theme';
|
|
3
4
|
declare var __VLS_1: {}, __VLS_3: {};
|
|
4
5
|
type __VLS_Slots = {} & {
|
|
5
6
|
label?: (props: typeof __VLS_1) => any;
|
|
@@ -121,7 +122,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
121
122
|
};
|
|
122
123
|
}>> & Readonly<{}>, {
|
|
123
124
|
readonly disabled: boolean;
|
|
124
|
-
readonly themeOverrides:
|
|
125
|
+
readonly themeOverrides: ComponentThemeVars;
|
|
125
126
|
readonly size: "small" | "default" | "large";
|
|
126
127
|
readonly label: string;
|
|
127
128
|
readonly error: string;
|