Skip to content

Commit

Permalink
fix: export config-provider props
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn committed Nov 16, 2023
1 parent f861799 commit 4d938fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 29 deletions.
20 changes: 10 additions & 10 deletions packages/core/src/config-provider/component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { PropType } from "vue";
import { defineComponent, renderSlot } from "vue";
import type { SharedConfig } from "@hoci/core";
import { provideSharedConfig } from "@hoci/core";
import { defineComponent, h, renderSlot } from "vue";
import { configProviderProps, provideSharedConfig } from "@hoci/core";
export const HiConfigProvider = defineComponent({
props: {
icon: {
type: Object as PropType<Partial<SharedConfig["icon"]>>
},
activateEvent: {
type: String as PropType<Partial<SharedConfig["activateEvent"]>>
...configProviderProps,
as: {
type: String
}
},
setup(props, context) {
provideSharedConfig(props);
return () => {
return renderSlot(context.slots, "default", undefined);
const content = renderSlot(context.slots, "default", undefined);
if (props.as) {
return h(props.as, content);
}
return content;
};
}
});
24 changes: 5 additions & 19 deletions packages/core/src/config-provider/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import type { SharedConfig } from "@hoci/shared";
import { defineHookProps } from "@hoci/shared";
import type { PropType } from "vue";

export const configProviderProps = defineHookProps({
src: {
type: String,
required: true
icon: {
type: Object as PropType<Partial<SharedConfig["icon"]>>
},
size: {
type: [Number, String]
},
width: {
type: [Number, String]
},
height: {
type: [Number, String]
},
color: {
type: String,
default: "currentColor"
},
mask: {
type: [Boolean, String] as PropType<boolean | "auto">,
default: () => "auto"
activateEvent: {
type: String as PropType<Partial<SharedConfig["activateEvent"]>>
}
});
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export * from "./selection";
export * from "./item";
export * from "./switch";
export * from "./icon";
export * from "./config-provider";
export * from "@hoci/shared";
7 changes: 7 additions & 0 deletions test/selection.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {useSelectionList} from "hoci";
import { it } from "vitest";

it("should select items", () => {


});

0 comments on commit 4d938fd

Please sign in to comment.