@douyinfe/semi-foundation 2.53.3 → 2.54.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/cascader/constants.ts +2 -0
- package/descriptions/constants.ts +2 -1
- package/descriptions/descriptions.scss +14 -0
- package/descriptions/foundation.ts +36 -0
- package/image/previewInnerFoundation.ts +2 -1
- package/image/utils.ts +18 -20
- package/lib/cjs/cascader/constants.d.ts +2 -0
- package/lib/cjs/cascader/constants.js +3 -1
- package/lib/cjs/descriptions/constants.d.ts +1 -0
- package/lib/cjs/descriptions/constants.js +2 -1
- package/lib/cjs/descriptions/descriptions.css +9 -0
- package/lib/cjs/descriptions/descriptions.scss +14 -0
- package/lib/cjs/descriptions/foundation.d.ts +7 -0
- package/lib/cjs/descriptions/foundation.js +45 -0
- package/lib/cjs/image/previewInnerFoundation.d.ts +1 -0
- package/lib/cjs/image/previewInnerFoundation.js +1 -1
- package/lib/cjs/image/utils.d.ts +1 -1
- package/lib/cjs/image/utils.js +46 -21
- package/lib/cjs/toast/toastFoundation.d.ts +1 -1
- package/lib/es/cascader/constants.d.ts +2 -0
- package/lib/es/cascader/constants.js +3 -1
- package/lib/es/descriptions/constants.d.ts +1 -0
- package/lib/es/descriptions/constants.js +2 -1
- package/lib/es/descriptions/descriptions.css +9 -0
- package/lib/es/descriptions/descriptions.scss +14 -0
- package/lib/es/descriptions/foundation.d.ts +7 -0
- package/lib/es/descriptions/foundation.js +37 -0
- package/lib/es/image/previewInnerFoundation.d.ts +1 -0
- package/lib/es/image/previewInnerFoundation.js +1 -1
- package/lib/es/image/utils.d.ts +1 -1
- package/lib/es/image/utils.js +46 -21
- package/lib/es/toast/toastFoundation.d.ts +1 -1
- package/package.json +3 -3
- package/toast/toastFoundation.ts +1 -1
package/cascader/constants.ts
CHANGED
|
@@ -151,6 +151,20 @@ $module: #{$prefix}-descriptions;
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
&-horizontal {
|
|
156
|
+
table {
|
|
157
|
+
table-layout: fixed;
|
|
158
|
+
}
|
|
159
|
+
table, tbody {
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&-horizontal &-item {
|
|
165
|
+
flex: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
@import "./rtl.scss";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
|
|
3
|
+
export interface DescriptionsAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {}
|
|
4
|
+
|
|
5
|
+
export default class DescriptionsFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<DescriptionsAdapter<P, S>, P, S> {
|
|
6
|
+
constructor(adapter: DescriptionsAdapter<P, S>) {
|
|
7
|
+
super({ ...adapter });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getHorizontalList() {
|
|
11
|
+
const { column, data, children } = this.getProps();
|
|
12
|
+
let columns;
|
|
13
|
+
if (data?.length) {
|
|
14
|
+
columns = data || [];
|
|
15
|
+
} else {
|
|
16
|
+
columns =
|
|
17
|
+
children?.map(item => ({
|
|
18
|
+
value: item.props.children,
|
|
19
|
+
...item.props,
|
|
20
|
+
})) || [];
|
|
21
|
+
}
|
|
22
|
+
const horizontalList = [];
|
|
23
|
+
const curSpan = { totalSpan: 0, itemList: [] };
|
|
24
|
+
for (const item of columns) {
|
|
25
|
+
curSpan.totalSpan += item.span || 1;
|
|
26
|
+
curSpan.itemList.push(item);
|
|
27
|
+
if (curSpan.totalSpan >= column) {
|
|
28
|
+
horizontalList.push(curSpan.itemList);
|
|
29
|
+
curSpan.itemList = [];
|
|
30
|
+
curSpan.totalSpan = 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (curSpan.itemList.length != 0) horizontalList.push(curSpan.itemList);
|
|
34
|
+
return horizontalList;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -14,6 +14,7 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
14
14
|
notifyRatioChange: (type: RatioType) => void;
|
|
15
15
|
notifyRotateChange: (angle: number) => void;
|
|
16
16
|
notifyDownload: (src: string, index: number) => void;
|
|
17
|
+
notifyDownloadError: (src: string) => void;
|
|
17
18
|
registerKeyDownListener: () => void;
|
|
18
19
|
unregisterKeyDownListener: () => void;
|
|
19
20
|
disabledBodyScroll: () => void;
|
|
@@ -173,7 +174,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
173
174
|
const setDownloadName = this._adapter.getSetDownloadFunc();
|
|
174
175
|
const downloadSrc = imgSrc[currentIndex];
|
|
175
176
|
const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1).split('?')[0];
|
|
176
|
-
downloadImage(downloadSrc, downloadName);
|
|
177
|
+
downloadImage(downloadSrc, downloadName, this._adapter.notifyDownloadError);
|
|
177
178
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
178
179
|
}
|
|
179
180
|
|
package/image/utils.ts
CHANGED
|
@@ -12,26 +12,24 @@ export const isTargetEmit = (event, targetClasses): boolean => {
|
|
|
12
12
|
return isTarget;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const downloadImage = (src: string, filename: string
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
document.body.removeChild(eleLink);
|
|
34
|
-
};
|
|
15
|
+
export const downloadImage = async (src: string, filename: string, downloadErrorCb: (src: string) => void ) => {
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(src);
|
|
18
|
+
if (response.ok) {
|
|
19
|
+
const blob = await response.blob();
|
|
20
|
+
const url = URL.createObjectURL(blob);
|
|
21
|
+
const link = document.createElement('a');
|
|
22
|
+
link.href = url;
|
|
23
|
+
link.download = filename;
|
|
24
|
+
link.click();
|
|
25
|
+
URL.revokeObjectURL(url);
|
|
26
|
+
link.remove();
|
|
27
|
+
} else {
|
|
28
|
+
downloadErrorCb(src);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
downloadErrorCb(src);
|
|
32
|
+
}
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
export const crossMerge = (leftArr = [], rightArr = []) => {
|
|
@@ -12,6 +12,8 @@ declare const strings: {
|
|
|
12
12
|
readonly LEAF_ONLY_MERGE_TYPE: "leafOnly";
|
|
13
13
|
readonly AUTO_MERGE_VALUE_MERGE_TYPE: "autoMergeValue";
|
|
14
14
|
readonly NONE_MERGE_TYPE: "none";
|
|
15
|
+
readonly SEARCH_POSITION_TRIGGER: "trigger";
|
|
16
|
+
readonly SEARCH_POSITION_CUSTOM: "custom";
|
|
15
17
|
};
|
|
16
18
|
declare const numbers: {};
|
|
17
19
|
export { cssClasses, strings, numbers };
|
|
@@ -20,7 +20,9 @@ const strings = {
|
|
|
20
20
|
/* Merge Type */
|
|
21
21
|
LEAF_ONLY_MERGE_TYPE: 'leafOnly',
|
|
22
22
|
AUTO_MERGE_VALUE_MERGE_TYPE: 'autoMergeValue',
|
|
23
|
-
NONE_MERGE_TYPE: 'none'
|
|
23
|
+
NONE_MERGE_TYPE: 'none',
|
|
24
|
+
SEARCH_POSITION_TRIGGER: 'trigger',
|
|
25
|
+
SEARCH_POSITION_CUSTOM: 'custom'
|
|
24
26
|
};
|
|
25
27
|
exports.strings = strings;
|
|
26
28
|
const numbers = {};
|
|
@@ -11,7 +11,8 @@ const cssClasses = {
|
|
|
11
11
|
exports.cssClasses = cssClasses;
|
|
12
12
|
const strings = {
|
|
13
13
|
ALIGN_SET: ['left', 'justify', 'plain', 'center'],
|
|
14
|
-
SIZE_SET: ['small', 'medium', 'large']
|
|
14
|
+
SIZE_SET: ['small', 'medium', 'large'],
|
|
15
|
+
LAYOUT_SET: ['horizontal', 'vertical']
|
|
15
16
|
};
|
|
16
17
|
exports.strings = strings;
|
|
17
18
|
const numbers = {};
|
|
@@ -120,6 +120,15 @@
|
|
|
120
120
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
121
121
|
font-size: 28px;
|
|
122
122
|
}
|
|
123
|
+
.semi-descriptions-horizontal table {
|
|
124
|
+
table-layout: fixed;
|
|
125
|
+
}
|
|
126
|
+
.semi-descriptions-horizontal table, .semi-descriptions-horizontal tbody {
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
129
|
+
.semi-descriptions-horizontal .semi-descriptions-item {
|
|
130
|
+
flex: 0;
|
|
131
|
+
}
|
|
123
132
|
|
|
124
133
|
.semi-rtl .semi-descriptions,
|
|
125
134
|
.semi-portal-rtl .semi-descriptions {
|
|
@@ -151,6 +151,20 @@ $module: #{$prefix}-descriptions;
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
&-horizontal {
|
|
156
|
+
table {
|
|
157
|
+
table-layout: fixed;
|
|
158
|
+
}
|
|
159
|
+
table, tbody {
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&-horizontal &-item {
|
|
165
|
+
flex: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
@import "./rtl.scss";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
export interface DescriptionsAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
|
+
}
|
|
4
|
+
export default class DescriptionsFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<DescriptionsAdapter<P, S>, P, S> {
|
|
5
|
+
constructor(adapter: DescriptionsAdapter<P, S>);
|
|
6
|
+
getHorizontalList(): any[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
class DescriptionsFoundation extends _foundation.default {
|
|
10
|
+
constructor(adapter) {
|
|
11
|
+
super(Object.assign({}, adapter));
|
|
12
|
+
}
|
|
13
|
+
getHorizontalList() {
|
|
14
|
+
const {
|
|
15
|
+
column,
|
|
16
|
+
data,
|
|
17
|
+
children
|
|
18
|
+
} = this.getProps();
|
|
19
|
+
let columns;
|
|
20
|
+
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
21
|
+
columns = data || [];
|
|
22
|
+
} else {
|
|
23
|
+
columns = (children === null || children === void 0 ? void 0 : children.map(item => Object.assign({
|
|
24
|
+
value: item.props.children
|
|
25
|
+
}, item.props))) || [];
|
|
26
|
+
}
|
|
27
|
+
const horizontalList = [];
|
|
28
|
+
const curSpan = {
|
|
29
|
+
totalSpan: 0,
|
|
30
|
+
itemList: []
|
|
31
|
+
};
|
|
32
|
+
for (const item of columns) {
|
|
33
|
+
curSpan.totalSpan += item.span || 1;
|
|
34
|
+
curSpan.itemList.push(item);
|
|
35
|
+
if (curSpan.totalSpan >= column) {
|
|
36
|
+
horizontalList.push(curSpan.itemList);
|
|
37
|
+
curSpan.itemList = [];
|
|
38
|
+
curSpan.totalSpan = 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (curSpan.itemList.length != 0) horizontalList.push(curSpan.itemList);
|
|
42
|
+
return horizontalList;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = DescriptionsFoundation;
|
|
@@ -10,6 +10,7 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
10
10
|
notifyRatioChange: (type: RatioType) => void;
|
|
11
11
|
notifyRotateChange: (angle: number) => void;
|
|
12
12
|
notifyDownload: (src: string, index: number) => void;
|
|
13
|
+
notifyDownloadError: (src: string) => void;
|
|
13
14
|
registerKeyDownListener: () => void;
|
|
14
15
|
unregisterKeyDownListener: () => void;
|
|
15
16
|
disabledBodyScroll: () => void;
|
|
@@ -173,7 +173,7 @@ class PreviewInnerFoundation extends _foundation.default {
|
|
|
173
173
|
const setDownloadName = this._adapter.getSetDownloadFunc();
|
|
174
174
|
const downloadSrc = imgSrc[currentIndex];
|
|
175
175
|
const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1).split('?')[0];
|
|
176
|
-
(0, _utils.downloadImage)(downloadSrc, downloadName);
|
|
176
|
+
(0, _utils.downloadImage)(downloadSrc, downloadName, this._adapter.notifyDownloadError);
|
|
177
177
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
178
178
|
};
|
|
179
179
|
this.handlePreviewClose = e => {
|
package/lib/cjs/image/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const isTargetEmit: (event: any, targetClasses: any) => boolean;
|
|
2
|
-
export declare const downloadImage: (src: string, filename: string) => void
|
|
2
|
+
export declare const downloadImage: (src: string, filename: string, downloadErrorCb: (src: string) => void) => Promise<void>;
|
|
3
3
|
export declare const crossMerge: (leftArr?: any[], rightArr?: any[]) => any[];
|
|
4
4
|
export declare const getPreloadImagArr: (imgSrc: string[], currentIndex: number, preLoadGap: number, infinite: boolean) => any[];
|
package/lib/cjs/image/utils.js
CHANGED
|
@@ -4,6 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isTargetEmit = exports.getPreloadImagArr = exports.downloadImage = exports.crossMerge = void 0;
|
|
7
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) {
|
|
9
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) {
|
|
15
|
+
try {
|
|
16
|
+
step(generator.next(value));
|
|
17
|
+
} catch (e) {
|
|
18
|
+
reject(e);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function rejected(value) {
|
|
22
|
+
try {
|
|
23
|
+
step(generator["throw"](value));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
reject(e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function step(result) {
|
|
29
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
30
|
+
}
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
7
34
|
const isTargetEmit = (event, targetClasses) => {
|
|
8
35
|
// event.path usage is discouraged, use event.composedPath() as it's standard and is more future-proof
|
|
9
36
|
// path is the event-triggered bubbling path, which stores each node through which bubbling passes.
|
|
@@ -18,27 +45,25 @@ const isTargetEmit = (event, targetClasses) => {
|
|
|
18
45
|
return isTarget;
|
|
19
46
|
};
|
|
20
47
|
exports.isTargetEmit = isTargetEmit;
|
|
21
|
-
const downloadImage = (src, filename) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
};
|
|
48
|
+
const downloadImage = (src, filename, downloadErrorCb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
try {
|
|
50
|
+
const response = yield fetch(src);
|
|
51
|
+
if (response.ok) {
|
|
52
|
+
const blob = yield response.blob();
|
|
53
|
+
const url = URL.createObjectURL(blob);
|
|
54
|
+
const link = document.createElement('a');
|
|
55
|
+
link.href = url;
|
|
56
|
+
link.download = filename;
|
|
57
|
+
link.click();
|
|
58
|
+
URL.revokeObjectURL(url);
|
|
59
|
+
link.remove();
|
|
60
|
+
} else {
|
|
61
|
+
downloadErrorCb(src);
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
downloadErrorCb(src);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
42
67
|
exports.downloadImage = downloadImage;
|
|
43
68
|
const crossMerge = function () {
|
|
44
69
|
let leftArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -9,6 +9,7 @@ export interface ConfigProps {
|
|
|
9
9
|
right?: number | string;
|
|
10
10
|
duration?: number;
|
|
11
11
|
zIndex?: number;
|
|
12
|
+
theme?: ToastTheme;
|
|
12
13
|
getPopupContainer?: () => HTMLElement | null;
|
|
13
14
|
}
|
|
14
15
|
export interface ToastProps extends ConfigProps {
|
|
@@ -20,7 +21,6 @@ export interface ToastProps extends ConfigProps {
|
|
|
20
21
|
className?: string;
|
|
21
22
|
showClose?: boolean;
|
|
22
23
|
icon?: any;
|
|
23
|
-
theme?: ToastTheme;
|
|
24
24
|
direction?: Directions;
|
|
25
25
|
close?: (id: string) => void;
|
|
26
26
|
stack?: boolean;
|
|
@@ -12,6 +12,8 @@ declare const strings: {
|
|
|
12
12
|
readonly LEAF_ONLY_MERGE_TYPE: "leafOnly";
|
|
13
13
|
readonly AUTO_MERGE_VALUE_MERGE_TYPE: "autoMergeValue";
|
|
14
14
|
readonly NONE_MERGE_TYPE: "none";
|
|
15
|
+
readonly SEARCH_POSITION_TRIGGER: "trigger";
|
|
16
|
+
readonly SEARCH_POSITION_CUSTOM: "custom";
|
|
15
17
|
};
|
|
16
18
|
declare const numbers: {};
|
|
17
19
|
export { cssClasses, strings, numbers };
|
|
@@ -13,7 +13,9 @@ const strings = {
|
|
|
13
13
|
/* Merge Type */
|
|
14
14
|
LEAF_ONLY_MERGE_TYPE: 'leafOnly',
|
|
15
15
|
AUTO_MERGE_VALUE_MERGE_TYPE: 'autoMergeValue',
|
|
16
|
-
NONE_MERGE_TYPE: 'none'
|
|
16
|
+
NONE_MERGE_TYPE: 'none',
|
|
17
|
+
SEARCH_POSITION_TRIGGER: 'trigger',
|
|
18
|
+
SEARCH_POSITION_CUSTOM: 'custom'
|
|
17
19
|
};
|
|
18
20
|
const numbers = {};
|
|
19
21
|
export { cssClasses, strings, numbers };
|
|
@@ -4,7 +4,8 @@ const cssClasses = {
|
|
|
4
4
|
};
|
|
5
5
|
const strings = {
|
|
6
6
|
ALIGN_SET: ['left', 'justify', 'plain', 'center'],
|
|
7
|
-
SIZE_SET: ['small', 'medium', 'large']
|
|
7
|
+
SIZE_SET: ['small', 'medium', 'large'],
|
|
8
|
+
LAYOUT_SET: ['horizontal', 'vertical']
|
|
8
9
|
};
|
|
9
10
|
const numbers = {};
|
|
10
11
|
export { cssClasses, strings, numbers };
|
|
@@ -120,6 +120,15 @@
|
|
|
120
120
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
121
121
|
font-size: 28px;
|
|
122
122
|
}
|
|
123
|
+
.semi-descriptions-horizontal table {
|
|
124
|
+
table-layout: fixed;
|
|
125
|
+
}
|
|
126
|
+
.semi-descriptions-horizontal table, .semi-descriptions-horizontal tbody {
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
129
|
+
.semi-descriptions-horizontal .semi-descriptions-item {
|
|
130
|
+
flex: 0;
|
|
131
|
+
}
|
|
123
132
|
|
|
124
133
|
.semi-rtl .semi-descriptions,
|
|
125
134
|
.semi-portal-rtl .semi-descriptions {
|
|
@@ -151,6 +151,20 @@ $module: #{$prefix}-descriptions;
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
&-horizontal {
|
|
156
|
+
table {
|
|
157
|
+
table-layout: fixed;
|
|
158
|
+
}
|
|
159
|
+
table, tbody {
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&-horizontal &-item {
|
|
165
|
+
flex: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
@import "./rtl.scss";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
export interface DescriptionsAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
|
+
}
|
|
4
|
+
export default class DescriptionsFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<DescriptionsAdapter<P, S>, P, S> {
|
|
5
|
+
constructor(adapter: DescriptionsAdapter<P, S>);
|
|
6
|
+
getHorizontalList(): any[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import BaseFoundation from '../base/foundation';
|
|
2
|
+
export default class DescriptionsFoundation extends BaseFoundation {
|
|
3
|
+
constructor(adapter) {
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
5
|
+
}
|
|
6
|
+
getHorizontalList() {
|
|
7
|
+
const {
|
|
8
|
+
column,
|
|
9
|
+
data,
|
|
10
|
+
children
|
|
11
|
+
} = this.getProps();
|
|
12
|
+
let columns;
|
|
13
|
+
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
14
|
+
columns = data || [];
|
|
15
|
+
} else {
|
|
16
|
+
columns = (children === null || children === void 0 ? void 0 : children.map(item => Object.assign({
|
|
17
|
+
value: item.props.children
|
|
18
|
+
}, item.props))) || [];
|
|
19
|
+
}
|
|
20
|
+
const horizontalList = [];
|
|
21
|
+
const curSpan = {
|
|
22
|
+
totalSpan: 0,
|
|
23
|
+
itemList: []
|
|
24
|
+
};
|
|
25
|
+
for (const item of columns) {
|
|
26
|
+
curSpan.totalSpan += item.span || 1;
|
|
27
|
+
curSpan.itemList.push(item);
|
|
28
|
+
if (curSpan.totalSpan >= column) {
|
|
29
|
+
horizontalList.push(curSpan.itemList);
|
|
30
|
+
curSpan.itemList = [];
|
|
31
|
+
curSpan.totalSpan = 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (curSpan.itemList.length != 0) horizontalList.push(curSpan.itemList);
|
|
35
|
+
return horizontalList;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -10,6 +10,7 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
10
10
|
notifyRatioChange: (type: RatioType) => void;
|
|
11
11
|
notifyRotateChange: (angle: number) => void;
|
|
12
12
|
notifyDownload: (src: string, index: number) => void;
|
|
13
|
+
notifyDownloadError: (src: string) => void;
|
|
13
14
|
registerKeyDownListener: () => void;
|
|
14
15
|
unregisterKeyDownListener: () => void;
|
|
15
16
|
disabledBodyScroll: () => void;
|
|
@@ -166,7 +166,7 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
166
166
|
const setDownloadName = this._adapter.getSetDownloadFunc();
|
|
167
167
|
const downloadSrc = imgSrc[currentIndex];
|
|
168
168
|
const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1).split('?')[0];
|
|
169
|
-
downloadImage(downloadSrc, downloadName);
|
|
169
|
+
downloadImage(downloadSrc, downloadName, this._adapter.notifyDownloadError);
|
|
170
170
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
171
171
|
};
|
|
172
172
|
this.handlePreviewClose = e => {
|
package/lib/es/image/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const isTargetEmit: (event: any, targetClasses: any) => boolean;
|
|
2
|
-
export declare const downloadImage: (src: string, filename: string) => void
|
|
2
|
+
export declare const downloadImage: (src: string, filename: string, downloadErrorCb: (src: string) => void) => Promise<void>;
|
|
3
3
|
export declare const crossMerge: (leftArr?: any[], rightArr?: any[]) => any[];
|
|
4
4
|
export declare const getPreloadImagArr: (imgSrc: string[], currentIndex: number, preLoadGap: number, infinite: boolean) => any[];
|
package/lib/es/image/utils.js
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) {
|
|
9
|
+
try {
|
|
10
|
+
step(generator.next(value));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
reject(e);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function rejected(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator["throw"](value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function step(result) {
|
|
23
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
24
|
+
}
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
1
28
|
export const isTargetEmit = (event, targetClasses) => {
|
|
2
29
|
// event.path usage is discouraged, use event.composedPath() as it's standard and is more future-proof
|
|
3
30
|
// path is the event-triggered bubbling path, which stores each node through which bubbling passes.
|
|
@@ -11,27 +38,25 @@ export const isTargetEmit = (event, targetClasses) => {
|
|
|
11
38
|
});
|
|
12
39
|
return isTarget;
|
|
13
40
|
};
|
|
14
|
-
export const downloadImage = (src, filename) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
};
|
|
41
|
+
export const downloadImage = (src, filename, downloadErrorCb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
const response = yield fetch(src);
|
|
44
|
+
if (response.ok) {
|
|
45
|
+
const blob = yield response.blob();
|
|
46
|
+
const url = URL.createObjectURL(blob);
|
|
47
|
+
const link = document.createElement('a');
|
|
48
|
+
link.href = url;
|
|
49
|
+
link.download = filename;
|
|
50
|
+
link.click();
|
|
51
|
+
URL.revokeObjectURL(url);
|
|
52
|
+
link.remove();
|
|
53
|
+
} else {
|
|
54
|
+
downloadErrorCb(src);
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
downloadErrorCb(src);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
35
60
|
export const crossMerge = function () {
|
|
36
61
|
let leftArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
37
62
|
let rightArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -9,6 +9,7 @@ export interface ConfigProps {
|
|
|
9
9
|
right?: number | string;
|
|
10
10
|
duration?: number;
|
|
11
11
|
zIndex?: number;
|
|
12
|
+
theme?: ToastTheme;
|
|
12
13
|
getPopupContainer?: () => HTMLElement | null;
|
|
13
14
|
}
|
|
14
15
|
export interface ToastProps extends ConfigProps {
|
|
@@ -20,7 +21,6 @@ export interface ToastProps extends ConfigProps {
|
|
|
20
21
|
className?: string;
|
|
21
22
|
showClose?: boolean;
|
|
22
23
|
icon?: any;
|
|
23
|
-
theme?: ToastTheme;
|
|
24
24
|
direction?: Directions;
|
|
25
25
|
close?: (id: string) => void;
|
|
26
26
|
stack?: boolean;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.54.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.
|
|
10
|
+
"@douyinfe/semi-animation": "2.54.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "30c24d26549ecb166625ef4f0a731235b71968fc",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
30
30
|
"@babel/preset-env": "^7.15.8",
|
package/toast/toastFoundation.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface ConfigProps {
|
|
|
13
13
|
right?: number | string;
|
|
14
14
|
duration?: number;
|
|
15
15
|
zIndex?: number;
|
|
16
|
+
theme?: ToastTheme;
|
|
16
17
|
getPopupContainer?: () => HTMLElement | null
|
|
17
18
|
}
|
|
18
19
|
export interface ToastProps extends ConfigProps {
|
|
@@ -24,7 +25,6 @@ export interface ToastProps extends ConfigProps {
|
|
|
24
25
|
className?: string;
|
|
25
26
|
showClose?: boolean;
|
|
26
27
|
icon?: any;
|
|
27
|
-
theme?: ToastTheme;
|
|
28
28
|
direction?: Directions;
|
|
29
29
|
close?: (id: string) => void;
|
|
30
30
|
stack?: boolean
|