vue-devui 1.3.4-alpha.4 → 1.4.1
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/editable-select/index.es.js +1242 -567
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/modal/index.es.js +10 -5
- package/modal/index.umd.js +1 -1
- package/nuxt/components/SELECT_KEY.js +3 -0
- package/package.json +1 -1
- package/search/index.es.js +1 -0
- package/search/index.umd.js +1 -1
- package/style.css +1 -1
- package/tabs/index.es.js +7 -5
- package/tabs/index.umd.js +1 -1
- package/types/editable-select/__tests__/{editable-select.spec.d.ts → basic-editable-select.spec.d.ts} +0 -0
- package/types/editable-select/__tests__/clearable-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/custom-template-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/disabled-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/event-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/search-filter-select.spec.d.ts +1 -0
- package/types/editable-select/src/components/dropdown/dropdown-types.d.ts +15 -0
- package/types/editable-select/src/components/dropdown/dropdown.d.ts +2 -0
- package/types/editable-select/src/components/option/option-types.d.ts +18 -0
- package/types/editable-select/src/components/option/option.d.ts +37 -0
- package/types/editable-select/src/composables/use-input-event.d.ts +14 -0
- package/types/editable-select/src/composables/use-input-render.d.ts +12 -0
- package/types/editable-select/src/composables/use-keyboard-select.d.ts +6 -6
- package/types/editable-select/src/composables/use-lazy-load.d.ts +3 -2
- package/types/editable-select/src/composables/use-option.d.ts +7 -0
- package/types/editable-select/src/composables/use-select.d.ts +24 -4
- package/types/editable-select/src/editable-select-types.d.ts +53 -18
- package/types/editable-select/src/editable-select.d.ts +130 -1
- package/types/form/__tests__/form-item-input.spec.d.ts +1 -0
- package/types/select/src/select.d.ts +1 -1
- package/vue-devui.es.js +908 -423
- package/vue-devui.umd.js +14 -14
- package/types/editable-select/src/composables/use-cache-filtered-options.d.ts +0 -7
- package/types/editable-select/src/composables/use-filter-options.d.ts +0 -7
- package/types/editable-select/src/composables/use-input.d.ts +0 -6
- package/types/editable-select/src/utils/index.d.ts +0 -9
- package/types/form/__tests__/form-item.spec.d.ts +0 -0
package/tabs/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRefs, computed, defineComponent, shallowRef, reactive, inject, onUpdated, onBeforeMount, onMounted, onUnmounted, watch, createVNode, resolveComponent,
|
|
1
|
+
import { toRefs, computed, defineComponent, shallowRef, reactive, inject, onUpdated, onBeforeMount, onMounted, onUnmounted, watch, nextTick, createVNode, resolveComponent, provide, mergeProps, getCurrentInstance } from "vue";
|
|
2
2
|
const tabsProps = {
|
|
3
3
|
modelValue: {
|
|
4
4
|
type: [String, Number],
|
|
@@ -263,10 +263,12 @@ var TabNav = defineComponent({
|
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
watch(() => props.modelValue, () => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
nextTick(() => {
|
|
267
|
+
const tab2 = tabsList.value.find((item) => item.props.id === props.modelValue);
|
|
268
|
+
if (tab2) {
|
|
269
|
+
activeClick(tab2);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
270
272
|
});
|
|
271
273
|
return () => {
|
|
272
274
|
const closeIconEl = (item) => {
|
package/tabs/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(v=typeof globalThis!="undefined"?globalThis:v||self,t(v.index={},v.Vue))})(this,function(v,t){"use strict";const w={modelValue:{type:[String,Number],default:null},type:{type:String,default:"tabs"},showContent:{type:Boolean,default:!0},reactivable:{type:Boolean,default:!0},customWidth:{type:String,default:""},cssClass:{type:String,default:""},beforeChange:{type:Function,default:null},closeable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},tabPosition:{type:String,default:"top"}};function y(e,a,n){let o=e;return a&&(o+=`__${a}`),n&&(o+=`--${n}`),o}function V(e,a=!1){const n=a?`.devui-${e}`:`devui-${e}`;return{b:()=>y(n),e:s=>s?y(n,s):"",m:s=>s?y(n,"",s):"",em:(s,f)=>s&&f?y(n,s,f):""}}const g=V("tabs");function
|
|
1
|
+
(function(v,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(v=typeof globalThis!="undefined"?globalThis:v||self,t(v.index={},v.Vue))})(this,function(v,t){"use strict";const w={modelValue:{type:[String,Number],default:null},type:{type:String,default:"tabs"},showContent:{type:Boolean,default:!0},reactivable:{type:Boolean,default:!0},customWidth:{type:String,default:""},cssClass:{type:String,default:""},beforeChange:{type:Function,default:null},closeable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},tabPosition:{type:String,default:"top"}};function y(e,a,n){let o=e;return a&&(o+=`__${a}`),n&&(o+=`--${n}`),o}function V(e,a=!1){const n=a?`.devui-${e}`:`devui-${e}`;return{b:()=>y(n),e:s=>s?y(n,s):"",m:s=>s?y(n,"",s):"",em:(s,f)=>s&&f?y(n,s,f):""}}const g=V("tabs");function k(e,a){const{cssClass:n,tabPosition:o,customWidth:r}=t.toRefs(e),l=t.computed(()=>({[g.e("nav")]:!0,[g.em("nav",e.type)]:!0,[n.value]:Boolean(n.value),[g.em("nav","top")]:o.value==="top",[g.em("nav","right")]:o.value==="right",[g.em("nav","bottom")]:o.value==="bottom",[g.em("nav","left")]:o.value==="left"})),i=t.computed(()=>({["custom-width"]:Boolean(r.value)})),s={width:e.customWidth?e.customWidth:""},f=t.computed(()=>["top","bottom"].includes(e.tabPosition)?{left:a.offsetLeft+"px",width:a.offsetWidth+"px"}:{top:a.offsetTop+"px",height:a.offsetHeight+"px",width:a.offsetWidth+"px"});return{ulClasses:l,aClasses:i,customStyle:s,sliderAnimationStyle:f}}function U(e,a,n,o,r,l){const i=()=>{e.type==="slider"&&setTimeout(()=>{var c;const d=(c=l.value)==null?void 0:c.querySelector("#"+e.modelValue+".active");d&&l.value&&(["top","bottom"].includes(e.tabPosition)?o.offsetLeft=d.getBoundingClientRect().left-l.value.getBoundingClientRect().left:(o.offsetTop=d.getBoundingClientRect().top-l.value.getBoundingClientRect().top,o.offsetHeight=d.getBoundingClientRect().height),o.offsetWidth=d.getBoundingClientRect().width)})},s=d=>{let c=Promise.resolve(!0);if(typeof e.beforeChange=="function"){const u=e.beforeChange(d);typeof u!="undefined"&&(u.then?c=u:c=Promise.resolve(u))}return c},f=(d,c)=>{const u=d.props.id;!e.reactivable&&e.modelValue===u||s(u).then(p=>{if(!p)return;const C=n.value.find(P=>P.props.id===u);a&&C&&!C.props.disabled&&(a.state.active=u,e.type==="slider"&&c&&l&&l.value&&(["left","right"].includes(e.tabPosition)?o.offsetLeft=c.getBoundingClientRect().left-l.value.nativeElement.getBoundingClientRect().left:(o.offsetTop=c.getBoundingClientRect().top-l.value.nativeElement.getBoundingClientRect().top,o.offsetHeight=c.getBoundingClientRect().height),o.offsetWidth=c.getBoundingClientRect().width),r.emit("active-tab-change",C.props.id))})};return{update:i,activeClick:f,beforeMount:()=>{e.type!=="slider"&&e.modelValue===void 0&&n.value&&n.value.length>0&&f(n.value[0])},mounted:()=>{var d;if(e.type==="slider"&&e.modelValue===void 0&&n.value&&n.value.length>0&&n.value[0]){const c=n.value[0],u=(d=c.tabsEle)==null?void 0:d.value,p=u==null?void 0:u.getElementById(c.tabId);f(p)}},tabCanClose:d=>(e.closeable||d.closeable)&&!d.disabled}}function $(e){return{onTabRemove:(o,r)=>{r.stopPropagation(),e.emit("tab-remove",o.props,r),e.emit("tab-change",o.props.id,"delete")},onTabAdd:()=>{e.emit("tab-add"),e.emit("tab-change",void 0,"add")}}}var F="",j=t.defineComponent({name:"DTabNav",props:w,emits:["active-tab-change","tab-remove","tab-add","tab-change"],setup(e,a){const n=V("tabs"),o=t.shallowRef(),r=t.reactive({offsetLeft:0,offsetWidth:0,offsetTop:0,offsetHeight:0,id:null}),l=t.inject("tabs"),i=t.computed(()=>Object.values((l==null?void 0:l.state.data)||{})),{ulClasses:s,aClasses:f,customStyle:B,sliderAnimationStyle:N}=k(e,r),{update:m,beforeMount:d,mounted:c,activeClick:u,tabCanClose:p}=U(e,l,i,r,a,o),{onTabRemove:C,onTabAdd:P}=$(a),_=()=>{P(),t.nextTick(()=>{o.value&&(o.value.scrollLeft=o.value.scrollWidth)})};let R=!1;const L=h=>{if(o.value){const T=h.clientX,b=o.value.scrollLeft;R=!0,o.value.addEventListener("mousemove",M=>{if(R&&o.value){const E=M.clientX-T;o.value.scrollLeft=b-E}}),o.value.addEventListener("mouseup",()=>{R=!1}),o.value.addEventListener("mouseleave",()=>{R=!1})}};return t.onUpdated(()=>m()),t.onBeforeMount(()=>d()),t.onMounted(()=>{c(),o.value&&o.value.addEventListener("mousedown",L)}),t.onUnmounted(()=>{o.value&&o.value.removeEventListener("mousedown",L)}),t.watch(()=>e.modelValue,()=>{t.nextTick(()=>{const h=i.value.find(T=>T.props.id===e.modelValue);h&&u(h)})}),()=>{const h=b=>p(b)?t.createVNode("span",{class:n.e("close-btn"),onClick:M=>C(b,M)},[t.createVNode(t.resolveComponent("d-icon"),{size:"12px",name:"error-o"},null)]):null,T=e.addable?t.createVNode("li",{class:n.e("new-tab"),onClick:_},[t.createVNode(t.resolveComponent("d-icon"),{name:"add"},null)]):null;return t.createVNode("ul",{ref:o,role:"tablist",class:s.value},[(i.value||[]).map(b=>t.createVNode("li",{role:"presentation",onClick:()=>{u(b)},class:(e.modelValue===b.props.id?"active":"")+(b.props.disabled?" disabled":""),id:b.props.id},[t.createVNode("span",{class:n.e("nav-content")},[t.createVNode("a",{role:"tab","data-toggle":b.props.id,"aria-expanded":e.modelValue===b.props.id,class:f.value,style:B},[b.slots.title?b.slots.title():t.createVNode("span",null,[b.props.title])]),h(b)])])),T,t.createVNode("div",{class:n.e(`nav-${e.type}-animation`),style:N.value},null)])}}});const W=V("tabs");function X(e){return{onUpdateModelValue:i=>{e.emit("update:modelValue",i)},onActiveTabChange:i=>{e.emit("active-tab-change",i)},onTabRemove:(i,s)=>{e.emit("tab-remove",i,s)},onTabAdd:()=>{e.emit("tab-add")},onTabChange:(i,s)=>{e.emit("tab-change",i,s)}}}function D(e){return{tabsClasses:t.computed(()=>({[W.b()]:!0,[W.m(e.tabPosition)]:!0}))}}var S=t.defineComponent({name:"DTabs",props:w,emits:["update:modelValue","active-tab-change","tab-remove","tab-add","tab-change"],setup(e,a){const n=t.reactive({data:{},active:e.modelValue,showContent:e.showContent}),o=m=>{m.uid&&(n.data[m.uid]=m)},r=m=>{m&&delete n.data[m]};t.provide("tabs",{state:n,addTab:o,deleteTab:r});const{onUpdateModelValue:l,onActiveTabChange:i,onTabRemove:s,onTabAdd:f,onTabChange:B}=X(a),{tabsClasses:N}=D(e);return t.watch(()=>n.active,()=>{l(n.active)}),()=>{var c,u;const m=t.createVNode(j,t.mergeProps(e,{onActiveTabChange:i,onTabRemove:s,onTabAdd:f,onTabChange:B}),null),d=(u=(c=a.slots).default)==null?void 0:u.call(c);return t.createVNode("div",{class:N.value},[e.tabPosition==="bottom"?[d,m]:[m,d],t.createVNode("div",{style:"clear: both"},null)])}}});const H={title:{type:[String,Number],default:null},id:{type:String,default:null},disabled:{type:Boolean,default:!1},closeable:{type:Boolean,default:!1}};var q="",A=t.defineComponent({name:"DTab",props:H,setup(e,{slots:a}){const n=t.inject("tabs"),o=V("tab"),r=t.getCurrentInstance(),l=t.reactive({uid:r==null?void 0:r.uid,slots:a,props:e});return t.onMounted(()=>{n==null||n.addTab(l)}),t.onUnmounted(()=>{n==null||n.deleteTab(l.uid)}),()=>{var f;const{id:i}=e;return(n==null?void 0:n.state.showContent)&&n.state.active===i?t.createVNode("div",{class:o.e("content")},[t.createVNode("div",{role:"tabpanel"},[(f=a.default)==null?void 0:f.call(a)])]):null}}}),I={title:"Tabs \u9009\u9879\u5361",category:"\u5BFC\u822A",status:"100%",install(e){e.component(S.name,S),e.component(A.name,A)}};v.Tab=A,v.Tabs=S,v.default=I,v.tabsProps=w,Object.defineProperty(v,"__esModule",{value:!0}),v[Symbol.toStringTag]="Module"});
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import { Options } from '../../editable-select-types';
|
|
3
|
+
export declare const dropdownProps: {
|
|
4
|
+
readonly options: {
|
|
5
|
+
readonly type: PropType<Options>;
|
|
6
|
+
readonly default: () => never[];
|
|
7
|
+
};
|
|
8
|
+
readonly width: {
|
|
9
|
+
readonly type: NumberConstructor;
|
|
10
|
+
};
|
|
11
|
+
readonly maxHeight: {
|
|
12
|
+
readonly type: NumberConstructor;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type DropdownProps = ExtractPropTypes<typeof dropdownProps>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<unknown, object, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<unknown>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const editableSelectOptionProps: {
|
|
3
|
+
label: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
value: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
};
|
|
9
|
+
disabled: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
hovering: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare type EditableSelectOptionProps = ExtractPropTypes<typeof editableSelectOptionProps>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
label: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
};
|
|
5
|
+
value: {
|
|
6
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
7
|
+
};
|
|
8
|
+
disabled: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
hovering: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "select"[], "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
label: {
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
};
|
|
20
|
+
value: {
|
|
21
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
22
|
+
};
|
|
23
|
+
disabled: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
hovering: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
}>> & {
|
|
32
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
hovering: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref, SetupContext } from 'vue';
|
|
2
|
+
import { EditableSelectProps } from '../editable-select-types';
|
|
3
|
+
import { States } from './use-select';
|
|
4
|
+
export interface UseInputEventReturnType {
|
|
5
|
+
blur: () => void;
|
|
6
|
+
setSoftFocus: () => void;
|
|
7
|
+
onMouseenter: () => void;
|
|
8
|
+
onMouseleave: () => void;
|
|
9
|
+
onInput: (e: Event) => void;
|
|
10
|
+
handleBlur: (e: FocusEvent) => void;
|
|
11
|
+
handleFocus: (e: FocusEvent) => void;
|
|
12
|
+
handleClear: (e: Event) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function useInputEvent(inputRef: Ref<HTMLInputElement | undefined>, props: EditableSelectProps, states: States, ctx: SetupContext): UseInputEventReturnType;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { EditableSelectProps } from '../editable-select-types';
|
|
3
|
+
import { States } from './use-select';
|
|
4
|
+
interface UseInputRenderReturnType {
|
|
5
|
+
inputClasses: ComputedRef<Record<string, boolean>>;
|
|
6
|
+
inputPlaceholderClasses: ComputedRef<Record<string, boolean>>;
|
|
7
|
+
inputWrapperClasses: ComputedRef<Record<string, boolean>>;
|
|
8
|
+
inputInnerClasses: ComputedRef<Record<string, boolean>>;
|
|
9
|
+
inputSuffixClasses: ComputedRef<Record<string, boolean>>;
|
|
10
|
+
}
|
|
11
|
+
export declare function useInputRender(props: EditableSelectProps, states: States): UseInputRenderReturnType;
|
|
12
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { EditableSelectProps, Option, Options } from '../editable-select-types';
|
|
3
|
+
import { States } from './use-select';
|
|
4
|
+
export interface UseKeyboardSelectReturnType {
|
|
5
|
+
onKeydown: (e: KeyboardEvent) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare function useKeyboardSelect(
|
|
7
|
-
export {};
|
|
7
|
+
export declare function useKeyboardSelect(props: EditableSelectProps, states: States, filteredOptions: Ref<Options>, scrollToItem: (index: number) => void, handleOptionSelect: (option: Option, byClick: boolean) => void): UseKeyboardSelectReturnType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Ref, SetupContext } from 'vue';
|
|
2
|
-
|
|
2
|
+
import { EditableSelectProps } from '../editable-select-types';
|
|
3
|
+
interface UseLazyLoadReturnType {
|
|
3
4
|
loadMore: () => void;
|
|
4
5
|
}
|
|
5
|
-
export declare function useLazyLoad(dropdownRef: Ref<HTMLElement>,
|
|
6
|
+
export declare function useLazyLoad(dropdownRef: Ref<HTMLElement | undefined>, props: EditableSelectProps, ctx: SetupContext): UseLazyLoadReturnType;
|
|
6
7
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { EditableSelectOptionProps } from '../components/option/option-types';
|
|
3
|
+
interface UseOptionReturnType {
|
|
4
|
+
optionClasses: ComputedRef<Record<string, boolean>>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useOption(props: EditableSelectOptionProps): UseOptionReturnType;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
2
|
-
import { EditableSelectProps,
|
|
1
|
+
import { ComputedRef, Ref, SetupContext } from 'vue';
|
|
2
|
+
import { EditableSelectProps, Option, Options } from '../editable-select-types';
|
|
3
|
+
export interface UseSelectStatesReturnType {
|
|
4
|
+
hoveringIndex: number;
|
|
5
|
+
selectedIndex: number;
|
|
6
|
+
query: string;
|
|
7
|
+
inputValue: string;
|
|
8
|
+
selectedLabel: string;
|
|
9
|
+
isFocus: boolean;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
softFocus: boolean;
|
|
12
|
+
isSilentBlur: boolean;
|
|
13
|
+
inputHovering: boolean;
|
|
14
|
+
}
|
|
3
15
|
interface UseSelectReturnType {
|
|
4
|
-
|
|
16
|
+
cachedOptions: Ref<Options>;
|
|
17
|
+
filteredOptions: ComputedRef<Options>;
|
|
18
|
+
emptyText: ComputedRef<string>;
|
|
19
|
+
showClearable: ComputedRef<boolean>;
|
|
20
|
+
toggleMenu: () => void;
|
|
21
|
+
handleOptionSelect: (option: Option, byClick: boolean) => void;
|
|
22
|
+
scrollToItem: (index: number) => void;
|
|
5
23
|
}
|
|
6
|
-
export declare
|
|
24
|
+
export declare type States = UseSelectStatesReturnType;
|
|
25
|
+
export declare function useSelectStates(): UseSelectStatesReturnType;
|
|
26
|
+
export declare function useSelect(dropdownRef: Ref, props: EditableSelectProps, states: States, setSoftFocus: () => void, ctx: SetupContext): UseSelectReturnType;
|
|
7
27
|
export {};
|
|
@@ -1,50 +1,85 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
export interface
|
|
1
|
+
import type { PropType, ExtractPropTypes, InjectionKey, Ref, ComputedRef } from 'vue';
|
|
2
|
+
export interface Option {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string | number;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|
|
7
|
-
export declare type Option = string | number | Partial<OptionObjectItem>;
|
|
8
8
|
export declare type Options = Array<Option>;
|
|
9
|
+
export declare type Placement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
|
|
10
|
+
export declare type EditableSelectSize = 'sm' | 'lg';
|
|
9
11
|
export declare const editableSelectProps: {
|
|
10
12
|
readonly modelValue: {
|
|
11
|
-
readonly type:
|
|
12
|
-
|
|
13
|
+
readonly type: PropType<string | number>;
|
|
14
|
+
};
|
|
15
|
+
readonly appendToBody: {
|
|
16
|
+
readonly type: BooleanConstructor;
|
|
17
|
+
readonly default: false;
|
|
18
|
+
};
|
|
19
|
+
readonly position: {
|
|
20
|
+
readonly type: PropType<Placement[]>;
|
|
21
|
+
readonly default: readonly ["bottom"];
|
|
13
22
|
};
|
|
14
23
|
readonly options: {
|
|
15
24
|
readonly type: PropType<Options>;
|
|
16
25
|
readonly default: () => never[];
|
|
17
26
|
};
|
|
27
|
+
readonly width: {
|
|
28
|
+
readonly type: NumberConstructor;
|
|
29
|
+
};
|
|
30
|
+
readonly maxHeight: {
|
|
31
|
+
readonly type: NumberConstructor;
|
|
32
|
+
};
|
|
33
|
+
readonly size: {
|
|
34
|
+
readonly type: PropType<EditableSelectSize>;
|
|
35
|
+
};
|
|
36
|
+
readonly placeholder: {
|
|
37
|
+
readonly type: StringConstructor;
|
|
38
|
+
readonly default: "Select";
|
|
39
|
+
};
|
|
40
|
+
readonly loading: {
|
|
41
|
+
readonly type: BooleanConstructor;
|
|
42
|
+
readonly default: false;
|
|
43
|
+
};
|
|
18
44
|
readonly allowClear: {
|
|
19
45
|
readonly type: BooleanConstructor;
|
|
20
46
|
readonly default: false;
|
|
21
47
|
};
|
|
22
48
|
readonly disabled: {
|
|
23
49
|
readonly type: BooleanConstructor;
|
|
50
|
+
readonly default: false;
|
|
24
51
|
};
|
|
25
52
|
readonly disabledKey: {
|
|
26
53
|
readonly type: StringConstructor;
|
|
27
54
|
readonly default: "";
|
|
28
55
|
};
|
|
29
|
-
readonly
|
|
30
|
-
readonly type:
|
|
31
|
-
readonly default:
|
|
32
|
-
};
|
|
33
|
-
readonly width: {
|
|
34
|
-
readonly type: NumberConstructor;
|
|
56
|
+
readonly remote: {
|
|
57
|
+
readonly type: BooleanConstructor;
|
|
58
|
+
readonly default: false;
|
|
35
59
|
};
|
|
36
|
-
readonly
|
|
37
|
-
readonly type:
|
|
60
|
+
readonly filterMethod: {
|
|
61
|
+
readonly type: PropType<(inputValue: string) => void>;
|
|
38
62
|
};
|
|
39
|
-
readonly
|
|
40
|
-
readonly type:
|
|
63
|
+
readonly remoteMethod: {
|
|
64
|
+
readonly type: PropType<(inputValue: string) => void>;
|
|
41
65
|
};
|
|
42
66
|
readonly enableLazyLoad: {
|
|
43
67
|
readonly type: BooleanConstructor;
|
|
44
68
|
readonly default: false;
|
|
45
69
|
};
|
|
46
|
-
readonly searchFn: {
|
|
47
|
-
readonly type: PropType<(option: OptionObjectItem, term: string) => boolean>;
|
|
48
|
-
};
|
|
49
70
|
};
|
|
50
71
|
export declare type EditableSelectProps = ExtractPropTypes<typeof editableSelectProps>;
|
|
72
|
+
export interface EditableSelectContext {
|
|
73
|
+
dropdownRef: Ref<HTMLElement | undefined>;
|
|
74
|
+
query: Ref<string>;
|
|
75
|
+
inputValue: Ref<string>;
|
|
76
|
+
hoveringIndex: Ref<number>;
|
|
77
|
+
loading: Ref<boolean>;
|
|
78
|
+
modelValue: Ref<string | number | undefined> | undefined;
|
|
79
|
+
emptyText: ComputedRef<string>;
|
|
80
|
+
disabledKey: string;
|
|
81
|
+
loadMore: () => void;
|
|
82
|
+
handleOptionSelect: (option: Option, byClick: boolean) => void;
|
|
83
|
+
setSoftFocus: () => void;
|
|
84
|
+
}
|
|
85
|
+
export declare const SELECT_KEY: InjectionKey<EditableSelectContext>;
|
|
@@ -1,3 +1,132 @@
|
|
|
1
1
|
import './editable-select.scss';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
readonly modelValue: {
|
|
4
|
+
readonly type: import("vue").PropType<string | number>;
|
|
5
|
+
};
|
|
6
|
+
readonly appendToBody: {
|
|
7
|
+
readonly type: BooleanConstructor;
|
|
8
|
+
readonly default: false;
|
|
9
|
+
};
|
|
10
|
+
readonly position: {
|
|
11
|
+
readonly type: import("vue").PropType<import("./editable-select-types").Placement[]>;
|
|
12
|
+
readonly default: readonly ["bottom"];
|
|
13
|
+
};
|
|
14
|
+
readonly options: {
|
|
15
|
+
readonly type: import("vue").PropType<import("./editable-select-types").Options>;
|
|
16
|
+
readonly default: () => never[];
|
|
17
|
+
};
|
|
18
|
+
readonly width: {
|
|
19
|
+
readonly type: NumberConstructor;
|
|
20
|
+
};
|
|
21
|
+
readonly maxHeight: {
|
|
22
|
+
readonly type: NumberConstructor;
|
|
23
|
+
};
|
|
24
|
+
readonly size: {
|
|
25
|
+
readonly type: import("vue").PropType<import("./editable-select-types").EditableSelectSize>;
|
|
26
|
+
};
|
|
27
|
+
readonly placeholder: {
|
|
28
|
+
readonly type: StringConstructor;
|
|
29
|
+
readonly default: "Select";
|
|
30
|
+
};
|
|
31
|
+
readonly loading: {
|
|
32
|
+
readonly type: BooleanConstructor;
|
|
33
|
+
readonly default: false;
|
|
34
|
+
};
|
|
35
|
+
readonly allowClear: {
|
|
36
|
+
readonly type: BooleanConstructor;
|
|
37
|
+
readonly default: false;
|
|
38
|
+
};
|
|
39
|
+
readonly disabled: {
|
|
40
|
+
readonly type: BooleanConstructor;
|
|
41
|
+
readonly default: false;
|
|
42
|
+
};
|
|
43
|
+
readonly disabledKey: {
|
|
44
|
+
readonly type: StringConstructor;
|
|
45
|
+
readonly default: "";
|
|
46
|
+
};
|
|
47
|
+
readonly remote: {
|
|
48
|
+
readonly type: BooleanConstructor;
|
|
49
|
+
readonly default: false;
|
|
50
|
+
};
|
|
51
|
+
readonly filterMethod: {
|
|
52
|
+
readonly type: import("vue").PropType<(inputValue: string) => void>;
|
|
53
|
+
};
|
|
54
|
+
readonly remoteMethod: {
|
|
55
|
+
readonly type: import("vue").PropType<(inputValue: string) => void>;
|
|
56
|
+
};
|
|
57
|
+
readonly enableLazyLoad: {
|
|
58
|
+
readonly type: BooleanConstructor;
|
|
59
|
+
readonly default: false;
|
|
60
|
+
};
|
|
61
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "clear" | "blur" | "change" | "focus" | "loadMore" | "update:modelValue" | "visibleChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
readonly modelValue: {
|
|
63
|
+
readonly type: import("vue").PropType<string | number>;
|
|
64
|
+
};
|
|
65
|
+
readonly appendToBody: {
|
|
66
|
+
readonly type: BooleanConstructor;
|
|
67
|
+
readonly default: false;
|
|
68
|
+
};
|
|
69
|
+
readonly position: {
|
|
70
|
+
readonly type: import("vue").PropType<import("./editable-select-types").Placement[]>;
|
|
71
|
+
readonly default: readonly ["bottom"];
|
|
72
|
+
};
|
|
73
|
+
readonly options: {
|
|
74
|
+
readonly type: import("vue").PropType<import("./editable-select-types").Options>;
|
|
75
|
+
readonly default: () => never[];
|
|
76
|
+
};
|
|
77
|
+
readonly width: {
|
|
78
|
+
readonly type: NumberConstructor;
|
|
79
|
+
};
|
|
80
|
+
readonly maxHeight: {
|
|
81
|
+
readonly type: NumberConstructor;
|
|
82
|
+
};
|
|
83
|
+
readonly size: {
|
|
84
|
+
readonly type: import("vue").PropType<import("./editable-select-types").EditableSelectSize>;
|
|
85
|
+
};
|
|
86
|
+
readonly placeholder: {
|
|
87
|
+
readonly type: StringConstructor;
|
|
88
|
+
readonly default: "Select";
|
|
89
|
+
};
|
|
90
|
+
readonly loading: {
|
|
91
|
+
readonly type: BooleanConstructor;
|
|
92
|
+
readonly default: false;
|
|
93
|
+
};
|
|
94
|
+
readonly allowClear: {
|
|
95
|
+
readonly type: BooleanConstructor;
|
|
96
|
+
readonly default: false;
|
|
97
|
+
};
|
|
98
|
+
readonly disabled: {
|
|
99
|
+
readonly type: BooleanConstructor;
|
|
100
|
+
readonly default: false;
|
|
101
|
+
};
|
|
102
|
+
readonly disabledKey: {
|
|
103
|
+
readonly type: StringConstructor;
|
|
104
|
+
readonly default: "";
|
|
105
|
+
};
|
|
106
|
+
readonly remote: {
|
|
107
|
+
readonly type: BooleanConstructor;
|
|
108
|
+
readonly default: false;
|
|
109
|
+
};
|
|
110
|
+
readonly filterMethod: {
|
|
111
|
+
readonly type: import("vue").PropType<(inputValue: string) => void>;
|
|
112
|
+
};
|
|
113
|
+
readonly remoteMethod: {
|
|
114
|
+
readonly type: import("vue").PropType<(inputValue: string) => void>;
|
|
115
|
+
};
|
|
116
|
+
readonly enableLazyLoad: {
|
|
117
|
+
readonly type: BooleanConstructor;
|
|
118
|
+
readonly default: false;
|
|
119
|
+
};
|
|
120
|
+
}>>, {
|
|
121
|
+
readonly position: import("./editable-select-types").Placement[];
|
|
122
|
+
readonly loading: boolean;
|
|
123
|
+
readonly disabled: boolean;
|
|
124
|
+
readonly options: import("./editable-select-types").Options;
|
|
125
|
+
readonly placeholder: string;
|
|
126
|
+
readonly disabledKey: string;
|
|
127
|
+
readonly appendToBody: boolean;
|
|
128
|
+
readonly enableLazyLoad: boolean;
|
|
129
|
+
readonly allowClear: boolean;
|
|
130
|
+
readonly remote: boolean;
|
|
131
|
+
}>;
|
|
3
132
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -189,11 +189,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
189
189
|
readonly 'onUpdate:modelValue': (val: import("./select-types").ModelValue) => void;
|
|
190
190
|
readonly onToggleChange: (bool: boolean) => void;
|
|
191
191
|
readonly allowClear: boolean;
|
|
192
|
+
readonly remote: boolean;
|
|
192
193
|
readonly overview: "border" | "underlined";
|
|
193
194
|
readonly optionDisabledKey: string;
|
|
194
195
|
readonly collapseTags: boolean;
|
|
195
196
|
readonly collapseTagsTooltip: boolean;
|
|
196
|
-
readonly remote: boolean;
|
|
197
197
|
readonly allowCreate: boolean;
|
|
198
198
|
readonly noDataText: string;
|
|
199
199
|
readonly noMatchText: string;
|