@mlightcad/ui-components 0.0.2 → 0.0.4

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/style.css CHANGED
@@ -1 +1 @@
1
- .vertical-button-group[data-v-d11b3637]{display:flex;flex-direction:column;align-items:flex-start}.horizontal-button-group[data-v-d11b3637]{display:flex;flex-direction:row}.custom-button[data-v-d11b3637]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:10px}.icon-text-wrapper[data-v-d11b3637]{display:flex;flex-direction:column;align-items:center;justify-content:center}.button-text[data-v-d11b3637]{margin-left:0;margin-top:8px}
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}
@@ -4,11 +4,11 @@ import "element-plus/es/components/button-group/style/css";
4
4
  import "element-plus/es/components/tooltip/style/css";
5
5
  import "element-plus/es/components/button/style/css";
6
6
  import "element-plus/es/components/icon/style/css";
7
- import { defineComponent as B, computed as r, openBlock as l, createBlock as i, normalizeClass as E, withCtx as u, createElementBlock as m, Fragment as w, renderList as M, normalizeStyle as S, createElementVNode as I, createVNode as L, toDisplayString as N, createCommentVNode as V } from "vue";
8
- const G = { class: "icon-text-wrapper" }, H = {
7
+ import { defineComponent as B, computed as r, openBlock as l, createBlock as i, normalizeClass as E, withCtx as u, createElementBlock as m, Fragment as M, renderList as S, normalizeStyle as w, createElementVNode as I, createVNode as L, toDisplayString as N, createCommentVNode as V } from "vue";
8
+ const G = {
9
9
  key: 0,
10
- class: "button-text"
11
- }, D = /* @__PURE__ */ B({
10
+ class: "ml-toolbar-button-text"
11
+ }, H = /* @__PURE__ */ B({
12
12
  __name: "MlToolbar",
13
13
  props: {
14
14
  items: {},
@@ -19,7 +19,7 @@ const G = { class: "icon-text-wrapper" }, H = {
19
19
  click: null
20
20
  },
21
21
  setup(e, { emit: c }) {
22
- const t = e, s = c, a = r(() => t.layout === "vertical" ? "vertical-button-group" : "horizontal-button-group"), _ = r(() => t.size === "small" ? 20 : 30), p = r(() => {
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
23
  switch (t.size) {
24
24
  case "small":
25
25
  return 30;
@@ -27,32 +27,34 @@ const G = { class: "icon-text-wrapper" }, H = {
27
27
  return 50;
28
28
  }
29
29
  return 70;
30
- }), d = (o) => o.description ? o.description : o.text, b = r(() => t.size === "large"), v = (o) => {
30
+ }), d = (o) => o.description ? o.description : o.text, b = r(() => t.size === "large"), f = (o) => {
31
31
  s("click", o);
32
32
  };
33
- return (o, $) => {
34
- const f = y, h = g, x = C, z = T;
35
- return l(), i(z, {
33
+ return (o, O) => {
34
+ const v = y, h = g, z = C, k = T;
35
+ return l(), i(k, {
36
36
  class: E(a.value)
37
37
  }, {
38
38
  default: u(() => [
39
- (l(!0), m(w, null, M(o.items, (n, k) => (l(), i(x, {
39
+ (l(!0), m(M, null, S(o.items, (n, x) => (l(), i(z, {
40
40
  key: n.text,
41
- content: d(n)
41
+ content: d(n),
42
+ "hide-after": 0
42
43
  }, {
43
44
  default: u(() => [
44
45
  (l(), i(h, {
45
- style: S({ width: p.value + "px", height: p.value + "px" }),
46
- key: k,
47
- onClick: (j) => v(n.command)
46
+ class: "ml-toolbar-button",
47
+ style: w({ width: p.value + "px", height: p.value + "px" }),
48
+ key: x,
49
+ onClick: ($) => f(n.command)
48
50
  }, {
49
51
  default: u(() => [
50
- I("div", G, [
51
- L(f, {
52
+ I("div", null, [
53
+ L(v, {
52
54
  size: _.value,
53
55
  innerHTML: n.icon
54
56
  }, null, 8, ["size", "innerHTML"]),
55
- b.value ? (l(), m("div", H, N(n.text), 1)) : V("", !0)
57
+ b.value ? (l(), m("div", G, N(n.text), 1)) : V("", !0)
56
58
  ])
57
59
  ]),
58
60
  _: 2
@@ -65,18 +67,18 @@ const G = { class: "icon-text-wrapper" }, H = {
65
67
  }, 8, ["class"]);
66
68
  };
67
69
  }
68
- }), F = (e, c) => {
70
+ }), D = (e, c) => {
69
71
  const t = e.__vccOpts || e;
70
72
  for (const [s, a] of c)
71
73
  t[s] = a;
72
74
  return t;
73
- }, O = /* @__PURE__ */ F(D, [["__scopeId", "data-v-d11b3637"]]), U = {
75
+ }, F = /* @__PURE__ */ D(H, [["__scopeId", "data-v-04772114"]]), R = {
74
76
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
77
  install(e) {
76
- e.component("MlToolbar", O);
78
+ e.component("MlToolbar", F);
77
79
  }
78
80
  };
79
81
  export {
80
- O as MlToolbar,
81
- U as default
82
+ F as MlToolbar,
83
+ R as default
82
84
  };
@@ -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,g,C,M,q,w,e){"use strict";const m={class:"icon-text-wrapper"},d={key:0,class:"button-text"},u=((l,r)=>{const n=l.__vccOpts||l;for(const[i,p]of r)n[i]=p;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,p=e.computed(()=>n.layout==="vertical"?"vertical-button-group":"horizontal-button-group"),f=e.computed(()=>n.size==="small"?20:30),a=e.computed(()=>{switch(n.size){case"small":return 30;case"medium":return 50}return 70}),y=s=>s.description?s.description:s.text,b=e.computed(()=>n.size==="large"),k=s=>{i("click",s)};return(s,$)=>{const h=o.ElIcon,x=o.ElButton,B=o.ElTooltip,z=o.ElButtonGroup;return e.openBlock(),e.createBlock(z,{class:e.normalizeClass(p.value)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,(c,T)=>(e.openBlock(),e.createBlock(B,{key:c.text,content:y(c)},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(x,{style:e.normalizeStyle({width:a.value+"px",height:a.value+"px"}),key:T,onClick:I=>k(c.command)},{default:e.withCtx(()=>[e.createElementVNode("div",m,[e.createVNode(h,{size:f.value,innerHTML:c.icon},null,8,["size","innerHTML"]),b.value?(e.openBlock(),e.createElementBlock("div",d,e.toDisplayString(c.text),1)):e.createCommentVNode("",!0)])]),_:2},1032,["style","onClick"]))]),_:2},1032,["content"]))),128))]),_:1},8,["class"])}}}),[["__scopeId","data-v-d11b3637"]]),_={install(l){l.component("MlToolbar",u)}};t.MlToolbar=u,t.default=_,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,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"}})});
@@ -8,7 +8,7 @@ const emit = defineEmits({
8
8
  click: null
9
9
  });
10
10
  const buttonGroupClass = computed(() => {
11
- return props.layout === 'vertical' ? 'vertical-button-group' : 'horizontal-button-group';
11
+ return props.layout === '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,13 +62,13 @@ 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
70
- const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ 'onClick': {} }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }));
71
- const __VLS_14 = __VLS_13({ ...{ 'onClick': {} }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
70
+ const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }));
71
+ const __VLS_14 = __VLS_13({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
72
72
  let __VLS_18;
73
73
  const __VLS_19 = {
74
74
  onClick: (...[$event]) => {
@@ -77,7 +77,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
77
77
  };
78
78
  let __VLS_15;
79
79
  let __VLS_16;
80
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("icon-text-wrapper") }, });
80
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
81
81
  const __VLS_20 = __VLS_resolvedLocalAndGlobalComponents.ElIcon;
82
82
  /** @type { [typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, ] } */
83
83
  // @ts-ignore
@@ -85,7 +85,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
85
85
  const __VLS_22 = __VLS_21({ size: ((__VLS_ctx.buttonIconSize)), }, ...__VLS_functionalComponentArgsRest(__VLS_21));
86
86
  __VLS_directiveAsFunction(__VLS_ctx.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.icon) }, null, null);
87
87
  if (__VLS_ctx.isShowButtonText) {
88
- __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("button-text") }, });
88
+ __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("ml-toolbar-button-text") }, });
89
89
  (item.text);
90
90
  }
91
91
  __VLS_nonNullable(__VLS_17.slots).default;
@@ -95,8 +95,8 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
95
95
  }
96
96
  __VLS_nonNullable(__VLS_5.slots).default;
97
97
  const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
98
- __VLS_styleScopedClasses['icon-text-wrapper'];
99
- __VLS_styleScopedClasses['button-text'];
98
+ __VLS_styleScopedClasses['ml-toolbar-button'];
99
+ __VLS_styleScopedClasses['ml-toolbar-button-text'];
100
100
  var __VLS_slots;
101
101
  var __VLS_inheritedAttrs;
102
102
  const __VLS_refs = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/ui-components",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
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>",
package/src/MlToolbar.vue CHANGED
@@ -4,16 +4,18 @@
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
10
+ class="ml-toolbar-button"
9
11
  :style="{ width: buttonSize + 'px', height: buttonSize + 'px' }"
10
12
  :key="index"
11
13
  @click="handleCommand(item.command)"
12
14
  >
13
- <div class="icon-text-wrapper">
15
+ <div>
14
16
  <!-- eslint-disable-next-line vue/no-v-text-v-html-on-component -->
15
17
  <el-icon :size="buttonIconSize" v-html="item.icon" />
16
- <div v-if="isShowButtonText" class="button-text">{{ item.text }}</div>
18
+ <div v-if="isShowButtonText" class="ml-toolbar-button-text">{{ item.text }}</div>
17
19
  </div>
18
20
  </el-button>
19
21
  </el-tooltip>
@@ -78,7 +80,7 @@ const emit = defineEmits({
78
80
  })
79
81
 
80
82
  const buttonGroupClass = computed(() => {
81
- return props.layout === 'vertical' ? 'vertical-button-group' : 'horizontal-button-group'
83
+ return props.layout === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group'
82
84
  })
83
85
 
84
86
  const buttonIconSize = computed(() => {
@@ -109,34 +111,27 @@ const handleCommand = (command: string) => {
109
111
  </script>
110
112
 
111
113
  <style scoped>
112
- .vertical-button-group {
114
+ .ml-vertical-toolbar-button-group {
113
115
  display: flex;
114
116
  flex-direction: column;
115
117
  align-items: flex-start;
116
118
  }
117
119
 
118
- .horizontal-button-group {
120
+ .ml-horizontal-toolbar-button-group {
119
121
  display: flex;
120
122
  flex-direction: row;
121
123
  }
122
124
 
123
- .custom-button {
125
+ .ml-toolbar-button {
124
126
  display: flex;
125
127
  flex-direction: column;
126
128
  align-items: center;
127
129
  justify-content: center;
128
- padding: 10px;
130
+ padding: 5px;
129
131
  }
130
132
 
131
- .icon-text-wrapper {
132
- display: flex;
133
- flex-direction: column;
134
- align-items: center;
135
- justify-content: center;
136
- }
137
-
138
- .button-text {
133
+ .ml-toolbar-button-text {
139
134
  margin-left: 0px;
140
- margin-top: 8px;
135
+ margin-top: 5px;
141
136
  }
142
137
  </style>