使用VUE重构项目
This commit is contained in:
35
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.d.ts
generated
vendored
Normal file
35
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { EpPropFinalized } from "../../utils/vue/props/types.js";
|
||||
import "../../utils/index.js";
|
||||
import * as vue from "vue";
|
||||
import { InjectionKey, Ref } from "vue";
|
||||
|
||||
//#region ../../packages/hooks/use-empty-values/index.d.ts
|
||||
type ValueOnClear = string | number | boolean | Function | null;
|
||||
interface UseEmptyValuesProps {
|
||||
/**
|
||||
* @description empty values supported by the component
|
||||
*/
|
||||
emptyValues?: unknown[];
|
||||
/**
|
||||
* @description return value when cleared, if you want to set `undefined`, use `() => undefined`
|
||||
*/
|
||||
valueOnClear?: ValueOnClear;
|
||||
}
|
||||
declare const emptyValuesContextKey: InjectionKey<Ref<UseEmptyValuesProps>>;
|
||||
declare const SCOPE = "use-empty-values";
|
||||
declare const DEFAULT_EMPTY_VALUES: (string | null | undefined)[];
|
||||
declare const DEFAULT_VALUE_ON_CLEAR: undefined;
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `UseEmptyValuesProps` instead.
|
||||
*/
|
||||
declare const useEmptyValuesProps: {
|
||||
readonly emptyValues: ArrayConstructor;
|
||||
readonly valueOnClear: 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)) | null)[], unknown, unknown, undefined, boolean>;
|
||||
};
|
||||
declare const useEmptyValues: (props: UseEmptyValuesProps, defaultValue?: null | undefined) => {
|
||||
emptyValues: vue.ComputedRef<unknown[]>;
|
||||
valueOnClear: vue.ComputedRef<any>;
|
||||
isEmptyValue: (value: unknown) => boolean;
|
||||
};
|
||||
//#endregion
|
||||
export { DEFAULT_EMPTY_VALUES, DEFAULT_VALUE_ON_CLEAR, SCOPE, UseEmptyValuesProps, emptyValuesContextKey, useEmptyValues, useEmptyValuesProps };
|
||||
64
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.mjs
generated
vendored
Normal file
64
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { isArray, isFunction } from "../../utils/types.mjs";
|
||||
import { debugWarn } from "../../utils/error.mjs";
|
||||
import { buildProps, definePropType } from "../../utils/vue/props/runtime.mjs";
|
||||
import { isEqual } from "lodash-unified";
|
||||
import { computed, getCurrentInstance, inject, ref } from "vue";
|
||||
|
||||
//#region ../../packages/hooks/use-empty-values/index.ts
|
||||
const emptyValuesContextKey = Symbol("emptyValuesContextKey");
|
||||
const SCOPE = "use-empty-values";
|
||||
const DEFAULT_EMPTY_VALUES = [
|
||||
"",
|
||||
void 0,
|
||||
null
|
||||
];
|
||||
const DEFAULT_VALUE_ON_CLEAR = void 0;
|
||||
/**
|
||||
* @deprecated Removed after 3.0.0, Use `UseEmptyValuesProps` instead.
|
||||
*/
|
||||
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)) debugWarn(SCOPE, "value-on-clear should be a value of empty-values");
|
||||
return {
|
||||
emptyValues,
|
||||
valueOnClear,
|
||||
isEmptyValue
|
||||
};
|
||||
};
|
||||
|
||||
//#endregion
|
||||
export { DEFAULT_EMPTY_VALUES, DEFAULT_VALUE_ON_CLEAR, SCOPE, emptyValuesContextKey, useEmptyValues, useEmptyValuesProps };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.mjs.map
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/es/hooks/use-empty-values/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":[],"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 { InjectionKey, Ref } from 'vue'\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype ValueOnClear = string | number | boolean | Function | null\n\nexport interface UseEmptyValuesProps {\n /**\n * @description empty values supported by the component\n */\n emptyValues?: unknown[]\n /**\n * @description return value when cleared, if you want to set `undefined`, use `() => undefined`\n */\n valueOnClear?: ValueOnClear\n}\n\nexport const emptyValuesContextKey: InjectionKey<Ref<UseEmptyValuesProps>> =\n Symbol('emptyValuesContextKey')\nexport const SCOPE = 'use-empty-values'\nexport const DEFAULT_EMPTY_VALUES = ['', undefined, null]\nexport const DEFAULT_VALUE_ON_CLEAR = undefined\n\n/**\n * @deprecated Removed after 3.0.0, Use `UseEmptyValuesProps` instead.\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: UseEmptyValuesProps,\n defaultValue?: null | undefined\n) => {\n const config = getCurrentInstance()\n ? inject(emptyValuesContextKey, ref<UseEmptyValuesProps>({}))\n : ref<UseEmptyValuesProps>({})\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"],"mappings":";;;;;;;AA0BA,MAAa,wBACX,OAAO,wBAAwB;AACjC,MAAa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