提交 75528a6a 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue

上级 a428188c
......@@ -274,6 +274,7 @@ function vueFactory(exports) {
this.parentNode = null;
this.nodeType = 3;
this.text = text;
this.children = [];
}
}
......
export function initComponents(Vue, weex) {
var components = function(vue) {
"use strict";
const OPEN_TYPES = [
"navigate",
"redirect",
"switchTab",
"reLaunch",
"navigateBack"
];
const navigatorProps = {
hoverClass: {
type: String,
default: "navigator-hover"
},
url: {
type: String,
default: ""
},
openType: {
type: String,
default: "navigate",
validator(value) {
return Boolean(~OPEN_TYPES.indexOf(value));
}
},
delta: {
type: Number,
default: 1
},
hoverStartTime: {
type: [Number, String],
default: 50
},
hoverStayTime: {
type: [Number, String],
default: 600
},
exists: {
type: String,
default: ""
},
hoverStopPropagation: {
type: Boolean,
default: false
}
};
function createNavigatorOnClick(props) {
return () => {
if (props.openType !== "navigateBack" && !props.url) {
console.error("<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
return;
}
switch (props.openType) {
case "navigate":
uni.navigateTo({
url: props.url
});
break;
case "redirect":
uni.redirectTo({
url: props.url,
exists: props.exists
});
break;
case "switchTab":
uni.switchTab({
url: props.url
});
break;
case "reLaunch":
uni.reLaunch({
url: props.url
});
break;
case "navigateBack":
uni.navigateBack({
delta: props.delta
});
break;
}
};
}
var Navigator = vue.defineComponent({
name: "Navigator",
props: navigatorProps,
setup(props, {
slots
}) {
const onClick = createNavigatorOnClick(props);
return () => vue.createVNode("div", {
"onClick": onClick
}, [slots.default && slots.default()]);
}
});
var index = {
Navigator
};
return index;
}(Vue);
return components;
}
import type { ExtractPropTypes } from 'vue'
const OPEN_TYPES = [
'navigate',
'redirect',
'switchTab',
'reLaunch',
'navigateBack',
]
export const navigatorProps = {
hoverClass: {
type: String,
default: 'navigator-hover',
},
url: {
type: String,
default: '',
},
openType: {
type: String,
default: 'navigate',
validator(value: unknown) {
return Boolean(~OPEN_TYPES.indexOf(value as string))
},
},
delta: {
type: Number,
default: 1,
},
hoverStartTime: {
type: [Number, String],
default: 50,
},
hoverStayTime: {
type: [Number, String],
default: 600,
},
exists: {
type: String,
default: '',
},
hoverStopPropagation: {
type: Boolean,
default: false,
},
}
export function createNavigatorOnClick(
props: ExtractPropTypes<typeof navigatorProps>
) {
return () => {
if (props.openType !== 'navigateBack' && !props.url) {
console.error(
'<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab'
)
return
}
switch (props.openType) {
case 'navigate':
uni.navigateTo({
url: props.url,
})
break
case 'redirect':
uni.redirectTo({
url: props.url,
// @ts-ignore
exists: props.exists,
})
break
case 'switchTab':
uni.switchTab({
url: props.url,
})
break
case 'reLaunch':
uni.reLaunch({
url: props.url,
})
break
case 'navigateBack':
uni.navigateBack({
delta: props.delta,
})
break
default:
break
}
}
}
import { getCurrentInstance, inject, onBeforeUnmount } from 'vue'
import { UniFormCtx, uniFormKey } from '../components/form'
import { UniFormCtx, uniFormKey } from '../vue/form'
interface ValueState {
value: string
......
export * from './components'
export * from './vue'
export { useOn, useSubscribe } from './helpers/useSubscribe'
export { useContextInfo, getContextInfo } from './helpers/useContextInfo'
export {
......@@ -27,8 +27,8 @@ export {
defineUnsupportedComponent,
} from './helpers/component'
export { flatVNode } from './helpers/flatVNode'
export { uniFormKey } from './components/form'
export type { UniFormCtx } from './components/form'
export { uniFormKey } from './vue/form'
export type { UniFormCtx } from './vue/form'
export type { DecodeOptions } from './helpers/text'
export { useRebuild } from './helpers/useRebuild'
export { default as animation } from './helpers/animation'
import Navigator from './navigator'
export default {
Navigator,
}
import { defineComponent } from 'vue'
import {
createNavigatorOnClick,
navigatorProps,
} from '../../components/navigator'
export default defineComponent({
name: 'Navigator',
props: navigatorProps,
setup(props, { slots }) {
const onClick = createNavigatorOnClick(props)
return () => <div onClick={onClick}>{slots.default && slots.default()}</div>
},
})
......@@ -7,7 +7,7 @@ function t(t, n) {
}
export function Decline() {}
Decline.prototype.x = function(e) {
Decline.prototype.x = function (e) {
return Math.sqrt(e)
}
......@@ -17,7 +17,7 @@ export function Friction(e, t) {
this._startTime = 0
this._v = 0
}
Friction.prototype.setV = function(x, y) {
Friction.prototype.setV = function (x, y) {
var n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5)
this._x_v = x
this._y_v = y
......@@ -27,11 +27,11 @@ Friction.prototype.setV = function(x, y) {
this._lastDt = null
this._startTime = new Date().getTime()
}
Friction.prototype.setS = function(x, y) {
Friction.prototype.setS = function (x, y) {
this._x_s = x
this._y_s = y
}
Friction.prototype.s = function(t) {
Friction.prototype.s = function (t) {
if (undefined === t) {
t = (new Date().getTime() - this._startTime) / 1e3
}
......@@ -55,10 +55,10 @@ Friction.prototype.s = function(t) {
}
return {
x,
y
y,
}
}
Friction.prototype.ds = function(t) {
Friction.prototype.ds = function (t) {
if (undefined === t) {
t = (new Date().getTime() - this._startTime) / 1e3
}
......@@ -67,19 +67,19 @@ Friction.prototype.ds = function(t) {
}
return {
dx: this._x_v + this._x_a * t,
dy: this._y_v + this._y_a * t
dy: this._y_v + this._y_a * t,
}
}
Friction.prototype.delta = function() {
Friction.prototype.delta = function () {
return {
x: (-1.5 * Math.pow(this._x_v, 2)) / this._x_a || 0,
y: (-1.5 * Math.pow(this._y_v, 2)) / this._y_a || 0
y: (-1.5 * Math.pow(this._y_v, 2)) / this._y_a || 0,
}
}
Friction.prototype.dt = function() {
Friction.prototype.dt = function () {
return -this._x_v / this._x_a
}
Friction.prototype.done = function() {
Friction.prototype.done = function () {
var t =
e(this.s().x, this._endPositionX) ||
e(this.s().y, this._endPositionY) ||
......@@ -87,11 +87,11 @@ Friction.prototype.done = function() {
this._lastDt = null
return t
}
Friction.prototype.setEnd = function(x, y) {
Friction.prototype.setEnd = function (x, y) {
this._endPositionX = x
this._endPositionY = y
}
Friction.prototype.reconfigure = function(m, f) {
Friction.prototype.reconfigure = function (m, f) {
this._m = m
this._f = 1e3 * f
}
......@@ -104,7 +104,7 @@ export function Spring(m, k, c) {
this._endPosition = 0
this._startTime = 0
}
Spring.prototype._solve = function(e, t) {
Spring.prototype._solve = function (e, t) {
var n = this._c
var i = this._m
var r = this._k
......@@ -114,13 +114,13 @@ Spring.prototype._solve = function(e, t) {
const s = e
const l = t / (a * e)
return {
x: function(e) {
x: function (e) {
return (s + l * e) * Math.pow(Math.E, a * e)
},
dx: function(e) {
dx: function (e) {
var t = Math.pow(Math.E, a * e)
return a * (s + l * e) * t + l * t
}
},
}
}
if (o > 0) {
......@@ -129,7 +129,7 @@ Spring.prototype._solve = function(e, t) {
const d = (t - c * e) / (u - c)
const h = e - d
return {
x: function(e) {
x: function (e) {
var t
var n
if (e === this._t) {
......@@ -145,7 +145,7 @@ Spring.prototype._solve = function(e, t) {
}
return h * t + d * n
},
dx: function(e) {
dx: function (e) {
var t
var n
if (e === this._t) {
......@@ -160,7 +160,7 @@ Spring.prototype._solve = function(e, t) {
n = this._powER2T = Math.pow(Math.E, u * e)
}
return h * c * t + d * u * n
}
},
}
}
var p = Math.sqrt(4 * i * r - n * n) / (2 * i)
......@@ -168,32 +168,32 @@ Spring.prototype._solve = function(e, t) {
var v = e
var g = (t - f * e) / p
return {
x: function(e) {
x: function (e) {
return (
Math.pow(Math.E, f * e) * (v * Math.cos(p * e) + g * Math.sin(p * e))
)
},
dx: function(e) {
dx: function (e) {
var t = Math.pow(Math.E, f * e)
var n = Math.cos(p * e)
var i = Math.sin(p * e)
return t * (g * p * n - v * p * i) + f * t * (g * i + v * n)
}
},
}
}
Spring.prototype.x = function(e) {
Spring.prototype.x = function (e) {
if (undefined === e) {
e = (new Date().getTime() - this._startTime) / 1e3
}
return this._solution ? this._endPosition + this._solution.x(e) : 0
}
Spring.prototype.dx = function(e) {
Spring.prototype.dx = function (e) {
if (undefined === e) {
e = (new Date().getTime() - this._startTime) / 1e3
}
return this._solution ? this._solution.dx(e) : 0
}
Spring.prototype.setEnd = function(e, n, i) {
Spring.prototype.setEnd = function (e, n, i) {
if (!i) {
i = new Date().getTime()
}
......@@ -220,25 +220,25 @@ Spring.prototype.setEnd = function(e, n, i) {
}
}
}
Spring.prototype.snap = function(e) {
Spring.prototype.snap = function (e) {
this._startTime = new Date().getTime()
this._endPosition = e
this._solution = {
x: function() {
x: function () {
return 0
},
dx: function() {
dx: function () {
return 0
}
},
}
}
Spring.prototype.done = function(n) {
Spring.prototype.done = function (n) {
if (!n) {
n = new Date().getTime()
}
return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1)
}
Spring.prototype.reconfigure = function(m, t, c) {
Spring.prototype.reconfigure = function (m, t, c) {
this._m = m
this._k = t
this._c = c
......@@ -247,13 +247,13 @@ Spring.prototype.reconfigure = function(m, t, c) {
this._startTime = new Date().getTime()
}
}
Spring.prototype.springConstant = function() {
Spring.prototype.springConstant = function () {
return this._k
}
Spring.prototype.damping = function() {
Spring.prototype.damping = function () {
return this._c
}
Spring.prototype.configuration = function() {
Spring.prototype.configuration = function () {
function e(e, t) {
e.reconfigure(1, t, e.damping())
}
......@@ -267,15 +267,15 @@ Spring.prototype.configuration = function() {
read: this.springConstant.bind(this),
write: e.bind(this, this),
min: 100,
max: 1e3
max: 1e3,
},
{
label: 'Damping',
read: this.damping.bind(this),
write: t.bind(this, this),
min: 1,
max: 500
}
max: 500,
},
]
}
......@@ -285,28 +285,28 @@ export function STD(e, t, n) {
this._springScale = new Spring(e, t, n)
this._startTime = 0
}
STD.prototype.setEnd = function(e, t, n, i) {
STD.prototype.setEnd = function (e, t, n, i) {
var r = new Date().getTime()
this._springX.setEnd(e, i, r)
this._springY.setEnd(t, i, r)
this._springScale.setEnd(n, i, r)
this._startTime = r
}
STD.prototype.x = function() {
STD.prototype.x = function () {
var e = (new Date().getTime() - this._startTime) / 1e3
return {
x: this._springX.x(e),
y: this._springY.x(e),
scale: this._springScale.x(e)
scale: this._springScale.x(e),
}
}
STD.prototype.done = function() {
STD.prototype.done = function () {
var e = new Date().getTime()
return (
this._springX.done(e) && this._springY.done(e) && this._springScale.done(e)
)
}
STD.prototype.reconfigure = function(e, t, n) {
STD.prototype.reconfigure = function (e, t, n) {
this._springX.reconfigure(e, t, n)
this._springY.reconfigure(e, t, n)
this._springScale.reconfigure(e, t, n)
......
import { getCurrentInstance } from 'vue'
import { useHover } from '../../helpers/useHover'
import { defineBuiltInComponent } from '@dcloudio/uni-components'
import { onEventPrevent } from '@dcloudio/uni-core'
const OPEN_TYPES = [
'navigate',
'redirect',
'switchTab',
'reLaunch',
'navigateBack',
]
const props = {
hoverClass: {
type: String,
default: 'navigator-hover',
},
url: {
type: String,
default: '',
},
openType: {
type: String,
default: 'navigate',
validator(value: unknown) {
return Boolean(~OPEN_TYPES.indexOf(value as string))
},
},
delta: {
type: Number,
default: 1,
},
hoverStartTime: {
type: [Number, String],
default: 50,
},
hoverStayTime: {
type: [Number, String],
default: 600,
},
exists: {
type: String,
default: '',
},
hoverStopPropagation: {
type: Boolean,
default: false,
},
}
import { useHover } from '../../helpers/useHover'
import {
createNavigatorOnClick,
navigatorProps,
} from '../../components/navigator'
export default /*#__PURE__*/ defineBuiltInComponent({
name: 'Navigator',
......@@ -55,52 +14,13 @@ export default /*#__PURE__*/ defineBuiltInComponent({
compatConfig: {
MODE: 3,
},
props,
props: navigatorProps,
setup(props, { slots }) {
const vm = getCurrentInstance()
const __scopeId = (vm && (vm.root.type as any).__scopeId) || ''
const { hovering, binding } = useHover(props)
function onClick($event: MouseEvent) {
if (props.openType !== 'navigateBack' && !props.url) {
console.error(
'<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab'
)
return
}
switch (props.openType) {
case 'navigate':
uni.navigateTo({
url: props.url,
})
break
case 'redirect':
uni.redirectTo({
url: props.url,
// @ts-ignore
exists: props.exists,
})
break
case 'switchTab':
uni.switchTab({
url: props.url,
})
break
case 'reLaunch':
uni.reLaunch({
url: props.url,
})
break
case 'navigateBack':
uni.navigateBack({
delta: props.delta,
})
break
default:
break
}
}
const onClick = createNavigatorOnClick(props)
return () => {
const { hoverClass, url } = props
......
import HTMLParser from '../../helpers/html-parser'
function removeDOCTYPE(html) {
return html
.replace(/<\?xml.*\?>\n/, '')
.replace(/<!doctype.*>\n/, '')
.replace(/<!DOCTYPE.*>\n/, '')
}
function parseAttrs(attrs) {
return attrs.reduce(function(pre, attr) {
let value = attr.value
const name = attr.name
if (value.match(/ /) && name !== 'style') {
value = value.split(' ')
}
if (pre[name]) {
if (Array.isArray(pre[name])) {
pre[name].push(value)
} else {
pre[name] = [pre[name], value]
}
} else {
pre[name] = value
}
return pre
}, {})
}
export default function parseHtml(html) {
html = removeDOCTYPE(html)
const stacks = []
const results = {
node: 'root',
children: []
}
HTMLParser(html, {
start: function(tag, attrs, unary) {
const node = {
name: tag
}
if (attrs.length !== 0) {
node.attrs = parseAttrs(attrs)
}
if (unary) {
const parent = stacks[0] || results
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
} else {
stacks.unshift(node)
}
},
end: function(tag) {
const node = stacks.shift()
if (node.name !== tag) console.error('invalid state: mismatch end tag')
if (stacks.length === 0) {
results.children.push(node)
} else {
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
}
},
chars: function(text) {
const node = {
type: 'text',
text: text
}
if (stacks.length === 0) {
results.children.push(node)
} else {
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
}
},
comment: function(text) {
const node = {
node: 'comment',
text: text
}
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
}
})
return results.children
}
import HTMLParser from '../../helpers/html-parser'
function removeDOCTYPE(html) {
return html
.replace(/<\?xml.*\?>\n/, '')
.replace(/<!doctype.*>\n/, '')
.replace(/<!DOCTYPE.*>\n/, '')
}
function parseAttrs(attrs) {
return attrs.reduce(function (pre, attr) {
let value = attr.value
const name = attr.name
if (value.match(/ /) && name !== 'style') {
value = value.split(' ')
}
if (pre[name]) {
if (Array.isArray(pre[name])) {
pre[name].push(value)
} else {
pre[name] = [pre[name], value]
}
} else {
pre[name] = value
}
return pre
}, {})
}
export default function parseHtml(html) {
html = removeDOCTYPE(html)
const stacks = []
const results = {
node: 'root',
children: [],
}
HTMLParser(html, {
start: function (tag, attrs, unary) {
const node = {
name: tag,
}
if (attrs.length !== 0) {
node.attrs = parseAttrs(attrs)
}
if (unary) {
const parent = stacks[0] || results
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
} else {
stacks.unshift(node)
}
},
end: function (tag) {
const node = stacks.shift()
if (node.name !== tag) console.error('invalid state: mismatch end tag')
if (stacks.length === 0) {
results.children.push(node)
} else {
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
}
},
chars: function (text) {
const node = {
type: 'text',
text: text,
}
if (stacks.length === 0) {
results.children.push(node)
} else {
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
}
},
comment: function (text) {
const node = {
node: 'comment',
text: text,
}
const parent = stacks[0]
if (!parent.children) {
parent.children = []
}
parent.children.push(node)
},
})
return results.children
}
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
root: __dirname,
build: {
minify: false,
lib: {
name: 'components',
entry: path.resolve(__dirname, 'src/nvue/index.ts'),
formats: ['iife'],
},
rollupOptions: {
external: ['uni', 'vue', 'weex'],
output: {
banner: 'export function initComponents(Vue, weex) {',
footer: 'return components\n}',
entryFileNames: 'components.js',
globals: {
uni: 'uni',
vue: 'Vue',
weex: 'weex',
},
},
},
},
plugins: [vue(), vueJsx({})],
})
......@@ -773,7 +773,7 @@ function provideForm(trigger) {
return fields2;
}
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
const props$v = {
const props$u = {
for: {
type: String,
default: ""
......@@ -781,7 +781,7 @@ const props$v = {
};
var index$D = /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
props: props$v,
props: props$u,
setup(props2, {
slots
}) {
......@@ -1667,7 +1667,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$u = {
const props$t = {
canvasId: {
type: String,
default: ""
......@@ -1683,7 +1683,7 @@ var index$B = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$u,
props: props$t,
computed: {
id() {
return this.canvasId;
......@@ -2140,7 +2140,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$t = {
const props$s = {
name: {
type: String,
default: ""
......@@ -2148,7 +2148,7 @@ const props$t = {
};
var index$A = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$t,
props: props$s,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -2200,7 +2200,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$s = {
const props$r = {
checked: {
type: [Boolean, String],
default: false
......@@ -2224,7 +2224,7 @@ const props$s = {
};
var index$z = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$s,
props: props$r,
setup(props2, {
slots
}) {
......@@ -2291,7 +2291,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$r = {
const props$q = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -2463,7 +2463,7 @@ function useQuill(props2, rootRef, trigger) {
useContextInfo();
useSubscribe();
}
const props$q = /* @__PURE__ */ shared.extend({}, props$r, {
const props$p = /* @__PURE__ */ shared.extend({}, props$q, {
id: {
type: String,
default: ""
......@@ -2491,7 +2491,7 @@ const props$q = /* @__PURE__ */ shared.extend({}, props$r, {
});
var index$y = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$q,
props: props$p,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -2577,7 +2577,7 @@ var index$x = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$p = {
const props$o = {
src: {
type: String,
default: ""
......@@ -2616,7 +2616,7 @@ const IMAGE_MODES = {
};
var index$w = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$p,
props: props$o,
setup(props2, {
emit: emit2
}) {
......@@ -2866,7 +2866,7 @@ const UniViewJSBridgeSubscribe = function() {
function getValueString(value) {
return value === null ? "" : String(value);
}
const props$o = /* @__PURE__ */ shared.extend({}, {
const props$n = /* @__PURE__ */ shared.extend({}, {
name: {
type: String,
default: ""
......@@ -2935,7 +2935,7 @@ const props$o = /* @__PURE__ */ shared.extend({}, {
type: Boolean,
default: false
}
}, props$r);
}, props$q);
const emit = [
"input",
"focus",
......@@ -3130,7 +3130,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$n = /* @__PURE__ */ shared.extend({}, props$o, {
const props$m = /* @__PURE__ */ shared.extend({}, props$n, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -3142,7 +3142,7 @@ const props$n = /* @__PURE__ */ shared.extend({}, props$o, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$n,
props: props$m,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -3320,7 +3320,7 @@ function flatVNode(nodes) {
}
return array;
}
const props$m = {
const props$l = {
scaleArea: {
type: Boolean,
default: false
......@@ -3329,7 +3329,7 @@ const props$m = {
var index$v = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "MovableArea",
props: props$m,
props: props$l,
setup(props2, {
slots
}) {
......@@ -3817,7 +3817,7 @@ STD.prototype.reconfigure = function(e2, t2, n) {
this._springY.reconfigure(e2, t2, n);
this._springScale.reconfigure(e2, t2, n);
};
const props$l = {
const props$k = {
direction: {
type: String,
default: "none"
......@@ -3873,7 +3873,7 @@ const props$l = {
};
var index$u = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: props$l,
props: props$k,
emits: ["change", "scale"],
setup(props2, {
slots,
......@@ -4244,8 +4244,14 @@ function useMovableViewState(props2, trigger, rootRef) {
setParent
};
}
const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"];
const props$k = {
const OPEN_TYPES = [
"navigate",
"redirect",
"switchTab",
"reLaunch",
"navigateBack"
];
const navigatorProps = {
hoverClass: {
type: String,
default: "navigator-hover"
......@@ -4282,13 +4288,49 @@ const props$k = {
default: false
}
};
function createNavigatorOnClick(props2) {
return () => {
if (props2.openType !== "navigateBack" && !props2.url) {
console.error("<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
return;
}
switch (props2.openType) {
case "navigate":
uni.navigateTo({
url: props2.url
});
break;
case "redirect":
uni.redirectTo({
url: props2.url,
exists: props2.exists
});
break;
case "switchTab":
uni.switchTab({
url: props2.url
});
break;
case "reLaunch":
uni.reLaunch({
url: props2.url
});
break;
case "navigateBack":
uni.navigateBack({
delta: props2.delta
});
break;
}
};
}
var index$t = /* @__PURE__ */ defineBuiltInComponent({
name: "Navigator",
inheritAttrs: false,
compatConfig: {
MODE: 3
},
props: props$k,
props: navigatorProps,
setup(props2, {
slots
}) {
......@@ -4298,40 +4340,7 @@ var index$t = /* @__PURE__ */ defineBuiltInComponent({
hovering,
binding
} = useHover(props2);
function onClick($event) {
if (props2.openType !== "navigateBack" && !props2.url) {
console.error("<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
return;
}
switch (props2.openType) {
case "navigate":
uni.navigateTo({
url: props2.url
});
break;
case "redirect":
uni.redirectTo({
url: props2.url,
exists: props2.exists
});
break;
case "switchTab":
uni.switchTab({
url: props2.url
});
break;
case "reLaunch":
uni.reLaunch({
url: props2.url
});
break;
case "navigateBack":
uni.navigateBack({
delta: props2.delta
});
break;
}
}
const onClick = createNavigatorOnClick(props2);
return () => {
const {
hoverClass,
......@@ -6399,7 +6408,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$9 = /* @__PURE__ */ shared.extend({}, props$o, {
const props$9 = /* @__PURE__ */ shared.extend({}, props$n, {
placeholderClass: {
type: String,
default: "input-placeholder"
......
......@@ -1805,7 +1805,7 @@ function provideForm(trigger) {
return fields2;
}
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
const props$C = {
const props$B = {
for: {
type: String,
default: ""
......@@ -1813,7 +1813,7 @@ const props$C = {
};
var index$z = /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
props: props$C,
props: props$B,
setup(props2, {
slots
}) {
......@@ -6381,7 +6381,7 @@ function getTempCanvas(width = 0, height = 0) {
tempCanvas.height = height;
return tempCanvas;
}
const props$B = {
const props$A = {
canvasId: {
type: String,
default: ""
......@@ -6397,7 +6397,7 @@ var index$w = /* @__PURE__ */ defineBuiltInComponent({
compatConfig: {
MODE: 3
},
props: props$B,
props: props$A,
computed: {
id() {
return this.canvasId;
......@@ -6857,7 +6857,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
}
const uniCheckGroupKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniCheckGroup" : "ucg");
const props$A = {
const props$z = {
name: {
type: String,
default: ""
......@@ -6865,7 +6865,7 @@ const props$A = {
};
var index$v = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$A,
props: props$z,
emits: ["change"],
setup(props2, {
emit: emit2,
......@@ -6917,7 +6917,7 @@ function useProvideCheckGroup(props2, trigger) {
}
return getFieldsValue;
}
const props$z = {
const props$y = {
checked: {
type: [Boolean, String],
default: false
......@@ -6941,7 +6941,7 @@ const props$z = {
};
var index$u = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$z,
props: props$y,
setup(props2, {
slots
}) {
......@@ -7018,7 +7018,7 @@ function useCheckboxInject(checkboxChecked, checkboxValue, reset) {
let resetTimer;
function iosHideKeyboard() {
}
const props$y = {
const props$x = {
cursorSpacing: {
type: [Number, String],
default: 0
......@@ -7795,7 +7795,7 @@ function useQuill(props2, rootRef, trigger) {
}
}, id2, true);
}
const props$x = /* @__PURE__ */ extend({}, props$y, {
const props$w = /* @__PURE__ */ extend({}, props$x, {
id: {
type: String,
default: ""
......@@ -7823,7 +7823,7 @@ const props$x = /* @__PURE__ */ extend({}, props$y, {
});
var index$t = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$x,
props: props$w,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
......@@ -7910,7 +7910,7 @@ var index$s = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$w = {
const props$v = {
src: {
type: String,
default: ""
......@@ -7949,7 +7949,7 @@ const IMAGE_MODES = {
};
var index$r = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$w,
props: props$v,
setup(props2, {
emit: emit2
}) {
......@@ -8263,7 +8263,7 @@ const UniViewJSBridgeSubscribe = function() {
function getValueString(value) {
return value === null ? "" : String(value);
}
const props$v = /* @__PURE__ */ extend({}, {
const props$u = /* @__PURE__ */ extend({}, {
name: {
type: String,
default: ""
......@@ -8332,7 +8332,7 @@ const props$v = /* @__PURE__ */ extend({}, {
type: Boolean,
default: false
}
}, props$y);
}, props$x);
const emit = [
"input",
"focus",
......@@ -8536,7 +8536,7 @@ function useField(props2, rootRef, emit2, beforeInput) {
trigger
};
}
const props$u = /* @__PURE__ */ extend({}, props$v, {
const props$t = /* @__PURE__ */ extend({}, props$u, {
placeholderClass: {
type: String,
default: "input-placeholder"
......@@ -8548,7 +8548,7 @@ const props$u = /* @__PURE__ */ extend({}, props$v, {
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$u,
props: props$t,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
......@@ -8726,7 +8726,7 @@ function flatVNode(nodes) {
}
return array;
}
const props$t = {
const props$s = {
scaleArea: {
type: Boolean,
default: false
......@@ -8735,7 +8735,7 @@ const props$t = {
var MovableArea = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "MovableArea",
props: props$t,
props: props$s,
setup(props2, {
slots
}) {
......@@ -9341,7 +9341,7 @@ STD.prototype.reconfigure = function(e2, t2, n) {
this._springY.reconfigure(e2, t2, n);
this._springScale.reconfigure(e2, t2, n);
};
const props$s = {
const props$r = {
direction: {
type: String,
default: "none"
......@@ -9397,7 +9397,7 @@ const props$s = {
};
var MovableView = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: props$s,
props: props$r,
emits: ["change", "scale"],
setup(props2, {
slots,
......@@ -9980,8 +9980,14 @@ function useMovableViewState(props2, trigger, rootRef) {
setParent
};
}
const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"];
const props$r = {
const OPEN_TYPES = [
"navigate",
"redirect",
"switchTab",
"reLaunch",
"navigateBack"
];
const navigatorProps = {
hoverClass: {
type: String,
default: "navigator-hover"
......@@ -10018,13 +10024,49 @@ const props$r = {
default: false
}
};
function createNavigatorOnClick(props2) {
return () => {
if (props2.openType !== "navigateBack" && !props2.url) {
console.error("<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
return;
}
switch (props2.openType) {
case "navigate":
uni.navigateTo({
url: props2.url
});
break;
case "redirect":
uni.redirectTo({
url: props2.url,
exists: props2.exists
});
break;
case "switchTab":
uni.switchTab({
url: props2.url
});
break;
case "reLaunch":
uni.reLaunch({
url: props2.url
});
break;
case "navigateBack":
uni.navigateBack({
delta: props2.delta
});
break;
}
};
}
var index$q = /* @__PURE__ */ defineBuiltInComponent({
name: "Navigator",
inheritAttrs: false,
compatConfig: {
MODE: 3
},
props: props$r,
props: navigatorProps,
setup(props2, {
slots
}) {
......@@ -10034,40 +10076,7 @@ var index$q = /* @__PURE__ */ defineBuiltInComponent({
hovering,
binding
} = useHover(props2);
function onClick($event) {
if (props2.openType !== "navigateBack" && !props2.url) {
console.error("<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab");
return;
}
switch (props2.openType) {
case "navigate":
uni.navigateTo({
url: props2.url
});
break;
case "redirect":
uni.redirectTo({
url: props2.url,
exists: props2.exists
});
break;
case "switchTab":
uni.switchTab({
url: props2.url
});
break;
case "reLaunch":
uni.reLaunch({
url: props2.url
});
break;
case "navigateBack":
uni.navigateBack({
delta: props2.delta
});
break;
}
}
const onClick = createNavigatorOnClick(props2);
return () => {
const {
hoverClass,
......@@ -13232,7 +13241,7 @@ var index$j = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const props$g = /* @__PURE__ */ extend({}, props$v, {
const props$g = /* @__PURE__ */ extend({}, props$u, {
placeholderClass: {
type: String,
default: "input-placeholder"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册