diff --git a/.gitignore b/.gitignore index 5507a39..d70f9af 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,6 @@ pnpm-debug.log* *.njsproj *.sln *.sw? -'node_modules' -'.temp' -'.cache' +'node_modules' +'.temp' +'.cache' diff --git a/components/lib/Ckeckbox/index.ts b/components/lib/Ckeckbox/index.ts new file mode 100644 index 0000000..2a8973d --- /dev/null +++ b/components/lib/Ckeckbox/index.ts @@ -0,0 +1,13 @@ +import { App } from "vue"; +import RdCheckbox from "./src/Checkbox.vue"; +import RdCheckboxGroup from "./src/CheckboxGroup.vue"; + +RdCheckbox.install = (app: App) => { + app.component(RdCheckbox.name, RdCheckbox); +}; + +RdCheckboxGroup.install = (app: App) => { + app.component(RdCheckboxGroup.name, RdCheckboxGroup); +}; + +export default { RdCheckbox, RdCheckboxGroup }; \ No newline at end of file diff --git a/components/lib/Ckeckbox/src/Checkbox.vue b/components/lib/Ckeckbox/src/Checkbox.vue new file mode 100644 index 0000000..d6d42a9 --- /dev/null +++ b/components/lib/Ckeckbox/src/Checkbox.vue @@ -0,0 +1,277 @@ + + + + + \ No newline at end of file diff --git a/components/lib/Ckeckbox/src/CheckboxGroup.vue b/components/lib/Ckeckbox/src/CheckboxGroup.vue new file mode 100644 index 0000000..e8a56ad --- /dev/null +++ b/components/lib/Ckeckbox/src/CheckboxGroup.vue @@ -0,0 +1,39 @@ + + + diff --git a/components/lib/breadcrumb/index.ts b/components/lib/breadcrumb/index.ts new file mode 100644 index 0000000..0b27e3b --- /dev/null +++ b/components/lib/breadcrumb/index.ts @@ -0,0 +1,13 @@ +import { App } from "vue"; +import RdBreadcrumb from "./src/breadcrum.vue"; +import RdBreadcrumbItem from "./src/breadcrumb-item.vue"; + +RdBreadcrumb.install = (app: App) => { + app.component(RdBreadcrumb.name, RdBreadcrumb); +}; + +RdBreadcrumbItem.install = (app: App) => { + app.component(RdBreadcrumbItem.name, RdBreadcrumbItem); +}; + +export default { RdBreadcrumbItem, RdBreadcrumb }; diff --git a/components/lib/breadcrumb/src/breadcrum.vue b/components/lib/breadcrumb/src/breadcrum.vue new file mode 100644 index 0000000..2d92e4e --- /dev/null +++ b/components/lib/breadcrumb/src/breadcrum.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/components/lib/breadcrumb/src/breadcrumb-item.vue b/components/lib/breadcrumb/src/breadcrumb-item.vue new file mode 100644 index 0000000..aeb4e81 --- /dev/null +++ b/components/lib/breadcrumb/src/breadcrumb-item.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/components/lib/button/__tests__/index.test.ts b/components/lib/button/__tests__/index.test.ts new file mode 100644 index 0000000..13bd0c2 --- /dev/null +++ b/components/lib/button/__tests__/index.test.ts @@ -0,0 +1,37 @@ +import { mount } from "@vue/test-utils"; +import rdButton from "../index"; +import { h } from "vue"; +describe('test rd-button',() => { + it('test props',() => { + const wrapper = mount(rdButton,{ + props:{ + type: 'primary', + shape: 'round', + loading: true, + block: true, + size: 'small', + danger: true, + disabled: false + } + }) + expect(wrapper.props()).toEqual({ + type: 'primary', + shape: 'round', + loading: true, + block: true, + size: 'small', + danger: true, + disabled: false + }) + }) + it('test slots',() => { + const wrapper = mount(rdButton,{ + slots:{ + 'icon-left':h('span','😀'), + 'icon-right':h('span','A') + } + }) + expect(wrapper.html()).toContain('😀') + expect(wrapper.html()).toContain('A') + }) +}) \ No newline at end of file diff --git a/components/lib/button/index.ts b/components/lib/button/index.ts new file mode 100644 index 0000000..397f226 --- /dev/null +++ b/components/lib/button/index.ts @@ -0,0 +1,6 @@ +import { App } from "vue"; +import rdButton from "../button/src/main.vue"; +rdButton.install = (app: App): void => { + app.component(rdButton.name, rdButton); +}; +export default rdButton; diff --git a/components/lib/button/main.vue b/components/lib/button/main.vue deleted file mode 100644 index 986fbc9..0000000 --- a/components/lib/button/main.vue +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - diff --git a/components/lib/button/src/assets/css/iconfont.css b/components/lib/button/src/assets/css/iconfont.css new file mode 100644 index 0000000..924e2f8 --- /dev/null +++ b/components/lib/button/src/assets/css/iconfont.css @@ -0,0 +1,51 @@ +@font-face { + font-family: "iconfont"; /* Project id 3889838 */ + src: url('../fonts/iconfont.woff2') format('woff2'), + url('../fonts/iconfont.woff') format('woff'), + url('../fonts/iconfont.ttf') format('truetype'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-sousuo:before { + content: "\e613"; +} + +.icon-jiazai_dan:before { + content: "\eaf3"; +} + +.icon-xiazai:before { + content: "\e624"; +} + +.icon-zhankai:before { + content: "\e617"; +} + +.icon-zhankai1:before { + content: "\e68b"; +} + +.icon-sousuo-xianxing:before { + content: "\e8b8"; +} + +.icon-shaixuan:before { + content: "\e60d"; +} + +.icon-sanjiaoxing_shang:before { + content: "\e654"; +} + +.icon-sanjiaoxing_shang-copy:before { + content: "\e655"; +} + diff --git a/components/lib/button/src/assets/fonts/iconfont.ttf b/components/lib/button/src/assets/fonts/iconfont.ttf new file mode 100644 index 0000000..8a810f5 Binary files /dev/null and b/components/lib/button/src/assets/fonts/iconfont.ttf differ diff --git a/components/lib/button/src/assets/fonts/iconfont.woff b/components/lib/button/src/assets/fonts/iconfont.woff new file mode 100644 index 0000000..740cc9a Binary files /dev/null and b/components/lib/button/src/assets/fonts/iconfont.woff differ diff --git a/components/lib/button/src/assets/fonts/iconfont.woff2 b/components/lib/button/src/assets/fonts/iconfont.woff2 new file mode 100644 index 0000000..2aa9a41 Binary files /dev/null and b/components/lib/button/src/assets/fonts/iconfont.woff2 differ diff --git a/components/lib/button/src/assets/images/loading.png b/components/lib/button/src/assets/images/loading.png new file mode 100644 index 0000000..9a2ea98 Binary files /dev/null and b/components/lib/button/src/assets/images/loading.png differ diff --git a/components/lib/button/src/main.vue b/components/lib/button/src/main.vue index b413d09..1d094e2 100644 --- a/components/lib/button/src/main.vue +++ b/components/lib/button/src/main.vue @@ -1,28 +1,209 @@ diff --git a/components/lib/button/src/types/index.ts b/components/lib/button/src/types/index.ts new file mode 100644 index 0000000..b6ddc49 --- /dev/null +++ b/components/lib/button/src/types/index.ts @@ -0,0 +1,3 @@ +export type shapeType = 'default' | 'circle' | 'round'; +export type sizeType = 'small' | 'middle' | 'large'; +export type typeType = 'primary' | 'default' | 'dashed' | 'text' | 'link' \ No newline at end of file diff --git a/components/lib/button2/main.vue b/components/lib/button2/main.vue deleted file mode 100644 index aa99d9e..0000000 --- a/components/lib/button2/main.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - - - diff --git a/components/lib/index.ts b/components/lib/index.ts index b28c417..d83ae27 100644 --- a/components/lib/index.ts +++ b/components/lib/index.ts @@ -1,17 +1,44 @@ import { App } from "vue"; -import rButton from "./button/src/main.vue"; -import gButton from "./button2/main.vue"; +import RdSelect from "./select/main.vue"; +import RdBreadcrumb from "./breadcrumb/src/breadcrum.vue"; +import RdBreadcrumbItem from "./breadcrumb/src/breadcrumb-item.vue"; +import RdChenckbox from "./Ckeckbox/src/Checkbox.vue"; +import RdCheckboxGroup from "./Ckeckbox/src/CheckboxGroup.vue"; import rdAvatar from "./avatar/index"; import rdTable from "./table/index"; import rdSelect from "./select/src/main.vue"; +import rdButton from "./button/index"; +const components = [ + RdSelect, + RdBreadcrumb, + RdBreadcrumbItem, + RdChenckbox, + RdCheckboxGroup, + rdAvatar, + rdTable, + rdSelect, + rdButton +]; + + -const components = [rButton, gButton, rdAvatar, rdTable, rdSelect]; const install = (app: App): void => { components.map((component) => { app.component(component.name, component); }); }; -export { rButton, gButton, rdAvatar, rdTable, rdSelect }; + +export { + RdSelect, + RdBreadcrumb, + RdBreadcrumbItem, + RdChenckbox, + RdCheckboxGroup, + rdAvatar, + rdTable, + rdSelect, + rdButton}; + export default { install, diff --git a/components/lib/input/input.ts b/components/lib/input/input.ts new file mode 100644 index 0000000..f005d69 --- /dev/null +++ b/components/lib/input/input.ts @@ -0,0 +1,92 @@ +import { computed, ref } from "vue"; + +export const inputProps = { + modelValue: { + type: [Number, String], + }, + placeholder: { + type: String, + }, + disabled: { + type: Boolean, + default: false, + }, + clearable: { + type: Boolean, + default: false, + }, + showPassword: { + type: Boolean, + default: false, + }, + type: { + type: String, + default: "text", + }, + suffixIcon: { + type: [String, Object], + }, + prefixIcon: { + type: [String, Object], + }, + readonly: { + type: Boolean, + default: false, + }, +}; + +export const inputEmit = [ + "update:modelValue", + "input", + "clear", + "blur", + "focus", +]; + +export const useInput = (props, emits) => { + const disabled = computed(() => props.disabled); + const placeholder = computed(() => props.placeholder); + const clearable = computed(() => props.clearable); + + const showPassword = computed(() => props.showPassword); + const passwordVisible = ref(false); + const readonly = computed(() => props.readonly); + + const type = computed(() => { + return showPassword.value + ? passwordVisible.value + ? "text" + : "password" + : props.type; + }); + + const classes = computed(() => ({ + "is-disabled": disabled.value, + "is-clearable": clearable.value, + "show-password": showPassword.value, + "jw-input": type.value !== "textarea", + "jw-textarea": type.value === "textarea", + "jw-input-suffix": + showPassword.value || clearable.value || props.suffixIcon, + "jw-input-prefix": props.prefixIcon, + })); + + const nativeInputValue = computed(() => + props.modelValue === null || props.modelValue === undefined + ? "" + : String(props.modelValue) + ); + return { + disabled, + classes, + clearable, + showPassword, + type, + passwordVisible, + placeholder, + suffixIcon: props.suffixIcon, + prefixIcon: props.prefixIcon, + readonly, + nativeInputValue, + }; +}; diff --git a/components/lib/input/main.vue b/components/lib/input/main.vue new file mode 100644 index 0000000..ccbc757 --- /dev/null +++ b/components/lib/input/main.vue @@ -0,0 +1,318 @@ +