vue-devui 1.0.0-rc.5 → 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 +22 -8
- 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 +72 -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 +29 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5548 -76
- 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 +48 -30
- package/checkbox/index.umd.js +1 -1
- package/checkbox/style.css +1 -1
- package/date-picker/index.es.js +91 -145
- 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 +39 -13
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +14 -14
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +958 -1200
- package/form/index.umd.js +18 -18
- 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 +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 +91 -145
- package/input/index.umd.js +1 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +27 -5
- 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 +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/CheckboxGroup.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Tree.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/treeProps.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 +135 -124
- 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 +76 -20
- 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 +34 -10
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/search/index.es.js +103 -153
- package/search/index.umd.js +14 -14
- 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 +52 -16
- 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 +6267 -536
- 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 +42 -15
- package/tooltip/index.umd.js +12 -12
- package/tooltip/style.css +1 -1
- package/{comment → tree}/index.d.ts +0 -0
- package/tree/index.es.js +1030 -0
- package/tree/index.umd.js +1 -0
- package/{comment → tree}/package.json +1 -1
- package/tree/style.css +1 -0
- 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 +5296 -4916
- package/vue-devui.umd.js +22 -22
- package/comment/index.es.js +0 -84
- package/comment/index.umd.js +0 -1
- package/comment/style.css +0 -1
- package/nuxt/components/Comment.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/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,21 +49,46 @@ 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",
|
|
77
|
+
md: "md",
|
|
54
78
|
sm: "sm"
|
|
55
79
|
};
|
|
56
80
|
const ICON_POSITION = {
|
|
57
81
|
right: "right",
|
|
58
82
|
left: "left"
|
|
59
83
|
};
|
|
84
|
+
const ns = useNamespace("search");
|
|
60
85
|
const getRootClass = (props) => {
|
|
61
86
|
return computed(() => ({
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
[
|
|
66
|
-
[
|
|
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]
|
|
67
92
|
}));
|
|
68
93
|
};
|
|
69
94
|
const keywordsHandles = (ctx, props) => {
|
|
@@ -5523,179 +5548,102 @@ const keydownHandles = (ctx, keywords, props) => {
|
|
|
5523
5548
|
};
|
|
5524
5549
|
};
|
|
5525
5550
|
const inputProps = {
|
|
5526
|
-
|
|
5551
|
+
modelValue: {
|
|
5527
5552
|
type: String,
|
|
5528
|
-
default:
|
|
5553
|
+
default: ""
|
|
5529
5554
|
},
|
|
5530
5555
|
disabled: {
|
|
5531
5556
|
type: Boolean,
|
|
5532
5557
|
default: false
|
|
5533
5558
|
},
|
|
5534
|
-
autoFocus: {
|
|
5535
|
-
type: Boolean,
|
|
5536
|
-
default: false
|
|
5537
|
-
},
|
|
5538
|
-
maxLength: {
|
|
5539
|
-
type: Number,
|
|
5540
|
-
default: Number.MAX_SAFE_INTEGER
|
|
5541
|
-
},
|
|
5542
|
-
cssClass: {
|
|
5543
|
-
type: String,
|
|
5544
|
-
default: ""
|
|
5545
|
-
},
|
|
5546
5559
|
error: {
|
|
5547
5560
|
type: Boolean,
|
|
5548
5561
|
default: false
|
|
5549
5562
|
},
|
|
5550
5563
|
size: {
|
|
5551
5564
|
type: String,
|
|
5552
|
-
default: ""
|
|
5553
|
-
},
|
|
5554
|
-
showPassword: {
|
|
5555
|
-
type: Boolean,
|
|
5556
|
-
default: false
|
|
5557
|
-
},
|
|
5558
|
-
modelValue: {
|
|
5559
|
-
type: String,
|
|
5560
|
-
default: ""
|
|
5561
|
-
},
|
|
5562
|
-
"update:modelValue": {
|
|
5563
|
-
type: Function,
|
|
5564
|
-
default: void 0
|
|
5565
|
-
},
|
|
5566
|
-
onChange: {
|
|
5567
|
-
type: Function,
|
|
5568
|
-
default: void 0
|
|
5569
|
-
},
|
|
5570
|
-
onKeydown: {
|
|
5571
|
-
type: Function,
|
|
5572
|
-
default: void 0
|
|
5573
|
-
},
|
|
5574
|
-
onFocus: {
|
|
5575
|
-
type: Function,
|
|
5576
|
-
default: void 0
|
|
5577
|
-
},
|
|
5578
|
-
onBlur: {
|
|
5579
|
-
type: Function,
|
|
5580
|
-
default: void 0
|
|
5565
|
+
default: "md"
|
|
5581
5566
|
}
|
|
5582
5567
|
};
|
|
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
|
+
}
|
|
5583
5607
|
var input = "";
|
|
5584
|
-
const formItemInjectionKey = Symbol("dFormItem");
|
|
5585
|
-
const dFormItemEvents = {
|
|
5586
|
-
blur: "d.form.blur",
|
|
5587
|
-
change: "d.form.change",
|
|
5588
|
-
input: "d.form.input"
|
|
5589
|
-
};
|
|
5590
5608
|
var DInput = defineComponent({
|
|
5591
5609
|
name: "DInput",
|
|
5592
|
-
|
|
5593
|
-
focus: {
|
|
5594
|
-
mounted: function(el, binding) {
|
|
5595
|
-
if (binding.value) {
|
|
5596
|
-
el.focus();
|
|
5597
|
-
}
|
|
5598
|
-
}
|
|
5599
|
-
}
|
|
5600
|
-
},
|
|
5610
|
+
inheritAttrs: false,
|
|
5601
5611
|
props: inputProps,
|
|
5602
|
-
emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
|
|
5612
|
+
emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown"],
|
|
5603
5613
|
setup(props, ctx) {
|
|
5604
|
-
const
|
|
5605
|
-
const hasFormItem = Object.keys(formItem).length > 0;
|
|
5606
|
-
const sizeCls = computed(() => `devui-input-${props.size}`);
|
|
5607
|
-
const showPwdIcon = ref(false);
|
|
5608
|
-
const inputType = ref("text");
|
|
5609
|
-
const inputCls = computed(() => {
|
|
5610
|
-
return {
|
|
5611
|
-
error: props.error,
|
|
5612
|
-
[props.cssClass]: true,
|
|
5613
|
-
"devui-input-restore": showPwdIcon.value,
|
|
5614
|
-
[sizeCls.value]: props.size !== ""
|
|
5615
|
-
};
|
|
5616
|
-
});
|
|
5617
|
-
const showPreviewIcon = computed(() => inputType.value === "password");
|
|
5618
|
-
watch(() => props.showPassword, (flg) => {
|
|
5619
|
-
inputType.value = flg ? "password" : "text";
|
|
5620
|
-
showPwdIcon.value = props.showPassword;
|
|
5621
|
-
}, {
|
|
5622
|
-
immediate: true
|
|
5623
|
-
});
|
|
5624
|
-
const onInput = ($event) => {
|
|
5625
|
-
ctx.emit("update:modelValue", $event.target.value);
|
|
5626
|
-
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
|
|
5627
|
-
}, onFocus = () => {
|
|
5628
|
-
ctx.emit("focus");
|
|
5629
|
-
}, onBlur = () => {
|
|
5630
|
-
ctx.emit("blur");
|
|
5631
|
-
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
|
|
5632
|
-
}, onChange = ($event) => {
|
|
5633
|
-
ctx.emit("change", $event.target.value);
|
|
5634
|
-
hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
|
|
5635
|
-
}, onKeydown = ($event) => {
|
|
5636
|
-
ctx.emit("keydown", $event);
|
|
5637
|
-
}, onChangeInputType = () => {
|
|
5638
|
-
inputType.value = inputType.value === "password" ? "text" : "password";
|
|
5639
|
-
};
|
|
5640
|
-
return {
|
|
5641
|
-
inputCls,
|
|
5642
|
-
inputType,
|
|
5643
|
-
showPreviewIcon,
|
|
5644
|
-
showPwdIcon,
|
|
5645
|
-
onInput,
|
|
5646
|
-
onFocus,
|
|
5647
|
-
onBlur,
|
|
5648
|
-
onChange,
|
|
5649
|
-
onKeydown,
|
|
5650
|
-
onChangeInputType
|
|
5651
|
-
};
|
|
5652
|
-
},
|
|
5653
|
-
render() {
|
|
5614
|
+
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
5654
5615
|
const {
|
|
5655
5616
|
modelValue,
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
onInput,
|
|
5617
|
+
disabled
|
|
5618
|
+
} = toRefs(props);
|
|
5619
|
+
const ns2 = useNamespace("input");
|
|
5620
|
+
const {
|
|
5621
|
+
isFocus,
|
|
5622
|
+
wrapClasses
|
|
5623
|
+
} = useInputRender(props);
|
|
5624
|
+
const {
|
|
5665
5625
|
onFocus,
|
|
5666
5626
|
onBlur,
|
|
5627
|
+
onInput,
|
|
5667
5628
|
onChange,
|
|
5668
|
-
onKeydown
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
}, {
|
|
5676
|
-
"value": modelValue,
|
|
5677
|
-
"disabled": disabled,
|
|
5678
|
-
"
|
|
5679
|
-
|
|
5680
|
-
"placeholder": placeholder,
|
|
5681
|
-
"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, {
|
|
5682
5641
|
"onInput": onInput,
|
|
5683
5642
|
"onFocus": onFocus,
|
|
5684
5643
|
"onBlur": onBlur,
|
|
5685
5644
|
"onChange": onChange,
|
|
5686
5645
|
"onKeydown": onKeydown
|
|
5687
|
-
}), null)
|
|
5688
|
-
"class": "devui-input__preview",
|
|
5689
|
-
"onClick": onChangeInputType
|
|
5690
|
-
}, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
|
|
5691
|
-
"name": "preview-forbidden",
|
|
5692
|
-
"size": "12px",
|
|
5693
|
-
"key": 1
|
|
5694
|
-
}, null) : createVNode(resolveComponent("d-icon"), {
|
|
5695
|
-
"name": "preview",
|
|
5696
|
-
"size": "12px",
|
|
5697
|
-
"key": 2
|
|
5698
|
-
}, null)])]);
|
|
5646
|
+
}), null)]);
|
|
5699
5647
|
}
|
|
5700
5648
|
});
|
|
5701
5649
|
var search = "";
|
|
@@ -5704,6 +5652,7 @@ var Search = defineComponent({
|
|
|
5704
5652
|
props: searchProps,
|
|
5705
5653
|
emits: ["update:modelValue", "search"],
|
|
5706
5654
|
setup(props, ctx) {
|
|
5655
|
+
const ns2 = useNamespace("search");
|
|
5707
5656
|
const rootClasses = getRootClass(props);
|
|
5708
5657
|
const {
|
|
5709
5658
|
keywords,
|
|
@@ -5729,6 +5678,7 @@ var Search = defineComponent({
|
|
|
5729
5678
|
autoFocus: props.autoFocus,
|
|
5730
5679
|
modelValue: keywords.value,
|
|
5731
5680
|
placeholder: props.placeholder,
|
|
5681
|
+
maxLength: props.maxLength,
|
|
5732
5682
|
cssClass: props.cssClass,
|
|
5733
5683
|
onKeydown: onInputKeydown,
|
|
5734
5684
|
"onUpdate:modelValue": onInputUpdate
|
|
@@ -5736,21 +5686,21 @@ var Search = defineComponent({
|
|
|
5736
5686
|
return createVNode("div", {
|
|
5737
5687
|
"class": rootClasses.value
|
|
5738
5688
|
}, [props.iconPosition === "left" && createVNode("div", {
|
|
5739
|
-
"class": "
|
|
5689
|
+
"class": ns2.e("icon"),
|
|
5740
5690
|
"onClick": onClickHandle
|
|
5741
5691
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5742
5692
|
"name": "search",
|
|
5743
5693
|
"size": "inherit",
|
|
5744
5694
|
"key": "search"
|
|
5745
5695
|
}, null)]), createVNode(DInput, inputProps2, null), clearIconShow.value && createVNode("div", {
|
|
5746
|
-
"class": "
|
|
5696
|
+
"class": ns2.e("clear"),
|
|
5747
5697
|
"onClick": onClearHandle
|
|
5748
5698
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5749
5699
|
"name": "close",
|
|
5750
5700
|
"size": "inherit",
|
|
5751
5701
|
"key": "close"
|
|
5752
5702
|
}, null)]), props.iconPosition === "right" && createVNode("div", {
|
|
5753
|
-
"class": "
|
|
5703
|
+
"class": ns2.e("icon"),
|
|
5754
5704
|
"onClick": onClickHandle
|
|
5755
5705
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
5756
5706
|
"name": "search",
|