@mlightcad/ui-components 0.0.3 → 0.0.5

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
 
@@ -1,4 +1,5 @@
1
- import { ElIcon as y, ElButton as g, ElTooltip as C, ElButtonGroup as T } from "element-plus/es";
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".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}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { ElIcon as g, ElButton as y, ElTooltip as C, ElButtonGroup as T } from "element-plus/es";
2
3
  import "element-plus/es/components/base/style/css";
3
4
  import "element-plus/es/components/button-group/style/css";
4
5
  import "element-plus/es/components/tooltip/style/css";
@@ -13,13 +14,13 @@ const G = {
13
14
  props: {
14
15
  items: {},
15
16
  size: { default: "large" },
16
- layout: { default: "horizontal" }
17
+ direction: {}
17
18
  },
18
19
  emits: {
19
20
  click: null
20
21
  },
21
22
  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(() => {
23
+ 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
24
  switch (t.size) {
24
25
  case "small":
25
26
  return 30;
@@ -31,20 +32,21 @@ const G = {
31
32
  s("click", o);
32
33
  };
33
34
  return (o, O) => {
34
- const v = y, z = g, h = C, k = T;
35
- return l(), i(k, {
35
+ const v = g, h = y, k = C, x = T;
36
+ return l(), i(x, {
36
37
  class: E(a.value)
37
38
  }, {
38
39
  default: u(() => [
39
- (l(!0), m(M, null, S(o.items, (n, x) => (l(), i(h, {
40
+ (l(!0), m(M, null, S(o.items, (n, z) => (l(), i(k, {
40
41
  key: n.text,
41
- content: d(n)
42
+ content: d(n),
43
+ "hide-after": 0
42
44
  }, {
43
45
  default: u(() => [
44
- (l(), i(z, {
46
+ (l(), i(h, {
45
47
  class: "ml-toolbar-button",
46
48
  style: w({ width: p.value + "px", height: p.value + "px" }),
47
- key: x,
49
+ key: z,
48
50
  onClick: ($) => f(n.command)
49
51
  }, {
50
52
  default: u(() => [
@@ -71,7 +73,7 @@ const G = {
71
73
  for (const [s, a] of c)
72
74
  t[s] = a;
73
75
  return t;
74
- }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-dce3ecfb"]]), R = {
76
+ }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-0fe7ba99"]]), R = {
75
77
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
78
  install(e) {
77
79
  e.component("MlToolbar", F);
@@ -1 +1,2 @@
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[u,i]of r)n[u]=i;return n})(e.defineComponent({__name:"MlToolbar",props:{items:{},size:{default:"large"},layout:{default:"horizontal"}},emits:{click:null},setup(l,{emit:r}){const n=l,u=r,i=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=>{u("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(i.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)},{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-dce3ecfb"]]),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(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".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}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ (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;
@@ -62,8 +62,8 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
62
62
  const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.ElTooltip;
63
63
  /** @type { [typeof __VLS_components.ElTooltip, typeof __VLS_components.elTooltip, typeof __VLS_components.ElTooltip, typeof __VLS_components.elTooltip, ] } */
64
64
  // @ts-ignore
65
- const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), }));
66
- const __VLS_8 = __VLS_7({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
65
+ const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), hideAfter: ((0)), }));
66
+ const __VLS_8 = __VLS_7({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), hideAfter: ((0)), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
67
67
  const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
68
68
  /** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
69
69
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ui-components",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
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>",
@@ -29,8 +29,7 @@
29
29
  "package.json"
30
30
  ],
31
31
  "devDependencies": {
32
- "rollup-plugin-peer-deps-external": "^2.2.4",
33
- "vite-plugin-css-injected-by-js": "^3.5.1"
32
+ "rollup-plugin-peer-deps-external": "^2.2.4"
34
33
  },
35
34
  "peerDependencies": {
36
35
  "element-plus": "^2.8.1",
@@ -41,6 +40,7 @@
41
40
  "build": "vue-tsc && vite build",
42
41
  "generate": "vite-ssg build",
43
42
  "lint": "eslint src/",
43
+ "lint:fix": "eslint src/ --fix",
44
44
  "preview": "vite preview",
45
45
  "typecheck": "vue-tsc --noEmit"
46
46
  }
package/src/MlToolbar.vue CHANGED
@@ -4,6 +4,7 @@
4
4
  v-for="(item, index) in items"
5
5
  :key="item.text"
6
6
  :content="buttonTooltip(item)"
7
+ :hide-after=0
7
8
  >
8
9
  <el-button
9
10
  class="ml-toolbar-button"
@@ -66,7 +67,7 @@ interface Props {
66
67
  * - vertical: arrange button vertically
67
68
  * - horizontal: arrange button horizontally
68
69
  */
69
- layout?: 'vertical' | 'horizontal'
70
+ direction?: 'vertical' | 'horizontal'
70
71
  }
71
72
 
72
73
  const props = withDefaults(defineProps<Props>(), {
@@ -79,7 +80,7 @@ const emit = defineEmits({
79
80
  })
80
81
 
81
82
  const buttonGroupClass = computed(() => {
82
- 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'
83
84
  })
84
85
 
85
86
  const buttonIconSize = computed(() => {
@@ -113,7 +114,6 @@ const handleCommand = (command: string) => {
113
114
  .ml-vertical-toolbar-button-group {
114
115
  display: flex;
115
116
  flex-direction: column;
116
- align-items: flex-start;
117
117
  }
118
118
 
119
119
  .ml-horizontal-toolbar-button-group {
@@ -126,11 +126,11 @@ const handleCommand = (command: string) => {
126
126
  flex-direction: column;
127
127
  align-items: center;
128
128
  justify-content: center;
129
- padding: 0px;
129
+ padding: 5px;
130
130
  }
131
131
 
132
132
  .ml-toolbar-button-text {
133
133
  margin-left: 0px;
134
- margin-top: 8px;
134
+ margin-top: 5px;
135
135
  }
136
136
  </style>
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .ml-vertical-toolbar-button-group[data-v-dce3ecfb]{display:flex;flex-direction:column;align-items:flex-start}.ml-horizontal-toolbar-button-group[data-v-dce3ecfb]{display:flex;flex-direction:row}.ml-toolbar-button[data-v-dce3ecfb]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0}.ml-toolbar-button-text[data-v-dce3ecfb]{margin-left:0;margin-top:8px}