测试
This commit is contained in:
16
frontend/node_modules/element-plus/es/hooks/use-empty-values/index.d.ts
generated
vendored
Normal file
16
frontend/node_modules/element-plus/es/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 {};
|
||||
64
frontend/node_modules/element-plus/es/hooks/use-empty-values/index.mjs
generated
vendored
Normal file
64
frontend/node_modules/element-plus/es/hooks/use-empty-values/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { getCurrentInstance, inject, ref, computed } from 'vue';
|
||||
import { isEqual } from 'lodash-unified';
|
||||
import { buildProps, definePropType } from '../../utils/vue/props/runtime.mjs';
|
||||
import { isFunction, isArray } from '@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 = buildProps({
|
||||
emptyValues: Array,
|
||||
valueOnClear: {
|
||||
type: definePropType([
|
||||
String,
|
||||
Number,
|
||||
Boolean,
|
||||
Function
|
||||
]),
|
||||
default: void 0,
|
||||
validator: (val) => {
|
||||
val = isFunction(val) ? val() : val;
|
||||
if (isArray(val)) {
|
||||
return val.every((item) => !item);
|
||||
}
|
||||
return !val;
|
||||
}
|
||||
}
|
||||
});
|
||||
const useEmptyValues = (props, defaultValue) => {
|
||||
const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
|
||||
const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
|
||||
const valueOnClear = computed(() => {
|
||||
if (isFunction(props.valueOnClear)) {
|
||||
return props.valueOnClear();
|
||||
} else if (props.valueOnClear !== void 0) {
|
||||
return props.valueOnClear;
|
||||
} else if (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 (isArray(value)) {
|
||||
result = emptyValues.value.some((emptyValue) => {
|
||||
return isEqual(value, emptyValue);
|
||||
});
|
||||
} else {
|
||||
result = emptyValues.value.includes(value);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
if (!isEmptyValue(valueOnClear.value)) ;
|
||||
return {
|
||||
emptyValues,
|
||||
valueOnClear,
|
||||
isEmptyValue
|
||||
};
|
||||
};
|
||||
|
||||
export { DEFAULT_EMPTY_VALUES, DEFAULT_VALUE_ON_CLEAR, SCOPE, emptyValuesContextKey, useEmptyValues, useEmptyValuesProps };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/hooks/use-empty-values/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/hooks/use-empty-values/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-empty-values/index.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, ref } from 'vue'\nimport {\n buildProps,\n debugWarn,\n definePropType,\n isArray,\n isFunction,\n} from '@element-plus/utils'\nimport { isEqual } from 'lodash-unified'\n\nimport type { ExtractPropTypes, InjectionKey, Ref } from 'vue'\n\ntype EmptyValuesContext = ExtractPropTypes<typeof useEmptyValuesProps>\n\nexport const emptyValuesContextKey: InjectionKey<Ref<EmptyValuesContext>> =\n Symbol('emptyValuesContextKey')\nexport const SCOPE = 'use-empty-values'\nexport const DEFAULT_EMPTY_VALUES = ['', undefined, null]\nexport const DEFAULT_VALUE_ON_CLEAR = undefined\n\nexport const useEmptyValuesProps = buildProps({\n /**\n * @description empty values supported by the component\n */\n emptyValues: Array,\n /**\n * @description return value when cleared, if you want to set `undefined`, use `() => undefined`\n */\n valueOnClear: {\n /* eslint-disable-next-line @typescript-eslint/no-unsafe-function-type */\n type: definePropType<string | number | boolean | Function | null>([\n String,\n Number,\n Boolean,\n Function,\n ]),\n default: undefined,\n validator: (val: unknown) => {\n val = isFunction(val) ? val() : val\n if (isArray(val)) {\n return val.every((item) => !item)\n }\n return !val\n },\n },\n} as const)\n\nexport const useEmptyValues = (\n props: EmptyValuesContext,\n defaultValue?: null | undefined\n) => {\n const config = getCurrentInstance()\n ? inject(emptyValuesContextKey, ref<EmptyValuesContext>({}))\n : ref<EmptyValuesContext>({})\n\n const emptyValues = computed(\n () => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES\n )\n\n const valueOnClear = computed(() => {\n // function is used for undefined cause undefined can't be a value of prop\n if (isFunction(props.valueOnClear)) {\n return props.valueOnClear()\n } else if (props.valueOnClear !== undefined) {\n return props.valueOnClear\n } else if (isFunction(config.value.valueOnClear)) {\n return config.value.valueOnClear()\n } else if (config.value.valueOnClear !== undefined) {\n return config.value.valueOnClear\n }\n return defaultValue !== undefined ? defaultValue : DEFAULT_VALUE_ON_CLEAR\n })\n\n const isEmptyValue = (value: unknown) => {\n let result = true\n if (isArray(value)) {\n result = emptyValues.value.some((emptyValue) => {\n return isEqual(value, emptyValue)\n })\n } else {\n result = emptyValues.value.includes(value)\n }\n return result\n }\n\n if (!isEmptyValue(valueOnClear.value)) {\n debugWarn(SCOPE, 'value-on-clear should be a value of empty-values')\n }\n\n return {\n emptyValues,\n valueOnClear,\n isEmptyValue,\n }\n}\n"],"names":[],"mappings":";;;;;AASY,MAAC,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,EAAE;AACzD,MAAC,KAAK,GAAG,mBAAmB;AAC5B,MAAC,oBAAoB,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE;AAC3C,MAAC,sBAAsB,GAAG,KAAK,EAAE;AACjC,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,WAAW,EAAE,KAAK;AACpB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,IAAI,SAAS,EAAE,CAAC,GAAG,KAAK;AACxB,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC;AAC1C,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;AACxB,QAAQ,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1C,OAAO;AACP,MAAM,OAAO,CAAC,GAAG,CAAC;AAClB,KAAK;AACL,GAAG;AACH,CAAC,EAAE;AACS,MAAC,cAAc,GAAG,CAAC,KAAK,EAAE,YAAY,KA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