提交 0c0fd7bd 编写于 作者: fxy060608's avatar fxy060608

chore: build

上级 f828eb78
......@@ -99,8 +99,8 @@ var serviceContext = (function (vue) {
map[list[i]] = true;
}
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
}
}
(process.env.NODE_ENV !== 'production')
? Object.freeze({})
: {};
......
import { createElementVNode, defineComponent, createVNode, mergeProps, getCurrentInstance, provide, watch, onUnmounted, shallowRef, reactive, watchEffect, ref, inject, onBeforeUnmount, computed, Text, isVNode, Fragment, onMounted } from "vue";
import { hasOwn, extend, isPlainObject } from "@vue/shared";
import { cacheStringFunction } from "@dcloudio/uni-shared";
import { extend, hasOwn, isPlainObject } from "@vue/shared";
import { cacheStringFunction, PRIMARY_COLOR } from "@dcloudio/uni-shared";
const OPEN_TYPES = [
"navigate",
"redirect",
......@@ -1751,11 +1751,189 @@ function useMovableViewState(props, trigger, rootRef, setTouchMovableViewContext
};
return touchStart;
}
const FONT_SIZE = 16;
const PROGRESS_VALUES = {
activeColor: PRIMARY_COLOR,
backgroundColor: "#EBEBEB",
activeMode: "backwards"
};
const progressProps = {
percent: {
type: [Number, String],
default: 0,
validator(value) {
return !isNaN(parseFloat(value));
}
},
fontSize: {
type: [String, Number],
default: FONT_SIZE
},
showInfo: {
type: [Boolean, String],
default: false
},
strokeWidth: {
type: [Number, String],
default: 6,
validator(value) {
return !isNaN(parseFloat(value));
}
},
color: {
type: String,
default: PROGRESS_VALUES.activeColor
},
activeColor: {
type: String,
default: PROGRESS_VALUES.activeColor
},
backgroundColor: {
type: String,
default: PROGRESS_VALUES.backgroundColor
},
active: {
type: [Boolean, String],
default: false
},
activeMode: {
type: String,
default: PROGRESS_VALUES.activeMode
},
duration: {
type: [Number, String],
default: 30,
validator(value) {
return !isNaN(parseFloat(value));
}
}
};
const progressStyles = [{
"uni-progress": {
flex: 1,
flexDirection: "row",
alignItems: "center"
},
"uni-progress-bar": {
flex: 1
},
"uni-progress-inner-bar": {
position: "absolute"
},
"uni-progress-info": {
marginLeft: "15px"
}
}];
var Progress = defineComponent({
name: "Progress",
props: progressProps,
styles: progressStyles,
emits: ["activeend"],
setup(props, {
emit
}) {
const progressRef = ref(null);
const progressBarRef = ref(null);
const trigger = useCustomEvent(progressRef, emit);
const state = useProgressState(props);
watch(() => state.realPercent, (newValue, oldValue) => {
state.lastPercent = oldValue || 0;
_activeAnimation(state, props, trigger);
});
onMounted(() => {
setTimeout(() => {
getComponentSize(progressBarRef.value).then(({
width
}) => {
state.progressWidth = width || 0;
_activeAnimation(state, props, trigger);
});
}, 50);
});
return () => {
const {
showInfo,
fontSize
} = props;
const {
outerBarStyle,
innerBarStyle,
currentPercent
} = state;
return createVNode("div", {
"ref": progressRef,
"class": "uni-progress"
}, [createVNode("div", {
"ref": progressBarRef,
"style": outerBarStyle,
"class": "uni-progress-bar"
}, [createVNode("div", {
"style": innerBarStyle,
"class": "uni-progress-inner-bar"
}, null)]), showInfo ? createNVueTextVNode(currentPercent + "%", {
class: "uni-progress-info",
style: {
fontSize
}
}) : null]);
};
}
});
function useProgressState(props) {
const currentPercent = ref(0);
const progressWidth = ref(0);
const outerBarStyle = computed(() => ({
backgroundColor: props.backgroundColor,
height: props.strokeWidth
}));
const innerBarStyle = computed(() => {
const backgroundColor = props.color !== PROGRESS_VALUES.activeColor && props.activeColor === PROGRESS_VALUES.activeColor ? props.color : props.activeColor;
return {
width: currentPercent.value * progressWidth.value / 100,
height: props.strokeWidth,
backgroundColor
};
});
const realPercent = computed(() => {
let realValue = parseFloat(props.percent);
realValue < 0 && (realValue = 0);
realValue > 100 && (realValue = 100);
return realValue;
});
const state = reactive({
outerBarStyle,
innerBarStyle,
realPercent,
currentPercent,
strokeTimer: 0,
lastPercent: 0,
progressWidth
});
return state;
}
function _activeAnimation(state, props, trigger) {
state.strokeTimer && clearInterval(state.strokeTimer);
if (props.active) {
state.currentPercent = props.activeMode === PROGRESS_VALUES.activeMode ? 0 : state.lastPercent;
state.strokeTimer = setInterval(() => {
if (state.currentPercent + 1 > state.realPercent) {
state.currentPercent = state.realPercent;
state.strokeTimer && clearInterval(state.strokeTimer);
trigger("activeend", {});
} else {
state.currentPercent += 1;
}
}, parseFloat(props.duration));
} else {
state.currentPercent = state.realPercent;
}
}
var components = {
Navigator,
Label,
Button,
MovableArea,
MovableView
MovableView,
Progress
};
export { components as default };
......@@ -1626,7 +1626,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$q = {
const props$p = {
canvasId: {
type: String,
default: ""
......@@ -1646,7 +1646,7 @@ var index$B = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$q,
props: props$p,
computed: {
id() {
return this.canvasId;
......@@ -2104,7 +2104,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$p = {
const props$o = {
name: {
type: String,
default: ""
......@@ -2112,7 +2112,7 @@ const props$p = {
};
var index$A = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$p,
props: props$o,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -2164,7 +2164,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$o = {
const props$n = {
checked: {
type: [Boolean, String],
default: false
......@@ -2188,7 +2188,7 @@ const props$o = {
};
var index$z = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$o,
props: props$n,
setup(props2, {
slots
}) {
......@@ -2255,7 +2255,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$n = {
const props$m = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -2427,7 +2427,7 @@ function useQuill(props2, rootRef, trigger) {
useContextInfo();
useSubscribe();
}
const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
const props$l = /* @__PURE__ */ shared.extend({}, props$m, {
id: {
type: String,
default: ""
......@@ -2455,7 +2455,7 @@ const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
});
var index$y = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$m,
props: props$l,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -2541,7 +2541,7 @@ var index$x = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$l = {
const props$k = {
src: {
type: String,
default: ""
......@@ -2580,7 +2580,7 @@ const IMAGE_MODES = {
};
var index$w = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$l,
props: props$k,
setup(props2, {
emit: emit2
}) {
......@@ -2829,7 +2829,7 @@ const UniViewJSBridgeSubscribe = function() {
function getValueString(value) {
return value === null ? "" : String(value);
}
const props$k = /* @__PURE__ */ shared.extend({}, {
const props$j = /* @__PURE__ */ shared.extend({}, {
name: {
type: String,
default: ""
......@@ -2898,7 +2898,7 @@ const props$k = /* @__PURE__ */ shared.extend({}, {
type: Boolean,
default: false
}
}, props$n);
}, props$m);
const emit = [
"input",
"focus",
......@@ -3093,7 +3093,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$j = /* @__PURE__ */ shared.extend({}, props$k, {
const props$i = /* @__PURE__ */ shared.extend({}, props$j, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -3105,7 +3105,7 @@ const props$j = /* @__PURE__ */ shared.extend({}, props$k, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$j,
props: props$i,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -4550,12 +4550,13 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const VALUES = {
const FONT_SIZE = 16;
const PROGRESS_VALUES = {
activeColor: uniShared.PRIMARY_COLOR,
backgroundColor: "#EBEBEB",
activeMode: "backwards"
};
const props$i = {
const progressProps = {
percent: {
type: [Number, String],
default: 0,
......@@ -4563,6 +4564,10 @@ const props$i = {
return !isNaN(parseFloat(value));
}
},
fontSize: {
type: [String, Number],
default: FONT_SIZE
},
showInfo: {
type: [Boolean, String],
default: false
......@@ -4576,15 +4581,15 @@ const props$i = {
},
color: {
type: String,
default: VALUES.activeColor
default: PROGRESS_VALUES.activeColor
},
activeColor: {
type: String,
default: VALUES.activeColor
default: PROGRESS_VALUES.activeColor
},
backgroundColor: {
type: String,
default: VALUES.backgroundColor
default: PROGRESS_VALUES.backgroundColor
},
active: {
type: [Boolean, String],
......@@ -4592,7 +4597,7 @@ const props$i = {
},
activeMode: {
type: String,
default: VALUES.activeMode
default: PROGRESS_VALUES.activeMode
},
duration: {
type: [Number, String],
......@@ -4604,7 +4609,7 @@ const props$i = {
};
var index$s = /* @__PURE__ */ defineBuiltInComponent({
name: "Progress",
props: props$i,
props: progressProps,
setup(props2) {
const state = useProgressState(props2);
_activeAnimation(state, props2);
......@@ -4640,7 +4645,7 @@ function useProgressState(props2) {
const currentPercent = vue.ref(0);
const outerBarStyle = vue.computed(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
const innerBarStyle = vue.computed(() => {
const backgroundColor = props2.color !== VALUES.activeColor && props2.activeColor === VALUES.activeColor ? props2.color : props2.activeColor;
const backgroundColor = props2.color !== PROGRESS_VALUES.activeColor && props2.activeColor === PROGRESS_VALUES.activeColor ? props2.color : props2.activeColor;
return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
});
const realPercent = vue.computed(() => {
......@@ -4661,7 +4666,7 @@ function useProgressState(props2) {
}
function _activeAnimation(state, props2) {
if (props2.active) {
state.currentPercent = props2.activeMode === VALUES.activeMode ? 0 : state.lastPercent;
state.currentPercent = props2.activeMode === PROGRESS_VALUES.activeMode ? 0 : state.lastPercent;
state.strokeTimer = setInterval(() => {
if (state.currentPercent + 1 > state.realPercent) {
state.currentPercent = state.realPercent;
......@@ -6370,7 +6375,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$9 = /* @__PURE__ */ shared.extend({}, props$k, {
const props$9 = /* @__PURE__ */ shared.extend({}, props$j, {
placeholderClass: {
type: String,
default: "input-placeholder"
......
......@@ -6416,7 +6416,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$x = {
const props$w = {
canvasId: {
type: String,
default: ""
......@@ -6436,7 +6436,7 @@ var index$w = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$x,
props: props$w,
computed: {
id() {
return this.canvasId;
......@@ -6897,7 +6897,7 @@ function useMethods(props2, canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$w = {
const props$v = {
name: {
type: String,
default: ""
......@@ -6905,7 +6905,7 @@ const props$w = {
};
var index$v = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$w,
props: props$v,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -6957,7 +6957,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$v = {
const props$u = {
checked: {
type: [Boolean, String],
default: false
......@@ -6981,7 +6981,7 @@ const props$v = {
};
var index$u = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$v,
props: props$u,
setup(props2, {
slots
}) {
......@@ -7058,7 +7058,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$u = {
const props$t = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -7835,7 +7835,7 @@ function useQuill(props2, rootRef, trigger) {
}
}, id2, true);
}
const props$t = /* @__PURE__ */ extend({}, props$u, {
const props$s = /* @__PURE__ */ extend({}, props$t, {
id: {
type: String,
default: ""
......@@ -7863,7 +7863,7 @@ const props$t = /* @__PURE__ */ extend({}, props$u, {
});
var index$t = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$t,
props: props$s,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -7950,7 +7950,7 @@ var index$s = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$s = {
const props$r = {
src: {
type: String,
default: ""
......@@ -7989,7 +7989,7 @@ const IMAGE_MODES = {
};
var index$r = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$s,
props: props$r,
setup(props2, {
emit: emit2
}) {
......@@ -8303,7 +8303,7 @@ const UniViewJSBridgeSubscribe = function() {
function getValueString(value) {
return value === null ? "" : String(value);
}
const props$r = /* @__PURE__ */ extend({}, {
const props$q = /* @__PURE__ */ extend({}, {
name: {
type: String,
default: ""
......@@ -8372,7 +8372,7 @@ const props$r = /* @__PURE__ */ extend({}, {
type: Boolean,
default: false
}
}, props$u);
}, props$t);
const emit = [
"input",
"focus",
......@@ -8576,7 +8576,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$q = /* @__PURE__ */ extend({}, props$r, {
const props$p = /* @__PURE__ */ extend({}, props$q, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -8588,7 +8588,7 @@ const props$q = /* @__PURE__ */ extend({}, props$r, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$q,
props: props$p,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -11136,12 +11136,13 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const VALUES = {
const FONT_SIZE = 16;
const PROGRESS_VALUES = {
activeColor: PRIMARY_COLOR,
backgroundColor: "#EBEBEB",
activeMode: "backwards"
};
const props$p = {
const progressProps = {
percent: {
type: [Number, String],
default: 0,
......@@ -11149,6 +11150,10 @@ const props$p = {
return !isNaN(parseFloat(value));
}
},
fontSize: {
type: [String, Number],
default: FONT_SIZE
},
showInfo: {
type: [Boolean, String],
default: false
......@@ -11162,15 +11167,15 @@ const props$p = {
},
color: {
type: String,
default: VALUES.activeColor
default: PROGRESS_VALUES.activeColor
},
activeColor: {
type: String,
default: VALUES.activeColor
default: PROGRESS_VALUES.activeColor
},
backgroundColor: {
type: String,
default: VALUES.backgroundColor
default: PROGRESS_VALUES.backgroundColor
},
active: {
type: [Boolean, String],
......@@ -11178,7 +11183,7 @@ const props$p = {
},
activeMode: {
type: String,
default: VALUES.activeMode
default: PROGRESS_VALUES.activeMode
},
duration: {
type: [Number, String],
......@@ -11190,7 +11195,7 @@ const props$p = {
};
var index$p = /* @__PURE__ */ defineBuiltInComponent({
name: "Progress",
props: props$p,
props: progressProps,
setup(props2) {
const state2 = useProgressState(props2);
_activeAnimation(state2, props2);
......@@ -11226,7 +11231,7 @@ function useProgressState(props2) {
const currentPercent = ref(0);
const outerBarStyle = computed(() => `background-color: ${props2.backgroundColor}; height: ${props2.strokeWidth}px;`);
const innerBarStyle = computed(() => {
const backgroundColor = props2.color !== VALUES.activeColor && props2.activeColor === VALUES.activeColor ? props2.color : props2.activeColor;
const backgroundColor = props2.color !== PROGRESS_VALUES.activeColor && props2.activeColor === PROGRESS_VALUES.activeColor ? props2.color : props2.activeColor;
return `width: ${currentPercent.value}%;background-color: ${backgroundColor}`;
});
const realPercent = computed(() => {
......@@ -11247,7 +11252,7 @@ function useProgressState(props2) {
}
function _activeAnimation(state2, props2) {
if (props2.active) {
state2.currentPercent = props2.activeMode === VALUES.activeMode ? 0 : state2.lastPercent;
state2.currentPercent = props2.activeMode === PROGRESS_VALUES.activeMode ? 0 : state2.lastPercent;
state2.strokeTimer = setInterval(() => {
if (state2.currentPercent + 1 > state2.realPercent) {
state2.currentPercent = state2.realPercent;
......@@ -13280,7 +13285,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$g = /* @__PURE__ */ extend({}, props$r, {
const props$g = /* @__PURE__ */ extend({}, props$q, {
placeholderClass: {
type: String,
default: "input-placeholder"
......
......@@ -104,6 +104,7 @@ const NVUE_BUILT_IN_TAGS = [
'timepicker',
'marquee',
'countdown',
'dc-switch',
];
const NVUE_U_BUILT_IN_TAGS = [
'text',
......@@ -113,6 +114,8 @@ const NVUE_U_BUILT_IN_TAGS = [
'video',
'web-view',
'slider',
'ad',
'ad-draw',
];
function isBuiltInComponent(tag) {
// h5 平台会被转换为 v-uni-
......
......@@ -100,6 +100,7 @@ const NVUE_BUILT_IN_TAGS = [
'timepicker',
'marquee',
'countdown',
'dc-switch',
];
const NVUE_U_BUILT_IN_TAGS = [
'text',
......@@ -109,6 +110,8 @@ const NVUE_U_BUILT_IN_TAGS = [
'video',
'web-view',
'slider',
'ad',
'ad-draw',
];
function isBuiltInComponent(tag) {
// h5 平台会被转换为 v-uni-
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册