@opentiny/vue-renderless 3.8.3 → 3.9.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/action-sheet/index.js +1 -1
- package/action-sheet/vue.js +12 -12
- package/alert/index.js +2 -2
- package/alert/vue.js +3 -3
- package/anchor/index.js +40 -23
- package/anchor/vue.js +5 -2
- package/button-group/index.js +6 -0
- package/button-group/vue.js +10 -5
- package/carousel/index.js +18 -20
- package/carousel/vue.js +29 -5
- package/carousel-item/index.js +2 -1
- package/carousel-item/vue.js +14 -2
- package/cascader/index.js +110 -11
- package/cascader/vue.js +35 -12
- package/chart-heatmap/index.js +12 -12
- package/checkbox/index.js +19 -6
- package/checkbox/vue.js +38 -20
- package/common/bigInt.js +2 -1
- package/common/browser.js +43 -37
- package/common/deps/ResizeObserver.js +2 -2
- package/common/deps/popper.js +26 -24
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/common/validate/util.js +3 -2
- package/drawer/index.js +16 -1
- package/drawer/vue.js +14 -3
- package/dropdown-item/mf.js +1 -1
- package/dropdown-menu/index.js +3 -0
- package/dropdown-menu/vue.js +20 -2
- package/file-upload/index.js +0 -1
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +2 -2
- package/image/vue.js +12 -1
- package/input/index.js +15 -3
- package/input/vue.js +34 -8
- package/ip-address/index.js +4 -4
- package/month-table/index.js +5 -2
- package/numeric/index.js +6 -3
- package/numeric/vue.js +1 -1
- package/package.json +8 -1
- package/pager/vue.js +2 -2
- package/popconfirm/index.js +1 -0
- package/popconfirm/vue.js +4 -2
- package/popover/index.js +19 -12
- package/popover/vue.js +15 -5
- package/progress/index.js +44 -6
- package/progress/vue.js +15 -4
- package/radio/index.js +2 -0
- package/radio/vue.js +3 -0
- package/record/index.js +166 -59
- package/record/vue.js +31 -14
- package/roles/index.js +5 -5
- package/roles/vue.js +1 -1
- package/slider/index.js +3 -1
- package/steps/index.js +8 -0
- package/steps/vue.js +3 -2
- package/switch/vue.js +9 -2
- package/tabs-mf/vue-bar.js +1 -1
- package/text-popup/vue.js +2 -1
- package/time-line/index.js +8 -0
- package/time-line/vue.js +2 -1
- package/tooltip/index.js +35 -25
- package/tooltip/vue.js +1 -1
- package/tree/index.js +1 -1
- package/user-head/vue.js +8 -1
package/progress/index.js
CHANGED
|
@@ -3,7 +3,11 @@ const computedBarStyle = ({ api, props }) => () => ({
|
|
|
3
3
|
width: props.percentage + "%",
|
|
4
4
|
backgroundColor: api.getCurrentColor(props.percentage)
|
|
5
5
|
});
|
|
6
|
-
const computedRelativeStrokeWidth = ({
|
|
6
|
+
const computedRelativeStrokeWidth = ({ constants, state }) => () => {
|
|
7
|
+
if (state.width === 0 || state.strokeWidth === 0)
|
|
8
|
+
return constants.REL_STROKE_WIDTH;
|
|
9
|
+
return (state.strokeWidth / state.width * 100).toFixed(1);
|
|
10
|
+
};
|
|
7
11
|
const computedRadius = ({ constants, props, state }) => () => props.type === constants.PROGRESS_TYPE.CIRCLE || props.type === constants.PROGRESS_TYPE.DASHBOARD ? parseInt(50 - parseFloat(state.relativeStrokeWidth) / 2, 10) : 0;
|
|
8
12
|
const computedTrackPath = ({ constants, props, state }) => () => {
|
|
9
13
|
const radiusValue = state.radius;
|
|
@@ -22,23 +26,55 @@ const computedTrailPathStyle = ({ state }) => () => ({
|
|
|
22
26
|
strokeDasharray: `${state.perimeter * state.rate}px, ${state.perimeter}px`,
|
|
23
27
|
strokeDashoffset: state.strokeDashoffset
|
|
24
28
|
});
|
|
29
|
+
const computedCircleStyle = ({ state }) => () => state.width ? { height: state.width + "px", width: state.width + "px" } : {};
|
|
25
30
|
const computedCirclePathStyle = ({ props, state }) => () => ({
|
|
26
31
|
strokeDasharray: `${state.perimeter * state.rate * (props.percentage / 100)}px, ${state.perimeter}px`,
|
|
27
32
|
strokeDashoffset: state.strokeDashoffset,
|
|
28
33
|
transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
|
|
29
34
|
});
|
|
30
35
|
const computedStroke = ({ api, constants, props }) => () => props.color && api.getCurrentColor(props.percentage) || constants.STATUS_TO_COLOR[props.status] || constants.STATUS_DEFAULT_COLOR;
|
|
31
|
-
const computedIconClass = ({ constants, props }) => () => {
|
|
36
|
+
const computedIconClass = ({ constants, props, mode }) => () => {
|
|
32
37
|
if (props.status === constants.PROGRESS_STATUS.SUCCESS) {
|
|
33
|
-
|
|
38
|
+
const iconClasses = props.type === constants.PROGRESS_TYPE.LINE ? [constants.ICON_SUCCESS, constants.ICON_CIRCLE_SUCCESS] : [constants.ICON_CIRCLE_SUCCESS, constants.ICON_SUCCESS];
|
|
39
|
+
return mode === "mobile-first" ? iconClasses[1] : iconClasses[0];
|
|
34
40
|
} else if (props.status === constants.PROGRESS_STATUS.WARNING) {
|
|
35
41
|
return props.type === constants.PROGRESS_TYPE.LINE ? constants.ICON_WARNING : constants.ICON_CIRCLE_WARNING;
|
|
36
42
|
} else if (props.status === constants.PROGRESS_STATUS.EXCEPTION) {
|
|
37
|
-
|
|
43
|
+
const iconClasses = props.type === constants.PROGRESS_TYPE.LINE ? [constants.ICON_EXCEPTION, constants.ICON_CIRCLE_EXCEPTION] : [constants.ICON_CIRCLE_EXCEPTION, constants.ICON_EXCEPTION];
|
|
44
|
+
return mode === "mobile-first" ? iconClasses[1] : iconClasses[0];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const computedIconStyle = ({ constants, props, state }) => () => {
|
|
48
|
+
if (props.type === constants.PROGRESS_TYPE.LINE) {
|
|
49
|
+
return state.strokeWidth ? {
|
|
50
|
+
width: constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE,
|
|
51
|
+
height: constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE
|
|
52
|
+
} : {};
|
|
53
|
+
} else {
|
|
54
|
+
return state.width ? { width: state.width / constants.WIDTH_RATE_TWO, height: state.width / constants.WIDTH_RATE_TWO } : {};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const computedProgressTextSize = ({ constants, props, state, mode }) => () => {
|
|
58
|
+
if (mode === "mobile-first") {
|
|
59
|
+
let fontSize = constants.TEXT_XS;
|
|
60
|
+
const sizeWidthMap = {
|
|
61
|
+
small: constants.PROGRESS_SIZE_WIDTH.SMALL,
|
|
62
|
+
medium: constants.PROGRESS_SIZE_WIDTH.MEDIUM,
|
|
63
|
+
large: constants.PROGRESS_SIZE_WIDTH.LARGE
|
|
64
|
+
};
|
|
65
|
+
if (props.type === constants.PROGRESS_TYPE.LINE) {
|
|
66
|
+
fontSize = state.strokeWidth ? constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE : props.size === constants.PROGRESS_SIZE.SMALL ? constants.TEXT_XS : constants.TEXT_SM;
|
|
67
|
+
} else {
|
|
68
|
+
const width = state.width ? state.width : sizeWidthMap[props.size];
|
|
69
|
+
fontSize = width / constants.WIDTH_RATE_THREE;
|
|
70
|
+
state.percentTextSize = width / constants.WIDTH_RATE_SIX;
|
|
71
|
+
}
|
|
72
|
+
return fontSize;
|
|
73
|
+
} else {
|
|
74
|
+
return props.type === constants.PROGRESS_TYPE.LINE ? constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE : state.width * 0.111111 + 2;
|
|
38
75
|
}
|
|
39
76
|
};
|
|
40
|
-
const
|
|
41
|
-
const computedContent = ({ props }) => () => typeof props.format === "function" ? props.format(props.percentage) || "" : `${props.percentage}%`;
|
|
77
|
+
const computedContent = ({ props }) => () => typeof props.format === "function" ? props.format() || "" : `${props.percentage}%`;
|
|
42
78
|
const getCurrentColor = ({ api, props }) => (percentage) => {
|
|
43
79
|
if (typeof props.color === "function") {
|
|
44
80
|
return props.color(percentage);
|
|
@@ -91,8 +127,10 @@ const customAfterAppearHook = ({ state, props }) => (el) => {
|
|
|
91
127
|
export {
|
|
92
128
|
computedBarStyle,
|
|
93
129
|
computedCirclePathStyle,
|
|
130
|
+
computedCircleStyle,
|
|
94
131
|
computedContent,
|
|
95
132
|
computedIconClass,
|
|
133
|
+
computedIconStyle,
|
|
96
134
|
computedPerimeter,
|
|
97
135
|
computedProgressTextSize,
|
|
98
136
|
computedRadius,
|
package/progress/vue.js
CHANGED
|
@@ -8,9 +8,11 @@ import {
|
|
|
8
8
|
computedRate,
|
|
9
9
|
computedStrokeDashoffset,
|
|
10
10
|
computedTrailPathStyle,
|
|
11
|
+
computedCircleStyle,
|
|
11
12
|
computedCirclePathStyle,
|
|
12
13
|
computedStroke,
|
|
13
14
|
computedIconClass,
|
|
15
|
+
computedIconStyle,
|
|
14
16
|
computedProgressTextSize,
|
|
15
17
|
computedContent,
|
|
16
18
|
getCurrentColor,
|
|
@@ -21,9 +23,10 @@ import {
|
|
|
21
23
|
customAfterAppearHook
|
|
22
24
|
} from "./index";
|
|
23
25
|
const api = ["state", "getCurrentColor", "getLevelColor", "getColorArray", "customBeforeAppearHook", "customAppearHook", "customAfterAppearHook"];
|
|
24
|
-
const renderless = (props, { computed, reactive }, { constants }) => {
|
|
26
|
+
const renderless = (props, { computed, reactive }, { constants, mode }) => {
|
|
25
27
|
const api2 = {};
|
|
26
28
|
const state = reactive({
|
|
29
|
+
percentTextSize: constants.TEXT_XS,
|
|
27
30
|
rate: computed(() => api2.computedRate()),
|
|
28
31
|
radius: computed(() => api2.computedRadius()),
|
|
29
32
|
stroke: computed(() => api2.computedStroke()),
|
|
@@ -32,10 +35,16 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
32
35
|
trackPath: computed(() => api2.computedTrackPath()),
|
|
33
36
|
perimeter: computed(() => api2.computedPerimeter()),
|
|
34
37
|
iconClass: computed(() => api2.computedIconClass()),
|
|
38
|
+
iconStyle: computed(() => api2.computedIconStyle()),
|
|
39
|
+
circleStyle: computed(() => api2.computedCircleStyle()),
|
|
35
40
|
trailPathStyle: computed(() => api2.computedTrailPathStyle()),
|
|
36
41
|
circlePathStyle: computed(() => api2.computedCirclePathStyle()),
|
|
37
42
|
progressTextSize: computed(() => api2.computedProgressTextSize()),
|
|
38
43
|
strokeDashoffset: computed(() => api2.computedStrokeDashoffset()),
|
|
44
|
+
strokeWidth: computed(
|
|
45
|
+
() => mode === "mobile-first" ? props.strokeWidth : props.strokeWidth || constants.DEFAULT_STROKE_WIDTH
|
|
46
|
+
),
|
|
47
|
+
width: computed(() => mode === "mobile-first" ? props.width : props.width || constants.DEFAULT_WIDTH),
|
|
39
48
|
relativeStrokeWidth: computed(() => api2.computedRelativeStrokeWidth())
|
|
40
49
|
});
|
|
41
50
|
Object.assign(api2, {
|
|
@@ -47,12 +56,14 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
47
56
|
computedPerimeter: computedPerimeter({ state }),
|
|
48
57
|
computedRadius: computedRadius({ constants, props, state }),
|
|
49
58
|
computedTrackPath: computedTrackPath({ constants, props, state }),
|
|
50
|
-
computedIconClass: computedIconClass({ constants, props }),
|
|
59
|
+
computedIconClass: computedIconClass({ constants, props, mode }),
|
|
60
|
+
computedIconStyle: computedIconStyle({ constants, props, state }),
|
|
61
|
+
computedCircleStyle: computedCircleStyle({ props, state }),
|
|
51
62
|
computedCirclePathStyle: computedCirclePathStyle({ props, state }),
|
|
52
63
|
computedStrokeDashoffset: computedStrokeDashoffset({ state }),
|
|
53
64
|
computedTrailPathStyle: computedTrailPathStyle({ state }),
|
|
54
|
-
computedRelativeStrokeWidth: computedRelativeStrokeWidth({
|
|
55
|
-
computedProgressTextSize: computedProgressTextSize({ constants, props }),
|
|
65
|
+
computedRelativeStrokeWidth: computedRelativeStrokeWidth({ state, constants }),
|
|
66
|
+
computedProgressTextSize: computedProgressTextSize({ state, constants, props, mode }),
|
|
56
67
|
customAfterAppearHook: customAfterAppearHook({ state, props }),
|
|
57
68
|
customBeforeAppearHook: customBeforeAppearHook({ props, state }),
|
|
58
69
|
getLevelColor: getLevelColor(api2),
|
package/radio/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const isGroup = ({ constants, parent: $parent, state }) => () => {
|
|
|
19
19
|
};
|
|
20
20
|
const radioSize = ({ props, state }) => () => state.isGroup ? state.radioGroup.state.radioGroupSize || props.size : props.size;
|
|
21
21
|
const isDisabled = ({ props, state }) => () => props.disabled || state.radioGroup.disabled || state.formDisabled;
|
|
22
|
+
const isDisplayOnly = ({ props }) => () => props.displayOnly;
|
|
22
23
|
const tabIndex = ({ props, state }) => () => state.isDisabled || state.isGroup && state.model !== props.label ? -1 : 0;
|
|
23
24
|
const getModel = ({ props, state }) => () => state.isGroup ? state.radioGroup.modelValue : props.modelValue;
|
|
24
25
|
const setModel = ({ constants, dispatch, emit, props, refs, state }) => (val) => {
|
|
@@ -56,6 +57,7 @@ export {
|
|
|
56
57
|
getModel,
|
|
57
58
|
handleChange,
|
|
58
59
|
isDisabled,
|
|
60
|
+
isDisplayOnly,
|
|
59
61
|
isGroup,
|
|
60
62
|
radioSize,
|
|
61
63
|
setModel,
|
package/radio/vue.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
isGroup,
|
|
5
5
|
radioSize,
|
|
6
6
|
isDisabled,
|
|
7
|
+
isDisplayOnly,
|
|
7
8
|
tabIndex,
|
|
8
9
|
getModel,
|
|
9
10
|
setModel,
|
|
@@ -21,6 +22,7 @@ const renderless = (props, { onMounted, onBeforeUnmount, computed, reactive, inj
|
|
|
21
22
|
isGroup: computed(() => api2.isGroup()),
|
|
22
23
|
radioSize: computed(() => api2.radioSize()),
|
|
23
24
|
isDisabled: computed(() => api2.isDisabled()),
|
|
25
|
+
isDisplayOnly: computed(() => api2.isDisplayOnly() || (parent.auiForm || {}).displayOnly),
|
|
24
26
|
tabIndex: computed(() => api2.tabIndex()),
|
|
25
27
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
26
28
|
model: computed({
|
|
@@ -35,6 +37,7 @@ const renderless = (props, { onMounted, onBeforeUnmount, computed, reactive, inj
|
|
|
35
37
|
isGroup: isGroup({ constants, parent, state }),
|
|
36
38
|
tabIndex: tabIndex({ props, state }),
|
|
37
39
|
isDisabled: isDisabled({ props, state }),
|
|
40
|
+
isDisplayOnly: isDisplayOnly({ props }),
|
|
38
41
|
setModel: setModel({ constants, dispatch, emit, props, refs, state }),
|
|
39
42
|
handleChange: handleChange({ constants, dispatch, emit, state, nextTick }),
|
|
40
43
|
dispatchDisplayedValue: dispatchDisplayedValue({ state, api: api2, dispatch }),
|
package/record/index.js
CHANGED
|
@@ -95,31 +95,91 @@ class Record {
|
|
|
95
95
|
onMediaProgress && onMediaProgress(this.analyser, this.audioContext);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
state.record.
|
|
112
|
-
state.
|
|
98
|
+
const calcRecordTime = ({ state }) => (recording = false) => {
|
|
99
|
+
state.record.now = Date.now();
|
|
100
|
+
if (!state.record.fn) {
|
|
101
|
+
state.record.fn = () => {
|
|
102
|
+
const cur = Date.now();
|
|
103
|
+
state.record.currentTime += (cur - state.record.now) / 1e3;
|
|
104
|
+
state.record.now = cur;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (!recording) {
|
|
108
|
+
state.record.timer = setInterval(state.record.fn, 1e3);
|
|
109
|
+
} else {
|
|
110
|
+
clearInterval(state.record.timer);
|
|
111
|
+
state.record.timer = null;
|
|
112
|
+
state.record.fn();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const toogleRecord = ({ state, api, emit, constants, props }) => ($event) => {
|
|
116
|
+
const { READY, RECORDING, PAUSE } = constants.STATUS;
|
|
117
|
+
if (props.isHwh5) {
|
|
118
|
+
if (state.record.status === READY) {
|
|
119
|
+
api.triggerClick($event, constants.HWH5_STATUS.START, () => state.record.status = RECORDING);
|
|
120
|
+
} else if (state.record.status === PAUSE) {
|
|
121
|
+
api.triggerClick($event, constants.HWH5_STATUS.CONTINUE, () => state.record.status = RECORDING);
|
|
122
|
+
} else {
|
|
123
|
+
api.triggerClick($event, constants.HWH5_STATUS.PAUSE, () => state.record.status = PAUSE);
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
if (state.record.status === READY) {
|
|
127
|
+
!state.recorder && (state.recorder = new Record({
|
|
128
|
+
onMediaProgress: (analyser, audioContext) => {
|
|
129
|
+
state.record.currentTime = audioContext.currentTime;
|
|
130
|
+
state.voiceNum = calcVoice(analyser);
|
|
131
|
+
},
|
|
132
|
+
onstop: (file) => emit("confirm", file)
|
|
133
|
+
}));
|
|
134
|
+
state.recorder.start().then((isSuccess) => {
|
|
135
|
+
if (!isSuccess) {
|
|
136
|
+
return emit("error");
|
|
137
|
+
}
|
|
138
|
+
state.record.status = RECORDING;
|
|
139
|
+
});
|
|
140
|
+
} else if (state.record.status === PAUSE) {
|
|
141
|
+
state.record.status = RECORDING;
|
|
142
|
+
state.recorder.resume();
|
|
143
|
+
} else {
|
|
144
|
+
state.record.status = PAUSE;
|
|
145
|
+
state.recorder.pause();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const handleConfirm = ({ state, emit, props, constants, api }) => ($event) => {
|
|
150
|
+
if (props.isHwh5) {
|
|
151
|
+
api.triggerClick($event, constants.HWH5_STATUS.CANCEL, () => emit("update:modelValue", false));
|
|
113
152
|
} else {
|
|
114
|
-
state.
|
|
115
|
-
|
|
153
|
+
state.isClickConfirm = true;
|
|
154
|
+
emit("update:modelValue", false);
|
|
116
155
|
}
|
|
117
156
|
};
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
157
|
+
const handleCancel = ({ emit, props, constants, api, state }) => ($event) => {
|
|
158
|
+
if (props.isHwh5) {
|
|
159
|
+
api.triggerClick($event, constants.HWH5_STATUS.CANCEL, () => emit("update:modelValue", false));
|
|
160
|
+
} else {
|
|
161
|
+
state.isClickConfirm = true;
|
|
162
|
+
emit("update:modelValue", false);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const triggerClick = ({ state }) => ($event, type, cb) => {
|
|
166
|
+
const res = state.listeners["trigger-click"] && state.listeners["trigger-click"]($event, type);
|
|
167
|
+
if (res && res.then) {
|
|
168
|
+
res.then(() => cb && cb());
|
|
169
|
+
} else {
|
|
170
|
+
cb && cb();
|
|
171
|
+
}
|
|
121
172
|
};
|
|
122
173
|
const watchModelValue = ({ api }) => (value) => !value && api.resetRecord();
|
|
174
|
+
const watchRecordStatus = ({ api, props, constants, state }) => (val) => {
|
|
175
|
+
if (val === constants.STATUS.RECORDING) {
|
|
176
|
+
props.isHwh5 && api.calcRecordTime();
|
|
177
|
+
api.renderAudioGraph();
|
|
178
|
+
} else if (val === constants.STATUS.PAUSE) {
|
|
179
|
+
props.isHwh5 && api.calcRecordTime(true);
|
|
180
|
+
}
|
|
181
|
+
cancelAnimationFrame(state.handlerId);
|
|
182
|
+
};
|
|
123
183
|
const calcVoice = (analyser) => {
|
|
124
184
|
const dataArray = new Uint8Array(analyser.fftSize);
|
|
125
185
|
analyser.getByteTimeDomainData(dataArray);
|
|
@@ -130,61 +190,108 @@ const calcVoice = (analyser) => {
|
|
|
130
190
|
lowValue += dataArray[i] < 128 ? 128 - dataArray[i] : 0;
|
|
131
191
|
}
|
|
132
192
|
let voiceNum = 1;
|
|
133
|
-
const voiceMatch = [0,
|
|
134
|
-
const ismatch = voiceMatch.some((
|
|
135
|
-
if (highValue <=
|
|
136
|
-
return voiceNum = idx + 1 + (
|
|
193
|
+
const voiceMatch = [0, 500, 1e3, 5e3, 1e4];
|
|
194
|
+
const ismatch = voiceMatch.some((val, idx) => {
|
|
195
|
+
if (highValue <= val) {
|
|
196
|
+
return voiceNum = idx + 1 + (val === 0 ? lowValue / 1e3 : highValue / val);
|
|
137
197
|
}
|
|
138
198
|
});
|
|
139
199
|
!ismatch && (voiceNum = 6);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
200
|
+
return voiceNum;
|
|
201
|
+
};
|
|
202
|
+
const getOptions = ({ canvasCtx, width }) => {
|
|
203
|
+
const createStrokeStyle = ({ canvasCtx: canvasCtx2, width: width2, colors = [] }) => {
|
|
204
|
+
const grd = canvasCtx2.createLinearGradient(0, 0, width2, 0);
|
|
205
|
+
colors.forEach(({ n, color }) => grd.addColorStop(n, color));
|
|
206
|
+
return grd;
|
|
207
|
+
};
|
|
208
|
+
const optionList = [
|
|
209
|
+
{ q: 0, a: 8, w: 1 / 35, speed: -0.05 },
|
|
210
|
+
{ q: 4, a: 7, w: 1 / 35, speed: -0.1 },
|
|
211
|
+
{ q: 10, a: 6, w: 1 / 35, speed: -0.3 }
|
|
212
|
+
];
|
|
213
|
+
const colorOptions = [
|
|
214
|
+
[
|
|
215
|
+
{ n: 0, color: "rgba(0, 109, 213, 0)" },
|
|
216
|
+
{ n: 0.5, color: "rgba(0, 109, 213, 0.8)" },
|
|
217
|
+
{ n: 1, color: "rgba(0, 109, 213, 0)" }
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
{ n: 0, color: "rgba(0, 14, 215, 0)" },
|
|
221
|
+
{ n: 0.5, color: "rgba(0, 14, 215, 0.4)" },
|
|
222
|
+
{ n: 1, color: "rgba(0, 14, 215, 0)" }
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
{ n: 0, color: "rgba(0, 109, 213, 0)" },
|
|
226
|
+
{ n: 0.5, color: "rgba(0, 109, 213, 0.3)" },
|
|
227
|
+
{ n: 1, color: "rgba(0, 109, 213, 0)" }
|
|
228
|
+
]
|
|
229
|
+
];
|
|
230
|
+
optionList.forEach((option, i) => {
|
|
231
|
+
option.strokeStyle = createStrokeStyle({
|
|
232
|
+
canvasCtx,
|
|
233
|
+
width,
|
|
234
|
+
colors: colorOptions[i]
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
return optionList;
|
|
145
238
|
};
|
|
146
|
-
const renderAudioGraph = ({ vm, state }) => (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
239
|
+
const renderAudioGraph = ({ vm, nextTick, state, props }) => () => {
|
|
240
|
+
nextTick(() => {
|
|
241
|
+
let canvas = vm.$refs.canvas;
|
|
242
|
+
if (canvas) {
|
|
243
|
+
const height = canvas.offsetHeight;
|
|
244
|
+
const width = canvas.offsetWidth;
|
|
245
|
+
canvas.height = height;
|
|
246
|
+
canvas.width = width;
|
|
247
|
+
const canvasCtx = canvas.getContext("2d");
|
|
248
|
+
const optionList = getOptions({ canvasCtx, width });
|
|
249
|
+
const draw = () => {
|
|
250
|
+
state.handlerId = requestAnimationFrame(draw);
|
|
251
|
+
let voiceNum = 1;
|
|
252
|
+
if (!props.isHwh5 && state.voiceNum) {
|
|
253
|
+
voiceNum = state.voiceNum.toFixed(1);
|
|
254
|
+
}
|
|
255
|
+
canvasCtx.clearRect(0, 0, width, height);
|
|
256
|
+
canvasCtx.fillStyle = "#fff";
|
|
257
|
+
canvasCtx.fillRect(0, 0, width, height);
|
|
258
|
+
optionList.forEach((option) => {
|
|
259
|
+
const { a, w, speed, strokeStyle } = option;
|
|
260
|
+
canvasCtx.lineWidth = 1;
|
|
261
|
+
canvasCtx.strokeStyle = strokeStyle;
|
|
262
|
+
let x = 0;
|
|
263
|
+
canvasCtx.beginPath();
|
|
264
|
+
canvasCtx.moveTo(x, height / 2);
|
|
265
|
+
option.q += speed;
|
|
266
|
+
for (let x2 = 0; x2 <= width; x2++) {
|
|
267
|
+
const y = a * voiceNum * Math.sin(w * x2 + option.q) + height / 2;
|
|
268
|
+
canvasCtx.lineTo(x2, y);
|
|
269
|
+
}
|
|
270
|
+
canvasCtx.stroke();
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
draw();
|
|
171
274
|
}
|
|
172
|
-
|
|
173
|
-
canvasCtx.stroke();
|
|
174
|
-
}
|
|
275
|
+
});
|
|
175
276
|
};
|
|
176
277
|
const resetRecord = ({ state, constants }) => () => {
|
|
177
278
|
state.record.status = constants.STATUS.READY;
|
|
178
279
|
state.record.currentTime = 0;
|
|
179
|
-
state.isClickConfirm && state.recorder && state.recorder.stop();
|
|
280
|
+
state.isClickConfirm && state.recorder && state.recorder.recorder && state.recorder.stop();
|
|
180
281
|
state.isClickConfirm = false;
|
|
282
|
+
clearInterval(state.record.timer);
|
|
283
|
+
state.record.timer = null;
|
|
181
284
|
};
|
|
182
285
|
const unmounted = ({ api }) => () => api.resetRecord();
|
|
183
286
|
export {
|
|
287
|
+
calcRecordTime,
|
|
288
|
+
handleCancel,
|
|
184
289
|
handleConfirm,
|
|
185
290
|
renderAudioGraph,
|
|
186
291
|
resetRecord,
|
|
187
292
|
toogleRecord,
|
|
293
|
+
triggerClick,
|
|
188
294
|
unmounted,
|
|
189
|
-
watchModelValue
|
|
295
|
+
watchModelValue,
|
|
296
|
+
watchRecordStatus
|
|
190
297
|
};
|
package/record/vue.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
toogleRecord,
|
|
4
|
+
handleConfirm,
|
|
5
|
+
watchModelValue,
|
|
6
|
+
renderAudioGraph,
|
|
7
|
+
unmounted,
|
|
8
|
+
resetRecord,
|
|
9
|
+
handleCancel,
|
|
10
|
+
triggerClick,
|
|
11
|
+
watchRecordStatus,
|
|
12
|
+
calcRecordTime
|
|
13
|
+
} from "./index";
|
|
14
|
+
const api = ["state", "toogleRecord", "handleConfirm", "handleCancel"];
|
|
15
|
+
const initState = ({ vm, api: api2, reactive, computed }) => {
|
|
5
16
|
const state = reactive({
|
|
17
|
+
listeners: vm.$listeners,
|
|
6
18
|
record: {
|
|
7
19
|
status: "ready",
|
|
8
20
|
currentTime: 0
|
|
@@ -17,25 +29,30 @@ const initState = ({ api: api2, reactive, computed }) => {
|
|
|
17
29
|
Object.assign(api2, { state });
|
|
18
30
|
return state;
|
|
19
31
|
};
|
|
20
|
-
const initApi = ({ api: api2, state, emit, vm, constants }) => {
|
|
32
|
+
const initApi = ({ api: api2, state, emit, vm, constants, props, nextTick }) => {
|
|
21
33
|
Object.assign(api2, {
|
|
22
|
-
toogleRecord: toogleRecord({ state, api: api2, emit, constants }),
|
|
23
|
-
handleConfirm: handleConfirm({ state, emit }),
|
|
34
|
+
toogleRecord: toogleRecord({ state, api: api2, emit, constants, props }),
|
|
35
|
+
handleConfirm: handleConfirm({ state, emit, props, constants, api: api2 }),
|
|
24
36
|
watchModelValue: watchModelValue({ api: api2 }),
|
|
25
|
-
renderAudioGraph: renderAudioGraph({ vm, state }),
|
|
37
|
+
renderAudioGraph: renderAudioGraph({ vm, nextTick, state, props }),
|
|
26
38
|
unmounted: unmounted({ api: api2 }),
|
|
27
|
-
resetRecord: resetRecord({ state, constants })
|
|
39
|
+
resetRecord: resetRecord({ state, constants }),
|
|
40
|
+
handleCancel: handleCancel({ emit, props, constants, api: api2, state }),
|
|
41
|
+
triggerClick: triggerClick({ state }),
|
|
42
|
+
watchRecordStatus: watchRecordStatus({ api: api2, props, constants, state }),
|
|
43
|
+
calcRecordTime: calcRecordTime({ state })
|
|
28
44
|
});
|
|
29
45
|
};
|
|
30
|
-
const initWatch = ({ watch, props, api: api2 }) => {
|
|
46
|
+
const initWatch = ({ watch, props, api: api2, state }) => {
|
|
31
47
|
watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
|
|
48
|
+
watch(() => state.record.status, api2.watchRecordStatus);
|
|
32
49
|
};
|
|
33
|
-
const renderless = (props, { reactive, watch, computed, onUnmounted }, { emit, vm, constants }) => {
|
|
50
|
+
const renderless = (props, { reactive, watch, computed, onUnmounted, nextTick }, { emit, vm, constants }) => {
|
|
34
51
|
const api2 = {};
|
|
35
|
-
const state = initState({ api: api2, reactive, computed });
|
|
36
|
-
initApi({ api: api2, state, emit, vm, constants });
|
|
37
|
-
initWatch({ watch, props, api: api2 });
|
|
38
|
-
onUnmounted(
|
|
52
|
+
const state = initState({ vm, api: api2, reactive, computed });
|
|
53
|
+
initApi({ api: api2, state, emit, vm, constants, props, nextTick });
|
|
54
|
+
initWatch({ watch, props, api: api2, state });
|
|
55
|
+
onUnmounted(api2.unmounted);
|
|
39
56
|
return api2;
|
|
40
57
|
};
|
|
41
58
|
export {
|
package/roles/index.js
CHANGED
|
@@ -37,15 +37,15 @@ const changeRole = ({ constants, emit, props, service, state }) => ({ roleId })
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
const initService = (service) => {
|
|
40
|
+
const initService = (service, props) => {
|
|
41
41
|
const { base = {}, common = {}, pushCustomized } = service || {};
|
|
42
42
|
const noopFn = () => Promise.resolve(null);
|
|
43
43
|
const commonNoopFn = () => Promise.reject(new Error("[Tiny Error][Roles] This component depends on @opentiny/vue-service"));
|
|
44
44
|
return {
|
|
45
|
-
getEnvInfoSync: base.getEnvInfoSync || commonNoopFn,
|
|
46
|
-
getChangeRoleUrl: common.getChangeRoleUrl || commonNoopFn,
|
|
47
|
-
getCustomized: common.getCustomized || noopFn,
|
|
48
|
-
pushCustomized: pushCustomized || noopFn
|
|
45
|
+
getEnvInfoSync: props.getEnvInfoSync || base.getEnvInfoSync || commonNoopFn,
|
|
46
|
+
getChangeRoleUrl: props.getChangeRoleUrl || common.getChangeRoleUrl || commonNoopFn,
|
|
47
|
+
getCustomized: props.getCustomized || common.getCustomized || noopFn,
|
|
48
|
+
pushCustomized: props.pushCustomized || pushCustomized || noopFn
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
export {
|
package/roles/vue.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
import { showList, show, hide, getRoleList, changeRole, initService } from "./index";
|
|
3
3
|
const api = ["state", "showList", "show", "hide", "changeRole"];
|
|
4
4
|
const renderless = (props, { computed, reactive }, { emit, service, constants }) => {
|
|
5
|
-
const $service = initService(service);
|
|
5
|
+
const $service = initService(service, props);
|
|
6
6
|
let api2 = {};
|
|
7
7
|
const state = reactive({
|
|
8
8
|
currentRole: "",
|
package/slider/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const bindEvent = (api) => () => {
|
|
|
9
9
|
};
|
|
10
10
|
const unBindEvent = (api) => () => off(window, "resize", api.bindResize);
|
|
11
11
|
const bindResize = ({ parent, props, state }) => () => {
|
|
12
|
-
const handleEl = parent.$el.
|
|
12
|
+
const handleEl = parent.$el.querySelector("div[role=tiny-slider]");
|
|
13
13
|
state.sliderSize = handleEl["client" + (props.vertical ? "Height" : "Width")];
|
|
14
14
|
state.sliderOffset = handleEl.getBoundingClientRect();
|
|
15
15
|
};
|
|
@@ -307,10 +307,12 @@ const watchActiveValue = ({ api, emit, props, state }) => (newValue, oldValue) =
|
|
|
307
307
|
const watchModelValue = ({ api, state }) => (value) => {
|
|
308
308
|
if (!state.innerTrigger) {
|
|
309
309
|
api.initSlider(value);
|
|
310
|
+
api.setActiveButtonValue(value);
|
|
310
311
|
} else {
|
|
311
312
|
state.innerTrigger = false;
|
|
312
313
|
if (!state.isDouble) {
|
|
313
314
|
api.initSlider(value);
|
|
315
|
+
api.setActiveButtonValue(value);
|
|
314
316
|
}
|
|
315
317
|
}
|
|
316
318
|
};
|
package/steps/index.js
CHANGED
|
@@ -23,8 +23,16 @@ const computedRightNodePos = ({ state, props }) => () => {
|
|
|
23
23
|
right: -(index + 1) * 4 + "px"
|
|
24
24
|
}));
|
|
25
25
|
};
|
|
26
|
+
const computedSpace = ({ props }) => {
|
|
27
|
+
const { space } = props;
|
|
28
|
+
if (/^\d+$/.test(space)) {
|
|
29
|
+
return `${space}px`;
|
|
30
|
+
}
|
|
31
|
+
return space;
|
|
32
|
+
};
|
|
26
33
|
export {
|
|
27
34
|
computedRightNodePos,
|
|
35
|
+
computedSpace,
|
|
28
36
|
isVisibleHandler,
|
|
29
37
|
updateStartIndex
|
|
30
38
|
};
|
package/steps/vue.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import { updateStartIndex, isVisibleHandler, computedRightNodePos } from "./index";
|
|
2
|
+
import { updateStartIndex, isVisibleHandler, computedRightNodePos, computedSpace } from "./index";
|
|
3
3
|
const api = ["state", "isVisibleHandler"];
|
|
4
4
|
const renderless = (props, { reactive, watch, computed }) => {
|
|
5
5
|
const state = reactive({
|
|
6
6
|
startIndex: 0,
|
|
7
7
|
endIndex: computed(() => state.startIndex + props.visibleNum),
|
|
8
|
-
rightNodePositions: computed(() => api2.computedRightNodePos())
|
|
8
|
+
rightNodePositions: computed(() => api2.computedRightNodePos()),
|
|
9
|
+
computedSpace: computed(() => computedSpace({ props }))
|
|
9
10
|
});
|
|
10
11
|
const api2 = {
|
|
11
12
|
updateStartIndex: updateStartIndex({ state, props }),
|
package/switch/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { toggle, computedWarpClasses, computedInnerClasses, computedStyle } from "./index";
|
|
3
3
|
const api = ["toggle", "state"];
|
|
4
|
-
const renderless = (props, { computed, watch, reactive, inject }, { parent, constants, mode, emit }) => {
|
|
4
|
+
const renderless = (props, { computed, watch, reactive, inject }, { parent, constants, mode, emit, designConfig }) => {
|
|
5
5
|
const prefixCls = constants.prefixcls(mode);
|
|
6
6
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
7
7
|
const api2 = {
|
|
@@ -14,7 +14,14 @@ const renderless = (props, { computed, watch, reactive, inject }, { parent, cons
|
|
|
14
14
|
style: computed(() => api2.computedStyle()),
|
|
15
15
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
16
16
|
disabled: computed(() => props.disabled || state.formDisabled),
|
|
17
|
-
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
|
|
17
|
+
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
|
|
18
|
+
showText: computed(() => {
|
|
19
|
+
if (props.showText === void 0) {
|
|
20
|
+
return (designConfig == null ? void 0 : designConfig.showText) || false;
|
|
21
|
+
} else {
|
|
22
|
+
return props.showText;
|
|
23
|
+
}
|
|
24
|
+
})
|
|
18
25
|
});
|
|
19
26
|
Object.assign(api2, {
|
|
20
27
|
state,
|
package/tabs-mf/vue-bar.js
CHANGED
|
@@ -2,9 +2,9 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
|
|
3
3
|
import { wheelListener, getBoundRect, handleClickDropdownItem, key, emitAdd } from "./index";
|
|
4
4
|
import { getAddWheelListener } from "./wheel";
|
|
5
|
-
const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
|
|
6
5
|
const api = ["state", "wheelListener", "handleClickDropdownItem", "key", "emitAdd"];
|
|
7
6
|
const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject, computed }, { vm }) => {
|
|
7
|
+
const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
|
|
8
8
|
const tabs = inject("tabs", null);
|
|
9
9
|
const state = reactive({
|
|
10
10
|
moreList: [],
|
package/text-popup/vue.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { computedWidth, watchValue, mounted, onFocus, onBlur, onInput, separteText, jointText } from "./index";
|
|
3
3
|
const api = ["state", "onFocus", "onBlur", "onInput"];
|
|
4
|
-
const renderless = (props, { computed, onMounted, reactive, watch }, { emit, nextTick, refs }) => {
|
|
4
|
+
const renderless = (props, { computed, onMounted, reactive, watch, inject }, { emit, nextTick, refs }) => {
|
|
5
5
|
const api2 = {};
|
|
6
6
|
const state = reactive({
|
|
7
|
+
showAutoWidth: inject("showAutoWidth", null),
|
|
7
8
|
type: "input",
|
|
8
9
|
textAreaValue: "",
|
|
9
10
|
text: null,
|