customs-ui-kit 1.0.1 → 1.0.3
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/customs-ui-kit.css +1 -1
- package/dist/customs-ui-kit.es.js +56 -51
- package/dist/customs-ui-kit.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.vue +2 -3
- package/src/components/Select/Select.stories.ts +40 -0
- package/src/components/Select/Select.vue +37 -0
- package/src/components/Select/index.ts +4 -0
- package/src/components/Table/Table.vue +3 -3
- package/src/index.ts +1 -0
package/dist/customs-ui-kit.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.isHighlight[data-v-ae952d65]{box-shadow:0 0 8px #409effcc;transform:scale(1.02);transition:all .3s ease}.myTableWrapper[data-v-160d151c]{width:100%;overflow:hidden}.myTable[data-v-160d151c]{--el-table-header-bg-color: #f5f7fa}
|
|
@@ -1,76 +1,81 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElButton as g, ElTable as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as i, openBlock as l, createBlock as s, unref as r, mergeProps as n, withCtx as d, renderSlot as u, createElementBlock as c, Fragment as f, renderList as m, createVNode as _, createSlots as h } from "vue";
|
|
2
|
+
import { ElButton as v, ElSelect as y, ElOption as g, ElTable as B, ElTableColumn as $ } from "element-plus";
|
|
3
|
+
const k = /* @__PURE__ */ i({
|
|
4
4
|
__name: "Button",
|
|
5
5
|
props: {
|
|
6
6
|
highlight: { type: Boolean }
|
|
7
7
|
},
|
|
8
|
-
setup(
|
|
9
|
-
return (
|
|
10
|
-
class: [
|
|
8
|
+
setup(t) {
|
|
9
|
+
return (a, o) => (l(), s(r(v), n(a.$attrs, {
|
|
10
|
+
class: ["myButton", { isHighlight: t.highlight }]
|
|
11
11
|
}), {
|
|
12
|
-
default:
|
|
13
|
-
u(
|
|
12
|
+
default: d(() => [
|
|
13
|
+
u(a.$slots, "default", {}, void 0, !0)
|
|
14
14
|
]),
|
|
15
15
|
_: 3
|
|
16
16
|
}, 16, ["class"]));
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
}), b = (t, a) => {
|
|
19
|
+
const o = t.__vccOpts || t;
|
|
20
|
+
for (const [e, p] of a)
|
|
21
|
+
o[e] = p;
|
|
22
|
+
return o;
|
|
23
|
+
}, I = /* @__PURE__ */ b(k, [["__scopeId", "data-v-ae952d65"]]), S = /* @__PURE__ */ i({
|
|
24
|
+
__name: "Select",
|
|
25
|
+
props: {
|
|
26
|
+
options: {}
|
|
27
|
+
},
|
|
28
|
+
setup(t) {
|
|
29
|
+
return (a, o) => (l(), s(r(y), n(a.$attrs, { class: "mySelect" }), {
|
|
30
|
+
default: d(() => [
|
|
31
|
+
t.options && t.options.length ? (l(!0), c(f, { key: 0 }, m(t.options, (e) => (l(), s(r(g), {
|
|
32
|
+
key: e.value,
|
|
33
|
+
label: e.label,
|
|
34
|
+
value: e.value,
|
|
35
|
+
disabled: e.disabled
|
|
36
|
+
}, null, 8, ["label", "value", "disabled"]))), 128)) : u(a.$slots, "default", { key: 1 }, void 0, !0)
|
|
37
|
+
]),
|
|
38
|
+
_: 3
|
|
39
|
+
}, 16));
|
|
40
|
+
}
|
|
41
|
+
}), M = /* @__PURE__ */ b(S, [["__scopeId", "data-v-ed4b07be"]]), T = { class: "myTableWrapper" }, E = /* @__PURE__ */ i({
|
|
29
42
|
__name: "Table",
|
|
30
43
|
props: {
|
|
31
44
|
data: { default: () => [] },
|
|
32
45
|
columns: { default: () => [] },
|
|
33
46
|
border: { type: Boolean, default: !0 }
|
|
34
47
|
},
|
|
35
|
-
setup(
|
|
36
|
-
return (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
width: t.width,
|
|
51
|
-
sortable: t.sortable
|
|
52
|
-
}, f({ _: 2 }, [
|
|
53
|
-
e.$slots[t.prop] ? {
|
|
48
|
+
setup(t) {
|
|
49
|
+
return (a, o) => (l(), c("div", T, [
|
|
50
|
+
_(r(B), n({
|
|
51
|
+
data: t.data,
|
|
52
|
+
border: t.border
|
|
53
|
+
}, a.$attrs, { class: "myTable" }), {
|
|
54
|
+
default: d(() => [
|
|
55
|
+
(l(!0), c(f, null, m(t.columns, (e) => (l(), s(r($), {
|
|
56
|
+
key: e.prop,
|
|
57
|
+
prop: e.prop,
|
|
58
|
+
label: e.label,
|
|
59
|
+
width: e.width,
|
|
60
|
+
sortable: e.sortable
|
|
61
|
+
}, h({ _: 2 }, [
|
|
62
|
+
a.$slots[e.prop] ? {
|
|
54
63
|
name: "default",
|
|
55
|
-
fn:
|
|
56
|
-
u(
|
|
64
|
+
fn: d((p) => [
|
|
65
|
+
u(a.$slots, e.prop, n({ ref_for: !0 }, p), void 0, !0)
|
|
57
66
|
]),
|
|
58
67
|
key: "0"
|
|
59
68
|
} : void 0
|
|
60
69
|
]), 1032, ["prop", "label", "width", "sortable"]))), 128)),
|
|
61
|
-
u(
|
|
70
|
+
u(a.$slots, "append", {}, void 0, !0)
|
|
62
71
|
]),
|
|
63
72
|
_: 3
|
|
64
|
-
}, 16, ["data", "border"
|
|
65
|
-
]
|
|
73
|
+
}, 16, ["data", "border"])
|
|
74
|
+
]));
|
|
66
75
|
}
|
|
67
|
-
}),
|
|
68
|
-
myTableWrapper: E,
|
|
69
|
-
myTable: H
|
|
70
|
-
}, S = {
|
|
71
|
-
$style: W
|
|
72
|
-
}, N = /* @__PURE__ */ c(C, [["__cssModules", S]]);
|
|
76
|
+
}), O = /* @__PURE__ */ b(E, [["__scopeId", "data-v-160d151c"]]);
|
|
73
77
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
I as MyButton,
|
|
79
|
+
M as MySelect,
|
|
80
|
+
O as MyTable
|
|
76
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.CustomsUIKit={},r.Vue,r.ElementPlus))})(this,(function(r,e,l){"use strict";const c=e.defineComponent({__name:"Button",props:{highlight:{type:Boolean}},setup(o){return(n,a)=>(e.openBlock(),e.createBlock(e.unref(l.ElButton),e.mergeProps(n.$attrs,{class:["myButton",{isHighlight:o.highlight}]}),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default",{},void 0,!0)]),_:3},16,["class"]))}}),s=(o,n)=>{const a=o.__vccOpts||o;for(const[t,d]of n)a[t]=d;return a},i=s(c,[["__scopeId","data-v-ae952d65"]]),p=s(e.defineComponent({__name:"Select",props:{options:{}},setup(o){return(n,a)=>(e.openBlock(),e.createBlock(e.unref(l.ElSelect),e.mergeProps(n.$attrs,{class:"mySelect"}),{default:e.withCtx(()=>[o.options&&o.options.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(o.options,t=>(e.openBlock(),e.createBlock(e.unref(l.ElOption),{key:t.value,label:t.label,value:t.value,disabled:t.disabled},null,8,["label","value","disabled"]))),128)):e.renderSlot(n.$slots,"default",{key:1},void 0,!0)]),_:3},16))}}),[["__scopeId","data-v-ed4b07be"]]),f={class:"myTableWrapper"},m=s(e.defineComponent({__name:"Table",props:{data:{default:()=>[]},columns:{default:()=>[]},border:{type:Boolean,default:!0}},setup(o){return(n,a)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(l.ElTable),e.mergeProps({data:o.data,border:o.border},n.$attrs,{class:"myTable"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columns,t=>(e.openBlock(),e.createBlock(e.unref(l.ElTableColumn),{key:t.prop,prop:t.prop,label:t.label,width:t.width,sortable:t.sortable},e.createSlots({_:2},[n.$slots[t.prop]?{name:"default",fn:e.withCtx(d=>[e.renderSlot(n.$slots,t.prop,e.mergeProps({ref_for:!0},d),void 0,!0)]),key:"0"}:void 0]),1032,["prop","label","width","sortable"]))),128)),e.renderSlot(n.$slots,"append",{},void 0,!0)]),_:3},16,["data","border"])]))}}),[["__scopeId","data-v-160d151c"]]);r.MyButton=i,r.MySelect=p,r.MyTable=m,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ElButton } from 'element-plus';
|
|
3
3
|
import type { ButtonProps as ElButtonProps } from 'element-plus';
|
|
4
|
-
import { useCssModule } from 'vue';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* 自定义按钮组件属性 (继承并扩展 Element Plus)
|
|
@@ -18,12 +17,12 @@ defineProps<MyButtonProps>();
|
|
|
18
17
|
</script>
|
|
19
18
|
|
|
20
19
|
<template>
|
|
21
|
-
<el-button v-bind="$attrs"
|
|
20
|
+
<el-button v-bind="$attrs" class="myButton" :class="{ 'isHighlight': highlight }">
|
|
22
21
|
<slot />
|
|
23
22
|
</el-button>
|
|
24
23
|
</template>
|
|
25
24
|
|
|
26
|
-
<style
|
|
25
|
+
<style scoped>
|
|
27
26
|
.myButton {
|
|
28
27
|
/* 在这里可以添加基础的自定义样式 */
|
|
29
28
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { MySelect } from './index';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/MySelect',
|
|
7
|
+
component: MySelect,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
size: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['large', 'default', 'small'],
|
|
13
|
+
},
|
|
14
|
+
clearable: { control: 'boolean' },
|
|
15
|
+
disabled: { control: 'boolean' },
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof MySelect>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
clearable: true,
|
|
25
|
+
placeholder: '请选择',
|
|
26
|
+
options: [
|
|
27
|
+
{ label: '选项一', value: '1' },
|
|
28
|
+
{ label: '选项二', value: '2' },
|
|
29
|
+
{ label: '选项三', value: '3', disabled: true },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
render: (args) => ({
|
|
33
|
+
components: { MySelect },
|
|
34
|
+
setup() {
|
|
35
|
+
const value = ref('');
|
|
36
|
+
return { args, value };
|
|
37
|
+
},
|
|
38
|
+
template: '<my-select v-model="value" v-bind="args" style="width: 240px" />',
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ElSelect, ElOption } from 'element-plus';
|
|
3
|
+
import type { SelectProps as ElSelectProps } from 'element-plus';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 自定义选择器组件属性 (继承并扩展 Element Plus)
|
|
7
|
+
*/
|
|
8
|
+
export interface MySelectProps extends /* @vue-ignore */ Partial<ElSelectProps> {
|
|
9
|
+
/**
|
|
10
|
+
* 数据源选项
|
|
11
|
+
*/
|
|
12
|
+
options?: Array<{ label: string; value: string | number; disabled?: boolean }>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
defineProps<MySelectProps>();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<el-select v-bind="$attrs" class="mySelect">
|
|
20
|
+
<template v-if="options && options.length">
|
|
21
|
+
<el-option
|
|
22
|
+
v-for="item in options"
|
|
23
|
+
:key="item.value"
|
|
24
|
+
:label="item.label"
|
|
25
|
+
:value="item.value"
|
|
26
|
+
:disabled="item.disabled"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
<slot v-else />
|
|
30
|
+
</el-select>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.mySelect {
|
|
35
|
+
/* 在这里可以添加基础的自定义样式 */
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -45,8 +45,8 @@ withDefaults(defineProps<MyTableProps>(), {
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<template>
|
|
48
|
-
<div
|
|
49
|
-
<el-table :data="data" :border="border" v-bind="$attrs"
|
|
48
|
+
<div class="myTableWrapper">
|
|
49
|
+
<el-table :data="data" :border="border" v-bind="$attrs" class="myTable">
|
|
50
50
|
<el-table-column
|
|
51
51
|
v-for="col in columns"
|
|
52
52
|
:key="col.prop"
|
|
@@ -67,7 +67,7 @@ withDefaults(defineProps<MyTableProps>(), {
|
|
|
67
67
|
</div>
|
|
68
68
|
</template>
|
|
69
69
|
|
|
70
|
-
<style
|
|
70
|
+
<style scoped>
|
|
71
71
|
.myTableWrapper {
|
|
72
72
|
width: 100%;
|
|
73
73
|
overflow: hidden;
|
package/src/index.ts
CHANGED