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.
- package/README.md +5 -0
- package/alert/index.es.js +37 -11
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +311 -77
- package/auto-complete/index.umd.js +3 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5632 -87
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +56 -29
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +364 -234
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +310 -157
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +28 -3
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +125 -45
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +437 -22
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +490 -605
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +29 -5
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +109 -13
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +330 -130
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +272 -199
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +126 -27
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +125 -25
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/formControlProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/overlay/index.es.js +31 -9
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +2 -1
- package/pagination/index.es.js +135 -124
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +198 -83
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/index.es.js +76 -20
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +161 -140
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +48 -16
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +108 -12
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +379 -167
- package/search/index.umd.js +17 -17
- package/search/style.css +1 -1
- package/select/index.es.js +7339 -556
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +37 -12
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +34 -10
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +201 -84
- package/splitter/index.umd.js +14 -14
- package/splitter/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +30 -6
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +6808 -585
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +136 -70
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +31 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +5631 -80
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/timeline/index.es.js +108 -12
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +190 -74
- package/tooltip/index.umd.js +17 -17
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +376 -256
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +138 -34
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +6770 -5769
- package/vue-devui.umd.js +27 -21
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/commentProps.js +0 -3
- package/nuxt/components/readTipProps.js +0 -3
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -261
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
package/tabs/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
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
|
-
|
|
38
|
-
|
|
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
|
-
|
|
43
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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("
|
|
120
|
-
"class": "devui-tabs"
|
|
121
|
-
}, [createVNode("ul", {
|
|
150
|
+
return createVNode("ul", {
|
|
122
151
|
"ref": tabsEle,
|
|
123
152
|
"role": "tablist",
|
|
124
|
-
"class":
|
|
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": `
|
|
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)])
|
|
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": "
|
|
243
|
+
"class": ns2.e("content")
|
|
177
244
|
}, [createVNode("div", {
|
|
178
|
-
"role": "tabpanel"
|
|
179
|
-
|
|
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(
|
|
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-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
|
106
|
-
"class":
|
|
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()])])
|
|
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(
|
|
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-
|
|
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}
|