vue-devui 1.0.0-rc.7 → 1.0.0-rc.8
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 +3 -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 +62 -26
- package/auto-complete/index.umd.js +5 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +32 -6
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +27 -3
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5548 -77
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +34 -13
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +47 -29
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +90 -138
- 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 +36 -12
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/form/index.es.js +208 -73
- package/form/index.umd.js +12 -12
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +28 -4
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +68 -49
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- 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 +90 -138
- package/input/index.umd.js +1 -1
- package/input/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 +41 -15
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +40 -13
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.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 +1 -1
- package/pagination/index.es.js +59 -32
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/popover/index.es.js +53 -24
- package/popover/index.umd.js +13 -13
- package/popover/style.css +1 -1
- package/progress/index.es.js +31 -9
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +32 -7
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +32 -8
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/search/index.es.js +100 -146
- package/search/index.umd.js +13 -13
- package/search/style.css +1 -1
- package/select/index.es.js +74 -51
- package/select/index.umd.js +1 -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 +52 -24
- package/splitter/index.umd.js +15 -15
- 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 +5710 -265
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +32 -8
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +27 -2
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +93 -76
- package/textarea/index.umd.js +1 -1
- package/textarea/style.css +1 -1
- package/tooltip/index.es.js +41 -14
- package/tooltip/index.umd.js +12 -12
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +60 -51
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +53 -22
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +3703 -3560
- package/vue-devui.umd.js +20 -20
package/search/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, ref, watch,
|
|
1
|
+
import { computed, ref, watch, inject, toRefs, defineComponent, createVNode, mergeProps, resolveComponent } from "vue";
|
|
2
2
|
const searchProps = {
|
|
3
3
|
size: {
|
|
4
4
|
type: String,
|
|
@@ -49,6 +49,29 @@ const searchProps = {
|
|
|
49
49
|
default: void 0
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
+
function createBem(namespace, element, modifier) {
|
|
53
|
+
let cls = namespace;
|
|
54
|
+
if (element) {
|
|
55
|
+
cls += `__${element}`;
|
|
56
|
+
}
|
|
57
|
+
if (modifier) {
|
|
58
|
+
cls += `--${modifier}`;
|
|
59
|
+
}
|
|
60
|
+
return cls;
|
|
61
|
+
}
|
|
62
|
+
function useNamespace(block) {
|
|
63
|
+
const namespace = `devui-${block}`;
|
|
64
|
+
const b = () => createBem(namespace);
|
|
65
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
66
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
67
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
68
|
+
return {
|
|
69
|
+
b,
|
|
70
|
+
e,
|
|
71
|
+
m,
|
|
72
|
+
em
|
|
73
|
+
};
|
|
74
|
+
}
|
|
52
75
|
const SIZE_CLASS = {
|
|
53
76
|
lg: "lg",
|
|
54
77
|
md: "md",
|
|
@@ -58,13 +81,14 @@ const ICON_POSITION = {
|
|
|
58
81
|
right: "right",
|
|
59
82
|
left: "left"
|
|
60
83
|
};
|
|
84
|
+
const ns = useNamespace("search");
|
|
61
85
|
const getRootClass = (props) => {
|
|
62
86
|
return computed(() => ({
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
[
|
|
67
|
-
[
|
|
87
|
+
[ns.b()]: true,
|
|
88
|
+
[ns.m("disabled")]: props.disabled,
|
|
89
|
+
[ns.m("no-border")]: props.noBorder,
|
|
90
|
+
[ns.m(props.size)]: SIZE_CLASS[props.size],
|
|
91
|
+
[ns.m(props.iconPosition)]: ICON_POSITION[props.iconPosition]
|
|
68
92
|
}));
|
|
69
93
|
};
|
|
70
94
|
const keywordsHandles = (ctx, props) => {
|
|
@@ -5524,173 +5548,102 @@ const keydownHandles = (ctx, keywords, props) => {
|
|
|
5524
5548
|
};
|
|
5525
5549
|
};
|
|
5526
5550
|
const inputProps = {
|
|
5527
|
-
|
|
5551
|
+
modelValue: {
|
|
5528
5552
|
type: String,
|
|
5529
|
-
default:
|
|
5553
|
+
default: ""
|
|
5530
5554
|
},
|
|
5531
5555
|
disabled: {
|
|
5532
5556
|
type: Boolean,
|
|
5533
5557
|
default: false
|
|
5534
5558
|
},
|
|
5535
|
-
autoFocus: {
|
|
5536
|
-
type: Boolean,
|
|
5537
|
-
default: false
|
|
5538
|
-
},
|
|
5539
|
-
maxLength: {
|
|
5540
|
-
type: Number,
|
|
5541
|
-
default: Number.MAX_SAFE_INTEGER
|
|
5542
|
-
},
|
|
5543
|
-
cssClass: {
|
|
5544
|
-
type: String,
|
|
5545
|
-
default: ""
|
|
5546
|
-
},
|
|
5547
5559
|
error: {
|
|
5548
5560
|
type: Boolean,
|
|
5549
5561
|
default: false
|
|
5550
5562
|
},
|
|
5551
5563
|
size: {
|
|
5552
5564
|
type: String,
|
|
5553
|
-
default: ""
|
|
5554
|
-
},
|
|
5555
|
-
showPassword: {
|
|
5556
|
-
type: Boolean,
|
|
5557
|
-
default: false
|
|
5558
|
-
},
|
|
5559
|
-
modelValue: {
|
|
5560
|
-
type: String,
|
|
5561
|
-
default: ""
|
|
5562
|
-
},
|
|
5563
|
-
"update:modelValue": {
|
|
5564
|
-
type: Function,
|
|
5565
|
-
default: void 0
|
|
5566
|
-
},
|
|
5567
|
-
onChange: {
|
|
5568
|
-
type: Function,
|
|
5569
|
-
default: void 0
|
|
5570
|
-
},
|
|
5571
|
-
onKeydown: {
|
|
5572
|
-
type: Function,
|
|
5573
|
-
default: void 0
|
|
5574
|
-
},
|
|
5575
|
-
onFocus: {
|
|
5576
|
-
type: Function,
|
|
5577
|
-
default: void 0
|
|
5578
|
-
},
|
|
5579
|
-
onBlur: {
|
|
5580
|
-
type: Function,
|
|
5581
|
-
default: void 0
|
|
5565
|
+
default: "md"
|
|
5582
5566
|
}
|
|
5583
5567
|
};
|
|
5584
5568
|
const FORM_ITEM_TOKEN = Symbol("dFormItem");
|
|
5569
|
+
function useInputRender(props) {
|
|
5570
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
5571
|
+
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
5572
|
+
const ns2 = useNamespace("input");
|
|
5573
|
+
const isFocus = ref(false);
|
|
5574
|
+
const { error, size, disabled } = toRefs(props);
|
|
5575
|
+
const wrapClasses = computed(() => ({
|
|
5576
|
+
[ns2.b()]: true,
|
|
5577
|
+
[ns2.m("focus")]: isFocus.value,
|
|
5578
|
+
[ns2.m("disabled")]: disabled.value,
|
|
5579
|
+
[ns2.m("error")]: error.value || isValidateError.value,
|
|
5580
|
+
[ns2.m("feedback")]: formItemContext == null ? void 0 : formItemContext.showFeedback,
|
|
5581
|
+
[ns2.m(size.value)]: true
|
|
5582
|
+
}));
|
|
5583
|
+
return { isFocus, wrapClasses };
|
|
5584
|
+
}
|
|
5585
|
+
function useInputEvent(isFocus, ctx) {
|
|
5586
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
5587
|
+
const onFocus = (e) => {
|
|
5588
|
+
isFocus.value = true;
|
|
5589
|
+
ctx.emit("focus", e);
|
|
5590
|
+
};
|
|
5591
|
+
const onBlur = (e) => {
|
|
5592
|
+
isFocus.value = false;
|
|
5593
|
+
ctx.emit("blur", e);
|
|
5594
|
+
formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
|
|
5595
|
+
};
|
|
5596
|
+
const onInput = (e) => {
|
|
5597
|
+
ctx.emit("update:modelValue", e.target.value);
|
|
5598
|
+
};
|
|
5599
|
+
const onChange = (e) => {
|
|
5600
|
+
ctx.emit("change", e.target.value);
|
|
5601
|
+
};
|
|
5602
|
+
const onKeydown = (e) => {
|
|
5603
|
+
ctx.emit("keydown", e);
|
|
5604
|
+
};
|
|
5605
|
+
return { onFocus, onBlur, onInput, onChange, onKeydown };
|
|
5606
|
+
}
|
|
5585
5607
|
var input = "";
|
|
5586
5608
|
var DInput = defineComponent({
|
|
5587
5609
|
name: "DInput",
|
|
5588
|
-
|
|
5589
|
-
focus: {
|
|
5590
|
-
mounted: function(el, binding) {
|
|
5591
|
-
if (binding.value) {
|
|
5592
|
-
el.focus();
|
|
5593
|
-
}
|
|
5594
|
-
}
|
|
5595
|
-
}
|
|
5596
|
-
},
|
|
5610
|
+
inheritAttrs: false,
|
|
5597
5611
|
props: inputProps,
|
|
5598
|
-
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
5612
|
+
emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown"],
|
|
5599
5613
|
setup(props, ctx) {
|
|
5600
|
-
const formItemContext = inject(FORM_ITEM_TOKEN);
|
|
5601
|
-
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
5602
|
-
const showPwdIcon = ref(false);
|
|
5603
|
-
const inputType = ref("text");
|
|
5604
|
-
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
5605
|
-
const inputCls = computed(() => ({
|
|
5606
|
-
"devui-error": props.error || isValidateError.value,
|
|
5607
|
-
[props.cssClass]: true,
|
|
5608
|
-
"devui-input-restore": showPwdIcon.value,
|
|
5609
|
-
[sizeCls.value]: props.size !== ""
|
|
5610
|
-
}));
|
|
5611
|
-
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
5612
|
-
watch(() => props.showPassword, (flg) => {
|
|
5613
|
-
inputType.value = flg ? "password" : "text";
|
|
5614
|
-
showPwdIcon.value = props.showPassword;
|
|
5615
|
-
}, {
|
|
5616
|
-
immediate: true
|
|
5617
|
-
});
|
|
5618
|
-
watch(() => props.modelValue, () => {
|
|
5619
|
-
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
5620
|
-
});
|
|
5621
|
-
const onInput = ($event) => {
|
|
5622
|
-
ctx.emit("update:modelValue", $event.target.value);
|
|
5623
|
-
}, onFocus = () => {
|
|
5624
|
-
ctx.emit("focus");
|
|
5625
|
-
}, onBlur = () => {
|
|
5626
|
-
ctx.emit("blur");
|
|
5627
|
-
formItemContext == null ? void 0 : formItemContext.validate("blur").catch((err) => console.warn(err));
|
|
5628
|
-
}, onChange = ($event) => {
|
|
5629
|
-
ctx.emit("change", $event.target.value);
|
|
5630
|
-
}, onKeydown = ($event) => {
|
|
5631
|
-
ctx.emit("keydown", $event);
|
|
5632
|
-
}, onChangeInputType = () => {
|
|
5633
|
-
inputType.value = inputType.value === "password" ? "text" : "password";
|
|
5634
|
-
};
|
|
5635
|
-
return {
|
|
5636
|
-
inputCls,
|
|
5637
|
-
inputType,
|
|
5638
|
-
showPreviewIcon,
|
|
5639
|
-
showPwdIcon,
|
|
5640
|
-
onInput,
|
|
5641
|
-
onFocus,
|
|
5642
|
-
onBlur,
|
|
5643
|
-
onChange,
|
|
5644
|
-
onKeydown,
|
|
5645
|
-
onChangeInputType
|
|
5646
|
-
};
|
|
5647
|
-
},
|
|
5648
|
-
render() {
|
|
5614
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
5649
5615
|
const {
|
|
5650
5616
|
modelValue,
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
onInput,
|
|
5617
|
+
disabled
|
|
5618
|
+
} = toRefs(props);
|
|
5619
|
+
const ns2 = useNamespace("input");
|
|
5620
|
+
const {
|
|
5621
|
+
isFocus,
|
|
5622
|
+
wrapClasses
|
|
5623
|
+
} = useInputRender(props);
|
|
5624
|
+
const {
|
|
5660
5625
|
onFocus,
|
|
5661
5626
|
onBlur,
|
|
5627
|
+
onInput,
|
|
5662
5628
|
onChange,
|
|
5663
|
-
onKeydown
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
}, {
|
|
5671
|
-
"value": modelValue,
|
|
5672
|
-
"disabled": disabled,
|
|
5673
|
-
"
|
|
5674
|
-
|
|
5675
|
-
"placeholder": placeholder,
|
|
5676
|
-
"class": inputCls,
|
|
5629
|
+
onKeydown
|
|
5630
|
+
} = useInputEvent(isFocus, ctx);
|
|
5631
|
+
watch(() => props.modelValue, () => {
|
|
5632
|
+
formItemContext == null ? void 0 : formItemContext.validate("change").catch((err) => console.warn(err));
|
|
5633
|
+
});
|
|
5634
|
+
return () => createVNode("div", {
|
|
5635
|
+
"class": wrapClasses.value
|
|
5636
|
+
}, [createVNode("input", mergeProps({
|
|
5637
|
+
"value": modelValue.value,
|
|
5638
|
+
"disabled": disabled.value,
|
|
5639
|
+
"class": ns2.e("inner")
|
|
5640
|
+
}, ctx.attrs, {
|
|
5677
5641
|
"onInput": onInput,
|
|
5678
5642
|
"onFocus": onFocus,
|
|
5679
5643
|
"onBlur": onBlur,
|
|
5680
5644
|
"onChange": onChange,
|
|
5681
5645
|
"onKeydown": onKeydown
|
|
5682
|
-
}), null)
|
|
5683
|
-
"class": "devui-input__preview",
|
|
5684
|
-
"onClick": onChangeInputType
|
|
5685
|
-
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
5686
|
-
"name": "preview-forbidden",
|
|
5687
|
-
"size": "12px",
|
|
5688
|
-
"key": 1
|
|
5689
|
-
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
5690
|
-
"name": "preview",
|
|
5691
|
-
"size": "12px",
|
|
5692
|
-
"key": 2
|
|
5693
|
-
}, null)])]);
|
|
5646
|
+
}), null)]);
|
|
5694
5647
|
}
|
|
5695
5648
|
});
|
|
5696
5649
|
var search = "";
|
|
@@ -5699,6 +5652,7 @@ var Search = defineComponent({
|
|
|
5699
5652
|
props: searchProps,
|
|
5700
5653
|
emits: ["update:modelValue", "search"],
|
|
5701
5654
|
setup(props, ctx) {
|
|
5655
|
+
const ns2 = useNamespace("search");
|
|
5702
5656
|
const rootClasses = getRootClass(props);
|
|
5703
5657
|
const {
|
|
5704
5658
|
keywords,
|
|
@@ -5732,21 +5686,21 @@ var Search = defineComponent({
|
|
|
5732
5686
|
return createVNode("div", {
|
|
5733
5687
|
"class": rootClasses.value
|
|
5734
5688
|
}, [props.iconPosition === "left" && createVNode("div", {
|
|
5735
|
-
"class": "
|
|
5689
|
+
"class": ns2.e("icon"),
|
|
5736
5690
|
"onClick": onClickHandle
|
|
5737
5691
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5738
5692
|
"name": "search",
|
|
5739
5693
|
"size": "inherit",
|
|
5740
5694
|
"key": "search"
|
|
5741
5695
|
}, null)]), createVNode(DInput, inputProps2, null), clearIconShow.value && createVNode("div", {
|
|
5742
|
-
"class": "
|
|
5696
|
+
"class": ns2.e("clear"),
|
|
5743
5697
|
"onClick": onClearHandle
|
|
5744
5698
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5745
5699
|
"name": "close",
|
|
5746
5700
|
"size": "inherit",
|
|
5747
5701
|
"key": "close"
|
|
5748
5702
|
}, null)]), props.iconPosition === "right" && createVNode("div", {
|
|
5749
|
-
"class": "
|
|
5703
|
+
"class": ns2.e("icon"),
|
|
5750
5704
|
"onClick": onClickHandle
|
|
5751
5705
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5752
5706
|
"name": "search",
|