yasuo
This commit is contained in:
parent
0c04f452ee
commit
c7f2091874
File diff suppressed because it is too large
Load Diff
@ -172,13 +172,11 @@ function triggerRefValue(ref, newVal) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var _a;
|
|
||||||
class ComputedRefImpl {
|
class ComputedRefImpl {
|
||||||
constructor(getter, _setter, isReadonly, isSSR) {
|
constructor(getter, _setter, isReadonly, isSSR) {
|
||||||
this._setter = _setter;
|
this._setter = _setter;
|
||||||
this.dep = void 0;
|
this.dep = void 0;
|
||||||
this.__v_isRef = true;
|
this.__v_isRef = true;
|
||||||
this[_a] = false;
|
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
this.effect = new ReactiveEffect(getter, () => {
|
this.effect = new ReactiveEffect(getter, () => {
|
||||||
if (!this._dirty) {
|
if (!this._dirty) {
|
||||||
@ -203,7 +201,6 @@ class ComputedRefImpl {
|
|||||||
this._setter(newValue);
|
this._setter(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_a = "__v_isReadonly";
|
|
||||||
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
||||||
let getter;
|
let getter;
|
||||||
let setter;
|
let setter;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { getCurrentScope, onScopeDispose, computed, toRefs, getCurrentInstance, onMounted, nextTick, ref, unref, isRef, reactive, watch, customRef, onUpdated } from "vue";
|
import { getCurrentScope, onScopeDispose, computed, toRefs, getCurrentInstance, onMounted, nextTick, ref, unref, isRef, reactive, watch, customRef, onUpdated } from "vue";
|
||||||
var _a;
|
var _a$1;
|
||||||
const isClient = typeof window !== "undefined";
|
const isClient$1 = typeof window !== "undefined";
|
||||||
const toString = Object.prototype.toString;
|
const toString$1 = Object.prototype.toString;
|
||||||
const isFunction = (val) => typeof val === "function";
|
const isFunction = (val) => typeof val === "function";
|
||||||
const isNumber = (val) => typeof val === "number";
|
const isNumber = (val) => typeof val === "number";
|
||||||
const isString = (val) => typeof val === "string";
|
const isString = (val) => typeof val === "string";
|
||||||
const isObject = (val) => toString.call(val) === "[object Object]";
|
const isObject$1 = (val) => toString$1.call(val) === "[object Object]";
|
||||||
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
||||||
const noop = () => {
|
const noop = () => {
|
||||||
};
|
};
|
||||||
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
isClient$1 && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
||||||
function resolveUnref(r) {
|
function resolveUnref(r) {
|
||||||
return typeof r === "function" ? r() : unref(r);
|
return typeof r === "function" ? r() : unref(r);
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|||||||
}
|
}
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
isPending.value = true;
|
isPending.value = true;
|
||||||
if (isClient)
|
if (isClient$1)
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
tryOnScopeDispose(stop);
|
tryOnScopeDispose(stop);
|
||||||
@ -156,7 +156,7 @@ function unrefElement(elRef) {
|
|||||||
const plain = resolveUnref(elRef);
|
const plain = resolveUnref(elRef);
|
||||||
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
||||||
}
|
}
|
||||||
const defaultWindow = isClient ? window : void 0;
|
const defaultWindow = isClient$1 ? window : void 0;
|
||||||
function useEventListener(...args) {
|
function useEventListener(...args) {
|
||||||
let target;
|
let target;
|
||||||
let event;
|
let event;
|
||||||
@ -561,4 +561,9 @@ function useWindowSize(options = {}) {
|
|||||||
useEventListener("orientationchange", update, { passive: true });
|
useEventListener("orientationchange", update, { passive: true });
|
||||||
return { width, height };
|
return { width, height };
|
||||||
}
|
}
|
||||||
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };
|
var _a;
|
||||||
|
const isClient = typeof window !== "undefined";
|
||||||
|
const toString = Object.prototype.toString;
|
||||||
|
const isObject = (val) => toString.call(val) === "[object Object]";
|
||||||
|
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
||||||
|
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as g, isObject$1 as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { w as withInstall } from "../badge/index2.js";
|
import { w as withInstall } from "../badge/index2.js";
|
||||||
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, normalizeClass, unref, createVNode, createCommentVNode, toDisplayString } from "vue";
|
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, normalizeClass, unref, createVNode, createCommentVNode, toDisplayString } from "vue";
|
||||||
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
import { _ as _sfc_main$2W } from "../_chunks/@layui/index.js";
|
||||||
import { i as isObject } from "../_chunks/@vueuse/index.js";
|
import { g as isObject } from "../_chunks/@vueuse/index.js";
|
||||||
var index = /* @__PURE__ */ (() => ":root{--textarea-border-radius: var(--global-border-radius);--textarea-border-color: var(--global-neutral-color-3)}.layui-textarea{border-width:1px;border-style:solid;background-color:#fff;color:#000000d9;border-radius:var(--textarea-border-radius);border-color:var(--textarea-border-color);display:block;width:100%;height:auto;line-height:20px;min-height:100px;padding:6px 10px;resize:vertical;position:relative;transition:none;-webkit-transition:none}.layui-textarea-wrapper{position:relative}.layui-textarea:hover,.layui-textarea:focus{border-color:#d2d2d2!important}.layui-textarea-clear{position:absolute;color:#00000073;right:10px;top:10px}.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-texterea-count{color:inherit;white-space:nowrap;pointer-events:none;text-align:right;margin-top:4px}.layui-textarea-disabled{cursor:not-allowed!important;opacity:.6}\n")();
|
var index = /* @__PURE__ */ (() => ":root{--textarea-border-radius: var(--global-border-radius);--textarea-border-color: var(--global-neutral-color-3)}.layui-textarea{border-width:1px;border-style:solid;background-color:#fff;color:#000000d9;border-radius:var(--textarea-border-radius);border-color:var(--textarea-border-color);display:block;width:100%;height:auto;line-height:20px;min-height:100px;padding:6px 10px;resize:vertical;position:relative;transition:none;-webkit-transition:none}.layui-textarea-wrapper{position:relative}.layui-textarea:hover,.layui-textarea:focus{border-color:#d2d2d2!important}.layui-textarea-clear{position:absolute;color:#00000073;right:10px;top:10px}.layui-textarea::-webkit-input-placeholder{line-height:1.3}.layui-texterea-count{color:inherit;white-space:nowrap;pointer-events:none;text-align:right;margin-top:4px}.layui-textarea-disabled{cursor:not-allowed!important;opacity:.6}\n")();
|
||||||
const _hoisted_1 = { class: "layui-textarea-wrapper" };
|
const _hoisted_1 = { class: "layui-textarea-wrapper" };
|
||||||
const _hoisted_2 = ["value", "placeholder", "name", "disabled", "maxlength"];
|
const _hoisted_2 = ["value", "placeholder", "name", "disabled", "maxlength"];
|
||||||
|
@ -54,7 +54,8 @@ const _sfc_main = defineComponent({
|
|||||||
dragText: null,
|
dragText: null,
|
||||||
modelValue: { default: null },
|
modelValue: { default: null },
|
||||||
auto: { type: Boolean, default: true },
|
auto: { type: Boolean, default: true },
|
||||||
sizeOutMsg: null
|
sizeOutMsg: null,
|
||||||
|
quality: null
|
||||||
},
|
},
|
||||||
emits: [
|
emits: [
|
||||||
"choose",
|
"choose",
|
||||||
@ -68,6 +69,24 @@ const _sfc_main = defineComponent({
|
|||||||
],
|
],
|
||||||
setup(__props, { emit }) {
|
setup(__props, { emit }) {
|
||||||
const props = __props;
|
const props = __props;
|
||||||
|
function imgcomp(file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
var options = {
|
||||||
|
file,
|
||||||
|
quality: 0.6,
|
||||||
|
mimeType: "image/jpeg",
|
||||||
|
maxWidth: 2e3,
|
||||||
|
maxHeight: 2e3,
|
||||||
|
convertSize: Infinity,
|
||||||
|
loose: true,
|
||||||
|
redressOrientation: true,
|
||||||
|
success: function(result) {
|
||||||
|
resolve(result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new ImageCompressor(options);
|
||||||
|
});
|
||||||
|
}
|
||||||
const getCutDownResult = () => {
|
const getCutDownResult = () => {
|
||||||
if (_cropper) {
|
if (_cropper) {
|
||||||
const canvas = _cropper.getCroppedCanvas();
|
const canvas = _cropper.getCroppedCanvas();
|
||||||
@ -164,7 +183,7 @@ const _sfc_main = defineComponent({
|
|||||||
computedCutLayerOption = computed(() => defaultCutLayerOption.value);
|
computedCutLayerOption = computed(() => defaultCutLayerOption.value);
|
||||||
}
|
}
|
||||||
const innerCutVisible = ref(false);
|
const innerCutVisible = ref(false);
|
||||||
const localUploadTransaction = (option) => {
|
const localUploadTransaction = async (option) => {
|
||||||
const { url, files } = option;
|
const { url, files } = option;
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
if (url.length <= 5) {
|
if (url.length <= 5) {
|
||||||
@ -174,7 +193,8 @@ const _sfc_main = defineComponent({
|
|||||||
if (Array.isArray(files) && files.length > 0) {
|
if (Array.isArray(files) && files.length > 0) {
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
let _file = files[i];
|
let _file = files[i];
|
||||||
formData.append(props.field + "[" + i + "]", _file);
|
let f = await imgcomp(_file);
|
||||||
|
formData.append(props.field + "[" + i + "]", f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.data && props.data instanceof Object) {
|
if (props.data && props.data instanceof Object) {
|
||||||
|
1189
lib/index.js
1189
lib/index.js
File diff suppressed because one or more lines are too long
@ -74,6 +74,26 @@ export interface UploadProps {
|
|||||||
modelValue?: any;
|
modelValue?: any;
|
||||||
auto?: boolean;
|
auto?: boolean;
|
||||||
sizeOutMsg?: string;
|
sizeOutMsg?: string;
|
||||||
|
quality?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
function imgcomp(file: File) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
var options = {
|
||||||
|
file: file,
|
||||||
|
quality: 0.6,
|
||||||
|
mimeType: "image/jpeg",
|
||||||
|
maxWidth: 2000,
|
||||||
|
maxHeight: 2000,
|
||||||
|
convertSize: Infinity,
|
||||||
|
loose: true,
|
||||||
|
redressOrientation: true,
|
||||||
|
success: function (result) {
|
||||||
|
resolve(result);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
new ImageCompressor(options);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCutDownResult = () => {
|
const getCutDownResult = () => {
|
||||||
@ -165,7 +185,7 @@ const props = withDefaults(defineProps<UploadProps>(), {
|
|||||||
cut: false,
|
cut: false,
|
||||||
cutOptions: void 0,
|
cutOptions: void 0,
|
||||||
modelValue: null,
|
modelValue: null,
|
||||||
auto: true,
|
auto: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const slot = useSlots();
|
const slot = useSlots();
|
||||||
@ -220,7 +240,7 @@ interface localUploadOption {
|
|||||||
|
|
||||||
const innerCutVisible = ref<boolean>(false);
|
const innerCutVisible = ref<boolean>(false);
|
||||||
|
|
||||||
const localUploadTransaction = (option: localUploadTransaction) => {
|
const localUploadTransaction = async (option: localUploadTransaction) => {
|
||||||
const { url, files } = option;
|
const { url, files } = option;
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
if (url.length <= 5) {
|
if (url.length <= 5) {
|
||||||
@ -230,7 +250,8 @@ const localUploadTransaction = (option: localUploadTransaction) => {
|
|||||||
if (Array.isArray(files) && files.length > 0) {
|
if (Array.isArray(files) && files.length > 0) {
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
let _file = files[i];
|
let _file = files[i];
|
||||||
formData.append(props.field + "[" + i + "]", _file);
|
let f = await imgcomp(_file);
|
||||||
|
formData.append(props.field + "[" + i + "]", f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.data && props.data instanceof Object) {
|
if (props.data && props.data instanceof Object) {
|
||||||
@ -266,7 +287,7 @@ const errorF = (errorText: string) => {
|
|||||||
let errorMsg = errorText ? errorText : defaultErrorMsg;
|
let errorMsg = errorText ? errorText : defaultErrorMsg;
|
||||||
errorMsg = `${errorMsg}`;
|
errorMsg = `${errorMsg}`;
|
||||||
console.warn(errorMsg);
|
console.warn(errorMsg);
|
||||||
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) {});
|
layer.msg(errorMsg, { icon: 2, time: 1000 }, function (res: unknown) { });
|
||||||
emit("error", Object.assign({ currentTimeStamp, msg: errorMsg }));
|
emit("error", Object.assign({ currentTimeStamp, msg: errorMsg }));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -443,22 +464,9 @@ onUnmounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div class="layui-upload layui-upload-wrap" :class="disabledPreview ? 'layui-upload-file-disabled' : ''">
|
||||||
class="layui-upload layui-upload-wrap"
|
<input type="file" class="layui-upload-file" ref="orgFileInput" :name="field" :field="field" :multiple="multiple"
|
||||||
:class="disabledPreview ? 'layui-upload-file-disabled' : ''"
|
:accept="acceptMime" :disabled="disabled" @click="clickOrgInput" @change="uploadChange" />
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
class="layui-upload-file"
|
|
||||||
ref="orgFileInput"
|
|
||||||
:name="field"
|
|
||||||
:field="field"
|
|
||||||
:multiple="multiple"
|
|
||||||
:accept="acceptMime"
|
|
||||||
:disabled="disabled"
|
|
||||||
@click="clickOrgInput"
|
|
||||||
@change="uploadChange"
|
|
||||||
/>
|
|
||||||
<div v-if="!drag">
|
<div v-if="!drag">
|
||||||
<div class="layui-upload-btn-box" @click.stop="chooseFile">
|
<div class="layui-upload-btn-box" @click.stop="chooseFile">
|
||||||
<template v-if="slot.default">
|
<template v-if="slot.default">
|
||||||
@ -471,19 +479,12 @@ onUnmounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-else ref="dragRef" class="layui-upload-drag" :class="disabled
|
||||||
v-else
|
? 'layui-upload-drag-disable'
|
||||||
ref="dragRef"
|
: isDragEnter
|
||||||
class="layui-upload-drag"
|
|
||||||
:class="
|
|
||||||
disabled
|
|
||||||
? 'layui-upload-drag-disable'
|
|
||||||
: isDragEnter
|
|
||||||
? 'layui-upload-drag-draging'
|
? 'layui-upload-drag-draging'
|
||||||
: ''
|
: ''
|
||||||
"
|
" @click.stop="chooseFile">
|
||||||
@click.stop="chooseFile"
|
|
||||||
>
|
|
||||||
<i class="layui-icon"></i>
|
<i class="layui-icon"></i>
|
||||||
<p>{{ dragText }}</p>
|
<p>{{ dragText }}</p>
|
||||||
<div class="layui-hide" id="uploadDemoView">
|
<div class="layui-hide" id="uploadDemoView">
|
||||||
@ -491,38 +492,17 @@ onUnmounted(() => {
|
|||||||
<img src="" alt="上传成功后渲染" style="max-width: 196px" />
|
<img src="" alt="上传成功后渲染" style="max-width: 196px" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<lay-layer
|
<lay-layer v-model="innerCutVisible" :title="computedCutLayerOption.title" :move="computedCutLayerOption.move"
|
||||||
v-model="innerCutVisible"
|
:resize="computedCutLayerOption.resize" :shade="computedCutLayerOption.shade"
|
||||||
:title="computedCutLayerOption.title"
|
:shadeClose="computedCutLayerOption.shadeClose" :shadeOpacity="computedCutLayerOption.shadeOpacity"
|
||||||
:move="computedCutLayerOption.move"
|
:zIndex="computedCutLayerOption.zIndex" :btnAlign="computedCutLayerOption.btnAlign"
|
||||||
:resize="computedCutLayerOption.resize"
|
:area="computedCutLayerOption.area" :anim="computedCutLayerOption.anim"
|
||||||
:shade="computedCutLayerOption.shade"
|
:isOutAnim="computedCutLayerOption.isOutAnim" :btn="computedCutLayerOption.btn" @close="clearAllCutEffect">
|
||||||
:shadeClose="computedCutLayerOption.shadeClose"
|
<div class="copper-container" v-for="(base64str, index) in activeUploadFilesImgs" :key="`file${index}`">
|
||||||
:shadeOpacity="computedCutLayerOption.shadeOpacity"
|
<img :src="base64str" :id="`_lay_upload_img${index}`" class="_lay_upload_img" />
|
||||||
:zIndex="computedCutLayerOption.zIndex"
|
|
||||||
:btnAlign="computedCutLayerOption.btnAlign"
|
|
||||||
:area="computedCutLayerOption.area"
|
|
||||||
:anim="computedCutLayerOption.anim"
|
|
||||||
:isOutAnim="computedCutLayerOption.isOutAnim"
|
|
||||||
:btn="computedCutLayerOption.btn"
|
|
||||||
@close="clearAllCutEffect"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="copper-container"
|
|
||||||
v-for="(base64str, index) in activeUploadFilesImgs"
|
|
||||||
:key="`file${index}`"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
:src="base64str"
|
|
||||||
:id="`_lay_upload_img${index}`"
|
|
||||||
class="_lay_upload_img"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</lay-layer>
|
</lay-layer>
|
||||||
<div
|
<div class="layui-upload-list" :class="disabledPreview ? 'layui-upload-list-disabled' : ''">
|
||||||
class="layui-upload-list"
|
|
||||||
:class="disabledPreview ? 'layui-upload-list-disabled' : ''"
|
|
||||||
>
|
|
||||||
<slot name="preview"></slot>
|
<slot name="preview"></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
290
umd/index.js
290
umd/index.js
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user