Преглед изворни кода

fix: Fixed misspelling of words in code on semi-foundation, with no direct impact on users (#660)

* fix(foundation): word spelling
* fix: reverse some spelling & update some comment

Co-authored-by: pointhalo <[email protected]>
Co-authored-by: pointhalo <[email protected]>
Zn пре 3 година
родитељ
комит
5b0cc115a3
27 измењених фајлова са 103 додато и 103 уклоњено
  1. 6 6
      packages/semi-foundation/cascader/foundation.ts
  2. 2 2
      packages/semi-foundation/checkbox/checkboxGroupFoundation.ts
  3. 1 1
      packages/semi-foundation/datePicker/_utils/parser.ts
  4. 4 4
      packages/semi-foundation/datePicker/foundation.ts
  5. 11 11
      packages/semi-foundation/datePicker/monthsGridFoundation.ts
  6. 1 1
      packages/semi-foundation/datePicker/yearAndMonthFoundation.ts
  7. 5 5
      packages/semi-foundation/form/foundation.ts
  8. 5 5
      packages/semi-foundation/input/textareaFoundation.ts
  9. 2 2
      packages/semi-foundation/inputNumber/foundation.ts
  10. 12 12
      packages/semi-foundation/navigation/foundation.ts
  11. 2 2
      packages/semi-foundation/tabs/foundation.ts
  12. 1 1
      packages/semi-foundation/timePicker/ComboxFoundation.ts
  13. 1 1
      packages/semi-foundation/timePicker/constants.ts
  14. 1 1
      packages/semi-foundation/timePicker/foundation.ts
  15. 1 1
      packages/semi-foundation/transfer/foundation.ts
  16. 0 0
      packages/semi-foundation/transfer/transferUtils.ts
  17. 4 4
      packages/semi-foundation/tree/foundation.ts
  18. 11 11
      packages/semi-foundation/tree/treeUtil.ts
  19. 1 1
      packages/semi-foundation/treeSelect/constants.ts
  20. 4 4
      packages/semi-foundation/treeSelect/foundation.ts
  21. 8 8
      packages/semi-foundation/upload/foundation.ts
  22. 1 1
      packages/semi-foundation/upload/utils.ts
  23. 1 1
      packages/semi-foundation/utils/isNullOrUndefined.ts
  24. 10 10
      packages/semi-foundation/utils/object.ts
  25. 6 6
      packages/semi-ui/datePicker/monthsGrid.tsx
  26. 1 1
      packages/semi-ui/transfer/index.tsx
  27. 1 1
      packages/semi-ui/treeSelect/index.tsx

+ 6 - 6
packages/semi-foundation/cascader/foundation.ts

@@ -409,7 +409,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
             activeKeys,
             loadingKeys,
             loading,
-            keyEntities: keyEntitieState,
+            keyEntities: keyEntityState,
             selectedKeys: selectedKeysState
         } = this.getStates();
         const filterable = this._isFilterable();
@@ -472,7 +472,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
         } else if (loading) {
             // Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
             // Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
-            updateStates.keyEntities = assign(keyEntitieState, keyEntities);
+            updateStates.keyEntities = assign(keyEntityState, keyEntities);
             this._adapter.updateStates(updateStates);
             return;
         } else {
@@ -729,14 +729,14 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
         const prevCheckedStatus = checkedKeys.has(key);
         // next checked status
         const curCheckedStatus = disableStrictly ?
-            this.calcChekcedStatus(!prevCheckedStatus, key) :
+            this.calcCheckedStatus(!prevCheckedStatus, key) :
             !prevCheckedStatus;
         // calculate all key of nodes that are checked or half checked
         const {
             checkedKeys: curCheckedKeys,
             halfCheckedKeys: curHalfCheckedKeys
         } = disableStrictly ?
-            this.calcNonDisabedCheckedKeys(key, curCheckedStatus) :
+            this.calcNonDisabledCheckedKeys(key, curCheckedStatus) :
             this.calcCheckedKeys(key, curCheckedStatus);
 
         const mergeType = calcMergeType(autoMergeValue, leafOnly);
@@ -791,7 +791,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
         this._adapter.updateStates({ inputValue: '' });
     }
 
-    calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean) {
+    calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean) {
         const { keyEntities, disabledKeys } = this.getStates();
         const { checkedKeys } = this.getCopyFromState(['checkedKeys']);
         const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
@@ -807,7 +807,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
         return calcCheckedKeys(newCheckedKeys, keyEntities);
     }
 
-    calcChekcedStatus(targetStatus: boolean, eventKey: string) {
+    calcCheckedStatus(targetStatus: boolean, eventKey: string) {
         if (!targetStatus) {
             return targetStatus;
         }

+ 2 - 2
packages/semi-foundation/checkbox/checkboxGroupFoundation.ts

@@ -7,12 +7,12 @@ export interface CheckboxGroupAdapter extends DefaultAdapter{
     notifyChange: (value: any[]) => void;
 }
 class CheckboxGroupFoundation extends BaseFoundation<CheckboxGroupAdapter> {
-    static get checkboxGroupdefaultAdapter() {
+    static get checkboxGroupDefaultAdapter() {
         return {};
     }
 
     constructor(adapter: CheckboxGroupAdapter) {
-        super({ ...CheckboxGroupFoundation.checkboxGroupdefaultAdapter, ...adapter });
+        super({ ...CheckboxGroupFoundation.checkboxGroupDefaultAdapter, ...adapter });
     }
 
     init() {

+ 1 - 1
packages/semi-foundation/datePicker/_utils/parser.ts

@@ -7,7 +7,7 @@ import { isValid, parseISO, parse, Locale } from 'date-fns';
 /**
  * Parsing value to Date object
  */
-export function compatiableParse(
+export function compatibleParse(
     value: string,
     formatToken?: string,
     baseDate?: Date,

+ 4 - 4
packages/semi-foundation/datePicker/foundation.ts

@@ -7,7 +7,7 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
 import { isValidDate, isTimestamp } from './_utils/index';
 import isNullOrUndefined from '../utils/isNullOrUndefined';
 import { utcToZonedTime, zonedTimeToUtc } from '../utils/date-fns-extra';
-import { compatiableParse } from './_utils/parser';
+import { compatibleParse } from './_utils/parser';
 import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
 import { strings } from './constants';
 import { strings as inputStrings } from '../input/constants';
@@ -292,7 +292,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
         if (isValidDate(value)) {
             dateObj = value as Date;
         } else if (isString(value)) {
-            dateObj = compatiableParse(value as string, this.getProp('format'), undefined, dateFnsLocale);
+            dateObj = compatibleParse(value as string, this.getProp('format'), undefined, dateFnsLocale);
         } else if (isTimestamp(value)) {
             dateObj = new Date(value);
         } else {
@@ -613,7 +613,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
                 case 'date':
                 case 'dateTime':
                 case 'month':
-                    parsedResult = input ? compatiableParse(input, formatToken, nowDate, dateFnsLocale) : '';
+                    parsedResult = input ? compatibleParse(input, formatToken, nowDate, dateFnsLocale) : '';
                     formatedInput = parsedResult && isValid(parsedResult) && this.localeFormat(parsedResult as Date, formatToken);
                     if (parsedResult && formatedInput === input) {
                         result = [parsedResult as Date];
@@ -626,7 +626,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
                     parsedResult =
                         values &&
                         values.reduce((arr, cur) => {
-                            const parsedVal = cur && compatiableParse(cur, formatToken, nowDate, dateFnsLocale);
+                            const parsedVal = cur && compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
                             parsedVal && arr.push(parsedVal);
                             return arr;
                         }, []);

+ 11 - 11
packages/semi-foundation/datePicker/monthsGridFoundation.ts

@@ -15,7 +15,7 @@ import {
 } from 'date-fns';
 import { isBefore, isValidDate, getDefaultFormatToken, getFullDateOffset } from './_utils/index';
 import { formatFullDate, WeekStartNumber } from './_utils/getMonthTable';
-import { compatiableParse } from './_utils/parser';
+import { compatibleParse } from './_utils/parser';
 import { includes, isSet, isEqual, isFunction } from 'lodash';
 import { zonedTimeToUtc } from '../utils/date-fns-extra';
 import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
@@ -148,7 +148,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
     }
 
     initDefaultPickerValue() {
-        const defaultPickerValue = compatiableParse(this.getProp('defaultPickerValue'));
+        const defaultPickerValue = compatibleParse(this.getProp('defaultPickerValue'));
 
         if (defaultPickerValue && isValidDate(defaultPickerValue)) {
             this._updatePanelDetail(strings.PANEL_TYPE_LEFT, {
@@ -600,7 +600,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
 
         const dateFormat = this.getValidDateFormat();
         // When passed to the upper layer, it is converted into a Date object to ensure that the input parameter format of initFormDefaultValue is consistent
-        const newSelectedDates = [...newSelected].map(_dateStr => compatiableParse(_dateStr, dateFormat, undefined, dateFnsLocale));
+        const newSelectedDates = [...newSelected].map(_dateStr => compatibleParse(_dateStr, dateFormat, undefined, dateFnsLocale));
 
         this.handleShowDateAndTime(panelType, time);
 
@@ -628,15 +628,15 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
     _mergeDateAndTime(date: Date | string, time: Date | string) {
         const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
         const dateStr = format(
-            isValidDate(date) ? date as Date : compatiableParse(date as string, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale),
+            isValidDate(date) ? date as Date : compatibleParse(date as string, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale),
             strings.FORMAT_FULL_DATE
         );
         const timeStr = format(
-            isValidDate(time) ? time as Date : compatiableParse(time as string, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale),
+            isValidDate(time) ? time as Date : compatibleParse(time as string, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale),
             strings.FORMAT_TIME_PICKER
         );
         const timeFormat = this.getValidTimeFormat();
-        return compatiableParse(`${dateStr} ${timeStr}`, timeFormat, undefined, dateFnsLocale);
+        return compatibleParse(`${dateStr} ${timeStr}`, timeFormat, undefined, dateFnsLocale);
     }
 
     handleRangeSelected(day: MonthDayInfo) {
@@ -700,8 +700,8 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
         // only notify when choose completed
         if (rangeStart || rangeEnd) {
             const [startDate, endDate] = [
-                compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale),
-                compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale),
+                compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale),
+                compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale),
             ];
             let date: [Date, Date] = [startDate, endDate];
 
@@ -812,7 +812,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
         //     date = pickerDate.getDate();
         // } else
         if (type === 'dateTimeRange' && destRange) {
-            const rangeDate = compatiableParse(destRange, dateFormat, undefined, dateFnsLocale);
+            const rangeDate = compatibleParse(destRange, dateFormat, undefined, dateFnsLocale);
             year = rangeDate.getFullYear();
             monthNo = rangeDate.getMonth();
             date = rangeDate.getDate();
@@ -859,8 +859,8 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
         const dateFormat = this.getValidDateFormat();
         // TODO: Modify a time individually
         if (rangeStart && rangeEnd) {
-            let startDate = compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale);
-            let endDate = compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
+            let startDate = compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale);
+            let endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
             // console.log('_updateTimeInDateRange()', rangeStart, rangeEnd, startDate, endDate);
 
             if (panelType === strings.PANEL_TYPE_RIGHT) {

+ 1 - 1
packages/semi-foundation/datePicker/yearAndMonthFoundation.ts

@@ -42,7 +42,7 @@ export interface YearScrollItem {
     disabled: boolean;
 }
 
-export default class YearAndMonthFoundataion extends BaseFoundation<YearAndMonthAdapter> {
+export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthAdapter> {
 
     constructor(adapter: YearAndMonthAdapter) {
         super({ ...adapter });

+ 5 - 5
packages/semi-foundation/form/foundation.ts

@@ -290,7 +290,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
     _getOperateFieldMap(fieldPaths?: Array<string>): Map<string, FieldStaff> {
         let targetFields = new Map();
         if (!isUndefined(fieldPaths)) {
-            // reset or validate spcific fields
+            // reset or validate specific fields
             fieldPaths.forEach(path => {
                 const field = this.fields.get(path);
                 // may be undefined, if exists two fields like 'a[0]'、'a[1]', but user directly call reset(['a']) / validate(['a'])
@@ -396,8 +396,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
                 this.updateArrayField(path, { updateKey: new Date().valueOf() });
             });
         }
-        // When isOverrid is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values
-        // 当isOverrid为true,传入的values中可能存在不存在的field时,直接将其同步到formState.values中
+        // When isOverride is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values
+        // 当isOverride为true,传入的values中可能存在不存在的field时,直接将其同步到formState.values中
         if (isOverride) {
             this.data.values = _values;
         }
@@ -548,7 +548,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
         };
         const setTouched = (field: string, isTouched: boolean, opts: CallOpts) => {
             const fieldApi = this.fields.get(field) ? this.fields.get(field).fieldApi : undefined;
-            // touched is boolean variable, no need to execu deepClone like setValue
+            // touched is boolean variable, no need to exec deepClone like setValue
             if (fieldApi) {
                 fieldApi.setTouched(isTouched, opts);
             } else {
@@ -619,7 +619,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
     }
 
     getFormState(needClone = false): FormState {
-        // NOTES:这里如果直接返回this.data,forceUpdae触发Formrerender时,通过context传下去的formState会被认为是同一个对象【应该是浅对比的原因】
+        // NOTES:这里如果直接返回this.data,forceUpdate 触发 Form rerender 时,通过context传下去的formState会被认为是同一个对象【应该是浅对比的原因】
         // 使用了useFormState相关的component都不会触发重新渲染。所以使用...复制一次
 
         /*

+ 5 - 5
packages/semi-foundation/input/textareaFoundation.ts

@@ -9,7 +9,7 @@ import calculateNodeHeight from './util/calculateNodeHeight';
 import getSizingData from './util/getSizingData';
 import isEnterPress from '../utils/isEnterPress';
 
-export interface TextAreaDefaultAdpter {
+export interface TextAreaDefaultAdapter {
     notifyChange: noopFunction;
     setValue: noopFunction;
     toggleFocusing: noopFunction;
@@ -17,18 +17,18 @@ export interface TextAreaDefaultAdpter {
     notifyBlur: noopFunction;
     notifyKeyDown: noopFunction;
     notifyEnterPress: noopFunction;
-    toggleHovering(hoving: boolean): void;
+    toggleHovering(hovering: boolean): void;
     notifyClear(e: any): void;
 }
 
-export interface TextAreaAdpter extends Partial<DefaultAdapter>, Partial<TextAreaDefaultAdpter> {
+export interface TextAreaAdapter extends Partial<DefaultAdapter>, Partial<TextAreaDefaultAdapter> {
     setMinLength(length: number): void;
     notifyPressEnter(e: any): void;
     getRef(): any;
     notifyHeightUpdate(e: any): void;
 }
 
-export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
+export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter> {
     static get textAreaDefaultAdapter() {
         return {
             notifyChange: noop,
@@ -42,7 +42,7 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
         };
     }
 
-    constructor(adapter: TextAreaAdpter) {
+    constructor(adapter: TextAreaAdapter) {
         super({
             ...TextAreaFoundation.textAreaDefaultAdapter,
             ...adapter

+ 2 - 2
packages/semi-foundation/inputNumber/foundation.ts

@@ -215,9 +215,9 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
         if (code === keyCode.UP || code === keyCode.DOWN) {
             this._adapter.setClickUpOrDown(true);
             this._adapter.recordCursorPosition();
-            const formatedVal = code === keyCode.UP ? this.add() : this.minus();
+            const formattedVal = code === keyCode.UP ? this.add() : this.minus();
 
-            this._doInput(formatedVal, event, () => {
+            this._doInput(formattedVal, event, () => {
                 this._adapter.restoreCursor();
             });
 

+ 12 - 12
packages/semi-foundation/navigation/foundation.ts

@@ -118,7 +118,7 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
     init(lifecycle: string) {
         const { defaultSelectedKeys, selectedKeys } = this.getProps();
         let willSelectedKeys = selectedKeys || defaultSelectedKeys || [];
-        const { itemKeysMap, willOpenKeys, formatedItems } = this.getCalcState();
+        const { itemKeysMap, willOpenKeys, formattedItems } = this.getCalcState();
         const parentSelectKeys = this.selectLevelZeroParentKeys(itemKeysMap, willSelectedKeys);
         willSelectedKeys = willSelectedKeys.concat(parentSelectKeys);
 
@@ -127,13 +127,13 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
                 selectedKeys: willSelectedKeys,
                 itemKeysMap,
                 openKeys: willOpenKeys,
-                items: formatedItems,
+                items: formattedItems,
             };
         } else {
             this._adapter.updateSelectedKeys(willSelectedKeys);
             this._adapter.setItemKeysMap(itemKeysMap);
             this._adapter.updateOpenKeys(willOpenKeys);
-            this._adapter.updateItems(formatedItems);
+            this._adapter.updateItems(formattedItems);
             this._adapter.setItemsChanged(true);
         }
         return undefined;
@@ -143,22 +143,22 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
      * Get the state to be calculated
      */
     getCalcState() {
-        const { itemKeysMap, formatedItems } = this.getFormatedItems();
+        const { itemKeysMap, formattedItems } = this.getFormattedItems();
         const willOpenKeys = this.getWillOpenKeys(itemKeysMap);
-        return { itemKeysMap, willOpenKeys, formatedItems };
+        return { itemKeysMap, willOpenKeys, formattedItems };
     }
 
     /**
      * Calculate formatted items and itemsKeyMap
      */
-    getFormatedItems() {
+    getFormattedItems() {
         const { items, children } = this.getProps();
-        const formatedItems = this.formatItems(items);
-        const willHandleItems = Array.isArray(items) && items.length ? formatedItems : children;
+        const formattedItems = this.formatItems(items);
+        const willHandleItems = Array.isArray(items) && items.length ? formattedItems : children;
         const itemKeysMap = NavigationFoundation.buildItemKeysMap(willHandleItems);
         return {
             itemKeysMap,
-            formatedItems
+            formattedItems
         };
     }
 
@@ -229,11 +229,11 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
     }
 
     formatItems(items: ItemProps[] = []) {
-        const formatedItems = [];
+        const formattedItems = [];
         for (const item of items) {
-            formatedItems.push(new NavItem(item));
+            formattedItems.push(new NavItem(item));
         }
-        return formatedItems;
+        return formattedItems;
     }
 
     handleSelect(data: OnSelectData) {

+ 2 - 2
packages/semi-foundation/tabs/foundation.ts

@@ -30,8 +30,8 @@ class TabsFoundation<P = Record<string, any>, S = Record<string, any>> extends B
     }
 
     handleTabClick(activeKey: string, event: any): void {
-        const isControledComponent = this._isInProps('activeKey');
-        if (isControledComponent) {
+        const isControlledComponent = this._isInProps('activeKey');
+        if (isControlledComponent) {
             this._notifyChange(activeKey);
         } else {
             this._notifyChange(activeKey);

+ 1 - 1
packages/semi-foundation/timePicker/ComboxFoundation.ts

@@ -89,7 +89,7 @@ class ComboboxFoundation extends BaseFoundation<DefaultAdapter> {
         if (this._isInProps('format')) {
             return this.getProp('format');
         } else if (this.getProp('use12Hours')) {
-            return strings.DEFAULT_FROMAT_A;
+            return strings.DEFAULT_FORMAT_A;
         } else {
             return strings.DEFAULT_FORMAT;
         }

+ 1 - 1
packages/semi-foundation/timePicker/constants.ts

@@ -21,7 +21,7 @@ const strings = {
     DEFAULT_MULTIPLE_SEPARATOR,
     SIZE: inputStrings.SIZE,
     DEFAULT_FORMAT: 'HH:mm:ss',
-    DEFAULT_FROMAT_A: 'a h:mm:ss',
+    DEFAULT_FORMAT_A: 'a h:mm:ss',
     STATUS: VALIDATE_STATUS,
     DEFAULT_POSITION: {
         [TYPE_TIME_PICKER]: 'bottomLeft',

+ 1 - 1
packages/semi-foundation/timePicker/foundation.ts

@@ -94,7 +94,7 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
         if (this._isInProps('format')) {
             return this.getProp('format');
         } else if (this.getProp('use12Hours')) {
-            return strings.DEFAULT_FROMAT_A;
+            return strings.DEFAULT_FORMAT_A;
         } else {
             return strings.DEFAULT_FORMAT;
         }

+ 1 - 1
packages/semi-foundation/transfer/foundation.ts

@@ -2,7 +2,7 @@ import { omit } from 'lodash';
 import BaseFoundation, { DefaultAdapter } from '../base/foundation';
 import { BasicValue as BasicTreeValue } from '../tree/foundation';
 import { strings } from './constants';
-import { _generateGroupedData, _generateTreeData } from './transferUtlls';
+import { _generateGroupedData, _generateTreeData } from './transferUtils';
 
 export interface BasicDataItem {
     [x: string]: any;

+ 0 - 0
packages/semi-foundation/transfer/transferUtlls.ts → packages/semi-foundation/transfer/transferUtils.ts


+ 4 - 4
packages/semi-foundation/tree/foundation.ts

@@ -544,7 +544,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
     /*
     * Compute the checked state of the node
     */
-    calcChekcedStatus(targetStatus: boolean, eventKey: string) {
+    calcCheckedStatus(targetStatus: boolean, eventKey: string) {
         // From checked to unchecked, you can change it directly
         if (!targetStatus) {
             return targetStatus;
@@ -566,7 +566,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
     /*
     * In strict disable mode, calculate the nodes of checked and halfCheckedKeys and return their corresponding keys
     */
-    calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean) {
+    calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean) {
         const { keyEntities, disabledKeys } = this.getStates();
         const { checkedKeys } = this.getCopyFromState(['checkedKeys']);
         const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
@@ -592,9 +592,9 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
         const { checked, eventKey, data } = treeNode;
         if (checkRelation === 'related') {
             // Find the checked state of the current node
-            const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
+            const targetStatus = disableStrictly ? this.calcCheckedStatus(!checked, eventKey) : !checked;
             const { checkedKeys, halfCheckedKeys } = disableStrictly ?
-                this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
+                this.calcNonDisabledCheckedKeys(eventKey, targetStatus) :
                 this.calcCheckedKeys(eventKey, targetStatus);
             this._adapter.notifySelect(eventKey, targetStatus, data);
             this.notifyChange([...checkedKeys], e);

+ 11 - 11
packages/semi-foundation/tree/treeUtil.ts

@@ -87,11 +87,11 @@ export function convertJsonToData(treeJson: TreeDataSimpleJson) {
             value: children,
         };
         if (isObject(children)) {
-            const childres: any[] = [];
+            const newChildren: any[] = [];
             Object.entries(children).forEach(c => {
-                traverseNode(c[0], c[1], currPath, childres);
+                traverseNode(c[0], c[1], currPath, newChildren);
             });
-            newNode.children = childres;
+            newNode.children = newChildren;
         }
         res.push(newNode);
     };
@@ -327,8 +327,8 @@ export function calcCheckedKeys(values: any, keyEntities: KeyEntities) {
         visited = [...visited, ...siblingKeys];
         const allChecked = siblingKeys.every((siblingKey: string) => checkedKeys.has(siblingKey));
         if (!allChecked) {
-            const ancesterKeys = findAncestorKeys([key], keyEntities, false);
-            halfCheckedKeys = new Set([...halfCheckedKeys, ...ancesterKeys]);
+            const ancestorKeys = findAncestorKeys([key], keyEntities, false);
+            halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
         } else {
             checkedKeys.add(parent.key);
             // IMPORTANT! parent level may not exist in original level map; if add to the end directly may destroy the hierarchical order
@@ -358,8 +358,8 @@ export function calcExpandedKeys(keyList: any[] = [], keyEntities: KeyEntities,
         keyList = [keyList];
     }
     if (autoExpandParent) {
-        const ancesterKeys = findAncestorKeys(keyList, keyEntities, true);
-        return new Set(ancesterKeys);
+        const ancestorKeys = findAncestorKeys(keyList, keyEntities, true);
+        return new Set(ancestorKeys);
     }
     return new Set(keyList);
 }
@@ -482,8 +482,8 @@ export function calcCheckedKeysForChecked(key: string, keyEntities: KeyEntities,
         // eslint-disable-next-line @typescript-eslint/no-shadow
         const allChecked = siblingKeys.every(key => checkedKeys.has(key));
         if (!allChecked) {
-            const ancesterKeys = findAncestorKeys([key], keyEntities, false);
-            halfCheckedKeys = new Set([...halfCheckedKeys, ...ancesterKeys]);
+            const ancestorKeys = findAncestorKeys([key], keyEntities, false);
+            halfCheckedKeys = new Set([...halfCheckedKeys, ...ancestorKeys]);
         } else {
             const par = node.parent;
             checkedKeys.add(par.key);
@@ -525,10 +525,10 @@ export function calcCheckedKeysForUnchecked(key: string, keyEntities: KeyEntitie
         const siblingKeys = findSiblingKeys([key], keyEntities);
         // eslint-disable-next-line @typescript-eslint/no-shadow
         const anyChecked = siblingKeys.some(key => checkedKeys.has(key) || halfCheckedKeys.has(key));
-        const ancesterKeys = findAncestorKeys([key], keyEntities, false);
+        const ancestorKeys = findAncestorKeys([key], keyEntities, false);
         // If there is checked or halfChecked in the sibling node, you need to change the parent node to halfChecked
         if (anyChecked) {
-            ancesterKeys.forEach(itemKey => {
+            ancestorKeys.forEach(itemKey => {
                 if (checkedKeys.has(itemKey)) {
                     checkedKeys.delete(itemKey);
                     halfCheckedKeys.add(itemKey);

+ 1 - 1
packages/semi-foundation/treeSelect/constants.ts

@@ -5,7 +5,7 @@ import {
 
 const cssClasses = {
     PREFIX: `${BASE_CLASS_PREFIX}-tree-select`,
-    PREFIXTREE: `${BASE_CLASS_PREFIX}-tree`,
+    PREFIX_TREE: `${BASE_CLASS_PREFIX}-tree`,
     PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-select-option`
 };
 

+ 4 - 4
packages/semi-foundation/treeSelect/foundation.ts

@@ -622,11 +622,11 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
         const { checked, eventKey, data } = treeNode;
         if (checkRelation === 'related') {
             const targetStatus = disableStrictly ?
-                this.calcChekcedStatus(!checked, eventKey) :
+                this.calcCheckedStatus(!checked, eventKey) :
                 !checked;
 
             const { checkedKeys, halfCheckedKeys } = disableStrictly ?
-                this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
+                this.calcNonDisabledCheckedKeys(eventKey, targetStatus) :
                 this.calcCheckedKeys(eventKey, targetStatus);
             this._adapter.notifySelect(eventKey, targetStatus, data);
             this._notifyChange([...checkedKeys], e);
@@ -656,7 +656,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
         }
     }
 
-    calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean) {
+    calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean) {
         const { keyEntities, disabledKeys } = this.getStates();
         const { checkedKeys } = this.getCopyFromState(['checkedKeys']);
         const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
@@ -671,7 +671,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
         return calcCheckedKeys(newCheckedKeys, keyEntities);
     }
 
-    calcChekcedStatus(targetStatus: boolean, eventKey: string) {
+    calcCheckedStatus(targetStatus: boolean, eventKey: string) {
         if (!targetStatus) {
             return targetStatus;
         }

+ 8 - 8
packages/semi-foundation/upload/foundation.ts

@@ -124,11 +124,11 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
     checkFileSize(file: File): boolean {
         const { size } = file;
         const { maxSize, minSize } = this.getProps();
-        let isIlligal = false;
+        let isIllegal = false;
         if (size > maxSize * byteKB || size < minSize * byteKB) {
-            isIlligal = true;
+            isIllegal = true;
         }
-        return isIlligal;
+        return isIllegal;
     }
 
     /**
@@ -425,7 +425,7 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
             const { fileList } = this.getStates();
             const buResult = this._adapter.notifyBeforeUpload({ file, fileList });
             switch (true) {
-                // sync valiate - boolean
+                // sync validate - boolean
                 case buResult === true: {
                     this.post(file);
                     break;
@@ -438,11 +438,11 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
                 // async validate
                 case buResult && isPromise(buResult): {
                     Promise.resolve(buResult as Promise<BeforeUploadObjectResult>).then(
-                        resloveData => {
+                        resolveData => {
                             let newResult = { shouldUpload: true };
-                            const typeOfResloveData = Object.prototype.toString.call(resloveData).slice(8, -1);
-                            if (typeOfResloveData === 'Object') {
-                                newResult = { ...newResult, ...resloveData };
+                            const typeOfResolveData = Object.prototype.toString.call(resolveData).slice(8, -1);
+                            if (typeOfResolveData === 'Object') {
+                                newResult = { ...newResult, ...resolveData };
                             }
                             this.handleBeforeUploadResultInObject(newResult, file);
                         },

+ 1 - 1
packages/semi-foundation/upload/utils.ts

@@ -86,7 +86,7 @@ export async function mapFileTree(items: Array<DataTransferItem>): Promise<Array
         const result = await Promise.all(promises);
         return result;
     } catch (error) {
-        console.warn('Catched error while loop directory.');
+        console.warn('Captured error while loop directory.');
         console.error(error);
         return [];
     }

+ 1 - 1
packages/semi-foundation/utils/isNullOrUndefined.ts

@@ -1,5 +1,5 @@
 /**
- * Whether null or undenfined
+ * Whether null or undefined
  * @param {*} value
  * @returns  {boolean}
  */

+ 10 - 10
packages/semi-foundation/utils/object.ts

@@ -16,7 +16,7 @@ type Many<T> = T | ReadonlyArray<T>;
 type PropertyName = string | number | symbol;
 type PropertyPath = Many<PropertyName>;
 
-type ObjctType = Record<string, any>;
+type ObjectType = Record<string, any>;
 
 const pathToArrayElem = (path: any) => {
     const pathArray = lodashToPath(path);
@@ -25,7 +25,7 @@ const pathToArrayElem = (path: any) => {
     return justNumber ? false : Number.isInteger(+pathArray[pathArray.length - 1]);
 };
 
-function isEmptyObject(target: ObjctType) {
+function isEmptyObject(target: ObjectType) {
 /**
  *  var a = {};
  *  var b = { c: undefined }
@@ -35,8 +35,8 @@ function isEmptyObject(target: ObjctType) {
  *  }
  *  the result of JSON.stringify(a/b/d) are same: '{}'
  *  We can use the above features to remove keys with empty values in Form
- *  But we cannot use JSON.stringify() directly, because if the input parameter of JSON.stringify includes fiberNode, it will cause an TypeError: 'Convering circular structure to JSON'
- *  So we have to mock it's behavihor, also, the form value cannot have Symbol or function type, it can be ignored
+ *  But we cannot use JSON.stringify() directly, because if the input parameter of JSON.stringify includes fiberNode, it will cause an TypeError: 'Converting circular structure to JSON'
+ *  So we have to mock it's behavior, also, the form value cannot have Symbol or function type, it can be ignored
  */
     if (!isObject(target)) {
         return false;
@@ -52,7 +52,7 @@ function isEmptyObject(target: ObjctType) {
     }
 }
 
-function cleanup(obj: ObjctType, path: string[], pull = true) {
+function cleanup(obj: ObjectType, path: string[], pull = true) {
     if (path.length === 0) {
         return;
     }
@@ -79,15 +79,15 @@ function cleanup(obj: ObjctType, path: string[], pull = true) {
     cleanup(obj, path.slice(0, path.length - 1), pull);
 }
 
-export function empty(object: ObjctType) {
+export function empty(object: ObjectType) {
     return lodashValues(object).length === 0;
 }
 
-export function get(object: ObjctType, path: PropertyPath) {
+export function get(object: ObjectType, path: PropertyPath) {
     return lodashGet(object, path);
 }
 
-export function remove(object: ObjctType, path: PropertyPath) {
+export function remove(object: ObjectType, path: PropertyPath) {
     lodashUnset(object, path);
     // a.b => [a, b]
     // arr[11].a => [arr, 11, a]
@@ -123,7 +123,7 @@ export function set(object: any, path: PropertyPath, value: any, allowEmpty?: bo
     }
 }
 
-export function has(object: ObjctType, path: PropertyPath) {
+export function has(object: ObjectType, path: PropertyPath) {
     return lodashHas(object, path);
 }
 
@@ -133,7 +133,7 @@ export function has(object: ObjctType, path: PropertyPath) {
  * @param {object|Function} srcObj
  * @returns {object|Function}
  */
-export function forwardStatics<T extends ObjctType | ((...arg: any) => any)>(obj: T, srcObj: ObjctType | ((...arg: any) => any)): T {
+export function forwardStatics<T extends ObjectType | ((...arg: any) => any)>(obj: T, srcObj: ObjectType | ((...arg: any) => any)): T {
     if (
         obj &&
         (typeof obj === 'function' || typeof obj === 'object') &&

+ 6 - 6
packages/semi-ui/datePicker/monthsGrid.tsx

@@ -10,7 +10,7 @@ import { format as formatFn, addMonths, isSameDay } from 'date-fns';
 
 import MonthsGridFoundation, { MonthInfo, MonthsGridAdapter, MonthsGridDateAdapter, MonthsGridFoundationProps, MonthsGridFoundationState, MonthsGridRangeAdapter, PanelType } from '@douyinfe/semi-foundation/datePicker/monthsGridFoundation';
 import { strings, numbers, cssClasses } from '@douyinfe/semi-foundation/datePicker/constants';
-import { compatiableParse } from '@douyinfe/semi-foundation/datePicker/_utils/parser';
+import { compatibleParse } from '@douyinfe/semi-foundation/datePicker/_utils/parser';
 import { noop, stubFalse } from 'lodash';
 import BaseComponent, { BaseProps } from '../_base/baseComponent';
 import Navigation from './navigation';
@@ -476,8 +476,8 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
             rangeStart &&
             rangeEnd &&
             isSameDay(
-                (startDate = compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale)),
-                (endDate = compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale))
+                (startDate = compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale)),
+                (endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale))
             )
         ) {
             if (panelType === strings.PANEL_TYPE_RIGHT) {
@@ -550,10 +550,10 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
 
         if (panelType === strings.PANEL_TYPE_LEFT) {
             panelDetail = monthLeft;
-            dateText = rangeStart ? formatFn(compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
+            dateText = rangeStart ? formatFn(compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
         } else {
             panelDetail = monthRight;
-            dateText = rangeEnd ? formatFn(compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
+            dateText = rangeEnd ? formatFn(compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
         }
 
         const { isTimePickerOpen, showDate } = panelDetail;
@@ -561,7 +561,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
 
         const timeText = showDate ? formatFn(showDate, formatTimePicker) : '';
 
-        const showSwithIcon = ['default'].includes(density);
+        const showSwitchIcon = ['default'].includes(density);
 
         const switchCls = classnames(`${prefixCls}-switch`);
         const dateCls = classnames({

+ 1 - 1
packages/semi-ui/transfer/index.tsx

@@ -4,7 +4,7 @@ import { SortableContainer, SortableElement, SortableHandle } from 'react-sortab
 import PropTypes from 'prop-types';
 import { isEqual, noop, omit, isEmpty, isArray } from 'lodash';
 import TransferFoundation, { TransferAdapter, BasicDataItem, OnSortEndProps } from '@douyinfe/semi-foundation/transfer/foundation';
-import { _generateDataByType, _generateSelectedItems } from '@douyinfe/semi-foundation/transfer/transferUtlls';
+import { _generateDataByType, _generateSelectedItems } from '@douyinfe/semi-foundation/transfer/transferUtils';
 import { cssClasses, strings } from '@douyinfe/semi-foundation/transfer/constants';
 import '@douyinfe/semi-foundation/transfer/transfer.scss';
 import BaseComponent from '../_base/baseComponent';

+ 1 - 1
packages/semi-ui/treeSelect/index.tsx

@@ -163,7 +163,7 @@ export interface TreeSelectState extends Omit<BasicTreeSelectInnerData, Override
 }
 
 const prefixcls = cssClasses.PREFIX;
-const prefixTree = cssClasses.PREFIXTREE;
+const prefixTree = cssClasses.PREFIX_TREE;
 
 const key = 0;