Skip to content

Commit d6cc262

Browse files
author
extclp
authored
refactor: replement deprecated fields (#7519)
1 parent 9d7c171 commit d6cc262

File tree

23 files changed

+30
-45
lines changed

23 files changed

+30
-45
lines changed

antd-tools/generator-types/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ async function readMarkdown(options: Options): Promise<Map<String, VueTag>> {
2121
return formatter(mdParser(fileContent), componentName, kebabComponentName, options.tagPrefix);
2222
})
2323
.filter(item => item) as VueTag[][];
24-
const tags: Map<String, VueTag> = new Map();
24+
const tags = new Map<String, VueTag>();
2525
flatMap(data, item => item).forEach(mergedTag => mergeTag(tags, mergedTag));
2626
return tags;
2727
}
2828

2929
function readTypings(options: Options): Map<String, VueTag> {
30-
const tags: Map<String, VueTag> = new Map();
30+
const tags = new Map<String, VueTag>();
3131
const fileContent = readFileSync(options.typingsPath, 'utf-8');
3232
fileContent
3333
.split('\n')
@@ -61,7 +61,7 @@ function mergeTag(tags: Map<String, VueTag>, mergedTag: VueTag) {
6161

6262
function mergeTags(mergedTagsArr: Map<String, VueTag>[]): VueTag[] {
6363
if (mergedTagsArr.length === 1) return [...mergedTagsArr[0].values()];
64-
const tags: Map<String, VueTag> = new Map();
64+
const tags = new Map<String, VueTag>();
6565
if (mergedTagsArr.length === 0) return [];
6666
mergedTagsArr.forEach(mergedTags => {
6767
mergedTags.forEach(mergedTag => mergeTag(tags, mergedTag));

antd-tools/generator-types/src/parser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type Articals = Artical[];
2121
function readLine(input: string) {
2222
const end = input.indexOf('\n');
2323

24-
return input.substr(0, end !== -1 ? end : input.length);
24+
return input.substring(0, end !== -1 ? end : input.length);
2525
}
2626

2727
function splitTableLine(line: string) {
@@ -47,7 +47,7 @@ function tableParse(input: string) {
4747
};
4848

4949
while (start < end) {
50-
const target = input.substr(start);
50+
const target = input.substring(start);
5151
const line = readLine(target);
5252

5353
if (!/^\|/.test(target)) {
@@ -79,7 +79,7 @@ export function mdParser(input: string): Articals {
7979
const end = input.length;
8080

8181
while (start < end) {
82-
const target = input.substr(start);
82+
const target = input.substring(start);
8383

8484
let match;
8585
if ((match = TITLE_REG.exec(target))) {
@@ -91,7 +91,7 @@ export function mdParser(input: string): Articals {
9191

9292
start += match.index + match[0].length;
9393
} else if ((match = TABLE_REG.exec(target))) {
94-
const { table, usedLength } = tableParse(target.substr(match.index));
94+
const { table, usedLength } = tableParse(target.substring(match.index));
9595
artical.push({
9696
type: 'table',
9797
table,

antd-tools/getTSCommonConfig.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
'use strict';
22

33
const fs = require('fs');
4-
const assign = require('object-assign');
54
const { getProjectPath } = require('./utils/projectHelper');
65

76
module.exports = function () {
87
let my = {};
98
if (fs.existsSync(getProjectPath('tsconfig.json'))) {
109
my = require(getProjectPath('tsconfig.json'));
1110
}
12-
return assign(
11+
return Object.assign(
1312
{
1413
noUnusedParameters: true,
1514
noUnusedLocals: true,

components/_util/getScroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function getScroll(
1212
const method = top ? 'scrollTop' : 'scrollLeft';
1313
let result = 0;
1414
if (isWindow(target)) {
15-
result = target[top ? 'pageYOffset' : 'pageXOffset'];
15+
result = target[top ? 'scrollY' : 'scrollX'];
1616
} else if (target instanceof Document) {
1717
result = target.documentElement[method];
1818
} else if (target instanceof HTMLElement) {

components/_util/scrollTo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) {
2222
const time = timestamp - startTime;
2323
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
2424
if (isWindow(container)) {
25-
(container as Window).scrollTo(window.pageXOffset, nextScrollTop);
26-
} else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
25+
(container as Window).scrollTo(window.scrollX, nextScrollTop);
26+
} else if (container instanceof Document) {
2727
(container as Document).documentElement.scrollTop = nextScrollTop;
2828
} else {
2929
(container as HTMLElement).scrollTop = nextScrollTop;

components/_util/triggerEvent.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

components/checkbox/Group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default defineComponent({
4141
});
4242
});
4343
const triggerUpdate = ref(Symbol());
44-
const registeredValuesMap = ref<Map<Symbol, string>>(new Map());
44+
const registeredValuesMap = ref(new Map<Symbol, string>());
4545
const cancelValue = (id: Symbol) => {
4646
registeredValuesMap.value.delete(id);
4747
triggerUpdate.value = Symbol();

components/menu/src/Menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default defineComponent({
112112
return !override;
113113
}),
114114
);
115-
const store = shallowRef<Map<string, StoreMenuInfo>>(new Map());
115+
const store = shallowRef(new Map<string, StoreMenuInfo>());
116116
const siderCollapsed = inject(SiderCollapsedKey, ref(undefined));
117117
const inlineCollapsed = computed(() => {
118118
if (siderCollapsed.value !== undefined) {

components/menu/src/hooks/useItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function convertItemsToNodes(
116116
export default function useItems(props: MenuProps) {
117117
const itemsNodes = shallowRef([]);
118118
const hasItmes = shallowRef(false);
119-
const store = shallowRef<Map<string, StoreMenuInfo>>(new Map());
119+
const store = shallowRef(new Map<string, StoreMenuInfo>());
120120
watch(
121121
() => props.items,
122122
() => {

components/rate/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function getScroll(w: Window) {
2-
let ret = w.pageXOffset;
2+
let ret = w.scrollX;
33
const method = 'scrollLeft';
44
if (typeof ret !== 'number') {
55
const d = w.document;

0 commit comments

Comments
 (0)