@mlightcad/ui-components 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -41,7 +41,7 @@ interface Props {
41
41
  * - vertical: arrange button vertically
42
42
  * - horizontal: arrange button horizontally
43
43
  */
44
- layout?: 'vertical' | 'horizontal'
44
+ direction?: 'vertical' | 'horizontal'
45
45
  }
46
46
  ```
47
47
 
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .ml-vertical-toolbar-button-group[data-v-04772114]{display:flex;flex-direction:column;align-items:flex-start}.ml-horizontal-toolbar-button-group[data-v-04772114]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-04772114]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-04772114]{margin-left:0;margin-top:5px}
1
+ .ml-vertical-toolbar-button-group[data-v-0fe7ba99]{display:flex;flex-direction:column}.ml-horizontal-toolbar-button-group[data-v-0fe7ba99]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-0fe7ba99]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px}.ml-toolbar-button-text[data-v-0fe7ba99]{margin-left:0;margin-top:5px}
@@ -1,4 +1,4 @@
1
- import { ElIcon as y, ElButton as g, ElTooltip as C, ElButtonGroup as T } from "element-plus/es";
1
+ import { ElIcon as g, ElButton as y, ElTooltip as C, ElButtonGroup as T } from "element-plus/es";
2
2
  import "element-plus/es/components/base/style/css";
3
3
  import "element-plus/es/components/button-group/style/css";
4
4
  import "element-plus/es/components/tooltip/style/css";
@@ -13,13 +13,13 @@ const G = {
13
13
  props: {
14
14
  items: {},
15
15
  size: { default: "large" },
16
- layout: { default: "horizontal" }
16
+ direction: {}
17
17
  },
18
18
  emits: {
19
19
  click: null
20
20
  },
21
21
  setup(e, { emit: c }) {
22
- const t = e, s = c, a = r(() => t.layout === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
22
+ const t = e, s = c, a = r(() => t.direction === "vertical" ? "ml-vertical-toolbar-button-group" : "ml-horizontal-toolbar-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
23
23
  switch (t.size) {
24
24
  case "small":
25
25
  return 30;
@@ -31,12 +31,12 @@ const G = {
31
31
  s("click", o);
32
32
  };
33
33
  return (o, O) => {
34
- const v = y, h = g, z = C, k = T;
35
- return l(), i(k, {
34
+ const v = g, h = y, k = C, x = T;
35
+ return l(), i(x, {
36
36
  class: E(a.value)
37
37
  }, {
38
38
  default: u(() => [
39
- (l(!0), m(M, null, S(o.items, (n, x) => (l(), i(z, {
39
+ (l(!0), m(M, null, S(o.items, (n, z) => (l(), i(k, {
40
40
  key: n.text,
41
41
  content: d(n),
42
42
  "hide-after": 0
@@ -45,7 +45,7 @@ const G = {
45
45
  (l(), i(h, {
46
46
  class: "ml-toolbar-button",
47
47
  style: w({ width: p.value + "px", height: p.value + "px" }),
48
- key: x,
48
+ key: z,
49
49
  onClick: ($) => f(n.command)
50
50
  }, {
51
51
  default: u(() => [
@@ -72,7 +72,7 @@ const G = {
72
72
  for (const [s, a] of c)
73
73
  t[s] = a;
74
74
  return t;
75
- }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-04772114"]]), R = {
75
+ }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-0fe7ba99"]]), R = {
76
76
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
77
  install(e) {
78
78
  e.component("MlToolbar", F);
@@ -1 +1 @@
1
- (function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/button-group/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/icon/style/css"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/button-group/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css","element-plus/es/components/icon/style/css","vue"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t.UIComponents={},t.es,null,null,null,null,null,t.Vue))})(this,function(t,o,T,g,C,M,q,e){"use strict";const m={key:0,class:"ml-toolbar-button-text"},p=((l,r)=>{const n=l.__vccOpts||l;for(const[i,u]of r)n[i]=u;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},layout:{default:"horizontal"}},emits:{click:null},setup(l,{emit:r}){const n=l,i=r,u=e.computed(()=>n.layout==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),_=e.computed(()=>n.size==="small"?20:30),a=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),b=s=>s.description?s.description:s.text,f=e.computed(()=>n.size==="large"),y=s=>{i("click",s)};return(s,w)=>{const k=o.ElIcon,h=o.ElButton,x=o.ElTooltip,B=o.ElButtonGroup;return e.openBlock(),e.createBlock(B,{class:e.normalizeClass(u.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,z)=>(e.openBlock(),e.createBlock(x,{key:c.text,content:b(c),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(h,{class:"ml-toolbar-button",style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:z,onClick:$=>y(c.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(k,{size:_.value,innerHTML:c.icon},null,8,["size","innerHTML"]),f.value?(e.openBlock(),e.createElementBlock("div",m,e.toDisplayString(c.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-04772114"]]),d={install(l){l.component("MlToolbar",p)}};t.MlToolbar=p,t.default=d,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/button-group/style/css"),require("element-plus/es/components/tooltip/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/icon/style/css"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/button-group/style/css","element-plus/es/components/tooltip/style/css","element-plus/es/components/button/style/css","element-plus/es/components/icon/style/css","vue"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t.UIComponents={},t.es,null,null,null,null,null,t.Vue))})(this,function(t,o,g,z,C,M,q,e){"use strict";const m={key:0,class:"ml-toolbar-button-text"},p=((l,r)=>{const n=l.__vccOpts||l;for(const[i,u]of r)n[i]=u;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},direction:{}},emits:{click:null},setup(l,{emit:r}){const n=l,i=r,u=e.computed(()=>n.direction==="vertical"?"ml-vertical-toolbar-button-group":"ml-horizontal-toolbar-button-group"),_=e.computed(()=>n.size==="small"?20:30),a=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),b=s=>s.description?s.description:s.text,f=e.computed(()=>n.size==="large"),y=s=>{i("click",s)};return(s,w)=>{const k=o.ElIcon,h=o.ElButton,x=o.ElTooltip,B=o.ElButtonGroup;return e.openBlock(),e.createBlock(B,{class:e.normalizeClass(u.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,T)=>(e.openBlock(),e.createBlock(x,{key:c.text,content:b(c),"hide-after":0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(h,{class:"ml-toolbar-button",style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:T,onClick:$=>y(c.command)},{default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(k,{size:_.value,innerHTML:c.icon},null,8,["size","innerHTML"]),f.value?(e.openBlock(),e.createElementBlock("div",m,e.toDisplayString(c.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-0fe7ba99"]]),d={install(l){l.component("MlToolbar",p)}};t.MlToolbar=p,t.default=d,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -39,7 +39,7 @@ interface Props {
39
39
  * - vertical: arrange button vertically
40
40
  * - horizontal: arrange button horizontally
41
41
  */
42
- layout?: 'vertical' | 'horizontal';
42
+ direction?: 'vertical' | 'horizontal';
43
43
  }
44
44
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
45
45
  size: string;
@@ -53,7 +53,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
53
53
  onClick?: ((...args: any[]) => any) | undefined;
54
54
  }, {
55
55
  size: "small" | "medium" | "large";
56
- layout: "vertical" | "horizontal";
57
56
  }, {}>;
58
57
  export default _default;
59
58
  type __VLS_WithDefaults<P, D> = {
@@ -8,7 +8,7 @@ const emit = defineEmits({
8
8
  click: null
9
9
  });
10
10
  const buttonGroupClass = computed(() => {
11
- return props.layout === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group';
11
+ return props.direction === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group';
12
12
  });
13
13
  const buttonIconSize = computed(() => {
14
14
  return (props.size === 'small') ? 20 : 30;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ui-components",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "One common UI component library based on Element Plus",
5
5
  "license": "MIT",
6
6
  "author": "MLight Lee <mlight.lee@outlook.com>",
@@ -40,6 +40,7 @@
40
40
  "build": "vue-tsc && vite build",
41
41
  "generate": "vite-ssg build",
42
42
  "lint": "eslint src/",
43
+ "lint:fix": "eslint src/ --fix",
43
44
  "preview": "vite preview",
44
45
  "typecheck": "vue-tsc --noEmit"
45
46
  }
package/src/MlToolbar.vue CHANGED
@@ -67,7 +67,7 @@ interface Props {
67
67
  * - vertical: arrange button vertically
68
68
  * - horizontal: arrange button horizontally
69
69
  */
70
- layout?: 'vertical' | 'horizontal'
70
+ direction?: 'vertical' | 'horizontal'
71
71
  }
72
72
 
73
73
  const props = withDefaults(defineProps<Props>(), {
@@ -80,7 +80,7 @@ const emit = defineEmits({
80
80
  })
81
81
 
82
82
  const buttonGroupClass = computed(() => {
83
- return props.layout === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group'
83
+ return props.direction === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group'
84
84
  })
85
85
 
86
86
  const buttonIconSize = computed(() => {
@@ -114,7 +114,6 @@ const handleCommand = (command: string) => {
114
114
  .ml-vertical-toolbar-button-group {
115
115
  display: flex;
116
116
  flex-direction: column;
117
- align-items: flex-start;
118
117
  }
119
118
 
120
119
  .ml-horizontal-toolbar-button-group {