测试
This commit is contained in:
16
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.d.ts
generated
vendored
Normal file
16
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { ExtractPropTypes, InjectionKey, Ref } from 'vue';
|
||||
type EmptyValuesContext = ExtractPropTypes<typeof useEmptyValuesProps>;
|
||||
export declare const emptyValuesContextKey: InjectionKey<Ref<EmptyValuesContext>>;
|
||||
export declare const SCOPE = "use-empty-values";
|
||||
export declare const DEFAULT_EMPTY_VALUES: (string | null | undefined)[];
|
||||
export declare const DEFAULT_VALUE_ON_CLEAR: undefined;
|
||||
export declare const useEmptyValuesProps: {
|
||||
readonly emptyValues: ArrayConstructor;
|
||||
readonly valueOnClear: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | ((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null))[], unknown, unknown, undefined, boolean>;
|
||||
};
|
||||
export declare const useEmptyValues: (props: EmptyValuesContext, defaultValue?: null | undefined) => {
|
||||
emptyValues: import("vue").ComputedRef<unknown[]>;
|
||||
valueOnClear: import("vue").ComputedRef<any>;
|
||||
isEmptyValue: (value: unknown) => boolean;
|
||||
};
|
||||
export {};
|
||||
73
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.js
generated
vendored
Normal file
73
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var vue = require('vue');
|
||||
var lodashUnified = require('lodash-unified');
|
||||
var runtime = require('../../utils/vue/props/runtime.js');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const emptyValuesContextKey = Symbol("emptyValuesContextKey");
|
||||
const SCOPE = "use-empty-values";
|
||||
const DEFAULT_EMPTY_VALUES = ["", void 0, null];
|
||||
const DEFAULT_VALUE_ON_CLEAR = void 0;
|
||||
const useEmptyValuesProps = runtime.buildProps({
|
||||
emptyValues: Array,
|
||||
valueOnClear: {
|
||||
type: runtime.definePropType([
|
||||
String,
|
||||
Number,
|
||||
Boolean,
|
||||
Function
|
||||
]),
|
||||
default: void 0,
|
||||
validator: (val) => {
|
||||
val = shared.isFunction(val) ? val() : val;
|
||||
if (shared.isArray(val)) {
|
||||
return val.every((item) => !item);
|
||||
}
|
||||
return !val;
|
||||
}
|
||||
}
|
||||
});
|
||||
const useEmptyValues = (props, defaultValue) => {
|
||||
const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
|
||||
const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
|
||||
const valueOnClear = vue.computed(() => {
|
||||
if (shared.isFunction(props.valueOnClear)) {
|
||||
return props.valueOnClear();
|
||||
} else if (props.valueOnClear !== void 0) {
|
||||
return props.valueOnClear;
|
||||
} else if (shared.isFunction(config.value.valueOnClear)) {
|
||||
return config.value.valueOnClear();
|
||||
} else if (config.value.valueOnClear !== void 0) {
|
||||
return config.value.valueOnClear;
|
||||
}
|
||||
return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
|
||||
});
|
||||
const isEmptyValue = (value) => {
|
||||
let result = true;
|
||||
if (shared.isArray(value)) {
|
||||
result = emptyValues.value.some((emptyValue) => {
|
||||
return lodashUnified.isEqual(value, emptyValue);
|
||||
});
|
||||
} else {
|
||||
result = emptyValues.value.includes(value);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
if (!isEmptyValue(valueOnClear.value)) ;
|
||||
return {
|
||||
emptyValues,
|
||||
valueOnClear,
|
||||
isEmptyValue
|
||||
};
|
||||
};
|
||||
|
||||
exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
|
||||
exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
|
||||
exports.SCOPE = SCOPE;
|
||||
exports.emptyValuesContextKey = emptyValuesContextKey;
|
||||
exports.useEmptyValues = useEmptyValues;
|
||||
exports.useEmptyValuesProps = useEmptyValuesProps;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/hooks/use-empty-values/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user