@douyinfe/semi-foundation 2.40.0-alpha.0 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/anchor/foundation.ts +0 -2
- package/anchor/linkFoundation.ts +0 -1
- package/autoComplete/foundation.ts +0 -1
- package/autoComplete/optionFoundation.ts +0 -2
- package/avatar/constants.ts +21 -4
- package/avatar/foundation.ts +3 -3
- package/base/foundation.ts +0 -1
- package/breadcrumb/foundation.ts +0 -1
- package/button/button.scss +0 -1
- package/calendar/eventUtil.ts +0 -2
- package/calendar/foundation.ts +0 -1
- package/cascader/foundation.ts +0 -5
- package/checkbox/checkbox.scss +0 -1
- package/checkbox/checkboxFoundation.ts +1 -2
- package/checkbox/checkboxGroupFoundation.ts +0 -1
- package/datePicker/foundation.ts +1 -4
- package/datePicker/inputFoundation.ts +0 -3
- package/datePicker/monthFoundation.ts +0 -1
- package/datePicker/monthsGridFoundation.ts +0 -2
- package/datePicker/yearAndMonthFoundation.ts +0 -2
- package/form/foundation.ts +12 -10
- package/form/interface.ts +4 -5
- package/form/utils.ts +0 -3
- package/image/image.scss +8 -4
- package/image/previewImageFoundation.ts +1 -1
- package/image/previewInnerFoundation.ts +11 -7
- package/image/variables.scss +1 -1
- package/input/foundation.ts +0 -2
- package/input/textareaFoundation.ts +0 -2
- package/inputNumber/foundation.ts +0 -5
- package/lib/cjs/anchor/foundation.js +0 -2
- package/lib/cjs/anchor/linkFoundation.js +0 -1
- package/lib/cjs/autoComplete/foundation.js +0 -2
- package/lib/cjs/autoComplete/optionFoundation.js +0 -2
- package/lib/cjs/avatar/constants.js +0 -1
- package/lib/cjs/avatar/foundation.js +2 -2
- package/lib/cjs/breadcrumb/foundation.js +0 -2
- package/lib/cjs/button/button.css +0 -1
- package/lib/cjs/button/button.scss +0 -1
- package/lib/cjs/calendar/eventUtil.js +0 -2
- package/lib/cjs/calendar/foundation.js +0 -1
- package/lib/cjs/cascader/foundation.js +0 -5
- package/lib/cjs/checkbox/checkbox.css +0 -1
- package/lib/cjs/checkbox/checkbox.scss +0 -1
- package/lib/cjs/checkbox/checkboxFoundation.js +0 -1
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +0 -1
- package/lib/cjs/datePicker/foundation.js +0 -5
- package/lib/cjs/datePicker/inputFoundation.js +0 -4
- package/lib/cjs/datePicker/monthFoundation.js +0 -1
- package/lib/cjs/datePicker/monthsGridFoundation.js +0 -3
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +0 -2
- package/lib/cjs/form/foundation.d.ts +4 -4
- package/lib/cjs/form/foundation.js +9 -8
- package/lib/cjs/form/interface.d.ts +4 -4
- package/lib/cjs/form/utils.js +0 -3
- package/lib/cjs/image/image.css +3 -1
- package/lib/cjs/image/image.scss +8 -4
- package/lib/cjs/image/previewInnerFoundation.d.ts +4 -2
- package/lib/cjs/image/previewInnerFoundation.js +2 -1
- package/lib/cjs/image/variables.scss +1 -1
- package/lib/cjs/input/foundation.js +0 -2
- package/lib/cjs/input/textareaFoundation.js +0 -2
- package/lib/cjs/inputNumber/foundation.js +0 -6
- package/lib/cjs/navigation/NavItem.js +0 -2
- package/lib/cjs/navigation/foundation.js +1 -4
- package/lib/cjs/navigation/itemFoundation.js +0 -1
- package/lib/cjs/navigation/subNavFoundation.js +1 -2
- package/lib/cjs/notification/notificationListFoundation.js +0 -2
- package/lib/cjs/pagination/foundation.d.ts +2 -0
- package/lib/cjs/pagination/foundation.js +16 -4
- package/lib/cjs/popconfirm/popconfirmFoundation.js +0 -2
- package/lib/cjs/radio/radio.css +1 -0
- package/lib/cjs/radio/radio.scss +1 -0
- package/lib/cjs/radio/radioGroupFoundation.js +0 -1
- package/lib/cjs/radio/radioInnerFoundation.js +0 -1
- package/lib/cjs/radio/variables.scss +1 -0
- package/lib/cjs/rating/foundation.js +0 -2
- package/lib/cjs/select/foundation.js +0 -5
- package/lib/cjs/select/optionFoundation.js +0 -2
- package/lib/cjs/select/select.css +0 -35
- package/lib/cjs/select/select.scss +11 -63
- package/lib/cjs/select/variables.scss +0 -10
- package/lib/cjs/skeleton/skeleton.css +2 -2
- package/lib/cjs/skeleton/variables.scss +2 -2
- package/lib/cjs/slider/foundation.js +0 -8
- package/lib/cjs/switch/foundation.js +0 -1
- package/lib/cjs/table/bodyFoundation.js +0 -1
- package/lib/cjs/table/constants.js +0 -2
- package/lib/cjs/table/foundation.js +0 -9
- package/lib/cjs/table/tableRowFoundation.js +0 -1
- package/lib/cjs/table/utils.js +0 -4
- package/lib/cjs/tag/constants.js +0 -2
- package/lib/cjs/tagInput/foundation.js +0 -2
- package/lib/cjs/timePicker/foundation.js +6 -8
- package/lib/cjs/timePicker/inputFoundation.js +0 -2
- package/lib/cjs/timePicker/utils/index.js +2 -2
- package/lib/cjs/tooltip/foundation.js +0 -11
- package/lib/cjs/transfer/foundation.js +0 -1
- package/lib/cjs/tree/foundation.js +0 -1
- package/lib/cjs/tree/treeUtil.js +0 -9
- package/lib/cjs/treeSelect/foundation.js +0 -1
- package/lib/cjs/upload/foundation.js +3 -1
- package/lib/cjs/utils/Event.js +0 -1
- package/lib/cjs/utils/date-fns-extra.js +0 -3
- package/lib/cjs/utils/function.js +0 -1
- package/lib/cjs/utils/object.js +0 -4
- package/lib/es/anchor/foundation.js +0 -2
- package/lib/es/anchor/linkFoundation.js +0 -1
- package/lib/es/autoComplete/foundation.js +0 -1
- package/lib/es/autoComplete/optionFoundation.js +0 -2
- package/lib/es/avatar/constants.js +0 -1
- package/lib/es/avatar/foundation.js +2 -2
- package/lib/es/breadcrumb/foundation.js +0 -1
- package/lib/es/button/button.css +0 -1
- package/lib/es/button/button.scss +0 -1
- package/lib/es/calendar/eventUtil.js +0 -2
- package/lib/es/calendar/foundation.js +0 -1
- package/lib/es/cascader/foundation.js +0 -5
- package/lib/es/checkbox/checkbox.css +0 -1
- package/lib/es/checkbox/checkbox.scss +0 -1
- package/lib/es/checkbox/checkboxFoundation.js +0 -1
- package/lib/es/checkbox/checkboxGroupFoundation.js +0 -1
- package/lib/es/datePicker/foundation.js +0 -4
- package/lib/es/datePicker/inputFoundation.js +0 -3
- package/lib/es/datePicker/monthFoundation.js +0 -1
- package/lib/es/datePicker/monthsGridFoundation.js +0 -2
- package/lib/es/datePicker/yearAndMonthFoundation.js +0 -2
- package/lib/es/form/foundation.d.ts +4 -4
- package/lib/es/form/foundation.js +9 -7
- package/lib/es/form/interface.d.ts +4 -4
- package/lib/es/form/utils.js +0 -3
- package/lib/es/image/image.css +3 -1
- package/lib/es/image/image.scss +8 -4
- package/lib/es/image/previewInnerFoundation.d.ts +4 -2
- package/lib/es/image/previewInnerFoundation.js +2 -1
- package/lib/es/image/variables.scss +1 -1
- package/lib/es/input/foundation.js +0 -2
- package/lib/es/input/textareaFoundation.js +0 -2
- package/lib/es/inputNumber/foundation.js +0 -5
- package/lib/es/navigation/NavItem.js +0 -2
- package/lib/es/navigation/foundation.js +1 -3
- package/lib/es/navigation/itemFoundation.js +0 -1
- package/lib/es/navigation/subNavFoundation.js +1 -2
- package/lib/es/notification/notificationListFoundation.js +0 -1
- package/lib/es/pagination/foundation.d.ts +2 -0
- package/lib/es/pagination/foundation.js +16 -3
- package/lib/es/popconfirm/popconfirmFoundation.js +0 -1
- package/lib/es/radio/radio.css +1 -0
- package/lib/es/radio/radio.scss +1 -0
- package/lib/es/radio/radioGroupFoundation.js +0 -1
- package/lib/es/radio/radioInnerFoundation.js +0 -1
- package/lib/es/radio/variables.scss +1 -0
- package/lib/es/rating/foundation.js +0 -1
- package/lib/es/select/foundation.js +0 -5
- package/lib/es/select/optionFoundation.js +0 -2
- package/lib/es/select/select.css +0 -35
- package/lib/es/select/select.scss +11 -63
- package/lib/es/select/variables.scss +0 -10
- package/lib/es/skeleton/skeleton.css +2 -2
- package/lib/es/skeleton/variables.scss +2 -2
- package/lib/es/slider/foundation.js +0 -7
- package/lib/es/switch/foundation.js +0 -1
- package/lib/es/table/bodyFoundation.js +0 -1
- package/lib/es/table/constants.js +0 -1
- package/lib/es/table/foundation.js +0 -8
- package/lib/es/table/tableRowFoundation.js +0 -1
- package/lib/es/table/utils.js +0 -3
- package/lib/es/tag/constants.js +0 -1
- package/lib/es/tagInput/foundation.js +0 -2
- package/lib/es/timePicker/foundation.js +6 -7
- package/lib/es/timePicker/inputFoundation.js +0 -2
- package/lib/es/timePicker/utils/index.js +2 -1
- package/lib/es/tooltip/foundation.js +0 -10
- package/lib/es/transfer/foundation.js +0 -1
- package/lib/es/tree/foundation.js +0 -1
- package/lib/es/tree/treeUtil.js +0 -9
- package/lib/es/treeSelect/foundation.js +0 -1
- package/lib/es/upload/foundation.js +3 -1
- package/lib/es/utils/Event.js +0 -1
- package/lib/es/utils/date-fns-extra.js +0 -2
- package/lib/es/utils/function.js +0 -1
- package/lib/es/utils/object.js +0 -3
- package/modal/modalFoundation.ts +3 -4
- package/navigation/NavItem.ts +0 -2
- package/navigation/foundation.ts +1 -3
- package/navigation/itemFoundation.ts +0 -1
- package/navigation/subNavFoundation.ts +1 -2
- package/notification/notificationListFoundation.ts +0 -2
- package/package.json +3 -3
- package/pagination/foundation.ts +13 -3
- package/popconfirm/popconfirmFoundation.ts +0 -1
- package/radio/radio.scss +1 -0
- package/radio/radioGroupFoundation.ts +0 -1
- package/radio/radioInnerFoundation.ts +0 -1
- package/radio/variables.scss +1 -0
- package/rating/foundation.ts +0 -1
- package/select/foundation.ts +0 -5
- package/select/optionFoundation.ts +0 -2
- package/select/select.scss +11 -63
- package/select/variables.scss +0 -10
- package/skeleton/variables.scss +2 -2
- package/slider/foundation.ts +0 -7
- package/switch/foundation.ts +0 -1
- package/table/bodyFoundation.ts +0 -1
- package/table/constants.ts +0 -1
- package/table/foundation.ts +0 -8
- package/table/tableRowFoundation.ts +0 -1
- package/table/utils.ts +0 -3
- package/tag/constants.ts +19 -2
- package/tagInput/foundation.ts +0 -2
- package/timePicker/foundation.ts +7 -8
- package/timePicker/inputFoundation.ts +0 -2
- package/timePicker/utils/index.ts +2 -1
- package/toast/toastFoundation.ts +1 -4
- package/toast/toastListFoundation.ts +0 -1
- package/tooltip/foundation.ts +0 -10
- package/transfer/foundation.ts +0 -1
- package/tree/foundation.ts +0 -1
- package/tree/treeUtil.ts +1 -10
- package/treeSelect/foundation.ts +0 -1
- package/upload/foundation.ts +3 -1
- package/utils/Event.ts +0 -1
- package/utils/date-fns-extra.ts +0 -2
- package/utils/function.ts +0 -1
- package/utils/object.ts +0 -3
|
@@ -8,9 +8,6 @@ exports.isValidTimezoneIANAString = isValidTimezoneIANAString;
|
|
|
8
8
|
exports.zonedTimeToUtc = exports.utcToZonedTime = exports.toIANA = exports.parse = void 0;
|
|
9
9
|
var _dateFnsTz = require("date-fns-tz");
|
|
10
10
|
var _dateFns = require("date-fns");
|
|
11
|
-
/* eslint-disable max-len */
|
|
12
|
-
/* eslint-disable eqeqeq */
|
|
13
|
-
|
|
14
11
|
/**
|
|
15
12
|
* Need to be IANA logo without daylight saving time
|
|
16
13
|
*/
|
package/lib/cjs/utils/object.js
CHANGED
|
@@ -18,9 +18,6 @@ var _has2 = _interopRequireDefault(require("lodash/has"));
|
|
|
18
18
|
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
19
19
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
/* eslint-disable max-len */
|
|
22
|
-
/* argus-disable unPkgSensitiveInfo */
|
|
23
|
-
|
|
24
21
|
const pathToArrayElem = path => {
|
|
25
22
|
const pathArray = (0, _toPath2.default)(path);
|
|
26
23
|
// internal-issues:673
|
|
@@ -67,7 +64,6 @@ function cleanup(obj, path) {
|
|
|
67
64
|
// lodashRemove(target, (value, index, array) => index > lastIndex);
|
|
68
65
|
// }
|
|
69
66
|
// Delete object if its empty
|
|
70
|
-
// eslint-disable-next-line
|
|
71
67
|
if (Array.isArray(target) && target.every(e => e == null)) {
|
|
72
68
|
(0, _unset2.default)(obj, path);
|
|
73
69
|
} else if (isEmptyObject(target)) {
|
|
@@ -7,11 +7,9 @@ const prefixCls = cssClasses.PREFIX;
|
|
|
7
7
|
export default class AnchorFoundation extends BaseFoundation {
|
|
8
8
|
constructor(adapter) {
|
|
9
9
|
var _this;
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
11
10
|
super(Object.assign(Object.assign({}, AnchorFoundation.defaultAdapter), adapter));
|
|
12
11
|
_this = this;
|
|
13
12
|
this.init = () => {};
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
15
13
|
this.destroy = () => {};
|
|
16
14
|
this.addLink = link => {
|
|
17
15
|
this._adapter.addLink(link);
|
|
@@ -2,7 +2,6 @@ import _isObject from "lodash/isObject";
|
|
|
2
2
|
import _isUndefined from "lodash/isUndefined";
|
|
3
3
|
import _isNumber from "lodash/isNumber";
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
|
-
/* eslint-disable prefer-const, max-len */
|
|
6
5
|
import BaseFoundation from '../base/foundation';
|
|
7
6
|
import warning from '../utils/warning';
|
|
8
7
|
import KeyCode from '../utils/keyCode';
|
|
@@ -3,9 +3,7 @@ export default class OptionFoundation extends BaseFoundation {
|
|
|
3
3
|
constructor(adapter) {
|
|
4
4
|
super(Object.assign({}, adapter));
|
|
5
5
|
}
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
7
6
|
init() {}
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
9
7
|
destroy() {}
|
|
10
8
|
onOptionClick(option) {
|
|
11
9
|
const isDisabled = this._isDisabled();
|
|
@@ -5,7 +5,6 @@ const cssClasses = {
|
|
|
5
5
|
const strings = {
|
|
6
6
|
SHAPE: ['circle', 'square'],
|
|
7
7
|
SIZE: ['extra-extra-small', 'extra-small', 'small', 'default', 'medium', 'large', 'extra-large'],
|
|
8
|
-
// eslint-disable-next-line max-len
|
|
9
8
|
COLOR: ['grey', 'red', 'pink', 'purple', 'violet', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'white'],
|
|
10
9
|
OVERLAP_FROM: ['start', 'end']
|
|
11
10
|
};
|
|
@@ -19,8 +19,8 @@ export default class AvatarFoundation extends BaseFoundation {
|
|
|
19
19
|
this._adapter.setFocusVisible(false);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
init() {}
|
|
23
|
-
destroy() {}
|
|
22
|
+
init() {}
|
|
23
|
+
destroy() {}
|
|
24
24
|
handleImgLoadError() {
|
|
25
25
|
const {
|
|
26
26
|
onError
|
package/lib/es/button/button.css
CHANGED
|
@@ -218,7 +218,6 @@ export const filterEvents = (events, start, end) => {
|
|
|
218
218
|
* @returns {arr}
|
|
219
219
|
* filter out event that is not in the week range
|
|
220
220
|
*/
|
|
221
|
-
// eslint-disable-next-line max-len
|
|
222
221
|
export const filterWeeklyEvents = (events, weekStart, weekStartsOn) => filterEvents(events, weekStart, addDays(endOfWeek(weekStart, {
|
|
223
222
|
weekStartsOn
|
|
224
223
|
}), 1));
|
|
@@ -282,7 +281,6 @@ export const collectDailyEvents = events => {
|
|
|
282
281
|
return collections;
|
|
283
282
|
};
|
|
284
283
|
export const renderDailyEvent = event => {
|
|
285
|
-
// eslint-disable-next-line prefer-const
|
|
286
284
|
let {
|
|
287
285
|
start,
|
|
288
286
|
end,
|
|
@@ -5,7 +5,6 @@ export default class CalendarFoundation extends BaseFoundation {
|
|
|
5
5
|
constructor(adapter) {
|
|
6
6
|
super(Object.assign({}, adapter));
|
|
7
7
|
}
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
9
8
|
init() {}
|
|
10
9
|
destroy() {
|
|
11
10
|
this.raf && cancelAnimationFrame(this.raf);
|
|
@@ -13,7 +13,6 @@ import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysF
|
|
|
13
13
|
import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
|
|
14
14
|
import { strings } from './constants';
|
|
15
15
|
import isEnterPress from '../utils/isEnterPress';
|
|
16
|
-
// eslint-disable-next-line max-len
|
|
17
16
|
export default class CascaderFoundation extends BaseFoundation {
|
|
18
17
|
constructor(adapter) {
|
|
19
18
|
super(Object.assign({}, adapter));
|
|
@@ -48,7 +47,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
48
47
|
const valueProp = onChangeWithObject ? [] : 'value';
|
|
49
48
|
if (multiple) {
|
|
50
49
|
const valuePath = [];
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
50
|
// @ts-ignore
|
|
53
51
|
item.forEach(checkedKey => {
|
|
54
52
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
@@ -115,9 +113,7 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
115
113
|
if (_isEmpty(keyEntities[selectedKey])) {
|
|
116
114
|
if (_includes(selectedKey, 'not-exist-')) {
|
|
117
115
|
/* Get the value behind not-exist- */
|
|
118
|
-
// eslint-disable-next-line prefer-destructuring
|
|
119
116
|
const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
|
|
120
|
-
// eslint-disable-next-line max-depth
|
|
121
117
|
if (_isEmpty(keyEntities[targetValue])) {
|
|
122
118
|
cacheValue = targetValue;
|
|
123
119
|
} else {
|
|
@@ -805,7 +801,6 @@ export default class CascaderFoundation extends BaseFoundation {
|
|
|
805
801
|
return this.getFilteredData();
|
|
806
802
|
}
|
|
807
803
|
return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist)
|
|
808
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
809
804
|
// @ts-ignore
|
|
810
805
|
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
811
806
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
position: relative;
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: flex-start;
|
|
9
|
-
flex-wrap: wrap;
|
|
10
9
|
font-size: 14px;
|
|
11
10
|
line-height: 20px;
|
|
12
11
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
@@ -12,7 +12,6 @@ $module: #{$prefix}-checkbox;
|
|
|
12
12
|
position: relative;
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: flex-start;
|
|
15
|
-
flex-wrap: wrap;
|
|
16
15
|
@include font-size-regular;
|
|
17
16
|
cursor: pointer;
|
|
18
17
|
transition: background-color $transition_duration-checkbox-bg $transition_function-checkbox-bg $transition_delay-checkbox-bg,
|
|
@@ -59,7 +59,6 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
59
59
|
warning(true, 'Warning: [Semi CheckboxGroup] value should be an Array');
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
63
62
|
destroy() {}
|
|
64
63
|
}
|
|
65
64
|
export default CheckboxGroupFoundation;
|
|
@@ -3,8 +3,6 @@ import _isEqual from "lodash/isEqual";
|
|
|
3
3
|
import _isString from "lodash/isString";
|
|
4
4
|
import _isObject from "lodash/isObject";
|
|
5
5
|
import _get from "lodash/get";
|
|
6
|
-
/* eslint-disable no-nested-ternary */
|
|
7
|
-
/* eslint-disable max-len, max-depth, */
|
|
8
6
|
import { format, isValid, isSameSecond, isEqual as isDateEqual, isDate } from 'date-fns';
|
|
9
7
|
import BaseFoundation from '../base/foundation';
|
|
10
8
|
import { isValidDate, isTimestamp } from './_utils/index';
|
|
@@ -380,7 +378,6 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
380
378
|
* @param {String} input
|
|
381
379
|
* @param {Event} e
|
|
382
380
|
*/
|
|
383
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
384
381
|
handleInputBlur() {
|
|
385
382
|
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
386
383
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -433,7 +430,6 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
433
430
|
this._adapter.setRangeInputFocus(false);
|
|
434
431
|
this._adapter.notifyClear(e);
|
|
435
432
|
}
|
|
436
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
437
433
|
handleRangeInputBlur(value, e) {}
|
|
438
434
|
// Parses input only after user returns
|
|
439
435
|
handleInputComplete() {
|
|
@@ -2,7 +2,6 @@ import _get from "lodash/get";
|
|
|
2
2
|
import _set from "lodash/set";
|
|
3
3
|
import _isObject from "lodash/isObject";
|
|
4
4
|
import _cloneDeep from "lodash/cloneDeep";
|
|
5
|
-
/* eslint-disable max-len */
|
|
6
5
|
import { format as formatFn } from 'date-fns';
|
|
7
6
|
import BaseFoundation from '../base/foundation';
|
|
8
7
|
import { formatDateValues } from './_utils/formatter';
|
|
@@ -19,9 +18,7 @@ export default class InputFoundation extends BaseFoundation {
|
|
|
19
18
|
constructor(adapter) {
|
|
20
19
|
super(Object.assign({}, adapter));
|
|
21
20
|
}
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
23
21
|
init() {}
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
25
22
|
destroy() {}
|
|
26
23
|
handleClick(e) {
|
|
27
24
|
this._adapter.notifyClick(e);
|
|
@@ -44,7 +44,6 @@ export default class CalendarMonthFoundation extends BaseFoundation {
|
|
|
44
44
|
});
|
|
45
45
|
this._adapter.setWeekDays(weekdays);
|
|
46
46
|
}
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
47
|
destroy() {}
|
|
49
48
|
handleClick(day) {
|
|
50
49
|
this._adapter.notifyDayClick(day);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
2
|
import _isSet from "lodash/isSet";
|
|
3
3
|
import _includes from "lodash/includes";
|
|
4
|
-
/* eslint-disable max-len */
|
|
5
4
|
import BaseFoundation from '../base/foundation';
|
|
6
5
|
import { strings } from './constants';
|
|
7
6
|
import { format, set, addMonths, subMonths, subYears, addYears, differenceInCalendarMonths, differenceInCalendarYears, isSameDay, parseISO } from 'date-fns';
|
|
@@ -181,7 +180,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
181
180
|
_initDateTimeRangePickerFormValue(values) {
|
|
182
181
|
this._initDateRangePickerFromValue(values, true);
|
|
183
182
|
}
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
185
183
|
destroy() {}
|
|
186
184
|
/**
|
|
187
185
|
* sync change another panel month when change months from the else yam panel
|
|
@@ -6,9 +6,7 @@ export default class YearAndMonthFoundation extends BaseFoundation {
|
|
|
6
6
|
constructor(adapter) {
|
|
7
7
|
super(Object.assign({}, adapter));
|
|
8
8
|
}
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
9
|
init() {}
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
12
10
|
destroy() {}
|
|
13
11
|
selectYear(item, panelType) {
|
|
14
12
|
// const year = item.value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseFoundation from '../base/foundation';
|
|
2
|
-
import { Options as
|
|
2
|
+
import { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
3
3
|
import { BaseFormAdapter, FormState, CallOpts, FieldState, FieldStaff, ComponentProps, setValuesConfig, ArrayFieldStaff } from './interface';
|
|
4
4
|
export type { BaseFormAdapter };
|
|
5
5
|
export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
@@ -19,7 +19,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
19
19
|
validate(fieldPaths?: Array<string>): Promise<unknown>;
|
|
20
20
|
_formValidate(): Promise<unknown>;
|
|
21
21
|
_fieldsValidate(fieldPaths: Array<string>): Promise<unknown>;
|
|
22
|
-
submit(): void;
|
|
22
|
+
submit(e?: any): void;
|
|
23
23
|
/**
|
|
24
24
|
* Case A:
|
|
25
25
|
* All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
|
|
@@ -95,6 +95,6 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
95
95
|
getFormProps(keys?: Array<string>): ComponentProps;
|
|
96
96
|
getFieldExist(field: string): boolean;
|
|
97
97
|
_autoScroll(timeout?: boolean | number): void;
|
|
98
|
-
_getErrorFieldAndScroll(scrollOpts?:
|
|
99
|
-
scrollToField(field: string, scrollOpts?:
|
|
98
|
+
_getErrorFieldAndScroll(scrollOpts?: ScrollIntoViewOptions | boolean): void;
|
|
99
|
+
scrollToField(field: string, scrollOpts?: ScrollIntoViewOptions<any>): void;
|
|
100
100
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toPath from "lodash/toPath";
|
|
2
2
|
import _isFunction from "lodash/isFunction";
|
|
3
3
|
import _isUndefined from "lodash/isUndefined";
|
|
4
|
-
/* eslint-disable prefer-const, max-len */
|
|
5
4
|
import BaseFoundation from '../base/foundation';
|
|
6
5
|
import * as ObjectUtil from '../utils/object';
|
|
7
6
|
import isPromise from '../utils/isPromise';
|
|
@@ -153,13 +152,15 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
153
152
|
maybePromisedErrors = errors;
|
|
154
153
|
}
|
|
155
154
|
if (!maybePromisedErrors) {
|
|
156
|
-
|
|
155
|
+
const _values = this._adapter.cloneDeep(values);
|
|
156
|
+
resolve(_values);
|
|
157
157
|
this.injectErrorToField({});
|
|
158
158
|
} else if (isPromise(maybePromisedErrors)) {
|
|
159
159
|
maybePromisedErrors.then(result => {
|
|
160
160
|
// validate success,clear error
|
|
161
161
|
if (!result) {
|
|
162
|
-
|
|
162
|
+
const _values = this._adapter.cloneDeep(values);
|
|
163
|
+
resolve(_values);
|
|
163
164
|
this.injectErrorToField({});
|
|
164
165
|
} else {
|
|
165
166
|
this.data.errors = result;
|
|
@@ -213,7 +214,8 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
213
214
|
this._adapter.forceUpdate();
|
|
214
215
|
const errors = this.getError();
|
|
215
216
|
if (this._isValid(targetFields)) {
|
|
216
|
-
|
|
217
|
+
const _values = this._adapter.cloneDeep(values);
|
|
218
|
+
resolve(_values);
|
|
217
219
|
} else {
|
|
218
220
|
this._autoScroll();
|
|
219
221
|
reject(errors);
|
|
@@ -221,7 +223,7 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
221
223
|
});
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
|
-
submit() {
|
|
226
|
+
submit(e) {
|
|
225
227
|
const {
|
|
226
228
|
values
|
|
227
229
|
} = this.data;
|
|
@@ -229,11 +231,11 @@ export default class FormFoundation extends BaseFoundation {
|
|
|
229
231
|
this.validate().then(resolveValues => {
|
|
230
232
|
// if valid do submit
|
|
231
233
|
const _values = this._adapter.cloneDeep(resolveValues);
|
|
232
|
-
this._adapter.notifySubmit(_values);
|
|
234
|
+
this._adapter.notifySubmit(_values, e);
|
|
233
235
|
}).catch(errors => {
|
|
234
236
|
const _errors = this._adapter.cloneDeep(errors);
|
|
235
237
|
const _values = this._adapter.cloneDeep(values);
|
|
236
|
-
this._adapter.notifySubmitFail(_errors, _values);
|
|
238
|
+
this._adapter.notifySubmitFail(_errors, _values, e);
|
|
237
239
|
});
|
|
238
240
|
}
|
|
239
241
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
import { Options as
|
|
2
|
+
import { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
3
3
|
export type BasicTriggerType = 'blur' | 'change' | 'custom' | 'mount';
|
|
4
4
|
export type FieldValidateTriggerType = BasicTriggerType | Array<BasicTriggerType>;
|
|
5
5
|
export type CommonFieldError = boolean | string | Array<any> | undefined | unknown;
|
|
6
6
|
export type BasicFieldError = Array<any>;
|
|
7
7
|
export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>, Values extends object = any> extends DefaultAdapter<P, S> {
|
|
8
8
|
cloneDeep: (val: any, ...rest: any[]) => any;
|
|
9
|
-
notifySubmit: (values: any) => void;
|
|
10
|
-
notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values
|
|
9
|
+
notifySubmit: (values: any, e?: any) => void;
|
|
10
|
+
notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>, e?: any) => void;
|
|
11
11
|
forceUpdate: (callback?: () => void) => void;
|
|
12
12
|
notifyChange: (formState: FormState) => void;
|
|
13
13
|
notifyValueChange: (values: any, changedValues: any) => void;
|
|
@@ -61,7 +61,7 @@ export interface BaseFormApi<T extends object = any> {
|
|
|
61
61
|
getValues: () => T;
|
|
62
62
|
/** set value of multiple fields */
|
|
63
63
|
setValues: (fieldsValue: Partial<T>, config?: setValuesConfig) => void;
|
|
64
|
-
scrollToField: <K extends keyof T>(field: K, scrollConfig?:
|
|
64
|
+
scrollToField: <K extends keyof T>(field: K, scrollConfig?: ScrollIntoViewOptions) => void;
|
|
65
65
|
}
|
|
66
66
|
export interface CallOpts {
|
|
67
67
|
[x: string]: any;
|
package/lib/es/form/utils.js
CHANGED
|
@@ -7,9 +7,6 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
7
7
|
}
|
|
8
8
|
return t;
|
|
9
9
|
};
|
|
10
|
-
/* eslint-disable prefer-destructuring */
|
|
11
|
-
/* eslint-disable prefer-const */
|
|
12
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
13
10
|
import AsyncValidator from 'async-validator';
|
|
14
11
|
/**
|
|
15
12
|
*
|
package/lib/es/image/image.css
CHANGED
|
@@ -109,9 +109,11 @@
|
|
|
109
109
|
.semi-image-preview-footer {
|
|
110
110
|
display: flex;
|
|
111
111
|
align-items: center;
|
|
112
|
+
}
|
|
113
|
+
.semi-image-preview-footer-content {
|
|
112
114
|
padding: 0 16px;
|
|
113
115
|
background: rgba(0, 0, 0, 0.75);
|
|
114
|
-
border-radius:
|
|
116
|
+
border-radius: var(--semi-border-radius-medium);
|
|
115
117
|
height: 48px;
|
|
116
118
|
}
|
|
117
119
|
.semi-image-preview-footer-wrapper {
|
package/lib/es/image/image.scss
CHANGED
|
@@ -123,10 +123,14 @@ $module: #{$prefix}-image;
|
|
|
123
123
|
&-footer {
|
|
124
124
|
display: flex;
|
|
125
125
|
align-items: center;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
|
|
127
|
+
&-content {
|
|
128
|
+
padding: $spacing-image_preview_footer-paddingY $spacing-image_preview_footer-paddingX;
|
|
129
|
+
background: $color-image_preview_footer-bg;
|
|
130
|
+
border-radius: $radius-image_preview_footer;
|
|
131
|
+
height: $height-image_preview_footer;
|
|
132
|
+
}
|
|
133
|
+
|
|
130
134
|
|
|
131
135
|
&-wrapper {
|
|
132
136
|
position: absolute;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation";
|
|
2
|
+
export type RatioType = "adaptation" | "realSize";
|
|
2
3
|
export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
4
|
getIsInGroup: () => boolean;
|
|
4
5
|
notifyChange: (index: number, direction: string) => void;
|
|
5
6
|
notifyZoom: (zoom: number, increase: boolean) => void;
|
|
6
7
|
notifyClose: () => void;
|
|
7
8
|
notifyVisibleChange: (visible: boolean) => void;
|
|
8
|
-
notifyRatioChange: (type:
|
|
9
|
+
notifyRatioChange: (type: RatioType) => void;
|
|
9
10
|
notifyRotateChange: (angle: number) => void;
|
|
10
11
|
notifyDownload: (src: string, index: number) => void;
|
|
11
12
|
registerKeyDownListener: () => void;
|
|
@@ -21,6 +22,7 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
21
22
|
setMouseActiveTime: (time: number) => void;
|
|
22
23
|
disabledBodyScroll: () => void;
|
|
23
24
|
enabledBodyScroll: () => void;
|
|
25
|
+
getSetDownloadFunc: () => (src: string) => string;
|
|
24
26
|
}
|
|
25
27
|
export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PreviewInnerAdapter<P, S>, P, S> {
|
|
26
28
|
constructor(adapter: PreviewInnerAdapter<P, S>);
|
|
@@ -35,7 +37,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
35
37
|
handleSwitchImage: (direction: string) => void;
|
|
36
38
|
handleDownload: () => void;
|
|
37
39
|
handlePreviewClose: () => void;
|
|
38
|
-
handleAdjustRatio: (type:
|
|
40
|
+
handleAdjustRatio: (type: RatioType) => void;
|
|
39
41
|
handleRotateImage: (direction: string) => void;
|
|
40
42
|
handleZoomImage: (newZoom: number) => void;
|
|
41
43
|
preloadGapImage: () => void;
|
|
@@ -108,8 +108,9 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
108
108
|
currentIndex,
|
|
109
109
|
imgSrc
|
|
110
110
|
} = this.getStates();
|
|
111
|
+
const setDownloadName = this._adapter.getSetDownloadFunc();
|
|
111
112
|
const downloadSrc = imgSrc[currentIndex];
|
|
112
|
-
const downloadName = downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
|
|
113
|
+
const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
|
|
113
114
|
downloadImage(downloadSrc, downloadName);
|
|
114
115
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
115
116
|
};
|
|
@@ -27,7 +27,7 @@ $height-image_preview_icon: 40px; // 图像预览footer操作区icon高度
|
|
|
27
27
|
$height-image_preview_header_close: 30px; // 图像预览header部分的关闭热区高度
|
|
28
28
|
|
|
29
29
|
$radius-image: var(--semi-border-radius-small); // 图像圆角
|
|
30
|
-
$radius-image_preview_footer:
|
|
30
|
+
$radius-image_preview_footer: var(--semi-border-radius-medium); // 图像预览footer操作区圆角
|
|
31
31
|
|
|
32
32
|
$color-image_mask-bg: var(--semi-color-overlay-bg); // 图像蒙层背景色
|
|
33
33
|
$color-image_mask_info_text: var(--semi-color-white); // 图像蒙层文字颜色
|
|
@@ -27,7 +27,6 @@ class InputFoundation extends BaseFoundation {
|
|
|
27
27
|
this._timer = null;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
// eslint-disable-next-line
|
|
31
30
|
setDisable() {}
|
|
32
31
|
_setInitValue() {
|
|
33
32
|
const {
|
|
@@ -107,7 +106,6 @@ class InputFoundation extends BaseFoundation {
|
|
|
107
106
|
if (_isNumber(maxLength) && maxLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
108
107
|
const valueLength = getValueLength(value);
|
|
109
108
|
if (valueLength > maxLength) {
|
|
110
|
-
// eslint-disable-next-line max-len
|
|
111
109
|
console.warn('[Semi Input] The input character is truncated because the input length exceeds the maximum length limit');
|
|
112
110
|
const truncatedValue = this.handleTruncateValue(value, maxLength);
|
|
113
111
|
return truncatedValue;
|
|
@@ -48,7 +48,6 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
48
48
|
init() {
|
|
49
49
|
this.setInitValue();
|
|
50
50
|
}
|
|
51
|
-
// eslint-disable-next-line
|
|
52
51
|
destroy() {}
|
|
53
52
|
setInitValue() {
|
|
54
53
|
const {
|
|
@@ -120,7 +119,6 @@ export default class TextAreaFoundation extends BaseFoundation {
|
|
|
120
119
|
if (_isNumber(maxLength) && maxLength >= 0 && _isFunction(getValueLength) && _isString(value)) {
|
|
121
120
|
const valueLength = getValueLength(value);
|
|
122
121
|
if (valueLength > maxLength) {
|
|
123
|
-
// eslint-disable-next-line max-len
|
|
124
122
|
console.warn('[Semi TextArea] The input character is truncated because the input length exceeds the maximum length limit');
|
|
125
123
|
const truncatedValue = this.handleTruncateValue(value, maxLength);
|
|
126
124
|
return truncatedValue;
|
|
@@ -2,9 +2,6 @@ import _isString from "lodash/isString";
|
|
|
2
2
|
import _get from "lodash/get";
|
|
3
3
|
import _toString from "lodash/toString";
|
|
4
4
|
import _toNumber from "lodash/toNumber";
|
|
5
|
-
/* eslint-disable max-len */
|
|
6
|
-
/* eslint-disable no-param-reassign */
|
|
7
|
-
/* eslint-disable eqeqeq */
|
|
8
5
|
import BaseFoundation from '../base/foundation';
|
|
9
6
|
import keyCode from '../utils/keyCode';
|
|
10
7
|
import { numbers } from './constants';
|
|
@@ -131,7 +128,6 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
131
128
|
const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
|
|
132
129
|
formattedNum += dotBeginStr;
|
|
133
130
|
} else if (precLength < lengthAfterDot) {
|
|
134
|
-
// eslint-disable-next-line max-depth
|
|
135
131
|
for (let i = 0; i < lengthAfterDot - precLength; i++) {
|
|
136
132
|
formattedNum += '0';
|
|
137
133
|
}
|
|
@@ -199,7 +195,6 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
199
195
|
}
|
|
200
196
|
|
|
201
197
|
if (willSetNum != null) {
|
|
202
|
-
// eslint-disable-next-line max-depth
|
|
203
198
|
if (!this._isControlledComponent('value')) {
|
|
204
199
|
this._adapter.setNumber(willSetNum);
|
|
205
200
|
}
|
|
@@ -6,9 +6,7 @@ export const DEFAULT_TOGGLE_ICON = {
|
|
|
6
6
|
export default class NavItem {
|
|
7
7
|
constructor() {
|
|
8
8
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
-
// eslint-disable-next-line eqeqeq
|
|
10
9
|
if (options == null || typeof options !== 'object') {
|
|
11
|
-
// eslint-disable-next-line no-param-reassign
|
|
12
10
|
options = {
|
|
13
11
|
text: options,
|
|
14
12
|
itemKey: options,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
|
-
/* eslint-disable max-depth */
|
|
3
|
-
/* eslint-disable max-len */
|
|
4
2
|
import BaseFoundation from '../base/foundation';
|
|
5
3
|
import NavItem from './NavItem';
|
|
6
4
|
import { strings } from './constants';
|
|
@@ -158,7 +156,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
158
156
|
}
|
|
159
157
|
return [...willOpenKeySet];
|
|
160
158
|
}
|
|
161
|
-
destroy() {}
|
|
159
|
+
destroy() {}
|
|
162
160
|
selectLevelZeroParentKeys(itemKeysMap) {
|
|
163
161
|
const _itemKeysMap = isNullOrUndefined(itemKeysMap) ? this.getState('itemKeysMap') : itemKeysMap;
|
|
164
162
|
// console.log(itemKeysMap);
|
|
@@ -14,7 +14,6 @@ export default class ItemFoundation extends BaseFoundation {
|
|
|
14
14
|
this._mounted = false;
|
|
15
15
|
}
|
|
16
16
|
isValidKey(itemKey) {
|
|
17
|
-
// eslint-disable-next-line eqeqeq
|
|
18
17
|
return itemKey != null && (typeof itemKey === 'string' || typeof itemKey === 'number');
|
|
19
18
|
}
|
|
20
19
|
handleClick(e) {
|
|
@@ -26,7 +26,7 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
26
26
|
// this.log('invoke SubNavFoundation init()');
|
|
27
27
|
this._timer = null;
|
|
28
28
|
}
|
|
29
|
-
destroy() {}
|
|
29
|
+
destroy() {}
|
|
30
30
|
clearDelayTimer() {
|
|
31
31
|
if (this._timer) {
|
|
32
32
|
clearTimeout(this._timer);
|
|
@@ -34,7 +34,6 @@ export default class SubNavFoundation extends BaseFoundation {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
isValidKey(itemKey) {
|
|
37
|
-
// eslint-disable-next-line eqeqeq
|
|
38
37
|
return itemKey != null && (typeof itemKey === 'number' || typeof itemKey === 'string');
|
|
39
38
|
}
|
|
40
39
|
handleDropdownVisibleChange(visible) {
|