mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-29 10:38:56 +08:00
refactor: replement deprecated fields (#7519)
This commit is contained in:
parent
9d7c171940
commit
d6cc262c3a
@ -21,13 +21,13 @@ async function readMarkdown(options: Options): Promise<Map<String, VueTag>> {
|
||||
return formatter(mdParser(fileContent), componentName, kebabComponentName, options.tagPrefix);
|
||||
})
|
||||
.filter(item => item) as VueTag[][];
|
||||
const tags: Map<String, VueTag> = new Map();
|
||||
const tags = new Map<String, VueTag>();
|
||||
flatMap(data, item => item).forEach(mergedTag => mergeTag(tags, mergedTag));
|
||||
return tags;
|
||||
}
|
||||
|
||||
function readTypings(options: Options): Map<String, VueTag> {
|
||||
const tags: Map<String, VueTag> = new Map();
|
||||
const tags = new Map<String, VueTag>();
|
||||
const fileContent = readFileSync(options.typingsPath, 'utf-8');
|
||||
fileContent
|
||||
.split('\n')
|
||||
@ -61,7 +61,7 @@ function mergeTag(tags: Map<String, VueTag>, mergedTag: VueTag) {
|
||||
|
||||
function mergeTags(mergedTagsArr: Map<String, VueTag>[]): VueTag[] {
|
||||
if (mergedTagsArr.length === 1) return [...mergedTagsArr[0].values()];
|
||||
const tags: Map<String, VueTag> = new Map();
|
||||
const tags = new Map<String, VueTag>();
|
||||
if (mergedTagsArr.length === 0) return [];
|
||||
mergedTagsArr.forEach(mergedTags => {
|
||||
mergedTags.forEach(mergedTag => mergeTag(tags, mergedTag));
|
||||
|
@ -21,7 +21,7 @@ export type Articals = Artical[];
|
||||
function readLine(input: string) {
|
||||
const end = input.indexOf('\n');
|
||||
|
||||
return input.substr(0, end !== -1 ? end : input.length);
|
||||
return input.substring(0, end !== -1 ? end : input.length);
|
||||
}
|
||||
|
||||
function splitTableLine(line: string) {
|
||||
@ -47,7 +47,7 @@ function tableParse(input: string) {
|
||||
};
|
||||
|
||||
while (start < end) {
|
||||
const target = input.substr(start);
|
||||
const target = input.substring(start);
|
||||
const line = readLine(target);
|
||||
|
||||
if (!/^\|/.test(target)) {
|
||||
@ -79,7 +79,7 @@ export function mdParser(input: string): Articals {
|
||||
const end = input.length;
|
||||
|
||||
while (start < end) {
|
||||
const target = input.substr(start);
|
||||
const target = input.substring(start);
|
||||
|
||||
let match;
|
||||
if ((match = TITLE_REG.exec(target))) {
|
||||
@ -91,7 +91,7 @@ export function mdParser(input: string): Articals {
|
||||
|
||||
start += match.index + match[0].length;
|
||||
} else if ((match = TABLE_REG.exec(target))) {
|
||||
const { table, usedLength } = tableParse(target.substr(match.index));
|
||||
const { table, usedLength } = tableParse(target.substring(match.index));
|
||||
artical.push({
|
||||
type: 'table',
|
||||
table,
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const assign = require('object-assign');
|
||||
const { getProjectPath } = require('./utils/projectHelper');
|
||||
|
||||
module.exports = function () {
|
||||
@ -9,7 +8,7 @@ module.exports = function () {
|
||||
if (fs.existsSync(getProjectPath('tsconfig.json'))) {
|
||||
my = require(getProjectPath('tsconfig.json'));
|
||||
}
|
||||
return assign(
|
||||
return Object.assign(
|
||||
{
|
||||
noUnusedParameters: true,
|
||||
noUnusedLocals: true,
|
||||
|
@ -12,7 +12,7 @@ export default function getScroll(
|
||||
const method = top ? 'scrollTop' : 'scrollLeft';
|
||||
let result = 0;
|
||||
if (isWindow(target)) {
|
||||
result = target[top ? 'pageYOffset' : 'pageXOffset'];
|
||||
result = target[top ? 'scrollY' : 'scrollX'];
|
||||
} else if (target instanceof Document) {
|
||||
result = target.documentElement[method];
|
||||
} else if (target instanceof HTMLElement) {
|
||||
|
@ -22,8 +22,8 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) {
|
||||
const time = timestamp - startTime;
|
||||
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
|
||||
if (isWindow(container)) {
|
||||
(container as Window).scrollTo(window.pageXOffset, nextScrollTop);
|
||||
} else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
|
||||
(container as Window).scrollTo(window.scrollX, nextScrollTop);
|
||||
} else if (container instanceof Document) {
|
||||
(container as Document).documentElement.scrollTop = nextScrollTop;
|
||||
} else {
|
||||
(container as HTMLElement).scrollTop = nextScrollTop;
|
||||
|
@ -1,8 +0,0 @@
|
||||
export default function triggerEvent(el: Element, type: string) {
|
||||
if ('createEvent' in document) {
|
||||
// modern browsers, IE9+
|
||||
const e = document.createEvent('HTMLEvents');
|
||||
e.initEvent(type, false, true);
|
||||
el.dispatchEvent(e);
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ export default defineComponent({
|
||||
});
|
||||
});
|
||||
const triggerUpdate = ref(Symbol());
|
||||
const registeredValuesMap = ref<Map<Symbol, string>>(new Map());
|
||||
const registeredValuesMap = ref(new Map<Symbol, string>());
|
||||
const cancelValue = (id: Symbol) => {
|
||||
registeredValuesMap.value.delete(id);
|
||||
triggerUpdate.value = Symbol();
|
||||
|
@ -112,7 +112,7 @@ export default defineComponent({
|
||||
return !override;
|
||||
}),
|
||||
);
|
||||
const store = shallowRef<Map<string, StoreMenuInfo>>(new Map());
|
||||
const store = shallowRef(new Map<string, StoreMenuInfo>());
|
||||
const siderCollapsed = inject(SiderCollapsedKey, ref(undefined));
|
||||
const inlineCollapsed = computed(() => {
|
||||
if (siderCollapsed.value !== undefined) {
|
||||
|
@ -116,7 +116,7 @@ function convertItemsToNodes(
|
||||
export default function useItems(props: MenuProps) {
|
||||
const itemsNodes = shallowRef([]);
|
||||
const hasItmes = shallowRef(false);
|
||||
const store = shallowRef<Map<string, StoreMenuInfo>>(new Map());
|
||||
const store = shallowRef(new Map<string, StoreMenuInfo>());
|
||||
watch(
|
||||
() => props.items,
|
||||
() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function getScroll(w: Window) {
|
||||
let ret = w.pageXOffset;
|
||||
let ret = w.scrollX;
|
||||
const method = 'scrollLeft';
|
||||
if (typeof ret !== 'number') {
|
||||
const d = w.document;
|
||||
|
@ -27,9 +27,9 @@ Searchable Tree.
|
||||
>
|
||||
<template #title="{ title }">
|
||||
<span v-if="title.indexOf(searchValue) > -1">
|
||||
{{ title.substr(0, title.indexOf(searchValue)) }}
|
||||
{{ title.substring(0, title.indexOf(searchValue)) }}
|
||||
<span style="color: #f50">{{ searchValue }}</span>
|
||||
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
|
||||
{{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
|
||||
</span>
|
||||
<span v-else>{{ title }}</span>
|
||||
</template>
|
||||
|
@ -95,7 +95,7 @@ const Group = defineComponent({
|
||||
? mergeDefaultValue(props.preview, defaultValues)
|
||||
: defaultValues;
|
||||
});
|
||||
const previewUrls = reactive<Map<number, PreviewUrl>>(new Map());
|
||||
const previewUrls = reactive(new Map<number, PreviewUrl>());
|
||||
const current = ref<number>();
|
||||
|
||||
const previewVisible = computed(() => preview.value.visible);
|
||||
|
@ -25,7 +25,7 @@ export default defineComponent<TimeUnitColumnProps>({
|
||||
const { open } = useInjectPanel();
|
||||
|
||||
const ulRef = shallowRef<HTMLElement>(null);
|
||||
const liRefs = ref<Map<number, HTMLElement | null>>(new Map());
|
||||
const liRefs = ref(new Map<number, HTMLElement | null>());
|
||||
const scrollRef = ref<Function>();
|
||||
|
||||
watch(
|
||||
|
@ -210,7 +210,7 @@ export default function createSlider(Component) {
|
||||
if (vertical) {
|
||||
return reverse ? rect.bottom : rect.top;
|
||||
}
|
||||
return window.pageXOffset + (reverse ? rect.right : rect.left);
|
||||
return window.scrollX + (reverse ? rect.right : rect.left);
|
||||
},
|
||||
getSliderLength() {
|
||||
const slider = this.sliderRef;
|
||||
|
@ -58,7 +58,7 @@ export function getHandleCenterPosition(vertical: boolean, handle: HTMLElement)
|
||||
const coords = handle.getBoundingClientRect();
|
||||
return vertical
|
||||
? coords.top + coords.height * 0.5
|
||||
: window.pageXOffset + coords.left + coords.width * 0.5;
|
||||
: window.scrollX + coords.left + coords.width * 0.5;
|
||||
}
|
||||
|
||||
export function ensureValueInRange(val: number, { max, min }: { max?: number; min?: number }) {
|
||||
|
@ -8,7 +8,7 @@ import { shallowRef, watchEffect } from 'vue';
|
||||
import { warning } from '../../vc-util/warning';
|
||||
|
||||
export default (treeData: ShallowRef<any>, fieldNames: Ref<FieldNames>) => {
|
||||
const valueEntities = shallowRef<Map<RawValueType, DataEntity>>(new Map());
|
||||
const valueEntities = shallowRef(new Map<RawValueType, DataEntity>());
|
||||
const keyEntities = shallowRef<Record<string, DataEntity>>({});
|
||||
watchEffect(() => {
|
||||
const fieldNamesValue = fieldNames.value;
|
||||
|
@ -40,7 +40,7 @@ export function fillFieldNames(fieldNames?: FieldNames): Required<FieldNames> {
|
||||
* Warning if TreeNode do not provides key
|
||||
*/
|
||||
export function warningWithoutKey(treeData: DataNode[], fieldNames: FieldNames) {
|
||||
const keys: Map<string, boolean> = new Map();
|
||||
const keys = new Map<string, boolean>();
|
||||
|
||||
function dig(list: DataNode[], path = '') {
|
||||
(list || []).forEach(treeNode => {
|
||||
|
@ -101,15 +101,14 @@ export function getOffset(node: any) {
|
||||
const box = node.getBoundingClientRect();
|
||||
const docElem = document.documentElement;
|
||||
|
||||
// < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
||||
return {
|
||||
left:
|
||||
box.left +
|
||||
(window.pageXOffset || docElem.scrollLeft) -
|
||||
(window.scrollX || docElem.scrollLeft) -
|
||||
(docElem.clientLeft || document.body.clientLeft || 0),
|
||||
top:
|
||||
box.top +
|
||||
(window.pageYOffset || docElem.scrollTop) -
|
||||
(window.scrollY || docElem.scrollTop) -
|
||||
(docElem.clientTop || document.body.clientTop || 0),
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export default () => {
|
||||
agent,
|
||||
) ||
|
||||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
||||
agent?.substr(0, 4),
|
||||
agent?.substring(0, 4),
|
||||
)
|
||||
);
|
||||
};
|
||||
|
@ -216,7 +216,6 @@
|
||||
"mockdate": "^2.0.2",
|
||||
"moment": "^2.29.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"postcss": "^8.2.12",
|
||||
"postcss-loader": "^6.0.0",
|
||||
"prettier": "^2.2.0",
|
||||
@ -308,10 +307,6 @@
|
||||
"dist/*",
|
||||
"*.css"
|
||||
],
|
||||
"vetur": {
|
||||
"tags": "vetur/tags.json",
|
||||
"attributes": "vetur/attributes.json"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-git",
|
||||
|
@ -36,8 +36,8 @@ const getRelativePosition = (
|
||||
const pointer = isTouch(event) ? getTouchPoint(event.touches, touchId) : (event as MouseEvent);
|
||||
|
||||
return {
|
||||
left: clamp((pointer.pageX - (rect.left + getParentWindow(node).pageXOffset)) / rect.width),
|
||||
top: clamp((pointer.pageY - (rect.top + getParentWindow(node).pageYOffset)) / rect.height),
|
||||
left: clamp((pointer.pageX - (rect.left + getParentWindow(node).scrollX)) / rect.width),
|
||||
top: clamp((pointer.pageY - (rect.top + getParentWindow(node).scrollY)) / rect.height),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { getNonce } from '../utils/nonce';
|
||||
// Bundler is configured to load this as a processed minified CSS-string
|
||||
import styles from '../css/styles.css';
|
||||
|
||||
const styleElementMap: Map<Document, HTMLStyleElement> = new Map();
|
||||
const styleElementMap = new Map<Document, HTMLStyleElement>();
|
||||
|
||||
/**
|
||||
* Injects CSS code into the document's <head>
|
||||
|
@ -56,7 +56,7 @@ export default defineComponent({
|
||||
location: { pathname },
|
||||
} = window;
|
||||
const currentProtocol = `${window.location.protocol}//`;
|
||||
const currentHref = window.location.href.substr(currentProtocol.length);
|
||||
const currentHref = window.location.href.substring(currentProtocol.length);
|
||||
|
||||
if (isLocalStorageNameSupported()) {
|
||||
localStorage.setItem('locale', isZhCN(pathname) ? 'en-US' : 'zh-CN');
|
||||
|
Loading…
Reference in New Issue
Block a user