plain-design 1.0.0-beta.149 → 1.0.0-beta.150
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/dist/plain-design.commonjs.min.js +1 -1
- package/dist/plain-design.min.css +2 -1
- package/dist/plain-design.min.js +1 -1
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/Image/image.scss +6 -1
- package/src/packages/components/Image/index.tsx +9 -2
- package/src/packages/components/Skeleton/index.tsx +44 -0
- package/src/packages/components/Skeleton/skeleton.scss +27 -0
- package/src/packages/entry.tsx +1 -0
package/package.json
CHANGED
|
@@ -278,7 +278,7 @@ div.#{componentName(image)} {
|
|
|
278
278
|
flex-direction: column;
|
|
279
279
|
align-items: center;
|
|
280
280
|
justify-content: center;
|
|
281
|
-
padding:
|
|
281
|
+
padding: 1em;
|
|
282
282
|
|
|
283
283
|
@include prefix(icon) {
|
|
284
284
|
font-size: 36px;
|
|
@@ -291,6 +291,7 @@ div.#{componentName(image)} {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
&.image-status-pending {
|
|
294
|
+
padding: 0;
|
|
294
295
|
@include prefix(loading) {
|
|
295
296
|
margin-bottom: 0;
|
|
296
297
|
}
|
|
@@ -331,4 +332,8 @@ div.#{componentName(image)} {
|
|
|
331
332
|
color: plv(primary-6);
|
|
332
333
|
}
|
|
333
334
|
}
|
|
335
|
+
|
|
336
|
+
&.image-status-empty, &.image-status-error {
|
|
337
|
+
aspect-ratio: 1;
|
|
338
|
+
}
|
|
334
339
|
}
|
|
@@ -6,6 +6,7 @@ import {Icon} from "../Icon";
|
|
|
6
6
|
import {LoadingMask} from "../LoadingMask";
|
|
7
7
|
import i18n from "../i18n";
|
|
8
8
|
import {$previewer} from "../$previewer";
|
|
9
|
+
import Skeleton from "../Skeleton";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 图片填充类型
|
|
@@ -146,12 +147,18 @@ export const Image = designComponent({
|
|
|
146
147
|
refs,
|
|
147
148
|
},
|
|
148
149
|
render: () => {
|
|
149
|
-
if (status.value === eImageStatus.empty || status.value === eImageStatus.
|
|
150
|
+
if (status.value === eImageStatus.empty || status.value === eImageStatus.error) {
|
|
150
151
|
return (
|
|
151
152
|
<div className={classes.value} style={styles.value} onClick={handler.onClick} ref={onRef.el}>
|
|
152
153
|
<Icon icon={status.value === eImageStatus.error ? 'pi-image-close' : 'pi-image'}/>
|
|
153
154
|
{!props.hideTips && <span>{tip[status.value]}</span>}
|
|
154
|
-
|
|
155
|
+
</div>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
if (status.value === eImageStatus.pending) {
|
|
159
|
+
return (
|
|
160
|
+
<div className={classes.value} style={styles.value} ref={onRef.el}>
|
|
161
|
+
<Skeleton full square={props.height == null}/>
|
|
155
162
|
</div>
|
|
156
163
|
);
|
|
157
164
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {designComponent, getComponentCls, useClasses, useStyles} from "@peryl/react-compose";
|
|
2
|
+
import './skeleton.scss';
|
|
3
|
+
import {unit} from "@peryl/utils/unit";
|
|
4
|
+
|
|
5
|
+
export const Skeleton = designComponent({
|
|
6
|
+
name: 'skeleton',
|
|
7
|
+
props: {
|
|
8
|
+
height: { type: String }, // 骨架高度
|
|
9
|
+
width: { type: String, default: '100%' }, // 骨架宽度
|
|
10
|
+
square: { type: Boolean }, // 根据宽度自适应为正方形
|
|
11
|
+
full: { type: Boolean }, // 适配宽高
|
|
12
|
+
round: { type: Boolean }, // 圆形圆角
|
|
13
|
+
radius: { type: String } // 自定义圆角
|
|
14
|
+
},
|
|
15
|
+
slots: ['default'],
|
|
16
|
+
setup({ props, slots }) {
|
|
17
|
+
|
|
18
|
+
const classes = useClasses(() => [
|
|
19
|
+
getComponentCls('skeleton'),
|
|
20
|
+
{
|
|
21
|
+
'skeleton-square': !props.height && props.square,
|
|
22
|
+
'skeleton-full': props.full,
|
|
23
|
+
}
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
const styles = useStyles(style => {
|
|
27
|
+
const { height, width } = props;
|
|
28
|
+
height != null && (style.height = height);
|
|
29
|
+
width != null && (style.width = width);
|
|
30
|
+
!!props.radius && (style.borderRadius = unit(props.radius));
|
|
31
|
+
!!props.round && (style.borderRadius = '9999px');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return () => {
|
|
35
|
+
return (
|
|
36
|
+
<div className={classes.value} style={styles.value}>
|
|
37
|
+
{slots.default()}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default Skeleton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@include prefix(skeleton) {
|
|
2
|
+
position: relative;
|
|
3
|
+
background: #f6f6f6 linear-gradient(to right, white 0, #e8e8e8 50%, white 100%);
|
|
4
|
+
background-size: 200% 100%;
|
|
5
|
+
background-position-x: 100%;
|
|
6
|
+
animation: loading 1500ms linear infinite;
|
|
7
|
+
|
|
8
|
+
&.skeleton-square {
|
|
9
|
+
aspect-ratio: 1;
|
|
10
|
+
}
|
|
11
|
+
&.skeleton-full {
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes loading {
|
|
18
|
+
0% {
|
|
19
|
+
background-position-x: 100%;
|
|
20
|
+
}
|
|
21
|
+
50% {
|
|
22
|
+
background-position-x: 0;
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
background-position-x: -100%;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/packages/entry.tsx
CHANGED
|
@@ -140,6 +140,7 @@ export type {iChatBoxHistory} from './components/AiChatBox';
|
|
|
140
140
|
export {$ai} from './components/$ai';
|
|
141
141
|
export type {iAiChoice, iAiChatResponse, iAiConfiguration, iAiHistory} from './components/$ai';
|
|
142
142
|
export {IconPicker} from './components/IconPicker';
|
|
143
|
+
export {Skeleton} from './components/Skeleton'
|
|
143
144
|
|
|
144
145
|
export {VirtualTable} from './components/VirtualTable';
|
|
145
146
|
export {Table} from './components/Table';
|