cosey 0.3.6 → 0.3.7
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/components/index.js +1 -0
- package/components/input-number-range/index.d.ts +9 -3
- package/components/input-number-range/index.js +1 -0
- package/components/input-number-range/input-number-range.d.ts +11 -0
- package/components/input-number-range/input-number-range.js +4 -0
- package/components/input-number-range/input-number-range.vue.d.ts +3 -1
- package/components/input-number-range/input-number-range.vue.js +117 -17
- package/components/input-number-range/style/index.js +27 -3
- package/components/table/table.vue.js +1 -1
- package/package.json +1 -1
package/components/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export { defaultMapSizeColNumber, formQueryContextSymbol, formQueryProps } from
|
|
|
72
72
|
export { default as hljs } from 'highlight.js/lib/core';
|
|
73
73
|
export { addIconifyIcon, iconifyIconsSets } from './iconify-icon/iconify-icon.js';
|
|
74
74
|
export { imageProps } from './image-card/image-card.js';
|
|
75
|
+
export { defaultInputNumberRangeProps } from './input-number-range/input-number-range.js';
|
|
75
76
|
export { defaultLongTextProps } from './long-text/long-text.js';
|
|
76
77
|
export { defaultMediaCardBaseProps, mediaCardBaseProps } from './media-card/media-card.js';
|
|
77
78
|
export { defaultMediaViewerBaseProps, defaultMediaViewerProps } from './media-viewer/media-viewer.js';
|
|
@@ -6,7 +6,9 @@ declare const _InputNumberRange: {
|
|
|
6
6
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
7
|
change: (value: number[] | undefined) => any;
|
|
8
8
|
"update:modelValue": (value: number[] | undefined) => any;
|
|
9
|
-
}, import("vue").PublicProps, {
|
|
9
|
+
}, import("vue").PublicProps, {
|
|
10
|
+
validateEvent: boolean;
|
|
11
|
+
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
10
12
|
P: {};
|
|
11
13
|
B: {};
|
|
12
14
|
D: {};
|
|
@@ -16,7 +18,9 @@ declare const _InputNumberRange: {
|
|
|
16
18
|
}, Readonly<import("./input-number-range").InputNumberRangeProps> & Readonly<{
|
|
17
19
|
onChange?: ((value: number[] | undefined) => any) | undefined;
|
|
18
20
|
"onUpdate:modelValue"?: ((value: number[] | undefined) => any) | undefined;
|
|
19
|
-
}>, {}, {}, {}, {}, {
|
|
21
|
+
}>, {}, {}, {}, {}, {
|
|
22
|
+
validateEvent: boolean;
|
|
23
|
+
}>;
|
|
20
24
|
__isFragment?: never;
|
|
21
25
|
__isTeleport?: never;
|
|
22
26
|
__isSuspense?: never;
|
|
@@ -26,7 +30,9 @@ declare const _InputNumberRange: {
|
|
|
26
30
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
31
|
change: (value: number[] | undefined) => any;
|
|
28
32
|
"update:modelValue": (value: number[] | undefined) => any;
|
|
29
|
-
}, string, {
|
|
33
|
+
}, string, {
|
|
34
|
+
validateEvent: boolean;
|
|
35
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
30
36
|
$slots: import("./input-number-range").InputNumberRangeSlots;
|
|
31
37
|
}) & import("vue").Plugin;
|
|
32
38
|
export { _InputNumberRange as InputNumberRange };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withInstall } from '../utils.js';
|
|
2
2
|
import stdin_default$1 from './input-number-range.vue.js';
|
|
3
|
+
export { defaultInputNumberRangeProps } from './input-number-range.js';
|
|
3
4
|
|
|
4
5
|
const _InputNumberRange = withInstall(stdin_default$1);
|
|
5
6
|
var stdin_default = _InputNumberRange;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
export interface InputNumberRangeProps {
|
|
2
2
|
modelValue?: number[];
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
stepStrictly?: boolean;
|
|
7
|
+
precision?: number;
|
|
3
8
|
startPlaceholder?: string;
|
|
4
9
|
endPlaceholder?: string;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
validateEvent?: boolean;
|
|
5
13
|
}
|
|
14
|
+
export declare const defaultInputNumberRangeProps: {
|
|
15
|
+
validateEvent: boolean;
|
|
16
|
+
};
|
|
6
17
|
export interface InputNumberRangeSlots {
|
|
7
18
|
default?: (props: Record<string, never>) => any;
|
|
8
19
|
}
|
|
@@ -6,7 +6,9 @@ declare const __VLS_component: import("vue").DefineComponent<InputNumberRangePro
|
|
|
6
6
|
}, string, import("vue").PublicProps, Readonly<InputNumberRangeProps> & Readonly<{
|
|
7
7
|
onChange?: ((value: number[] | undefined) => any) | undefined;
|
|
8
8
|
"onUpdate:modelValue"?: ((value: number[] | undefined) => any) | undefined;
|
|
9
|
-
}>, {
|
|
9
|
+
}>, {
|
|
10
|
+
validateEvent: boolean;
|
|
11
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
12
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
13
|
export default _default;
|
|
12
14
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeClass, unref,
|
|
1
|
+
import { defineComponent, mergeDefaults, ref, watch, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, createVNode } from 'vue';
|
|
2
|
+
import { defaultInputNumberRangeProps } from './input-number-range.js';
|
|
2
3
|
import stdin_default$1 from './style/index.js';
|
|
3
|
-
import {
|
|
4
|
+
import { useFormItem, CHANGE_EVENT, ElInputNumber } from 'element-plus';
|
|
5
|
+
import { debugWarn } from 'element-plus/es/utils/error.mjs';
|
|
6
|
+
import { isNullish } from '../../utils/is.js';
|
|
4
7
|
import { useComponentConfig } from '../config-provider/config-provider.js';
|
|
5
8
|
|
|
6
9
|
var stdin_default = /* @__PURE__ */defineComponent({
|
|
@@ -8,11 +11,31 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
8
11
|
name: "InputNumberRange"
|
|
9
12
|
},
|
|
10
13
|
__name: "input-number-range",
|
|
11
|
-
props: {
|
|
14
|
+
props: /* @__PURE__ */mergeDefaults({
|
|
12
15
|
modelValue: {
|
|
13
16
|
type: Array,
|
|
14
17
|
required: false
|
|
15
18
|
},
|
|
19
|
+
min: {
|
|
20
|
+
type: Number,
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
max: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: false
|
|
26
|
+
},
|
|
27
|
+
step: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: false
|
|
30
|
+
},
|
|
31
|
+
stepStrictly: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
required: false
|
|
34
|
+
},
|
|
35
|
+
precision: {
|
|
36
|
+
type: Number,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
16
39
|
startPlaceholder: {
|
|
17
40
|
type: String,
|
|
18
41
|
required: false
|
|
@@ -20,8 +43,20 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
20
43
|
endPlaceholder: {
|
|
21
44
|
type: String,
|
|
22
45
|
required: false
|
|
46
|
+
},
|
|
47
|
+
readonly: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
required: false
|
|
54
|
+
},
|
|
55
|
+
validateEvent: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
required: false
|
|
23
58
|
}
|
|
24
|
-
},
|
|
59
|
+
}, defaultInputNumberRangeProps),
|
|
25
60
|
emits: ["update:modelValue", "change"],
|
|
26
61
|
setup(__props, {
|
|
27
62
|
expose: __expose,
|
|
@@ -35,30 +70,95 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
35
70
|
const {
|
|
36
71
|
hashId
|
|
37
72
|
} = stdin_default$1(prefixCls);
|
|
38
|
-
const
|
|
39
|
-
|
|
73
|
+
const {
|
|
74
|
+
formItem
|
|
75
|
+
} = useFormItem();
|
|
76
|
+
const start = ref(null);
|
|
77
|
+
const end = ref(null);
|
|
78
|
+
const innerValue = ref(props.modelValue);
|
|
40
79
|
watch([start, end], () => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
80
|
+
const startNil = isNullish(start.value);
|
|
81
|
+
const endNil = isNullish(end.value);
|
|
82
|
+
if (startNil && endNil || !startNil && !endNil) {
|
|
83
|
+
const value = startNil && endNil ? void 0 : [start.value, end.value];
|
|
84
|
+
if (value !== innerValue.value) {
|
|
85
|
+
innerValue.value = value;
|
|
86
|
+
emit("update:modelValue", value);
|
|
87
|
+
emit("change", value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
watch(() => props.modelValue, () => {
|
|
92
|
+
if (props.validateEvent) {
|
|
93
|
+
formItem?.validate?.(CHANGE_EVENT).catch(err => debugWarn(err));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
watch(() => props.modelValue, newValue => {
|
|
97
|
+
if (innerValue.value !== newValue) {
|
|
98
|
+
innerValue.value = newValue;
|
|
99
|
+
if (!newValue) {
|
|
100
|
+
start.value = null;
|
|
101
|
+
end.value = null;
|
|
102
|
+
} else {
|
|
103
|
+
let [startValue, endValue] = newValue.map(item => {
|
|
104
|
+
item = +item;
|
|
105
|
+
return Number.isNaN(item) ? null : item;
|
|
106
|
+
});
|
|
107
|
+
start.value = startValue;
|
|
108
|
+
end.value = endValue;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
44
111
|
});
|
|
112
|
+
const isFocused = ref(false);
|
|
113
|
+
const onFocusIn = () => {
|
|
114
|
+
isFocused.value = true;
|
|
115
|
+
};
|
|
116
|
+
const onFocusOut = () => {
|
|
117
|
+
isFocused.value = false;
|
|
118
|
+
};
|
|
45
119
|
__expose();
|
|
46
120
|
return (_ctx, _cache) => {
|
|
47
121
|
return openBlock(), createElementBlock("div", {
|
|
48
|
-
class: normalizeClass([unref(hashId), unref(prefixCls)
|
|
49
|
-
|
|
122
|
+
class: normalizeClass([unref(hashId), unref(prefixCls), {
|
|
123
|
+
"is-focus": isFocused.value
|
|
124
|
+
}, "el-input__wrapper"]),
|
|
125
|
+
onFocusin: onFocusIn,
|
|
126
|
+
onFocusout: onFocusOut
|
|
127
|
+
}, [createElementVNode("div", {
|
|
128
|
+
class: normalizeClass(`${unref(prefixCls)}-start`)
|
|
129
|
+
}, [createVNode(unref(ElInputNumber), {
|
|
50
130
|
modelValue: start.value,
|
|
51
131
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => start.value = $event),
|
|
52
|
-
|
|
132
|
+
min: _ctx.min,
|
|
133
|
+
max: _ctx.max,
|
|
134
|
+
step: _ctx.step,
|
|
135
|
+
"step-strictly": _ctx.stepStrictly,
|
|
136
|
+
precision: _ctx.precision,
|
|
137
|
+
controls: false,
|
|
138
|
+
readonly: _ctx.readonly,
|
|
139
|
+
disabled: _ctx.disabled,
|
|
53
140
|
placeholder: _ctx.startPlaceholder
|
|
54
|
-
}, null, 8, ["modelValue", "
|
|
55
|
-
/*
|
|
141
|
+
}, null, 8, ["modelValue", "min", "max", "step", "step-strictly", "precision", "readonly", "disabled", "placeholder"])], 2
|
|
142
|
+
/* CLASS */), createElementVNode("div", {
|
|
143
|
+
class: normalizeClass(`${unref(prefixCls)}-separator`)
|
|
144
|
+
}, "-", 2
|
|
145
|
+
/* CLASS */), createElementVNode("div", {
|
|
146
|
+
class: normalizeClass(`${unref(prefixCls)}-end`)
|
|
147
|
+
}, [createVNode(unref(ElInputNumber), {
|
|
56
148
|
modelValue: end.value,
|
|
57
149
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => end.value = $event),
|
|
58
|
-
|
|
150
|
+
min: _ctx.min,
|
|
151
|
+
max: _ctx.max,
|
|
152
|
+
step: _ctx.step,
|
|
153
|
+
"step-strictly": _ctx.stepStrictly,
|
|
154
|
+
precision: _ctx.precision,
|
|
155
|
+
controls: false,
|
|
156
|
+
readonly: _ctx.readonly,
|
|
157
|
+
disabled: _ctx.disabled,
|
|
59
158
|
placeholder: _ctx.endPlaceholder
|
|
60
|
-
}, null, 8, ["modelValue", "placeholder"])], 2
|
|
61
|
-
/* CLASS */)
|
|
159
|
+
}, null, 8, ["modelValue", "min", "max", "step", "step-strictly", "precision", "readonly", "disabled", "placeholder"])], 2
|
|
160
|
+
/* CLASS */)], 34
|
|
161
|
+
/* CLASS, NEED_HYDRATION */);
|
|
62
162
|
};
|
|
63
163
|
}
|
|
64
164
|
});
|
|
@@ -5,9 +5,33 @@ var stdin_default = getSimpleStyleHook("InputNumberRange", (token) => {
|
|
|
5
5
|
return {
|
|
6
6
|
[`${componentCls}`]: {
|
|
7
7
|
display: "flex",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
width: "100%",
|
|
9
|
+
paddingInline: 10,
|
|
10
|
+
verticalAlign: "middle",
|
|
11
|
+
"&:hover": {
|
|
12
|
+
boxShadow: `0 0 0 1px var(--el-border-color-hover) inset`
|
|
13
|
+
},
|
|
14
|
+
"&.is-focus": {
|
|
15
|
+
boxShadow: `0 0 0 1px ${token.colorPrimary} inset`
|
|
16
|
+
},
|
|
17
|
+
[`${componentCls}-start,${componentCls}-end`]: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flex: 1,
|
|
20
|
+
".el-input__wrapper": {
|
|
21
|
+
boxShadow: "none !important"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[`${componentCls}-separator`]: {
|
|
25
|
+
flex: "none",
|
|
26
|
+
height: "100%",
|
|
27
|
+
paddingInline: token.paddingXS
|
|
28
|
+
},
|
|
29
|
+
".el-input-number": {
|
|
30
|
+
width: 0,
|
|
31
|
+
flex: 1,
|
|
32
|
+
"&.is-without-controls .el-input__wrapper": {
|
|
33
|
+
padding: 0
|
|
34
|
+
}
|
|
11
35
|
}
|
|
12
36
|
}
|
|
13
37
|
};
|
|
@@ -15,13 +15,13 @@ import stdin_default$7 from './table-footer/index.js';
|
|
|
15
15
|
import { defaultSummaryMethod } from './table-footer/utils.js';
|
|
16
16
|
import { uniqid } from '../../utils/string.js';
|
|
17
17
|
import { useComponentConfig, useConfig } from '../config-provider/config-provider.js';
|
|
18
|
-
import { isNullish, isObject, isFunction } from '../../utils/is.js';
|
|
19
18
|
import { flatColumns } from '../../utils/excel/index.js';
|
|
20
19
|
import { getVNodeText, createMergedExpose } from '../../utils/vue.js';
|
|
21
20
|
import { useFetch } from '../../hooks/useFetch.js';
|
|
22
21
|
import { useFullPage } from '../../hooks/useFullPage.js';
|
|
23
22
|
import { useLocale } from '../../hooks/useLocale.js';
|
|
24
23
|
import { addPxUnit } from '../../utils/css.js';
|
|
24
|
+
import { isNullish, isObject, isFunction } from '../../utils/is.js';
|
|
25
25
|
import { useResizeObserver } from '../../hooks/useResizeObserver.js';
|
|
26
26
|
import { walkTree } from '../../utils/tree.js';
|
|
27
27
|
|