@opentiny/vue-renderless 3.25.0 → 3.27.0
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/calendar-view/index.js +6 -3
- package/calendar-view/vue.js +9 -5
- package/color-picker/vue.js +4 -0
- package/color-select-panel/alpha-select/index.js +17 -12
- package/color-select-panel/alpha-select/vue.js +4 -2
- package/color-select-panel/hue-select/index.js +47 -16
- package/color-select-panel/hue-select/vue.js +32 -6
- package/color-select-panel/index.js +236 -8
- package/color-select-panel/linear-gradient/index.js +131 -0
- package/color-select-panel/linear-gradient/vue.js +21 -0
- package/color-select-panel/sv-select/index.js +12 -9
- package/color-select-panel/sv-select/vue.js +4 -2
- package/color-select-panel/utils/color-map.js +154 -0
- package/color-select-panel/utils/color-points.js +86 -0
- package/color-select-panel/utils/color.js +1 -1
- package/color-select-panel/utils/context.js +14 -0
- package/color-select-panel/vue.js +9 -4
- package/common/deps/infinite-scroll.js +1 -1
- package/dialog-box/index.js +3 -3
- package/dialog-box/vue.js +1 -0
- package/dropdown/vue.js +3 -1
- package/file-upload/index.js +3 -2
- package/file-upload/vue.js +1 -1
- package/fluent-editor/index.js +1 -1
- package/form-item/vue.js +1 -1
- package/guide/index.js +3 -3
- package/input/index.js +2 -1
- package/input/vue.js +2 -1
- package/package.json +3 -3
- package/pager/vue.js +1 -1
- package/picker/vue.js +10 -0
- package/popeditor/index.js +3 -3
- package/search/index.js +6 -2
- package/search/vue.js +1 -1
- package/select/index.js +30 -13
- package/select/vue.js +34 -10
- package/slider/vue.js +7 -0
- package/slider-button/vue.js +1 -0
- package/slider-button-group/vue.js +1 -0
- package/space/index.js +30 -0
- package/space/vue.js +39 -0
- package/tab-nav/index.js +2 -2
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +4 -1
- package/tabs-mf/vue-nav.js +9 -18
- package/tabs-mf/vue-slider-bar.js +24 -0
- package/tabs-mf/vue.js +3 -1
- package/tag/index.js +1 -1
- package/tree-menu/index.js +4 -0
- package/tree-menu/vue.js +3 -0
- package/types/button-group.type.d.ts +2 -1
- package/types/button.type.d.ts +2 -1
- package/types/color-select-panel.type.d.ts +197 -1
- package/types/dialog-box.type.d.ts +4 -11
- package/types/numeric.type.d.ts +1 -1
- package/types/pager.type.d.ts +2 -1
- package/types/picker.type.d.ts +4 -0
- package/types/radio-button.type.d.ts +1 -0
- package/types/radio-group.type.d.ts +2 -1
- package/types/radio.type.d.ts +2 -1
- package/types/slider.type.d.ts +2 -1
- package/types/space.type.d.ts +31 -0
- package/types/switch.type.d.ts +1 -1
- package/types/tabs.type.d.ts +2 -0
- package/types/user-contact.type.d.ts +1 -11
- package/user/index.js +6 -5
- package/user/vue.js +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
import { ColorPoint } from "../utils/color-points";
|
|
3
|
+
import { getClientXY } from "../utils/getClientXY";
|
|
4
|
+
import { Color } from "../utils/color";
|
|
5
|
+
import { draggable } from "../utils/use-drag";
|
|
6
|
+
import { isNullOrEmpty } from "@opentiny/utils";
|
|
7
|
+
const LINEAR_GRADIENT_BAR = "linearGradientBar";
|
|
8
|
+
const THUMB = "thumb";
|
|
9
|
+
const useLinearGradient = (state, hooks, utils, context) => {
|
|
10
|
+
const { vm } = utils;
|
|
11
|
+
const { nextTick } = hooks;
|
|
12
|
+
const activePoint = context.activeColor;
|
|
13
|
+
const addPoint = (point) => {
|
|
14
|
+
context.colorPoints.value.push(point);
|
|
15
|
+
};
|
|
16
|
+
const getPos = (event) => {
|
|
17
|
+
if (!vm) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
const el = vm.$refs[LINEAR_GRADIENT_BAR];
|
|
21
|
+
const rect = el.getBoundingClientRect();
|
|
22
|
+
const { clientX } = getClientXY(event);
|
|
23
|
+
return Math.min(Math.max(clientX - rect.left, 0), rect.width);
|
|
24
|
+
};
|
|
25
|
+
const onDrag = (event) => {
|
|
26
|
+
if (!vm) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
activePoint.value.cursorLeft = getPos(event);
|
|
30
|
+
};
|
|
31
|
+
const getActivePoint = () => {
|
|
32
|
+
return activePoint;
|
|
33
|
+
};
|
|
34
|
+
const onClickBar = (event) => {
|
|
35
|
+
const active = getActivePoint();
|
|
36
|
+
const newPoint = new ColorPoint(
|
|
37
|
+
new Color({
|
|
38
|
+
enableAlpha: active.value.color.enableAlpha,
|
|
39
|
+
format: active.value.color.format,
|
|
40
|
+
value: active.value.color.value
|
|
41
|
+
}),
|
|
42
|
+
active.value.cursorLeft
|
|
43
|
+
);
|
|
44
|
+
const left = getPos(event);
|
|
45
|
+
newPoint.cursorLeft = left;
|
|
46
|
+
addPoint(newPoint);
|
|
47
|
+
setActivePoint(newPoint);
|
|
48
|
+
nextTick(() => {
|
|
49
|
+
const lastColorPointElement = vm.$refs[THUMB].at(-1);
|
|
50
|
+
if (!lastColorPointElement) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
draggable(lastColorPointElement, {
|
|
54
|
+
drag(event2) {
|
|
55
|
+
onDrag(event2);
|
|
56
|
+
},
|
|
57
|
+
end(event2) {
|
|
58
|
+
onDrag(event2);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const setActivePoint = (point) => {
|
|
64
|
+
activePoint.value = point;
|
|
65
|
+
};
|
|
66
|
+
const onThumbMouseDown = (event, point) => {
|
|
67
|
+
setActivePoint(point);
|
|
68
|
+
const el = event.target;
|
|
69
|
+
draggable(el, {
|
|
70
|
+
drag(event2) {
|
|
71
|
+
onDrag(event2);
|
|
72
|
+
},
|
|
73
|
+
end(event2) {
|
|
74
|
+
onDrag(event2);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const getRelativePos = (points) => {
|
|
79
|
+
const bar = vm.$refs[LINEAR_GRADIENT_BAR];
|
|
80
|
+
if (!bar) {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
const rect = bar.getBoundingClientRect();
|
|
84
|
+
return Number.parseInt((points.cursorLeft / rect.width * 100).toFixed(0));
|
|
85
|
+
};
|
|
86
|
+
const toString = () => {
|
|
87
|
+
const colors = context.colorPoints.value.map((point) => {
|
|
88
|
+
return [point.color.value, getRelativePos(point)];
|
|
89
|
+
}).sort((a, b) => a[1] - b[1]).map(([colorValue, pos]) => {
|
|
90
|
+
return [colorValue, `${pos}%`].join(" ");
|
|
91
|
+
}).join(",");
|
|
92
|
+
return `linear-gradient(${context.deg.value}deg, ${colors})`;
|
|
93
|
+
};
|
|
94
|
+
hooks.watchEffect(() => {
|
|
95
|
+
if (isNullOrEmpty(context.deg.value)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
context.linearGardientValue.value = toString();
|
|
99
|
+
state.linearGradientBarBackground = toString().replace(`${context.deg.value}deg`, "90deg");
|
|
100
|
+
});
|
|
101
|
+
hooks.onMounted(() => {
|
|
102
|
+
const elements = vm.$refs[THUMB];
|
|
103
|
+
if (!elements || !elements.length) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
elements.forEach((el) => {
|
|
107
|
+
draggable(el, {
|
|
108
|
+
drag(event) {
|
|
109
|
+
onDrag(event);
|
|
110
|
+
},
|
|
111
|
+
end(event) {
|
|
112
|
+
onDrag(event);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
context.bar.value = vm.$refs[LINEAR_GRADIENT_BAR];
|
|
117
|
+
});
|
|
118
|
+
return { onClickBar, onThumbMouseDown, toString };
|
|
119
|
+
};
|
|
120
|
+
const initState = (hooks) => {
|
|
121
|
+
const { ref, reactive } = hooks;
|
|
122
|
+
const linearGradientBarBackground = ref("");
|
|
123
|
+
const state = reactive({ linearGradientBarBackground });
|
|
124
|
+
return state;
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
LINEAR_GRADIENT_BAR,
|
|
128
|
+
THUMB,
|
|
129
|
+
initState,
|
|
130
|
+
useLinearGradient
|
|
131
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
import { useContext } from "../utils/context";
|
|
3
|
+
import { initState, useLinearGradient } from ".";
|
|
4
|
+
const api = ["context", "onClickBar", "onThumbMouseDown", "state"];
|
|
5
|
+
const renderless = (_, hooks, utils) => {
|
|
6
|
+
const { reactive } = hooks;
|
|
7
|
+
const context = useContext(hooks);
|
|
8
|
+
const state = initState(hooks);
|
|
9
|
+
const { onClickBar, onThumbMouseDown } = useLinearGradient(state, hooks, utils, context);
|
|
10
|
+
const api2 = reactive({
|
|
11
|
+
state,
|
|
12
|
+
context,
|
|
13
|
+
onClickBar,
|
|
14
|
+
onThumbMouseDown
|
|
15
|
+
});
|
|
16
|
+
return api2;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
api,
|
|
20
|
+
renderless
|
|
21
|
+
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import "../../chunk-G2ADBYYC.js";
|
|
2
2
|
import { getClientXY } from "../utils/getClientXY";
|
|
3
|
-
|
|
3
|
+
import { useContext } from "../utils/context";
|
|
4
|
+
const initState = (props, hooks) => {
|
|
5
|
+
const { ref, computed, reactive } = hooks;
|
|
6
|
+
const context = useContext(hooks);
|
|
4
7
|
const cursorTop = ref(0);
|
|
5
8
|
const cursorLeft = ref(0);
|
|
6
9
|
const bg = ref("hsl(0, 100%, 50%)");
|
|
7
10
|
const colorValue = computed(() => {
|
|
8
|
-
const hue =
|
|
9
|
-
const value =
|
|
11
|
+
const hue = context.activeColor.value.color.get("hue");
|
|
12
|
+
const value = context.activeColor.value.color.get("value");
|
|
10
13
|
return { hue, value };
|
|
11
14
|
});
|
|
12
15
|
const state = reactive({
|
|
@@ -17,21 +20,21 @@ const initState = (props, { ref, computed, reactive }) => {
|
|
|
17
20
|
});
|
|
18
21
|
return state;
|
|
19
22
|
};
|
|
20
|
-
const useUpdate = (state, props, wrapper) => {
|
|
23
|
+
const useUpdate = (state, props, wrapper, context) => {
|
|
21
24
|
return () => {
|
|
22
25
|
const el = wrapper.value;
|
|
23
26
|
if (!el) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
|
-
const sat =
|
|
27
|
-
const value =
|
|
29
|
+
const sat = context.activeColor.value.color.get("sat");
|
|
30
|
+
const value = context.activeColor.value.color.get("value");
|
|
28
31
|
const { clientWidth: width, clientHeight: height } = el;
|
|
29
32
|
state.cursorLeft = sat * width / 100;
|
|
30
33
|
state.cursorTop = (100 - value) * height / 100;
|
|
31
|
-
state.bg = `hsl(${
|
|
34
|
+
state.bg = `hsl(${context.activeColor.value.color.get("hue")}, 100%, 50%)`;
|
|
32
35
|
};
|
|
33
36
|
};
|
|
34
|
-
const useDrag = (state, wrapper, props, { emit }) => {
|
|
37
|
+
const useDrag = (state, wrapper, props, { emit }, context) => {
|
|
35
38
|
return (event) => {
|
|
36
39
|
const el = wrapper.value;
|
|
37
40
|
const rect = el.getBoundingClientRect();
|
|
@@ -47,7 +50,7 @@ const useDrag = (state, wrapper, props, { emit }) => {
|
|
|
47
50
|
const s = left / rect.width * 100;
|
|
48
51
|
const v = 100 - top / rect.height * 100;
|
|
49
52
|
emit("svUpdate", { s, v });
|
|
50
|
-
|
|
53
|
+
context.activeColor.value.color.set({
|
|
51
54
|
sat: s,
|
|
52
55
|
value: v
|
|
53
56
|
});
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import "../../chunk-G2ADBYYC.js";
|
|
2
2
|
import { draggable } from "../utils/use-drag";
|
|
3
3
|
import { initState, initWatch, useDrag, useUpdate } from "./index";
|
|
4
|
+
import { useContext } from "../utils/context";
|
|
4
5
|
const api = ["state", "wrapper", "cursor"];
|
|
5
6
|
const renderless = (props, hooks, utils) => {
|
|
7
|
+
const ctx = useContext(hooks);
|
|
6
8
|
const state = initState(props, hooks);
|
|
7
9
|
const { ref, onMounted } = hooks;
|
|
8
10
|
const { emit } = utils;
|
|
9
11
|
const wrapper = ref();
|
|
10
|
-
const update = useUpdate(state, props, wrapper);
|
|
11
|
-
const onDrag = useDrag(state, wrapper, props, utils);
|
|
12
|
+
const update = useUpdate(state, props, wrapper, ctx);
|
|
13
|
+
const onDrag = useDrag(state, wrapper, props, utils, ctx);
|
|
12
14
|
initWatch(state, update, hooks);
|
|
13
15
|
onMounted(() => {
|
|
14
16
|
const drag = {
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
var color_map_default = {
|
|
3
|
+
"black": "#000000",
|
|
4
|
+
"silver": "#c0c0c0",
|
|
5
|
+
"gray": "#808080",
|
|
6
|
+
"white": "#ffffff",
|
|
7
|
+
"maroon": "#800000",
|
|
8
|
+
"red": "#ff0000",
|
|
9
|
+
"purple": "#800080",
|
|
10
|
+
"fuchsia": "#ff00ff",
|
|
11
|
+
"green": "#008000",
|
|
12
|
+
"lime": "#00ff00",
|
|
13
|
+
"olive": "#808000",
|
|
14
|
+
"yellow": "#ffff00",
|
|
15
|
+
"navy": "#000080",
|
|
16
|
+
"blue": "#0000ff",
|
|
17
|
+
"teal": "#008080",
|
|
18
|
+
"aqua": "#00ffff",
|
|
19
|
+
"aliceblue": "#f0f8ff",
|
|
20
|
+
"antiquewhite": "#faebd7",
|
|
21
|
+
"aquamarine": "#7fffd4",
|
|
22
|
+
"azure": "#f0ffff",
|
|
23
|
+
"beige": "#f5f5dc",
|
|
24
|
+
"bisque": "#ffe4c4",
|
|
25
|
+
"blanchedalmond": "#ffebcd",
|
|
26
|
+
"blueviolet": "#8a2be2",
|
|
27
|
+
"brown": "#a52a2a",
|
|
28
|
+
"burlywood": "#deb887",
|
|
29
|
+
"cadetblue": "#5f9ea0",
|
|
30
|
+
"chartreuse": "#7fff00",
|
|
31
|
+
"chocolate": "#d2691e",
|
|
32
|
+
"coral": "#ff7f50",
|
|
33
|
+
"cornflowerblue": "#6495ed",
|
|
34
|
+
"cornsilk": "#fff8dc",
|
|
35
|
+
"crimson": "#dc143c",
|
|
36
|
+
"cyan": "#00ffff",
|
|
37
|
+
"darkblue": "#00008b",
|
|
38
|
+
"darkcyan": "#008b8b",
|
|
39
|
+
"darkgoldenrod": "#b8860b",
|
|
40
|
+
"darkgray": "#a9a9a9",
|
|
41
|
+
"darkgreen": "#006400",
|
|
42
|
+
"darkgrey": "#a9a9a9",
|
|
43
|
+
"darkkhaki": "#bdb76b",
|
|
44
|
+
"darkmagenta": "#8b008b",
|
|
45
|
+
"darkolivegreen": "#556b2f",
|
|
46
|
+
"darkorange": "#ff8c00",
|
|
47
|
+
"darkorchid": "#9932cc",
|
|
48
|
+
"darkred": "#8b0000",
|
|
49
|
+
"darksalmon": "#e9967a",
|
|
50
|
+
"darkseagreen": "#8fbc8f",
|
|
51
|
+
"darkslateblue": "#483d8b",
|
|
52
|
+
"darkslategray": "#2f4f4f",
|
|
53
|
+
"darkslategrey": "#2f4f4f",
|
|
54
|
+
"darkturquoise": "#00ced1",
|
|
55
|
+
"darkviolet": "#9400d3",
|
|
56
|
+
"deeppink": "#ff1493",
|
|
57
|
+
"deepskyblue": "#00bfff",
|
|
58
|
+
"dimgray": "#696969",
|
|
59
|
+
"dimgrey": "#696969",
|
|
60
|
+
"dodgerblue": "#1e90ff",
|
|
61
|
+
"firebrick": "#b22222",
|
|
62
|
+
"floralwhite": "#fffaf0",
|
|
63
|
+
"forestgreen": "#228b22",
|
|
64
|
+
"gainsboro": "#dcdcdc",
|
|
65
|
+
"ghostwhite": "#f8f8ff",
|
|
66
|
+
"gold": "#ffd700",
|
|
67
|
+
"goldenrod": "#daa520",
|
|
68
|
+
"greenyellow": "#adff2f",
|
|
69
|
+
"grey": "#808080",
|
|
70
|
+
"honeydew": "#f0fff0",
|
|
71
|
+
"hotpink": "#ff69b4",
|
|
72
|
+
"indianred": "#cd5c5c",
|
|
73
|
+
"indigo": "#4b0082",
|
|
74
|
+
"ivory": "#fffff0",
|
|
75
|
+
"khaki": "#f0e68c",
|
|
76
|
+
"lavender": "#e6e6fa",
|
|
77
|
+
"lavenderblush": "#fff0f5",
|
|
78
|
+
"lawngreen": "#7cfc00",
|
|
79
|
+
"lemonchiffon": "#fffacd",
|
|
80
|
+
"lightblue": "#add8e6",
|
|
81
|
+
"lightcoral": "#f08080",
|
|
82
|
+
"lightcyan": "#e0ffff",
|
|
83
|
+
"lightgoldenrodyellow": "#fafad2",
|
|
84
|
+
"lightgray": "#d3d3d3",
|
|
85
|
+
"lightgreen": "#90ee90",
|
|
86
|
+
"lightgrey": "#d3d3d3",
|
|
87
|
+
"lightpink": "#ffb6c1",
|
|
88
|
+
"lightsalmon": "#ffa07a",
|
|
89
|
+
"lightseagreen": "#20b2aa",
|
|
90
|
+
"lightskyblue": "#87cefa",
|
|
91
|
+
"lightslategray": "#778899",
|
|
92
|
+
"lightslategrey": "#778899",
|
|
93
|
+
"lightsteelblue": "#b0c4de",
|
|
94
|
+
"lightyellow": "#ffffe0",
|
|
95
|
+
"limegreen": "#32cd32",
|
|
96
|
+
"linen": "#faf0e6",
|
|
97
|
+
"magenta": "#ff00ff",
|
|
98
|
+
"mediumaquamarine": "#66cdaa",
|
|
99
|
+
"mediumblue": "#0000cd",
|
|
100
|
+
"mediumorchid": "#ba55d3",
|
|
101
|
+
"mediumpurple": "#9370db",
|
|
102
|
+
"mediumseagreen": "#3cb371",
|
|
103
|
+
"mediumslateblue": "#7b68ee",
|
|
104
|
+
"mediumspringgreen": "#00fa9a",
|
|
105
|
+
"mediumturquoise": "#48d1cc",
|
|
106
|
+
"mediumvioletred": "#c71585",
|
|
107
|
+
"midnightblue": "#191970",
|
|
108
|
+
"mintcream": "#f5fffa",
|
|
109
|
+
"mistyrose": "#ffe4e1",
|
|
110
|
+
"moccasin": "#ffe4b5",
|
|
111
|
+
"navajowhite": "#ffdead",
|
|
112
|
+
"oldlace": "#fdf5e6",
|
|
113
|
+
"olivedrab": "#6b8e23",
|
|
114
|
+
"orange": "#ffa500",
|
|
115
|
+
"orangered": "#ff4500",
|
|
116
|
+
"orchid": "#da70d6",
|
|
117
|
+
"palegoldenrod": "#eee8aa",
|
|
118
|
+
"palegreen": "#98fb98",
|
|
119
|
+
"paleturquoise": "#afeeee",
|
|
120
|
+
"palevioletred": "#db7093",
|
|
121
|
+
"papayawhip": "#ffefd5",
|
|
122
|
+
"peachpuff": "#ffdab9",
|
|
123
|
+
"peru": "#cd853f",
|
|
124
|
+
"pink": "#ffc0cb",
|
|
125
|
+
"plum": "#dda0dd",
|
|
126
|
+
"powderblue": "#b0e0e6",
|
|
127
|
+
"rebeccapurple": "#663399",
|
|
128
|
+
"rosybrown": "#bc8f8f",
|
|
129
|
+
"royalblue": "#4169e1",
|
|
130
|
+
"saddlebrown": "#8b4513",
|
|
131
|
+
"salmon": "#fa8072",
|
|
132
|
+
"sandybrown": "#f4a460",
|
|
133
|
+
"seagreen": "#2e8b57",
|
|
134
|
+
"seashell": "#fff5ee",
|
|
135
|
+
"sienna": "#a0522d",
|
|
136
|
+
"skyblue": "#87ceeb",
|
|
137
|
+
"slateblue": "#6a5acd",
|
|
138
|
+
"slategray": "#708090",
|
|
139
|
+
"slategrey": "#708090",
|
|
140
|
+
"snow": "#fffafa",
|
|
141
|
+
"springgreen": "#00ff7f",
|
|
142
|
+
"steelblue": "#4682b4",
|
|
143
|
+
"tan": "#d2b48c",
|
|
144
|
+
"thistle": "#d8bfd8",
|
|
145
|
+
"tomato": "#ff6347",
|
|
146
|
+
"turquoise": "#40e0d0",
|
|
147
|
+
"violet": "#ee82ee",
|
|
148
|
+
"wheat": "#f5deb3",
|
|
149
|
+
"whitesmoke": "#f5f5f5",
|
|
150
|
+
"yellowgreen": "#9acd32"
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
color_map_default as default
|
|
154
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
import { draggable } from "./use-drag";
|
|
3
|
+
import { getClientXY } from "./getClientXY";
|
|
4
|
+
class ColorPoint {
|
|
5
|
+
constructor(color, cursorLeft) {
|
|
6
|
+
this.color = color;
|
|
7
|
+
this.cursorLeft = cursorLeft;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const useColorPoints = (props, hooks, ctx) => {
|
|
11
|
+
const { ref, watch, readonly } = hooks;
|
|
12
|
+
const points = ctx.colorPoints;
|
|
13
|
+
const actviePoint = ctx.activeColor;
|
|
14
|
+
const deg = ref(45);
|
|
15
|
+
const linearGradientValue = ref("");
|
|
16
|
+
const addPoint = (point) => {
|
|
17
|
+
points.value.push(point);
|
|
18
|
+
};
|
|
19
|
+
const removePoint = (point) => {
|
|
20
|
+
points.value = points.value.filter((curPoint) => curPoint !== point);
|
|
21
|
+
};
|
|
22
|
+
const updateDeg = (_deg) => {
|
|
23
|
+
deg.value = _deg;
|
|
24
|
+
};
|
|
25
|
+
const onDrag = (wrapper, event) => {
|
|
26
|
+
const wrapperEl = wrapper.value;
|
|
27
|
+
if (!wrapperEl) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const rect = wrapperEl.getBoundingClientRect();
|
|
31
|
+
const { clientX } = getClientXY(event);
|
|
32
|
+
actviePoint.value.cursorLeft = Math.min(Math.max(clientX - rect.left, 0), rect.width);
|
|
33
|
+
};
|
|
34
|
+
const onClick = (element, point) => {
|
|
35
|
+
const el = element;
|
|
36
|
+
actviePoint.value = point;
|
|
37
|
+
draggable(el, {
|
|
38
|
+
drag(event) {
|
|
39
|
+
onDrag(props.wrapper, event);
|
|
40
|
+
},
|
|
41
|
+
end(event) {
|
|
42
|
+
onDrag(props.wrapper, event);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const getRelativePos = (wrapper, point) => {
|
|
47
|
+
const wrapperEl = wrapper.value;
|
|
48
|
+
const rect = wrapperEl.getBoundingClientRect();
|
|
49
|
+
return (point.cursorLeft / rect.width * 100).toFixed(0);
|
|
50
|
+
};
|
|
51
|
+
const setActivePoint = (point) => {
|
|
52
|
+
actviePoint.value = point;
|
|
53
|
+
};
|
|
54
|
+
const getActviePoint = () => actviePoint;
|
|
55
|
+
const toString = () => {
|
|
56
|
+
const colroString = points.value.map(
|
|
57
|
+
(point) => [point.color.value, `${getRelativePos(props.wrapper, point)}%`].join(" ")
|
|
58
|
+
);
|
|
59
|
+
linearGradientValue.value = `linear-gradient(${deg.value}deg, ${colroString.join(",")})`;
|
|
60
|
+
};
|
|
61
|
+
watch(deg, toString, { deep: true });
|
|
62
|
+
watch(
|
|
63
|
+
actviePoint,
|
|
64
|
+
() => {
|
|
65
|
+
if (!props.wrapper.value) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
toString();
|
|
69
|
+
},
|
|
70
|
+
{ deep: true }
|
|
71
|
+
);
|
|
72
|
+
return {
|
|
73
|
+
onClick,
|
|
74
|
+
linearGradientValue: readonly(linearGradientValue),
|
|
75
|
+
updateDeg,
|
|
76
|
+
removePoint,
|
|
77
|
+
addPoint,
|
|
78
|
+
setActivePoint,
|
|
79
|
+
getActviePoint,
|
|
80
|
+
onDrag
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
ColorPoint,
|
|
85
|
+
useColorPoints
|
|
86
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-G2ADBYYC.js";
|
|
2
|
+
const ContextKey = Symbol("");
|
|
3
|
+
const createContext = (data, hooks) => {
|
|
4
|
+
hooks.provide(ContextKey, data);
|
|
5
|
+
return data;
|
|
6
|
+
};
|
|
7
|
+
const useContext = (hooks) => {
|
|
8
|
+
return hooks.inject(ContextKey);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
ContextKey,
|
|
12
|
+
createContext,
|
|
13
|
+
useContext
|
|
14
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { initApi, initState, initWatch } from "./index";
|
|
2
|
+
import { initApi, initState, initWatch, parseCustomRGBA } from "./index";
|
|
3
3
|
const api = [
|
|
4
4
|
"state",
|
|
5
5
|
"open",
|
|
@@ -16,8 +16,8 @@ const api = [
|
|
|
16
16
|
"onHistoryClick",
|
|
17
17
|
"onClickOutside"
|
|
18
18
|
];
|
|
19
|
-
const renderless = (props, hooks, utils) => {
|
|
20
|
-
const state = initState(props, hooks);
|
|
19
|
+
const renderless = (props, hooks, utils, ext) => {
|
|
20
|
+
const state = initState(props, hooks, utils, ext);
|
|
21
21
|
const {
|
|
22
22
|
open,
|
|
23
23
|
close,
|
|
@@ -32,7 +32,7 @@ const renderless = (props, hooks, utils) => {
|
|
|
32
32
|
onPredefineColorClick,
|
|
33
33
|
onHistoryClick,
|
|
34
34
|
onClickOutside
|
|
35
|
-
} = initApi(props, state, utils);
|
|
35
|
+
} = initApi(props, state, utils, hooks, ext);
|
|
36
36
|
const api2 = {
|
|
37
37
|
state,
|
|
38
38
|
open,
|
|
@@ -53,6 +53,11 @@ const renderless = (props, hooks, utils) => {
|
|
|
53
53
|
hooks.onMounted(() => {
|
|
54
54
|
if (props.modelValue) {
|
|
55
55
|
state.input = state.currentColor;
|
|
56
|
+
const result = parseCustomRGBA(state.currentColor, state.currentFormat) || [0, 0, 0, 0];
|
|
57
|
+
state.hexInput4 = Math.ceil(Number(result[0]));
|
|
58
|
+
state.hexInput5 = result[1];
|
|
59
|
+
state.hexInput6 = result[2];
|
|
60
|
+
state.hexInput7 = `${(Number(result[3]) || 1) * 100}%`;
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
63
|
return api2;
|
|
@@ -24,7 +24,7 @@ const parseAttrValue = (attrVal, type, defaultVal) => {
|
|
|
24
24
|
const computeScrollOptions = (el, instance) => Object.entries(attrs).reduce((accumulator, [name, option]) => {
|
|
25
25
|
const { type, default: defaultValue } = option;
|
|
26
26
|
const attrKey = `infinite-scroll-${name}`;
|
|
27
|
-
const $attrValue = instance.$el.getAttribute(attrKey);
|
|
27
|
+
const $attrValue = (instance == null ? void 0 : instance.$el) && typeof instance.$el.getAttribute === "function" ? instance.$el.getAttribute(attrKey) : null;
|
|
28
28
|
const attrValue = el.getAttribute(attrKey);
|
|
29
29
|
let value;
|
|
30
30
|
if (isNull(attrValue) && isNull($attrValue) || !isNull(attrValue)) {
|
package/dialog-box/index.js
CHANGED
|
@@ -129,14 +129,14 @@ const handleClose = ({
|
|
|
129
129
|
if (typeof props.beforeClose === "function" && props.beforeClose(type) === false) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
+
if (!emitEvent(emit, "before-close", api.hide)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
132
135
|
const el = parent.$el;
|
|
133
136
|
if (props.rightSlide) {
|
|
134
137
|
const dialogBoxDom = el.querySelector(constants.DIALOG_BOX_CLASS) || el;
|
|
135
138
|
dialogBoxDom.style.left = "";
|
|
136
139
|
}
|
|
137
|
-
if (!emitEvent(emit, "before-close", api.hide)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
140
|
api.hide(type);
|
|
141
141
|
};
|
|
142
142
|
const hide = ({ api, emit, state, props }) => (cancel) => {
|
package/dialog-box/vue.js
CHANGED
package/dropdown/vue.js
CHANGED
|
@@ -22,9 +22,11 @@ import {
|
|
|
22
22
|
toggleFocus
|
|
23
23
|
} from "./index";
|
|
24
24
|
const api = ["state", "handleMainButtonClick", "hide", "show", "initDomOperation", "handleClick", "clickOutside"];
|
|
25
|
-
const renderless = (props, { reactive, watch, provide, onMounted, computed, onBeforeUnmount }, { emit, parent, broadcast, vm, nextTick, mode, designConfig }) => {
|
|
25
|
+
const renderless = (props, { reactive, watch, provide, onMounted, computed, onBeforeUnmount }, { emit, parent, broadcast, vm, nextTick, mode, designConfig, useBreakpoint }) => {
|
|
26
26
|
const api2 = {};
|
|
27
|
+
const { current } = useBreakpoint();
|
|
27
28
|
const state = reactive({
|
|
29
|
+
current,
|
|
28
30
|
visible: false,
|
|
29
31
|
timeout: null,
|
|
30
32
|
focusing: false,
|
package/file-upload/index.js
CHANGED
|
@@ -291,10 +291,11 @@ const properFileSize = ({
|
|
|
291
291
|
if ([void 0, null].includes(file.size))
|
|
292
292
|
return true;
|
|
293
293
|
let maxSize = 0;
|
|
294
|
+
state.singleMaxSize = props.edm.singleFileMaxSize || state.singleMaxSize || 200;
|
|
294
295
|
if (Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
295
|
-
maxSize = state.isEdm ? Math.min(state.singleMaxSize, props.fileSize[1] / 1024) : Math.max(props.fileSize[0] / 1024, props.fileSize[1] / 1024);
|
|
296
|
+
maxSize = state.isEdm ? Math.min(state.singleMaxSize, Number(props.fileSize[1]) / 1024) : Math.max(Number(props.fileSize[0]) / 1024, Number(props.fileSize[1]) / 1024);
|
|
296
297
|
} else {
|
|
297
|
-
maxSize = state.isEdm ? Math.min(state.singleMaxSize) : props.fileSize / 1024;
|
|
298
|
+
maxSize = state.isEdm ? Math.min(state.singleMaxSize) : Number(props.fileSize) / 1024;
|
|
298
299
|
}
|
|
299
300
|
if (state.isEdm || Array.isArray(props.fileSize) && props.fileSize[1]) {
|
|
300
301
|
if (!isNaN(Number(maxSize)) && file.size > maxSize * 1024 * 1024) {
|
package/file-upload/vue.js
CHANGED
package/fluent-editor/index.js
CHANGED
|
@@ -109,7 +109,7 @@ const keyDownHandler = ({ state }) => (e) => {
|
|
|
109
109
|
if (e.keyCode === 27 && state.isFullscreen) {
|
|
110
110
|
state.isFullscreen = !state.isFullscreen;
|
|
111
111
|
}
|
|
112
|
-
} else {
|
|
112
|
+
} else if (e.type === "click") {
|
|
113
113
|
state.isFullscreen = !state.isFullscreen;
|
|
114
114
|
}
|
|
115
115
|
};
|
package/form-item/vue.js
CHANGED
|
@@ -98,7 +98,7 @@ const initState = ({
|
|
|
98
98
|
validateIcon: computed(() => api2.computedValidateIcon()),
|
|
99
99
|
isErrorInline: computed(() => api2.computedIsErrorInline()),
|
|
100
100
|
isErrorBlock: computed(() => api2.computedIsErrorBlock()),
|
|
101
|
-
disabled: computed(() => state.formInstance.disabled),
|
|
101
|
+
disabled: computed(() => state.formInstance.disabled || props.disabled),
|
|
102
102
|
tooltipType: computed(() => state.formInstance.state.tooltipType),
|
|
103
103
|
// 标记表单项下是否有多个子节点
|
|
104
104
|
isMultiple: false
|
package/guide/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { xss } from "@opentiny/utils";
|
|
3
3
|
const createShepherd = ({ state, props, Shepherd, offset, designConfig }) => () => {
|
|
4
|
-
const tour = newTour(state, Shepherd, offset, designConfig);
|
|
4
|
+
const tour = newTour(state, Shepherd, offset, designConfig, props);
|
|
5
5
|
state.tour = tour;
|
|
6
6
|
const result = {};
|
|
7
7
|
const deepCopy = getItemCopy(props, tour, result);
|
|
@@ -68,10 +68,10 @@ const getItemCopy = (props, tour, result) => {
|
|
|
68
68
|
});
|
|
69
69
|
return result;
|
|
70
70
|
};
|
|
71
|
-
const newTour = (state, Shepherd, offset, designConfig) => {
|
|
71
|
+
const newTour = (state, Shepherd, offset, designConfig, props) => {
|
|
72
72
|
var _a, _b;
|
|
73
73
|
const tour = new Shepherd.Tour({
|
|
74
|
-
useModalOverlay: (_b = (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.isUseModalOverlay
|
|
74
|
+
useModalOverlay: (_b = props.mask) != null ? _b : (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.isUseModalOverlay,
|
|
75
75
|
defaultStepOptions: {
|
|
76
76
|
modalOverlayOpeningPadding: state.modalOverlayOpeningPadding,
|
|
77
77
|
modalOverlayOpeningRadius: state.modalOverlayOpeningRadius,
|
package/input/index.js
CHANGED
|
@@ -71,7 +71,8 @@ const calcTextareaHeight = ({
|
|
|
71
71
|
}
|
|
72
72
|
const { paddingSize, borderSize, boxSizing, contextStyle } = api.calculateNodeStyling(targetElement);
|
|
73
73
|
hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
|
|
74
|
-
|
|
74
|
+
const safePlaceholder = targetElement.placeholder ? targetElement.placeholder.trim().split("\n")[0] : "";
|
|
75
|
+
hiddenTextarea.value = targetElement.value || safePlaceholder || "";
|
|
75
76
|
let height = hiddenTextarea.scrollHeight;
|
|
76
77
|
const textareaStyle = {};
|
|
77
78
|
if (mode === "mobile") {
|