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.
@@ -1 +1 @@
1
- ._isHighlight_2pl28_11{box-shadow:0 0 8px #409effcc;transform:scale(1.02);transition:all .3s ease}._myTableWrapper_1olwi_3{width:100%;overflow:hidden}._myTable_1olwi_3{--el-table-header-bg-color: #f5f7fa}
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 d, openBlock as o, createBlock as m, unref as r, mergeProps as n, withCtx as p, renderSlot as u, createElementBlock as i, normalizeClass as y, createVNode as b, Fragment as _, renderList as h, createSlots as f } from "vue";
2
- import { ElButton as g, ElTable as $, ElTableColumn as B } from "element-plus";
3
- const T = /* @__PURE__ */ d({
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(s) {
9
- return (e, l) => (o(), m(r(g), n(e.$attrs, {
10
- class: [e.$style.myButton, { [e.$style.isHighlight]: s.highlight }]
8
+ setup(t) {
9
+ return (a, o) => (l(), s(r(v), n(a.$attrs, {
10
+ class: ["myButton", { isHighlight: t.highlight }]
11
11
  }), {
12
- default: p(() => [
13
- u(e.$slots, "default")
12
+ default: d(() => [
13
+ u(a.$slots, "default", {}, void 0, !0)
14
14
  ]),
15
15
  _: 3
16
16
  }, 16, ["class"]));
17
17
  }
18
- }), k = "_myButton_2pl28_3", w = "_isHighlight_2pl28_11", M = {
19
- myButton: k,
20
- isHighlight: w
21
- }, c = (s, e) => {
22
- const l = s.__vccOpts || s;
23
- for (const [t, a] of e)
24
- l[t] = a;
25
- return l;
26
- }, v = {
27
- $style: M
28
- }, L = /* @__PURE__ */ c(T, [["__cssModules", v]]), C = /* @__PURE__ */ d({
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(s) {
36
- return (e, l) => (o(), i("div", {
37
- class: y(e.$style.myTableWrapper)
38
- }, [
39
- b(r($), n({
40
- data: s.data,
41
- border: s.border
42
- }, e.$attrs, {
43
- class: e.$style.myTable
44
- }), {
45
- default: p(() => [
46
- (o(!0), i(_, null, h(s.columns, (t) => (o(), m(r(B), {
47
- key: t.prop,
48
- prop: t.prop,
49
- label: t.label,
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: p((a) => [
56
- u(e.$slots, t.prop, n({ ref_for: !0 }, a))
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(e.$slots, "append")
70
+ u(a.$slots, "append", {}, void 0, !0)
62
71
  ]),
63
72
  _: 3
64
- }, 16, ["data", "border", "class"])
65
- ], 2));
73
+ }, 16, ["data", "border"])
74
+ ]));
66
75
  }
67
- }), E = "_myTableWrapper_1olwi_3", H = "_myTable_1olwi_3", W = {
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
- L as MyButton,
75
- N as MyTable
78
+ I as MyButton,
79
+ M as MySelect,
80
+ O as MyTable
76
81
  };
@@ -1 +1 @@
1
- (function(s,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):(s=typeof globalThis<"u"?globalThis:s||self,e(s.CustomsUIKit={},s.Vue,s.ElementPlus))})(this,(function(s,e,r){"use strict";const p=e.defineComponent({__name:"Button",props:{highlight:{type:Boolean}},setup(l){return(t,n)=>(e.openBlock(),e.createBlock(e.unref(r.ElButton),e.mergeProps(t.$attrs,{class:[t.$style.myButton,{[t.$style.isHighlight]:l.highlight}]}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16,["class"]))}}),d={myButton:"_myButton_2pl28_3",isHighlight:"_isHighlight_2pl28_11"},i=(l,t)=>{const n=l.__vccOpts||l;for(const[o,a]of t)n[o]=a;return n},c=i(p,[["__cssModules",{$style:d}]]),m=i(e.defineComponent({__name:"Table",props:{data:{default:()=>[]},columns:{default:()=>[]},border:{type:Boolean,default:!0}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.$style.myTableWrapper)},[e.createVNode(e.unref(r.ElTable),e.mergeProps({data:l.data,border:l.border},t.$attrs,{class:t.$style.myTable}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.columns,o=>(e.openBlock(),e.createBlock(e.unref(r.ElTableColumn),{key:o.prop,prop:o.prop,label:o.label,width:o.width,sortable:o.sortable},e.createSlots({_:2},[t.$slots[o.prop]?{name:"default",fn:e.withCtx(a=>[e.renderSlot(t.$slots,o.prop,e.mergeProps({ref_for:!0},a))]),key:"0"}:void 0]),1032,["prop","label","width","sortable"]))),128)),e.renderSlot(t.$slots,"append")]),_:3},16,["data","border","class"])],2))}}),[["__cssModules",{$style:{myTableWrapper:"_myTableWrapper_1olwi_3",myTable:"_myTable_1olwi_3"}}]]);s.MyButton=c,s.MyTable=m,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "customs-ui-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "dist/customs-ui-kit.umd.js",
5
5
  "module": "dist/customs-ui-kit.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -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" :class="[$style.myButton, { [$style.isHighlight]: highlight }]">
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 module>
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>
@@ -0,0 +1,4 @@
1
+ import MySelect from './Select.vue';
2
+
3
+ export { MySelect };
4
+ export type { MySelectProps } from './Select.vue';
@@ -45,8 +45,8 @@ withDefaults(defineProps<MyTableProps>(), {
45
45
  </script>
46
46
 
47
47
  <template>
48
- <div :class="$style.myTableWrapper">
49
- <el-table :data="data" :border="border" v-bind="$attrs" :class="$style.myTable">
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 module>
70
+ <style scoped>
71
71
  .myTableWrapper {
72
72
  width: 100%;
73
73
  overflow: hidden;
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components/Button';
2
+ export * from './components/Select';
2
3
  export * from './components/Table';