vue-devui 1.0.0-rc.6 → 1.0.0-rc.9

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.
Files changed (168) hide show
  1. package/README.md +5 -0
  2. package/alert/index.es.js +37 -11
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +311 -77
  6. package/auto-complete/index.umd.js +3 -5
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +81 -70
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5632 -87
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +56 -29
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +364 -234
  21. package/checkbox/index.umd.js +1 -1
  22. package/checkbox/style.css +1 -1
  23. package/date-picker/index.es.js +310 -157
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +28 -3
  27. package/drawer/index.umd.js +1 -1
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +125 -45
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/editable-select/index.es.js +437 -22
  33. package/editable-select/index.umd.js +1 -1
  34. package/editable-select/style.css +1 -1
  35. package/form/index.es.js +490 -605
  36. package/form/index.umd.js +15 -15
  37. package/form/style.css +1 -1
  38. package/fullscreen/index.es.js +29 -5
  39. package/fullscreen/index.umd.js +1 -1
  40. package/fullscreen/style.css +1 -1
  41. package/grid/index.es.js +71 -50
  42. package/grid/index.umd.js +1 -1
  43. package/grid/style.css +1 -1
  44. package/icon/index.es.js +109 -13
  45. package/icon/index.umd.js +1 -1
  46. package/icon/style.css +1 -0
  47. package/image-preview/index.es.js +34 -11
  48. package/image-preview/index.umd.js +1 -1
  49. package/image-preview/style.css +1 -1
  50. package/input/index.es.js +330 -130
  51. package/input/index.umd.js +1 -1
  52. package/input/style.css +1 -1
  53. package/input-number/index.es.js +272 -199
  54. package/input-number/index.umd.js +1 -1
  55. package/input-number/style.css +1 -1
  56. package/layout/index.es.js +34 -6
  57. package/layout/index.umd.js +1 -1
  58. package/layout/style.css +1 -1
  59. package/loading/index.es.js +34 -10
  60. package/loading/index.umd.js +1 -1
  61. package/loading/style.css +1 -1
  62. package/modal/index.es.js +126 -27
  63. package/modal/index.umd.js +1 -1
  64. package/modal/style.css +1 -1
  65. package/notification/index.es.js +125 -25
  66. package/notification/index.umd.js +1 -1
  67. package/notification/style.css +1 -1
  68. package/nuxt/components/ButtonGroup.js +3 -0
  69. package/nuxt/components/CheckboxButton.js +3 -0
  70. package/nuxt/components/CheckboxGroup.js +3 -0
  71. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  72. package/nuxt/components/FORM_TOKEN.js +3 -0
  73. package/nuxt/components/Icon.js +1 -0
  74. package/nuxt/components/LABEL_DATA.js +3 -0
  75. package/nuxt/components/Option.js +3 -0
  76. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  77. package/nuxt/components/buttonGroupProps.js +3 -0
  78. package/nuxt/components/formControlProps.js +3 -0
  79. package/nuxt/components/formItemProps.js +3 -0
  80. package/nuxt/components/formProps.js +3 -0
  81. package/nuxt/components/iconProps.js +1 -0
  82. package/nuxt/components/svgIconProps.js +3 -0
  83. package/overlay/index.es.js +31 -9
  84. package/overlay/index.umd.js +1 -1
  85. package/overlay/style.css +1 -1
  86. package/package.json +2 -1
  87. package/pagination/index.es.js +135 -124
  88. package/pagination/index.umd.js +1 -1
  89. package/pagination/style.css +1 -1
  90. package/popover/index.es.js +198 -83
  91. package/popover/index.umd.js +16 -16
  92. package/popover/style.css +1 -1
  93. package/progress/index.es.js +76 -20
  94. package/progress/index.umd.js +3 -3
  95. package/progress/style.css +1 -1
  96. package/radio/index.es.js +161 -140
  97. package/radio/index.umd.js +1 -1
  98. package/radio/style.css +1 -1
  99. package/rate/index.es.js +48 -16
  100. package/rate/index.umd.js +1 -1
  101. package/rate/style.css +1 -1
  102. package/result/index.es.js +108 -12
  103. package/result/index.umd.js +1 -1
  104. package/result/style.css +1 -1
  105. package/search/index.es.js +379 -167
  106. package/search/index.umd.js +17 -17
  107. package/search/style.css +1 -1
  108. package/select/index.es.js +7339 -556
  109. package/select/index.umd.js +27 -1
  110. package/select/style.css +1 -1
  111. package/skeleton/index.es.js +37 -12
  112. package/skeleton/index.umd.js +1 -1
  113. package/skeleton/style.css +1 -1
  114. package/slider/index.es.js +34 -10
  115. package/slider/index.umd.js +1 -1
  116. package/slider/style.css +1 -1
  117. package/splitter/index.es.js +201 -84
  118. package/splitter/index.umd.js +14 -14
  119. package/splitter/style.css +1 -1
  120. package/status/index.es.js +26 -2
  121. package/status/index.umd.js +1 -1
  122. package/status/style.css +1 -1
  123. package/style.css +1 -1
  124. package/switch/index.es.js +30 -6
  125. package/switch/index.umd.js +1 -1
  126. package/switch/style.css +1 -1
  127. package/table/index.es.js +6808 -585
  128. package/table/index.umd.js +27 -1
  129. package/table/style.css +1 -1
  130. package/tabs/index.es.js +136 -70
  131. package/tabs/index.umd.js +1 -1
  132. package/tabs/style.css +1 -1
  133. package/tag/index.es.js +31 -7
  134. package/tag/index.umd.js +1 -1
  135. package/tag/style.css +1 -1
  136. package/textarea/index.es.js +5631 -80
  137. package/textarea/index.umd.js +35 -1
  138. package/textarea/style.css +1 -1
  139. package/timeline/index.es.js +108 -12
  140. package/timeline/index.umd.js +1 -1
  141. package/timeline/style.css +1 -1
  142. package/tooltip/index.es.js +190 -74
  143. package/tooltip/index.umd.js +17 -17
  144. package/tooltip/style.css +1 -1
  145. package/tree/index.es.js +376 -256
  146. package/tree/index.umd.js +1 -1
  147. package/tree/style.css +1 -1
  148. package/upload/index.es.js +138 -34
  149. package/upload/index.umd.js +1 -1
  150. package/upload/style.css +1 -1
  151. package/vue-devui.es.js +6770 -5769
  152. package/vue-devui.umd.js +27 -21
  153. package/comment/index.d.ts +0 -7
  154. package/comment/index.es.js +0 -84
  155. package/comment/index.umd.js +0 -1
  156. package/comment/package.json +0 -7
  157. package/comment/style.css +0 -1
  158. package/nuxt/components/Comment.js +0 -3
  159. package/nuxt/components/FormControl.js +0 -3
  160. package/nuxt/components/FormLabel.js +0 -3
  161. package/nuxt/components/ReadTip.js +0 -3
  162. package/nuxt/components/commentProps.js +0 -3
  163. package/nuxt/components/readTipProps.js +0 -3
  164. package/read-tip/index.d.ts +0 -7
  165. package/read-tip/index.es.js +0 -261
  166. package/read-tip/index.umd.js +0 -1
  167. package/read-tip/package.json +0 -7
  168. package/read-tip/style.css +0 -1
package/tabs/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, reactive, provide, onUpdated, onBeforeMount, onMounted, createVNode, inject } from "vue";
1
+ import { toRefs, computed, defineComponent, shallowRef, reactive, inject, onUpdated, onBeforeMount, onMounted, createVNode, provide, mergeProps } from "vue";
2
2
  const tabsProps = {
3
3
  modelValue: {
4
4
  type: [String, Number],
@@ -33,67 +33,98 @@ const tabsProps = {
33
33
  default: null
34
34
  }
35
35
  };
36
+ function createBem(namespace, element, modifier) {
37
+ let cls = namespace;
38
+ if (element) {
39
+ cls += `__${element}`;
40
+ }
41
+ if (modifier) {
42
+ cls += `--${modifier}`;
43
+ }
44
+ return cls;
45
+ }
46
+ function useNamespace(block, needDot = false) {
47
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
48
+ const b = () => createBem(namespace);
49
+ const e = (element) => element ? createBem(namespace, element) : "";
50
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
51
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
52
+ return {
53
+ b,
54
+ e,
55
+ m,
56
+ em
57
+ };
58
+ }
36
59
  var tabs = "";
37
- var Tabs = defineComponent({
38
- name: "DTabs",
60
+ const ns = useNamespace("tabs");
61
+ function useTabNavRender(props) {
62
+ const { cssClass, vertical } = toRefs(props);
63
+ const ulClasses = computed(() => ({
64
+ [ns.e("nav")]: true,
65
+ [ns.em("nav", props.type)]: true,
66
+ [cssClass.value]: Boolean(cssClass.value),
67
+ [ns.e("stacked")]: vertical.value
68
+ }));
69
+ return { ulClasses };
70
+ }
71
+ function useTabNavFunction(props, tabs2, data, ctx, tabsEle) {
72
+ const canChange = function(currentTab) {
73
+ let changeResult = Promise.resolve(true);
74
+ if (typeof props.beforeChange === "function") {
75
+ const result = props.beforeChange(currentTab);
76
+ if (typeof result !== "undefined") {
77
+ if (result.then) {
78
+ changeResult = result;
79
+ } else {
80
+ changeResult = Promise.resolve(result);
81
+ }
82
+ }
83
+ }
84
+ return changeResult;
85
+ };
86
+ const activeClick = function(item, tabEl) {
87
+ if (!props.reactivable && props.modelValue === item.id) {
88
+ return;
89
+ }
90
+ canChange(item.id).then((change) => {
91
+ if (!change) {
92
+ return;
93
+ }
94
+ const tab2 = tabs2.state.data.find((itemOption) => itemOption.id === item.id);
95
+ if (tab2 && !tab2.disabled) {
96
+ tabs2.state.active = item.id;
97
+ ctx.emit("update:modelValue", tab2.id);
98
+ if (props.type === "slider" && tabEl && tabsEle) {
99
+ data.offsetLeft = tabEl.getBoundingClientRect().left - tabsEle.value.nativeElement.getBoundingClientRect().left;
100
+ data.offsetWidth = tabEl.getBoundingClientRect().width;
101
+ }
102
+ ctx.emit("active-tab-change", tab2.id);
103
+ }
104
+ });
105
+ };
106
+ return { activeClick };
107
+ }
108
+ var tabNav = "";
109
+ var TabNav = defineComponent({
110
+ name: "DTabNav",
39
111
  props: tabsProps,
40
112
  emits: ["update:modelValue", "active-tab-change"],
41
- setup(props, {
42
- emit,
43
- slots
44
- }) {
45
- const tabsEle = ref(null);
113
+ setup(props, ctx) {
114
+ const ns2 = useNamespace("tabs");
115
+ const tabsEle = shallowRef();
46
116
  const data = reactive({
47
117
  offsetLeft: 0,
48
118
  offsetWidth: 0,
49
119
  id: null
50
120
  });
51
- const state = reactive({
52
- data: [],
53
- active: props.modelValue,
54
- showContent: props.showContent,
55
- slots: []
56
- });
57
- provide("tabs", {
58
- state
59
- });
60
- const canChange = function(currentTab) {
61
- let changeResult = Promise.resolve(true);
62
- if (typeof props.beforeChange === "function") {
63
- const result = props.beforeChange(currentTab);
64
- if (typeof result !== "undefined") {
65
- if (result.then) {
66
- changeResult = result;
67
- } else {
68
- changeResult = Promise.resolve(result);
69
- }
70
- }
71
- }
72
- return changeResult;
73
- };
74
- const activeClick = function(item, tabEl) {
75
- if (!props.reactivable && props.modelValue === item.id) {
76
- return;
77
- }
78
- canChange(item.id).then((change) => {
79
- if (!change) {
80
- return;
81
- }
82
- const tab = state.data.find((itemOption) => itemOption.id === item.id);
83
- if (tab && !tab.disabled) {
84
- state.active = item.id;
85
- emit("update:modelValue", tab.id);
86
- if (props.type === "slider" && tabEl && tabsEle) {
87
- this.offsetLeft = tabEl.getBoundingClientRect().left - this.tabsEle.nativeElement.getBoundingClientRect().left;
88
- this.offsetWidth = tabEl.getBoundingClientRect().width;
89
- }
90
- emit("active-tab-change", tab.id);
91
- }
92
- });
93
- };
94
- const ulClass = [props.type];
95
- props.cssClass && ulClass.push(props.cssClass);
96
- props.vertical && ulClass.push("devui-nav-stacked");
121
+ const tabs2 = inject("tabs");
122
+ const {
123
+ ulClasses
124
+ } = useTabNavRender(props);
125
+ const {
126
+ activeClick
127
+ } = useTabNavFunction(props, tabs2, data, ctx, tabsEle);
97
128
  onUpdated(() => {
98
129
  if (props.type === "slider") {
99
130
  setTimeout(() => {
@@ -106,23 +137,21 @@ var Tabs = defineComponent({
106
137
  }
107
138
  });
108
139
  onBeforeMount(() => {
109
- if (props.type !== "slider" && props.modelValue === void 0 && state.data.length > 0) {
110
- activeClick(state.data[0]);
140
+ if (props.type !== "slider" && props.modelValue === void 0 && tabs2.state.data.length > 0) {
141
+ activeClick(tabs2.state.data[0]);
111
142
  }
112
143
  });
113
144
  onMounted(() => {
114
- if (props.type === "slider" && props.modelValue === void 0 && state.data.length > 0 && state.data[0]) {
115
- activeClick(state.data[0].tabsEle.value.getElementById(state.data[0].tabId));
145
+ if (props.type === "slider" && props.modelValue === void 0 && tabs2.state.data.length > 0 && tabs2.state.data[0]) {
146
+ activeClick(tabs2.state.data[0].tabsEle.value.getElementById(tabs2.state.data[0].tabId));
116
147
  }
117
148
  });
118
149
  return () => {
119
- return createVNode("div", {
120
- "class": "devui-tabs"
121
- }, [createVNode("ul", {
150
+ return createVNode("ul", {
122
151
  "ref": tabsEle,
123
152
  "role": "tablist",
124
- "class": `devui-nav devui-nav-${ulClass.join(" ")}`
125
- }, [state.data.map((item, i) => {
153
+ "class": ulClasses.value
154
+ }, [(tabs2.state.data || []).map((item, i) => {
126
155
  return createVNode("li", {
127
156
  "role": "presentation",
128
157
  "onClick": () => {
@@ -134,14 +163,49 @@ var Tabs = defineComponent({
134
163
  "role": "tab",
135
164
  "data-toggle": item.id,
136
165
  "aria-expanded": props.modelValue === (item.id || item.tabId)
137
- }, [state.slots[i] ? state.slots[i]() : createVNode("span", null, [item.title])])]);
166
+ }, [tabs2.state.slots[i] ? tabs2.state.slots[i]() : createVNode("span", null, [item.title])])]);
138
167
  }), createVNode("div", {
139
- "class": `devui-nav-${props.type}-animation`,
168
+ "class": ns2.e(`nav-${props.type}-animation`),
140
169
  "style": {
141
170
  left: data.offsetLeft + "px",
142
171
  width: data.offsetWidth + "px"
143
172
  }
144
- }, null)]), slots.default()]);
173
+ }, null)]);
174
+ };
175
+ }
176
+ });
177
+ var Tabs = defineComponent({
178
+ name: "DTabs",
179
+ props: tabsProps,
180
+ emits: ["update:modelValue", "active-tab-change"],
181
+ setup(props, {
182
+ emit,
183
+ slots
184
+ }) {
185
+ const ns2 = useNamespace("tabs");
186
+ const state = reactive({
187
+ data: [],
188
+ active: props.modelValue,
189
+ showContent: props.showContent,
190
+ slots: []
191
+ });
192
+ provide("tabs", {
193
+ state
194
+ });
195
+ const updateModelValue = (value) => {
196
+ emit("update:modelValue", value);
197
+ };
198
+ const activeTabChange = (value) => {
199
+ emit("active-tab-change", value);
200
+ };
201
+ return () => {
202
+ var _a;
203
+ return createVNode("div", {
204
+ "class": ns2.b()
205
+ }, [createVNode(TabNav, mergeProps(props, {
206
+ "onUpdate:modelValue": updateModelValue,
207
+ "onActiveTabChange": activeTabChange
208
+ }), null), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
145
209
  };
146
210
  }
147
211
  });
@@ -159,6 +223,7 @@ const tabProps = {
159
223
  default: false
160
224
  }
161
225
  };
226
+ var tab = "";
162
227
  var Tab = defineComponent({
163
228
  name: "DTab",
164
229
  props: tabProps,
@@ -168,16 +233,17 @@ var Tab = defineComponent({
168
233
  const tabs2 = inject("tabs");
169
234
  tabs2.state.slots.push(slots.title);
170
235
  tabs2.state.data.push(props);
236
+ const ns2 = useNamespace("tab");
171
237
  return () => {
238
+ var _a;
172
239
  const {
173
240
  id
174
241
  } = props;
175
242
  const content = tabs2.state.showContent && tabs2.state.active === id ? createVNode("div", {
176
- "class": "devui-tab-content"
243
+ "class": ns2.e("content")
177
244
  }, [createVNode("div", {
178
- "role": "tabpanel",
179
- "class": "devui-tab-pane in active"
180
- }, [slots.default()])]) : null;
245
+ "role": "tabpanel"
246
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]) : null;
181
247
  return content;
182
248
  };
183
249
  }
package/tabs/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(d,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(d=typeof globalThis!="undefined"?globalThis:d||self,t(d.index={},d.Vue))})(this,function(d,t){"use strict";const y={modelValue:{type:[String,Number],default:null},type:{type:String,default:"tabs"},showContent:{type:Boolean,default:!0},vertical:{type:Boolean,default:!1},reactivable:{type:Boolean,default:!0},customWidth:{type:String,default:""},cssClass:{type:String,default:""},beforeChange:{type:Function,default:null}};var B="",r=t.defineComponent({name:"DTabs",props:y,emits:["update:modelValue","active-tab-change"],setup(e,{emit:u,slots:i}){const s=t.ref(null),f=t.reactive({offsetLeft:0,offsetWidth:0,id:null}),n=t.reactive({data:[],active:e.modelValue,showContent:e.showContent,slots:[]});t.provide("tabs",{state:n});const m=function(a){let l=Promise.resolve(!0);if(typeof e.beforeChange=="function"){const o=e.beforeChange(a);typeof o!="undefined"&&(o.then?l=o:l=Promise.resolve(o))}return l},h=function(a,l){!e.reactivable&&e.modelValue===a.id||m(a.id).then(o=>{if(!o)return;const c=n.data.find(V=>V.id===a.id);c&&!c.disabled&&(n.active=a.id,u("update:modelValue",c.id),e.type==="slider"&&l&&s&&(this.offsetLeft=l.getBoundingClientRect().left-this.tabsEle.nativeElement.getBoundingClientRect().left,this.offsetWidth=l.getBoundingClientRect().width),u("active-tab-change",c.id))})},g=[e.type];return e.cssClass&&g.push(e.cssClass),e.vertical&&g.push("devui-nav-stacked"),t.onUpdated(()=>{e.type==="slider"&&setTimeout(()=>{const a=s.value.querySelector("#"+e.modelValue+".active");a&&(f.offsetLeft=a.getBoundingClientRect().left-s.value.getBoundingClientRect().left,f.offsetWidth=a.getBoundingClientRect().width)})}),t.onBeforeMount(()=>{e.type!=="slider"&&e.modelValue===void 0&&n.data.length>0&&h(n.data[0])}),t.onMounted(()=>{e.type==="slider"&&e.modelValue===void 0&&n.data.length>0&&n.data[0]&&h(n.data[0].tabsEle.value.getElementById(n.data[0].tabId))}),()=>t.createVNode("div",{class:"devui-tabs"},[t.createVNode("ul",{ref:s,role:"tablist",class:`devui-nav devui-nav-${g.join(" ")}`},[n.data.map((a,l)=>t.createVNode("li",{role:"presentation",onClick:()=>{h(a)},class:(e.modelValue===(a.id||a.tabId)?"active":"")+" "+(a.disabled?"disabled":""),id:a.id||a.tabId},[t.createVNode("a",{role:"tab","data-toggle":a.id,"aria-expanded":e.modelValue===(a.id||a.tabId)},[n.slots[l]?n.slots[l]():t.createVNode("span",null,[a.title])])])),t.createVNode("div",{class:`devui-nav-${e.type}-animation`,style:{left:f.offsetLeft+"px",width:f.offsetWidth+"px"}},null)]),i.default()])}});const v={title:{type:[String,Number],default:null},id:{type:String,default:null},disabled:{type:Boolean,default:!1}};var b=t.defineComponent({name:"DTab",props:v,setup(e,{slots:u}){const i=t.inject("tabs");return i.state.slots.push(u.title),i.state.data.push(e),()=>{const{id:s}=e;return i.state.showContent&&i.state.active===s?t.createVNode("div",{class:"devui-tab-content"},[t.createVNode("div",{role:"tabpanel",class:"devui-tab-pane in active"},[u.default()])]):null}}}),C={title:"Tabs \u9009\u9879\u5361",category:"\u5BFC\u822A",status:"60%",install(e){e.component(r.name,r),e.component(b.name,b)}};d.Tab=b,d.Tabs=r,d.default=C,d.tabsProps=y,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
1
+ (function(u,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(u=typeof globalThis!="undefined"?globalThis:u||self,t(u.index={},u.Vue))})(this,function(u,t){"use strict";const h={modelValue:{type:[String,Number],default:null},type:{type:String,default:"tabs"},showContent:{type:Boolean,default:!0},vertical:{type:Boolean,default:!1},reactivable:{type:Boolean,default:!0},customWidth:{type:String,default:""},cssClass:{type:String,default:""},beforeChange:{type:Function,default:null}};function r(e,d,l){let s=e;return d&&(s+=`__${d}`),l&&(s+=`--${l}`),s}function b(e,d=!1){const l=d?`.devui-${e}`:`devui-${e}`;return{b:()=>r(l),e:a=>a?r(l,a):"",m:a=>a?r(l,"",a):"",em:(a,n)=>a&&n?r(l,a,n):""}}var R="";const v=b("tabs");function y(e){const{cssClass:d,vertical:l}=t.toRefs(e);return{ulClasses:t.computed(()=>({[v.e("nav")]:!0,[v.em("nav",e.type)]:!0,[d.value]:Boolean(d.value),[v.e("stacked")]:l.value}))}}function V(e,d,l,s,i){const o=function(a){let n=Promise.resolve(!0);if(typeof e.beforeChange=="function"){const c=e.beforeChange(a);typeof c!="undefined"&&(c.then?n=c:n=Promise.resolve(c))}return n};return{activeClick:function(a,n){!e.reactivable&&e.modelValue===a.id||o(a.id).then(c=>{if(!c)return;const g=d.state.data.find(B=>B.id===a.id);g&&!g.disabled&&(d.state.active=a.id,s.emit("update:modelValue",g.id),e.type==="slider"&&n&&i&&(l.offsetLeft=n.getBoundingClientRect().left-i.value.nativeElement.getBoundingClientRect().left,l.offsetWidth=n.getBoundingClientRect().width),s.emit("active-tab-change",g.id))})}}}var S="",p=t.defineComponent({name:"DTabNav",props:h,emits:["update:modelValue","active-tab-change"],setup(e,d){const l=b("tabs"),s=t.shallowRef(),i=t.reactive({offsetLeft:0,offsetWidth:0,id:null}),o=t.inject("tabs"),{ulClasses:f}=y(e),{activeClick:a}=V(e,o,i,d,s);return t.onUpdated(()=>{e.type==="slider"&&setTimeout(()=>{const n=s.value.querySelector("#"+e.modelValue+".active");n&&(i.offsetLeft=n.getBoundingClientRect().left-s.value.getBoundingClientRect().left,i.offsetWidth=n.getBoundingClientRect().width)})}),t.onBeforeMount(()=>{e.type!=="slider"&&e.modelValue===void 0&&o.state.data.length>0&&a(o.state.data[0])}),t.onMounted(()=>{e.type==="slider"&&e.modelValue===void 0&&o.state.data.length>0&&o.state.data[0]&&a(o.state.data[0].tabsEle.value.getElementById(o.state.data[0].tabId))}),()=>t.createVNode("ul",{ref:s,role:"tablist",class:f.value},[(o.state.data||[]).map((n,c)=>t.createVNode("li",{role:"presentation",onClick:()=>{a(n)},class:(e.modelValue===(n.id||n.tabId)?"active":"")+" "+(n.disabled?"disabled":""),id:n.id||n.tabId},[t.createVNode("a",{role:"tab","data-toggle":n.id,"aria-expanded":e.modelValue===(n.id||n.tabId)},[o.state.slots[c]?o.state.slots[c]():t.createVNode("span",null,[n.title])])])),t.createVNode("div",{class:l.e(`nav-${e.type}-animation`),style:{left:i.offsetLeft+"px",width:i.offsetWidth+"px"}},null)])}}),m=t.defineComponent({name:"DTabs",props:h,emits:["update:modelValue","active-tab-change"],setup(e,{emit:d,slots:l}){const s=b("tabs"),i=t.reactive({data:[],active:e.modelValue,showContent:e.showContent,slots:[]});t.provide("tabs",{state:i});const o=a=>{d("update:modelValue",a)},f=a=>{d("active-tab-change",a)};return()=>{var a;return t.createVNode("div",{class:s.b()},[t.createVNode(p,t.mergeProps(e,{"onUpdate:modelValue":o,onActiveTabChange:f}),null),(a=l.default)==null?void 0:a.call(l)])}}});const N={title:{type:[String,Number],default:null},id:{type:String,default:null},disabled:{type:Boolean,default:!1}};var w="",C=t.defineComponent({name:"DTab",props:N,setup(e,{slots:d}){const l=t.inject("tabs");l.state.slots.push(d.title),l.state.data.push(e);const s=b("tab");return()=>{var f;const{id:i}=e;return l.state.showContent&&l.state.active===i?t.createVNode("div",{class:s.e("content")},[t.createVNode("div",{role:"tabpanel"},[(f=d.default)==null?void 0:f.call(d)])]):null}}}),T={title:"Tabs \u9009\u9879\u5361",category:"\u5BFC\u822A",status:"60%",install(e){e.component(m.name,m),e.component(C.name,C)}};u.Tab=C,u.Tabs=m,u.default=T,u.tabsProps=h,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
package/tabs/style.css CHANGED
@@ -1 +1 @@
1
- :host{display:block}.devui-nav-tabs,.devui-nav-pills{font-size:var(--devui-font-size, 12px);background:transparent;font-weight:700;list-style:none}.devui-nav-tabs li,.devui-nav-pills li{cursor:pointer;border:2px solid transparent}.devui-nav-tabs li a,.devui-nav-pills li a{cursor:pointer;border:none;line-height:30px;background-color:transparent;padding:0;text-decoration:none;color:var(--devui-text, #252b3a)}.devui-nav-tabs li a:hover,.devui-nav-tabs li a:focus,.devui-nav-tabs li a:active,.devui-nav-pills li a:hover,.devui-nav-pills li a:focus,.devui-nav-pills li a:active{outline:none}.devui-nav-tabs li.disabled a,.devui-nav-pills li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-nav-tabs li.active a,.devui-nav-tabs li:hover:not(.disabled) a,.devui-nav-pills li.active a,.devui-nav-pills li:hover:not(.disabled) a{color:var(--devui-brand, #5e7ce0)}.devui-nav-tabs li:after,.devui-nav-pills li:after{content:"";display:block;margin:auto;height:2px;width:0;background:transparent;transition:width .3s ease-out,background-color .3s ease-out}.devui-nav-tabs li.active:after,.devui-nav-pills li.active:after{width:100%;background:var(--devui-brand, #5e7ce0)}.devui-nav-options{font-size:var(--devui-font-size, 12px);background:transparent;border:none;border-radius:var(--devui-border-radius, 2px)}.devui-nav-options>li:last-of-type{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-nav-options>li{cursor:pointer;border:1px solid var(--devui-line, #adb0b8);border-left-width:0;background-color:var(--devui-base-bg, #ffffff);float:left}.devui-nav-options>li:first-child{border-left-width:1px;border-radius:var(--devui-border-radius, 2px) 0 0 var(--devui-border-radius, 2px)}.devui-nav-options>li:last-child{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-nav-options>li>a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);line-height:26px;padding:0 15px}.devui-nav-options>li>a:hover,.devui-nav-options>li>a:focus,.devui-nav-options>li>a:active{outline:none}.devui-nav-options>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-nav-options>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-nav-options>li.active>a,.devui-nav-options>li:hover:not(.disabled)>a{color:var(--devui-light-text, #ffffff)}.devui-nav-options>li.active>a:hover,.devui-nav-options>li:hover:not(.disabled)>a:hover{color:var(--devui-light-text, #ffffff);background:transparent}.devui-nav-options>li.active{background-color:var(--devui-brand, #5e7ce0);border-color:var(--devui-brand, #5e7ce0)}.devui-nav-options>li.active:not(:first-child):before{background-color:var(--devui-brand, #5e7ce0)}.devui-nav-options>li.active+li:before{background-color:var(--devui-brand, #5e7ce0)}.devui-nav-options>li:hover:not(.active):not(.disabled){background-color:var(--devui-brand-active, #526ecc);border-color:var(--devui-brand-active, #526ecc)}.devui-nav-options>li:hover:not(.active):not(.disabled):not(:first-child):before{background-color:var(--devui-brand-active, #526ecc)}.devui-nav-slider{font-size:var(--devui-font-size, 12px);border:none;border-radius:var(--devui-border-radius, 2px);background:var(--devui-list-item-hover-bg, #f2f5fc);width:fit-content;display:flex!important;align-items:center;position:relative}.devui-nav-slider>li{cursor:pointer;margin:2px;float:left;position:relative;z-index:1}.devui-nav-slider>li:first-child{border-left-width:1px;border-radius:var(--devui-border-radius, 2px) 0 0 var(--devui-border-radius, 2px)}.devui-nav-slider>li:last-child{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-nav-slider>li a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);line-height:28px;padding:0 15px}.devui-nav-slider>li a:hover,.devui-nav-slider>li a:focus,.devui-nav-slider>li a:active{outline:none}.devui-nav-slider>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-nav-slider>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-nav-slider>li.active a,.devui-nav-slider>li:hover:not(.disabled) a{color:var(--devui-brand-active, #526ecc)}.devui-nav-slider>li.active a:hover,.devui-nav-slider>li:hover:not(.disabled) a:hover{color:var(--devui-brand-active, #526ecc);background:transparent}.devui-nav-slider>li.active:not(:first-child):before,.devui-nav-slider>li:hover:not(.disabled):not(:first-child):before{content:"";display:block;top:-1px;left:-1px;width:1px;height:"calc(100% + 2px)";position:absolute}.devui-nav-slider>li.active{text-shadow:0 0 .7px var(--devui-brand, #5e7ce0)}.devui-nav-slider>li.active:not(:first-child):before{background-color:var(--devui-brand, #5e7ce0)}.devui-nav-slider>li.active+li:before{background-color:var(--devui-brand, #5e7ce0)}.devui-nav-slider>li:hover:not(.active):not(.disabled){color:var(--devui-brand-active, #526ecc)}.devui-nav-slider>li:hover:not(.active):not(.disabled):not(:first-child):before{background-color:var(--devui-brand-active, #526ecc)}.devui-nav-wrapped{font-size:var(--devui-font-size, 12px);background:transparent;border-bottom:1px solid var(--devui-dividing-line, #dfe1e6);background-color:var(--devui-base-bg, #ffffff)}.devui-nav-wrapped>li{cursor:pointer;float:left;position:relative;padding:8px 16px}.devui-nav-wrapped>li a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);border-radius:var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0 0}.devui-nav-wrapped>li a:hover,.devui-nav-wrapped>li a:focus,.devui-nav-wrapped>li a:active{outline:none}.devui-nav-wrapped>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-nav-wrapped>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-nav-wrapped>li.active{border:1px solid var(--devui-dividing-line, #dfe1e6);background:var(--devui-global-bg, #f3f6f8);border-radius:var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0 0;font-weight:700;margin:-1px;border-bottom-color:transparent}.devui-nav-wrapped>li.active a{color:var(--devui-brand-active, #526ecc)}.devui-nav-wrapped>li:hover:not(.active):not(.disabled) a{color:var(--devui-brand, #5e7ce0)}.devui-nav{list-style:none;padding-left:0}.devui-nav li a{text-decoration:none}.devui-nav li a.custom-width{display:inline-block;padding:0;text-align:center}.devui-nav-tabs:not(.devui-nav-stacked){border-bottom:1px var(--devui-line, #adb0b8) solid}.devui-nav-tabs:not(.devui-nav-stacked) li{float:left;margin-left:32px;margin-bottom:-3px}.devui-nav-tabs:not(.devui-nav-stacked) li:first-child{margin-left:0}.devui-nav-pills:not(.devui-nav-stacked)>li{float:left;margin-left:32px}.devui-nav-pills:not(.devui-nav-stacked)>li:first-child{margin-left:0}.devui-nav:before,.devui-nav:after{content:" ";display:table}.devui-nav:after{clear:both}.devui-tab-content{margin-top:20px}.devui-nav-slider-animation{position:absolute;z-index:0;background-color:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius, 2px);box-shadow:0 2px 4px 0 var(--devui-light-shadow, rgba(0, 0, 0, .1));top:1px;height:30px;transition:left .3s cubic-bezier(.645,.045,.355,1),width .3s cubic-bezier(.645,.045,.355,1)}
1
+ :host{display:block}.devui-tabs__nav--tabs,.devui-tabs__nav--pills{font-size:var(--devui-font-size, 12px);background:transparent;font-weight:700;list-style:none}.devui-tabs__nav--tabs li,.devui-tabs__nav--pills li{cursor:pointer;border:2px solid transparent}.devui-tabs__nav--tabs li a,.devui-tabs__nav--pills li a{cursor:pointer;border:none;line-height:30px;background-color:transparent;padding:0;text-decoration:none;color:var(--devui-text, #252b3a)}.devui-tabs__nav--tabs li a:hover,.devui-tabs__nav--tabs li a:focus,.devui-tabs__nav--tabs li a:active,.devui-tabs__nav--pills li a:hover,.devui-tabs__nav--pills li a:focus,.devui-tabs__nav--pills li a:active{outline:none}.devui-tabs__nav--tabs li.disabled a,.devui-tabs__nav--pills li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-tabs__nav--tabs li.active a,.devui-tabs__nav--tabs li:hover:not(.disabled) a,.devui-tabs__nav--pills li.active a,.devui-tabs__nav--pills li:hover:not(.disabled) a{color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--tabs li:after,.devui-tabs__nav--pills li:after{content:"";display:block;margin:auto;height:2px;width:0;background:transparent;transition:width var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95)),background-color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-tabs__nav--tabs li.active:after,.devui-tabs__nav--pills li.active:after{width:100%;background:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--options{font-size:var(--devui-font-size, 12px);background:transparent;border:none;border-radius:var(--devui-border-radius, 2px)}.devui-tabs__nav--options>li:last-of-type{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-tabs__nav--options>li{cursor:pointer;border:1px solid var(--devui-line, #adb0b8);border-left-width:0;background-color:var(--devui-base-bg, #ffffff);float:left}.devui-tabs__nav--options>li:first-child{border-left-width:1px;border-radius:var(--devui-border-radius, 2px) 0 0 var(--devui-border-radius, 2px)}.devui-tabs__nav--options>li:last-child{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-tabs__nav--options>li>a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);line-height:26px;padding:0 16px;transition:color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-tabs__nav--options>li>a:hover,.devui-tabs__nav--options>li>a:focus,.devui-tabs__nav--options>li>a:active{outline:none}.devui-tabs__nav--options>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-tabs__nav--options>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-tabs__nav--options>li.active>a,.devui-tabs__nav--options>li:hover:not(.disabled)>a{color:var(--devui-light-text, #ffffff)}.devui-tabs__nav--options>li.active>a:hover,.devui-tabs__nav--options>li:hover:not(.disabled)>a:hover{color:var(--devui-light-text, #ffffff);background:transparent}.devui-tabs__nav--options>li.active{background-color:var(--devui-brand, #5e7ce0);border-color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--options>li.active:not(:first-child):before{background-color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--options>li.active+li:before{background-color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--options>li:hover:not(.active):not(.disabled){background-color:var(--devui-brand-active, #526ecc);border-color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--options>li:hover:not(.active):not(.disabled):not(:first-child):before{background-color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--slider{font-size:var(--devui-font-size, 12px);border:none;border-radius:var(--devui-border-radius, 2px);background:var(--devui-list-item-hover-bg, #f2f5fc);width:fit-content;display:flex!important;align-items:center;position:relative}.devui-tabs__nav--slider>li{cursor:pointer;margin:2px;float:left;position:relative;z-index:1}.devui-tabs__nav--slider>li:first-child{border-left-width:1px;border-radius:var(--devui-border-radius, 2px) 0 0 var(--devui-border-radius, 2px)}.devui-tabs__nav--slider>li:last-child{border-radius:0 var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0}.devui-tabs__nav--slider>li a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);line-height:28px;padding:0 16px}.devui-tabs__nav--slider>li a:hover,.devui-tabs__nav--slider>li a:focus,.devui-tabs__nav--slider>li a:active{outline:none}.devui-tabs__nav--slider>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-tabs__nav--slider>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-tabs__nav--slider>li.active a,.devui-tabs__nav--slider>li:hover:not(.disabled) a{color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--slider>li.active a:hover,.devui-tabs__nav--slider>li:hover:not(.disabled) a:hover{color:var(--devui-brand-active, #526ecc);background:transparent}.devui-tabs__nav--slider>li.active:not(:first-child):before,.devui-tabs__nav--slider>li:hover:not(.disabled):not(:first-child):before{content:"";display:block;top:-1px;left:-1px;width:1px;height:"calc(100% + 2px)";position:absolute}.devui-tabs__nav--slider>li.active{text-shadow:0 0 .7px var(--devui-brand, #5e7ce0)}.devui-tabs__nav--slider>li.active:not(:first-child):before{background-color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--slider>li.active+li:before{background-color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav--slider>li:hover:not(.active):not(.disabled){color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--slider>li:hover:not(.active):not(.disabled):not(:first-child):before{background-color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--wrapped{font-size:var(--devui-font-size, 12px);background:transparent;border-bottom:1px solid var(--devui-dividing-line, #dfe1e6);background-color:var(--devui-base-bg, #ffffff)}.devui-tabs__nav--wrapped>li{cursor:pointer;float:left;position:relative;padding:8px 16px}.devui-tabs__nav--wrapped>li a{cursor:pointer;border:none;color:var(--devui-text, #252b3a);border-radius:var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0 0}.devui-tabs__nav--wrapped>li a:hover,.devui-tabs__nav--wrapped>li a:focus,.devui-tabs__nav--wrapped>li a:active{outline:none}.devui-tabs__nav--wrapped>li.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-tabs__nav--wrapped>li.disabled a{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-tabs__nav--wrapped>li.active{border:1px solid var(--devui-dividing-line, #dfe1e6);background:var(--devui-global-bg, #f3f6f8);border-radius:var(--devui-border-radius, 2px) var(--devui-border-radius, 2px) 0 0;font-weight:700;margin:-1px;border-bottom-color:transparent}.devui-tabs__nav--wrapped>li.active a{color:var(--devui-brand-active, #526ecc)}.devui-tabs__nav--wrapped>li:hover:not(.active):not(.disabled) a{color:var(--devui-brand, #5e7ce0)}.devui-tabs__nav{list-style:none;padding-left:0}.devui-tabs__nav li a{text-decoration:none}.devui-tabs__nav li a.custom-width{display:inline-block;padding:0;text-align:center}.devui-tabs__nav--tabs:not(.devui-tabs__stacked){border-bottom:1px var(--devui-line, #adb0b8) solid}.devui-tabs__nav--tabs:not(.devui-tabs__stacked) li{float:left;margin-left:32px;margin-bottom:-3px}.devui-tabs__nav--tabs:not(.devui-tabs__stacked) li:first-child{margin-left:0}.devui-tabs__nav--pills:not(.devui-tabs__stacked)>li{float:left;margin-left:32px}.devui-tabs__nav--pills:not(.devui-tabs__stacked)>li:first-child{margin-left:0}.devui-tabs__nav:before,.devui-tabs__nav:after{content:" ";display:table}.devui-tabs__nav:after{clear:both}.devui-tabs__nav-slider-animation{position:absolute;z-index:0;background-color:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius, 2px);box-shadow:0 2px 4px 0 var(--devui-light-shadow, rgba(37, 43, 58, .1));top:1px;height:30px;transition:left var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95)),width var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.devui-tab__content{margin-top:20px}
package/tag/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { computed, defineComponent, toRefs, ref, watch, onUnmounted, withDirectives, createVNode, resolveComponent, vShow } from "vue";
1
+ import { computed, defineComponent, toRefs, watch, onUnmounted, createVNode, resolveComponent } from "vue";
2
2
  const tagProps = {
3
3
  type: {
4
4
  type: String,
@@ -21,10 +21,34 @@ const tagProps = {
21
21
  default: false
22
22
  }
23
23
  };
24
+ function createBem(namespace, element, modifier) {
25
+ let cls = namespace;
26
+ if (element) {
27
+ cls += `__${element}`;
28
+ }
29
+ if (modifier) {
30
+ cls += `--${modifier}`;
31
+ }
32
+ return cls;
33
+ }
34
+ function useNamespace(block, needDot = false) {
35
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
36
+ const b = () => createBem(namespace);
37
+ const e = (element) => element ? createBem(namespace, element) : "";
38
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
39
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
40
+ return {
41
+ b,
42
+ e,
43
+ m,
44
+ em
45
+ };
46
+ }
24
47
  function useClass(props) {
48
+ const ns = useNamespace("tag");
25
49
  return computed(() => {
26
50
  const { type, color, deletable } = props;
27
- return `devui-tag-item devui-tag-${type || (color ? "colorful" : "") || "default"}${deletable ? " devui-tag-deletable" : ""}`;
51
+ return `${ns.e("item")} ${ns.m(type || (color ? "colorful" : "") || "default")} ${deletable ? ns.m("deletable") : ""}`;
28
52
  });
29
53
  }
30
54
  function useColor(props) {
@@ -63,6 +87,7 @@ var Tag = defineComponent({
63
87
  slots,
64
88
  emit
65
89
  }) {
90
+ const ns = useNamespace("tag");
66
91
  const {
67
92
  type,
68
93
  color,
@@ -74,12 +99,11 @@ var Tag = defineComponent({
74
99
  const themeColor = useColor(props);
75
100
  const tagTitle = titleContent.value || "";
76
101
  const isDefaultTag = () => !type.value && !color.value;
77
- const isShow = ref(true);
78
102
  const handleClick = (e) => {
79
103
  emit("click", e);
80
104
  };
81
105
  const handleDelete = (e) => {
82
- isShow.value = false;
106
+ e.stopPropagation();
83
107
  emit("tagDelete", e);
84
108
  };
85
109
  const closeIconEl = () => {
@@ -102,8 +126,8 @@ var Tag = defineComponent({
102
126
  onUnmounted(() => unWatch());
103
127
  return () => {
104
128
  var _a;
105
- return isShow.value && withDirectives(createVNode("div", {
106
- "class": "devui-tag",
129
+ return createVNode("div", {
130
+ "class": ns.b(),
107
131
  "onClick": handleClick
108
132
  }, [createVNode("span", {
109
133
  "class": tagClass.value,
@@ -113,7 +137,7 @@ var Tag = defineComponent({
113
137
  backgroundColor: checked.value ? themeColor.value : !color.value ? "" : "var(--devui-base-bg, #ffffff)"
114
138
  },
115
139
  "title": tagTitle
116
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots), closeIconEl()])]), [[vShow, isShow.value]]);
140
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots), closeIconEl()])]);
117
141
  };
118
142
  }
119
143
  });
package/tag/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.index={},t.Vue))})(this,function(t,e){"use strict";const f={type:{type:String,default:""},color:{type:String,default:""},titleContent:{type:String,default:""},checked:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1}};function p(a){return e.computed(()=>{const{type:o,color:n,deletable:c}=a;return`devui-tag-item devui-tag-${o||(n?"colorful":"")||"default"}${c?" devui-tag-deletable":""}`})}function g(a){return e.computed(()=>{const{color:o,type:n}=a,c={primary:"var(--devui-primary, #5e7ce0)",success:"var(--devui-success, #50d4ab)",warning:"var(--devui-warning, #fac20a)",danger:"var(--devui-danger, #f66f6a)"},r={"blue-w98":"#3383ff","aqua-w98":"#39afcc","olivine-w98":"#2fa898","green-w98":"#4eb15e","yellow-w98":"#b08d1a","orange-w98":"#d47f35","red-w98":"#f66f6a","pink-w98":"#f3689a","purple-w98":"#a97af8"};return!o&&n?c[n]:r[o]||o})}var D="",d=e.defineComponent({name:"DTag",props:f,emits:["click","tagDelete","checkedChange"],setup(a,{slots:o,emit:n}){const{type:c,color:r,checked:u,titleContent:m,deletable:y}=e.toRefs(a),h=p(a),i=g(a),C=m.value||"",b=()=>!c.value&&!r.value,s=e.ref(!0),w=l=>{n("click",l)},k=l=>{s.value=!1,n("tagDelete",l)},T=()=>y.value?e.createVNode("a",{class:"remove-button",onClick:k},[b()?e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"error-o",color:"#adb0b8"},null):e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"close",color:i.value},null)]):null,S=e.watch(u,l=>{n("checkedChange",l)});return e.onUnmounted(()=>S()),()=>{var l;return s.value&&e.withDirectives(e.createVNode("div",{class:"devui-tag",onClick:w},[e.createVNode("span",{class:h.value,style:{display:"block",color:u.value?"#fff":i.value,backgroundColor:u.value?i.value:r.value?"var(--devui-base-bg, #ffffff)":""},title:C},[(l=o.default)==null?void 0:l.call(o),T()])]),[[e.vShow,s.value]])}}}),v={title:"Tag \u6807\u7B7E",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(a){a.component(d.name,d)}};t.Tag=d,t.default=v,t.tagProps=f,Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"});
1
+ (function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.index={},o.Vue))})(this,function(o,e){"use strict";const m={type:{type:String,default:""},color:{type:String,default:""},titleContent:{type:String,default:""},checked:{type:Boolean,default:!1},deletable:{type:Boolean,default:!1}};function s(n,t,a){let l=n;return t&&(l+=`__${t}`),a&&(l+=`--${a}`),l}function v(n,t=!1){const a=t?`.devui-${n}`:`devui-${n}`;return{b:()=>s(a),e:c=>c?s(a,c):"",m:c=>c?s(a,"",c):"",em:(c,f)=>c&&f?s(a,c,f):""}}function y(n){const t=v("tag");return e.computed(()=>{const{type:a,color:l,deletable:u}=n;return`${t.e("item")} ${t.m(a||(l?"colorful":"")||"default")} ${u?t.m("deletable"):""}`})}function b(n){return e.computed(()=>{const{color:t,type:a}=n,l={primary:"var(--devui-primary, #5e7ce0)",success:"var(--devui-success, #50d4ab)",warning:"var(--devui-warning, #fac20a)",danger:"var(--devui-danger, #f66f6a)"},u={"blue-w98":"#3383ff","aqua-w98":"#39afcc","olivine-w98":"#2fa898","green-w98":"#4eb15e","yellow-w98":"#b08d1a","orange-w98":"#d47f35","red-w98":"#f66f6a","pink-w98":"#f3689a","purple-w98":"#a97af8"};return!t&&a?l[a]:u[t]||t})}var D="",p=e.defineComponent({name:"DTag",props:m,emits:["click","tagDelete","checkedChange"],setup(n,{slots:t,emit:a}){const l=v("tag"),{type:u,color:d,checked:i,titleContent:c,deletable:f}=e.toRefs(n),h=y(n),g=b(n),w=c.value||"",k=()=>!u.value&&!d.value,T=r=>{a("click",r)},$=r=>{r.stopPropagation(),a("tagDelete",r)},N=()=>f.value?e.createVNode("a",{class:"remove-button",onClick:$},[k()?e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"error-o",color:"#adb0b8"},null):e.createVNode(e.resolveComponent("d-icon"),{size:"12px",name:"close",color:g.value},null)]):null,V=e.watch(i,r=>{a("checkedChange",r)});return e.onUnmounted(()=>V()),()=>{var r;return e.createVNode("div",{class:l.b(),onClick:T},[e.createVNode("span",{class:h.value,style:{display:"block",color:i.value?"#fff":g.value,backgroundColor:i.value?g.value:d.value?"var(--devui-base-bg, #ffffff)":""},title:w},[(r=t.default)==null?void 0:r.call(t),N()])])}}}),C={title:"Tag \u6807\u7B7E",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(n){n.component(p.name,p)}};o.Tag=p,o.default=C,o.tagProps=m,Object.defineProperty(o,"__esModule",{value:!0}),o[Symbol.toStringTag]="Module"});
package/tag/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.devui-tag{display:inline-block;margin:4px}.devui-tag .devui-tag-item{display:block;position:relative;padding:0 8px;min-height:20px;border:1px solid;border-radius:var(--devui-border-radius, 2px);font-size:var(--devui-font-size, 12px);line-height:20px;cursor:default}.devui-tag .devui-tag-item.devui-tag-default{border:0;color:var(--devui-text, #252b3a);background-color:var(--devui-default-bg, #f3f6f8)}.devui-tag .devui-tag-item.devui-tag-primary{color:var(--devui-primary, #5e7ce0);background-color:var(--devui-primary-bg, #f2f5fc)}.devui-tag .devui-tag-item.devui-tag-success{color:var(--devui-success, #50d4ab);background-color:var(--devui-success-bg, #edfff9)}.devui-tag .devui-tag-item.devui-tag-warning{color:var(--devui-warning, #fac20a);background-color:var(--devui-warning-bg, #fff3e8)}.devui-tag .devui-tag-item.devui-tag-danger{color:var(--devui-danger, #f66f6a);background-color:var(--devui-danger-bg, #ffeeed)}.devui-tag .devui-tag-item.devui-tag-colorful{background-color:#fff}.devui-tag .devui-tag-item.devui-tag-deletable{padding-right:32px}.devui-tag .remove-button{display:inline-block;margin-left:12px;font-size:var(--devui-font-size-icon, 16px);cursor:pointer;width:12px;height:12px;line-height:12px;border-radius:50%;text-align:center;position:absolute;top:50%;transform:translateY(-50%)}.devui-tag .remove-button i{vertical-align:0}
1
+ @charset "UTF-8";.devui-tag{display:inline-block;margin:4px}.devui-tag .devui-tag__item{display:block;position:relative;padding:0 8px;min-height:20px;border:1px solid;border-radius:var(--devui-border-radius, 2px);font-size:var(--devui-font-size, 12px);line-height:20px;cursor:default}.devui-tag .devui-tag__item.devui-tag--default{border:0;color:var(--devui-text, #252b3a);background-color:var(--devui-default-bg, #f3f6f8)}.devui-tag .devui-tag__item.devui-tag--primary{color:var(--devui-primary, #5e7ce0);background-color:var(--devui-primary-bg, #f2f5fc)}.devui-tag .devui-tag__item.devui-tag--success{color:var(--devui-success, #50d4ab);background-color:var(--devui-success-bg, #edfff9)}.devui-tag .devui-tag__item.devui-tag--warning{color:var(--devui-warning, #fac20a);background-color:var(--devui-warning-bg, #fff3e8)}.devui-tag .devui-tag__item.devui-tag--danger{color:var(--devui-danger, #f66f6a);background-color:var(--devui-danger-bg, #ffeeed)}.devui-tag .devui-tag__item.devui-tag--colorful{background-color:#fff}.devui-tag .devui-tag__item.devui-tag--deletable{padding-right:32px}.devui-tag .remove-button{display:inline-block;margin-left:12px;font-size:var(--devui-font-size-icon, 16px);cursor:pointer;width:12px;height:12px;line-height:12px;border-radius:50%;text-align:center;position:absolute;top:50%;transform:translateY(-50%)}.devui-tag .remove-button i{vertical-align:0}