@mezzanine-ui/core 0.7.1 → 0.9.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/_internal/overlay-with-slide-fade/_index.scss +1 -0
- package/_internal/overlay-with-slide-fade/_overlay-with-slide-fade-styles.scss +7 -0
- package/_internal/overlay-with-slide-fade/_overlay-with-slider-fade.scss +1 -0
- package/_internal/overlay-with-slide-fade/index.d.ts +1 -0
- package/_internal/overlay-with-slide-fade/index.js +1 -0
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.d.ts +4 -0
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.js +6 -0
- package/_styles.scss +3 -0
- package/button/_button-styles.scss +0 -1
- package/drawer/_drawer-styles.scss +0 -2
- package/icon/_icon-styles.scss +5 -0
- package/icon/icon.d.ts +2 -0
- package/icon/icon.js +29 -18
- package/input/_input-styles.scss +26 -0
- package/input/input.d.ts +2 -0
- package/input/input.js +2 -0
- package/message/message.js +2 -2
- package/package.json +2 -2
- package/page-footer/_page-footer-styles.scss +0 -1
- package/table/_table-styles.scss +12 -0
- package/table/index.js +1 -1
- package/table/table.d.ts +13 -2
- package/table/table.js +31 -2
- package/upload/UploadPictureBlock.d.ts +51 -0
- package/upload/UploadPictureBlock.js +111 -0
- package/upload/UploadPictureWall.d.ts +5 -0
- package/upload/UploadPictureWall.js +7 -0
- package/upload/_index.scss +3 -0
- package/upload/_upload-picture-block-styles.scss +119 -0
- package/upload/_upload-picture-block.scss +3 -0
- package/upload/_upload-picture-styles.scss +9 -0
- package/upload/_upload-picture-wall-styles.scss +20 -0
- package/upload/_upload-picture-wall.scss +3 -0
- package/upload/_upload-picture.scss +3 -0
- package/upload/index.d.ts +3 -0
- package/upload/index.js +3 -0
- package/upload/uploadPicture.d.ts +4 -0
- package/upload/uploadPicture.js +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward './overlay-with-slider-fade';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$prefix: mzn-overlay-with-slide-fade;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './overlayWithSlideFade';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { overlayWithSlideFadeClasses, overlayWithSlideFadePrefix } from './overlayWithSlideFade.js';
|
package/_styles.scss
CHANGED
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
@include _load-styles($options, textarea);
|
|
62
62
|
@include _load-styles($options, upload);
|
|
63
63
|
@include _load-styles($options, upload, upload-result);
|
|
64
|
+
@include _load-styles($options, upload, upload-picture);
|
|
65
|
+
@include _load-styles($options, upload, upload-picture-block);
|
|
66
|
+
@include _load-styles($options, upload, upload-picture-wall);
|
|
64
67
|
@include _load-styles($options, picker);
|
|
65
68
|
@include _load-styles($options, date-range-picker);
|
|
66
69
|
@include _load-styles($options, date-time-picker);
|
|
@@ -181,7 +181,6 @@ $outlined-border-width: 1px !default;
|
|
|
181
181
|
justify-content: center;
|
|
182
182
|
align-items: center;
|
|
183
183
|
text-decoration: none;
|
|
184
|
-
text-transform: uppercase;
|
|
185
184
|
transition: transition.standard(background-color), transition.standard(border), transition.standard(color);
|
|
186
185
|
will-change: background-color, border-color, color;
|
|
187
186
|
|
package/icon/_icon-styles.scss
CHANGED
|
@@ -9,6 +9,7 @@ $spin-keyframes-name: #{$prefix}-spin !default;
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.#{$prefix} {
|
|
12
|
+
cursor: var(--#{$prefix}-cursor);
|
|
12
13
|
display: inline-block;
|
|
13
14
|
width: 1em;
|
|
14
15
|
height: 1em;
|
|
@@ -25,4 +26,8 @@ $spin-keyframes-name: #{$prefix}-spin !default;
|
|
|
25
26
|
&--spin {
|
|
26
27
|
animation: #{$spin-keyframes-name} 500ms infinite linear;
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
&--size {
|
|
31
|
+
font-size: var(--#{$prefix}-size);
|
|
32
|
+
}
|
|
28
33
|
}
|
package/icon/icon.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { MainColor } from '@mezzanine-ui/system/palette';
|
|
|
3
3
|
export declare type IconColor = 'inherit' | MainColor | 'disabled';
|
|
4
4
|
export interface IconCssVars {
|
|
5
5
|
color?: IconColor;
|
|
6
|
+
size?: number;
|
|
6
7
|
}
|
|
7
8
|
export declare const iconPrefix = "mzn-icon";
|
|
8
9
|
export declare const iconClasses: {
|
|
9
10
|
readonly host: "mzn-icon";
|
|
10
11
|
readonly color: "mzn-icon--color";
|
|
11
12
|
readonly spin: "mzn-icon--spin";
|
|
13
|
+
readonly size: "mzn-icon--size";
|
|
12
14
|
};
|
|
13
15
|
export declare function toIconCssVars(variables: IconCssVars): CssVarInterpolations;
|
package/icon/icon.js
CHANGED
|
@@ -6,28 +6,39 @@ const iconClasses = {
|
|
|
6
6
|
host: iconPrefix,
|
|
7
7
|
color: `${iconPrefix}--color`,
|
|
8
8
|
spin: `${iconPrefix}--spin`,
|
|
9
|
+
size: `${iconPrefix}--size`,
|
|
9
10
|
};
|
|
10
11
|
function toIconCssVars(variables) {
|
|
11
|
-
const { color } = variables;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const { color, size } = variables;
|
|
13
|
+
let result = {};
|
|
14
|
+
/** color mapping */
|
|
15
|
+
if (color) {
|
|
16
|
+
let colorValue;
|
|
17
|
+
if (color === 'inherit') {
|
|
18
|
+
colorValue = color;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
/**
|
|
22
|
+
* Use `action-disabled` color of palette as `disabled` color of icon.
|
|
23
|
+
*/
|
|
24
|
+
const colorName = color === 'disabled'
|
|
25
|
+
? 'action-disabled'
|
|
26
|
+
: color;
|
|
27
|
+
colorValue = toCssVar(`${palettePrefix}-${colorName}`);
|
|
28
|
+
}
|
|
29
|
+
result = {
|
|
30
|
+
...result,
|
|
31
|
+
[`--${iconPrefix}-color`]: colorValue,
|
|
32
|
+
};
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
34
|
+
/** size mapping */
|
|
35
|
+
if (typeof size !== 'undefined') {
|
|
36
|
+
result = {
|
|
37
|
+
...result,
|
|
38
|
+
[`--${iconPrefix}-size`]: `${size}px`,
|
|
39
|
+
};
|
|
18
40
|
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Use `action-disabled` color of palette as `disabled` color of icon.
|
|
22
|
-
*/
|
|
23
|
-
const colorName = color === 'disabled'
|
|
24
|
-
? 'action-disabled'
|
|
25
|
-
: color;
|
|
26
|
-
colorValue = toCssVar(`${palettePrefix}-${colorName}`);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
[`--${iconPrefix}-color`]: colorValue,
|
|
30
|
-
};
|
|
41
|
+
return result;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
export { iconClasses, iconPrefix, toIconCssVars };
|
package/input/_input-styles.scss
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../text-field';
|
|
3
|
+
@use '../select';
|
|
3
4
|
@use './input' as *;
|
|
4
5
|
|
|
5
6
|
.#{$prefix} {
|
|
7
|
+
&__tags-mode {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
|
|
11
|
+
.#{select.$prefix}-trigger__tags {
|
|
12
|
+
width: unset;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
input {
|
|
16
|
+
width: unset;
|
|
17
|
+
flex: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__input-on-top {
|
|
21
|
+
flex-direction: column-reverse;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
.#{text-field.$prefix}__clear-icon {
|
|
26
|
+
opacity: 1;
|
|
27
|
+
pointer-events: auto;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
6
32
|
input {
|
|
7
33
|
padding-left: var(--#{text-field.$prefix}-padding-left);
|
|
8
34
|
padding-right: var(--#{text-field.$prefix}-padding-right);
|
package/input/input.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export declare type InputSize = Size;
|
|
|
3
3
|
export declare const inputPrefix = "mzn-input";
|
|
4
4
|
export declare const inputClasses: {
|
|
5
5
|
readonly host: "mzn-input";
|
|
6
|
+
readonly tagsMode: "mzn-input__tags-mode";
|
|
7
|
+
readonly tagsModeInputOnTop: "mzn-input__tags-mode__input-on-top";
|
|
6
8
|
};
|
package/input/input.js
CHANGED
package/message/message.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CheckCircleFilledIcon, ExclamationCircleFilledIcon,
|
|
1
|
+
import { CheckCircleFilledIcon, ExclamationCircleFilledIcon, TimesCircleFilledIcon, InfoCircleFilledIcon } from '@mezzanine-ui/icons';
|
|
2
2
|
|
|
3
3
|
const messagePrefix = 'mzn-message';
|
|
4
4
|
const messageIcons = {
|
|
5
5
|
success: CheckCircleFilledIcon,
|
|
6
6
|
warning: ExclamationCircleFilledIcon,
|
|
7
|
-
error:
|
|
7
|
+
error: TimesCircleFilledIcon,
|
|
8
8
|
info: InfoCircleFilledIcon,
|
|
9
9
|
};
|
|
10
10
|
const messageClasses = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezzanine-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Core for mezzanine-ui",
|
|
5
5
|
"author": "Mezzanine",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build:clean": "node ../../scripts/cleanBuild.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mezzanine-ui/icons": "^0.
|
|
26
|
+
"@mezzanine-ui/icons": "^0.7.3",
|
|
27
27
|
"@mezzanine-ui/system": "^0.7.0",
|
|
28
28
|
"tslib": "^2.1.0"
|
|
29
29
|
}
|
package/table/_table-styles.scss
CHANGED
|
@@ -103,6 +103,18 @@ $table-refresh-vertical-padding: 8px !default;
|
|
|
103
103
|
&__cellWrapper {
|
|
104
104
|
@include flexible;
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
&__expandedTableWrapper {
|
|
108
|
+
padding: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__expandedTableRow {
|
|
112
|
+
background-color: palette.color(divider);
|
|
113
|
+
|
|
114
|
+
&:last-child {
|
|
115
|
+
border-bottom: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
&__empty {
|
package/table/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix } from './table.js';
|
|
1
|
+
export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix } from './table.js';
|
package/table/table.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export declare const tableClasses: {
|
|
|
12
12
|
readonly bodyRow: `${string}__row`;
|
|
13
13
|
readonly bodyRowHighlight: `${string}__row--highlight`;
|
|
14
14
|
readonly bodyRowCellWrapper: `${string}__row__cellWrapper`;
|
|
15
|
+
readonly bodyRowExpandedTableWrapper: `${string}__row__expandedTableWrapper`;
|
|
16
|
+
readonly bodyRowExpandedTable: `${string}__row__expandedTable`;
|
|
17
|
+
readonly bodyRowExpandedTableRow: `${string}__row__expandedTableRow`;
|
|
15
18
|
readonly cell: string;
|
|
16
19
|
readonly cellEllipsis: `${string}__ellipsis`;
|
|
17
20
|
readonly selections: "mzn-table__selections";
|
|
@@ -42,7 +45,7 @@ export declare type TableColumn<SourceType> = {
|
|
|
42
45
|
headerClassName?: string;
|
|
43
46
|
width?: number;
|
|
44
47
|
sorter?(a: any, b: any): number;
|
|
45
|
-
onSorted?(
|
|
48
|
+
onSorted?(dataIndex: string, sortedType: string): void;
|
|
46
49
|
editable?: boolean;
|
|
47
50
|
setCellProps?(record: SourceType): TableRecord<unknown>;
|
|
48
51
|
/** @default true */
|
|
@@ -50,6 +53,7 @@ export declare type TableColumn<SourceType> = {
|
|
|
50
53
|
/** force display tooltip whenever content is hovered */
|
|
51
54
|
forceShownTooltipWhenHovered?: boolean;
|
|
52
55
|
};
|
|
56
|
+
export declare type ExpandedTableColumn = Omit<TableColumn<TableRecord<unknown>>, 'title' | 'renderTitle' | 'align' | 'headerClassName' | 'width' | 'sorter' | 'onSorted' | 'editable' | 'setCellProps'>;
|
|
53
57
|
export declare type TableFetchMore = {
|
|
54
58
|
callback?(): any;
|
|
55
59
|
isReachEnd?: boolean;
|
|
@@ -70,8 +74,12 @@ export interface TableRowSelection {
|
|
|
70
74
|
/** === Feature Expandable */
|
|
71
75
|
export interface TableExpandable<SourceType> {
|
|
72
76
|
className?: string;
|
|
73
|
-
expandedRowRender(record: SourceType):
|
|
77
|
+
expandedRowRender(record: SourceType): string | {
|
|
78
|
+
dataSource: TableDataSource[];
|
|
79
|
+
columns?: ExpandedTableColumn[];
|
|
80
|
+
};
|
|
74
81
|
rowExpandable?(record: SourceType): boolean;
|
|
82
|
+
onExpand?(record: SourceType, status: boolean): void;
|
|
75
83
|
}
|
|
76
84
|
/** === Feature Pagination */
|
|
77
85
|
export interface TablePagination {
|
|
@@ -101,3 +109,6 @@ export interface TableComponents {
|
|
|
101
109
|
cell?: any;
|
|
102
110
|
};
|
|
103
111
|
}
|
|
112
|
+
/** styling */
|
|
113
|
+
export declare function getColumnStyle(column: TableColumn<TableRecord<unknown>>): {};
|
|
114
|
+
export declare function getCellStyle(column: TableColumn<TableRecord<unknown>>): {};
|
package/table/table.js
CHANGED
|
@@ -12,6 +12,9 @@ const tableClasses = {
|
|
|
12
12
|
bodyRow: `${tableBodyPrefix}__row`,
|
|
13
13
|
bodyRowHighlight: `${tableBodyPrefix}__row--highlight`,
|
|
14
14
|
bodyRowCellWrapper: `${tableBodyPrefix}__row__cellWrapper`,
|
|
15
|
+
bodyRowExpandedTableWrapper: `${tableBodyPrefix}__row__expandedTableWrapper`,
|
|
16
|
+
bodyRowExpandedTable: `${tableBodyPrefix}__row__expandedTable`,
|
|
17
|
+
bodyRowExpandedTableRow: `${tableBodyPrefix}__row__expandedTableRow`,
|
|
15
18
|
cell: tableCellPrefix,
|
|
16
19
|
cellEllipsis: `${tableCellPrefix}__ellipsis`,
|
|
17
20
|
selections: `${tablePrefix}__selections`,
|
|
@@ -22,6 +25,32 @@ const tableClasses = {
|
|
|
22
25
|
paginationIndicator: `${tablePrefix}__pagination__indicator`,
|
|
23
26
|
paginationActions: `${tablePrefix}__pagination__actions`,
|
|
24
27
|
refresh: `${tablePrefix}__refresh`,
|
|
25
|
-
};
|
|
28
|
+
};
|
|
29
|
+
/** styling */
|
|
30
|
+
function getColumnStyle(column) {
|
|
31
|
+
if (!column)
|
|
32
|
+
return {};
|
|
33
|
+
let style = {};
|
|
34
|
+
if (column.width) {
|
|
35
|
+
style = {
|
|
36
|
+
...style,
|
|
37
|
+
width: column.width,
|
|
38
|
+
maxWidth: column.width,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return style;
|
|
42
|
+
}
|
|
43
|
+
function getCellStyle(column) {
|
|
44
|
+
if (!column)
|
|
45
|
+
return {};
|
|
46
|
+
let style = {};
|
|
47
|
+
if (column.align) {
|
|
48
|
+
style = {
|
|
49
|
+
...style,
|
|
50
|
+
justifyContent: column.align === 'center' ? column.align : `flex-${column.align}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return style;
|
|
54
|
+
}
|
|
26
55
|
|
|
27
|
-
export { tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix };
|
|
56
|
+
export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { CssVarInterpolations } from '@mezzanine-ui/system/css';
|
|
3
|
+
import EventEmitter from 'events';
|
|
4
|
+
export declare const uploadPictureBlockPrefix = "mzn-upload-picture-block";
|
|
5
|
+
export interface UploadPictureBlockCssVars {
|
|
6
|
+
percentage?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadPictureBlockClasses: {
|
|
9
|
+
host: string;
|
|
10
|
+
disabled: string;
|
|
11
|
+
error: string;
|
|
12
|
+
loading: string;
|
|
13
|
+
group: string;
|
|
14
|
+
status: string;
|
|
15
|
+
preview: string;
|
|
16
|
+
delete: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function toUploadPictureBlockCssVars(variables: UploadPictureBlockCssVars): CssVarInterpolations;
|
|
19
|
+
export declare class ImageUploader extends EventEmitter {
|
|
20
|
+
uid: string;
|
|
21
|
+
file: File | null;
|
|
22
|
+
percentage: number;
|
|
23
|
+
preview: string;
|
|
24
|
+
url: string;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
isError: boolean;
|
|
27
|
+
constructor(file?: File, url?: string);
|
|
28
|
+
setNewFile(file: File): void;
|
|
29
|
+
setPreview(): void;
|
|
30
|
+
setPercentage(percentage: number): void;
|
|
31
|
+
setUrl(url: string): void;
|
|
32
|
+
setLoadingStatus(isLoading: boolean): void;
|
|
33
|
+
setErrorStatus(isError: boolean): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
getUid(): string;
|
|
36
|
+
getFile(): File | null;
|
|
37
|
+
getPercentage(): number;
|
|
38
|
+
getPreview(): string;
|
|
39
|
+
getUrl(): string;
|
|
40
|
+
getIsLoading(): boolean;
|
|
41
|
+
getIsError(): boolean;
|
|
42
|
+
getAll(): {
|
|
43
|
+
uid: string;
|
|
44
|
+
file: File | null;
|
|
45
|
+
percentage: number;
|
|
46
|
+
preview: string;
|
|
47
|
+
url: string;
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
isError: boolean;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import EventEmitter from 'events';
|
|
2
|
+
import uniqueId from 'lodash/uniqueId';
|
|
3
|
+
|
|
4
|
+
const uploadPictureBlockPrefix = 'mzn-upload-picture-block';
|
|
5
|
+
const uploadPictureBlockClasses = {
|
|
6
|
+
host: uploadPictureBlockPrefix,
|
|
7
|
+
disabled: `${uploadPictureBlockPrefix}--disabled`,
|
|
8
|
+
error: `${uploadPictureBlockPrefix}--error`,
|
|
9
|
+
loading: `${uploadPictureBlockPrefix}--loading`,
|
|
10
|
+
group: `${uploadPictureBlockPrefix}__group`,
|
|
11
|
+
status: `${uploadPictureBlockPrefix}__status`,
|
|
12
|
+
preview: `${uploadPictureBlockPrefix}__preview`,
|
|
13
|
+
delete: `${uploadPictureBlockPrefix}__delete`,
|
|
14
|
+
};
|
|
15
|
+
function toUploadPictureBlockCssVars(variables) {
|
|
16
|
+
const { percentage, } = variables;
|
|
17
|
+
return {
|
|
18
|
+
[`--${uploadPictureBlockPrefix}-percentage`]: percentage,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
class ImageUploader extends EventEmitter {
|
|
22
|
+
constructor(file, url) {
|
|
23
|
+
super();
|
|
24
|
+
this.uid = uniqueId('file_');
|
|
25
|
+
this.file = file || null;
|
|
26
|
+
this.percentage = 0;
|
|
27
|
+
this.preview = '';
|
|
28
|
+
this.url = url || '';
|
|
29
|
+
this.isLoading = false;
|
|
30
|
+
this.isError = false;
|
|
31
|
+
}
|
|
32
|
+
setNewFile(file) {
|
|
33
|
+
this.uid = uniqueId('file_');
|
|
34
|
+
this.file = file;
|
|
35
|
+
this.percentage = 0;
|
|
36
|
+
this.preview = '';
|
|
37
|
+
this.url = '';
|
|
38
|
+
this.isLoading = false;
|
|
39
|
+
this.isError = false;
|
|
40
|
+
this.emit('fileChange');
|
|
41
|
+
}
|
|
42
|
+
setPreview() {
|
|
43
|
+
if (this.file) {
|
|
44
|
+
const reader = new FileReader();
|
|
45
|
+
reader.addEventListener('load', () => {
|
|
46
|
+
this.preview = reader.result;
|
|
47
|
+
this.emit('previewChange');
|
|
48
|
+
});
|
|
49
|
+
reader.readAsDataURL(this.file);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
setPercentage(percentage) {
|
|
53
|
+
this.percentage = percentage;
|
|
54
|
+
this.emit('percentageChange');
|
|
55
|
+
}
|
|
56
|
+
setUrl(url) {
|
|
57
|
+
this.url = url;
|
|
58
|
+
this.emit('urlChange');
|
|
59
|
+
}
|
|
60
|
+
setLoadingStatus(isLoading) {
|
|
61
|
+
this.isLoading = isLoading;
|
|
62
|
+
this.emit('loadingStatusChange');
|
|
63
|
+
}
|
|
64
|
+
setErrorStatus(isError) {
|
|
65
|
+
this.isError = isError;
|
|
66
|
+
this.emit('errorStatusChange');
|
|
67
|
+
}
|
|
68
|
+
clear() {
|
|
69
|
+
this.file = null;
|
|
70
|
+
this.percentage = 0;
|
|
71
|
+
this.preview = '';
|
|
72
|
+
this.url = '';
|
|
73
|
+
this.isLoading = false;
|
|
74
|
+
this.isError = false;
|
|
75
|
+
this.emit('clear');
|
|
76
|
+
}
|
|
77
|
+
getUid() {
|
|
78
|
+
return this.uid;
|
|
79
|
+
}
|
|
80
|
+
getFile() {
|
|
81
|
+
return this.file;
|
|
82
|
+
}
|
|
83
|
+
getPercentage() {
|
|
84
|
+
return this.percentage;
|
|
85
|
+
}
|
|
86
|
+
getPreview() {
|
|
87
|
+
return this.preview;
|
|
88
|
+
}
|
|
89
|
+
getUrl() {
|
|
90
|
+
return this.url;
|
|
91
|
+
}
|
|
92
|
+
getIsLoading() {
|
|
93
|
+
return this.isLoading;
|
|
94
|
+
}
|
|
95
|
+
getIsError() {
|
|
96
|
+
return this.isError;
|
|
97
|
+
}
|
|
98
|
+
getAll() {
|
|
99
|
+
return {
|
|
100
|
+
uid: this.uid,
|
|
101
|
+
file: this.file,
|
|
102
|
+
percentage: this.percentage,
|
|
103
|
+
preview: this.preview,
|
|
104
|
+
url: this.url,
|
|
105
|
+
isLoading: this.isLoading,
|
|
106
|
+
isError: this.isError,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { ImageUploader, toUploadPictureBlockCssVars, uploadPictureBlockClasses, uploadPictureBlockPrefix };
|
package/upload/_index.scss
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@use '~@mezzanine-ui/system/palette';
|
|
2
|
+
@use '~@mezzanine-ui/system/transition';
|
|
3
|
+
@use '~@mezzanine-ui/system/spacing';
|
|
4
|
+
@use '~@mezzanine-ui/system/typography';
|
|
5
|
+
@use '../icon';
|
|
6
|
+
@use './upload-picture-block' as *;
|
|
7
|
+
|
|
8
|
+
$icon-size: 32px !default;
|
|
9
|
+
|
|
10
|
+
.#{$prefix} {
|
|
11
|
+
--#{$prefix}-status-color: #{palette.color(text-primary)};
|
|
12
|
+
--#{$prefix}-icon-color: #{palette.color(primary)};
|
|
13
|
+
--#{$prefix}-preview-opacity: 1;
|
|
14
|
+
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
background-color: palette.color(surface);
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
padding: 0;
|
|
23
|
+
border: 1px solid palette.color(border);
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
transition: transition.standard(border-color);
|
|
27
|
+
will-change: border-color;
|
|
28
|
+
|
|
29
|
+
.#{icon.$prefix} {
|
|
30
|
+
width: $icon-size;
|
|
31
|
+
height: $icon-size;
|
|
32
|
+
color: var(--#{$prefix}-icon-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__preview {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
opacity: var(--#{$prefix}-preview-opacity);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__status {
|
|
42
|
+
@include typography.variant(input2);
|
|
43
|
+
|
|
44
|
+
color: var(--#{$prefix}-status-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&__group {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
position: absolute;
|
|
53
|
+
padding: spacing.level(2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&__delete {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
position: absolute;
|
|
61
|
+
width: 100%;
|
|
62
|
+
height: 100%;
|
|
63
|
+
padding: 0;
|
|
64
|
+
border: none;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
transition: transition.standard(background-color), transition.standard(opacity);
|
|
69
|
+
will-change: background-color, opacity;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
&:not(.#{$prefix}--loading):not(.#{$prefix}--disabled) {
|
|
74
|
+
.#{$prefix}__delete {
|
|
75
|
+
background-color: palette.color(surface);
|
|
76
|
+
opacity: 0.9;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:not(.#{$prefix}--disabled):not(.#{$prefix}--error) {
|
|
81
|
+
border-color: palette.color(primary);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&--loading {
|
|
86
|
+
--#{$prefix}-preview-opacity: 0.15;
|
|
87
|
+
|
|
88
|
+
cursor: default;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
|
|
91
|
+
&::before {
|
|
92
|
+
position: absolute;
|
|
93
|
+
content: "";
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: 100%;
|
|
98
|
+
background-color: palette.color(primary-hover-bg);
|
|
99
|
+
transform-origin: left;
|
|
100
|
+
transform: scaleX(calc(var(--#{$prefix}-percentage, 0) / 100));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&--error {
|
|
105
|
+
--#{$prefix}-status-color: #{palette.color(error)};
|
|
106
|
+
--#{$prefix}-icon-color: #{palette.color(error)};
|
|
107
|
+
|
|
108
|
+
border-color: palette.color(error);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&--disabled {
|
|
112
|
+
--#{$prefix}-status-color: #{palette.color(text-disabled)};
|
|
113
|
+
--#{$prefix}-icon-color: #{palette.color(action-disabled)};
|
|
114
|
+
|
|
115
|
+
background-color: palette.color(action-disabled-bg);
|
|
116
|
+
border-color: palette.color(action-disabled-bg);
|
|
117
|
+
cursor: default;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use '~@mezzanine-ui/system/spacing';
|
|
2
|
+
@use './upload-picture-wall' as *;
|
|
3
|
+
|
|
4
|
+
$width: 128px !default;
|
|
5
|
+
$height: 128px !default;
|
|
6
|
+
$row-gap: spacing.level(3) !default;
|
|
7
|
+
$column-gap: spacing.level(3) !default;
|
|
8
|
+
$repeat: 3;
|
|
9
|
+
|
|
10
|
+
.#{$prefix} {
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-columns: repeat($repeat, minmax(0, $width));
|
|
13
|
+
row-gap: $row-gap;
|
|
14
|
+
column-gap: $column-gap;
|
|
15
|
+
|
|
16
|
+
&__item {
|
|
17
|
+
width: $width;
|
|
18
|
+
height: $height;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/upload/index.d.ts
CHANGED
package/upload/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { uploadInputClasses, uploadInputPrefix } from './uploadInput.js';
|
|
2
2
|
export { toUploadResultCssVars, uploadResultClasses, uploadResultPrefix } from './uploadResult.js';
|
|
3
|
+
export { uploadPictureClasses, uploadPicturePrefix } from './uploadPicture.js';
|
|
4
|
+
export { ImageUploader, toUploadPictureBlockCssVars, uploadPictureBlockClasses, uploadPictureBlockPrefix } from './UploadPictureBlock.js';
|
|
5
|
+
export { uploadPictureWallClasses, uploadPictureWallPrefix } from './UploadPictureWall.js';
|