plain-design 1.0.0-beta.75 → 1.0.0-beta.77
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 +2 -2
- package/dist/plain-design.min.css +30 -28
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/Application/utils/application.utils.ts +2 -7
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +13 -0
- package/src/packages/components/Box/box.scss +6 -0
- package/src/packages/components/Box/index.tsx +29 -0
- package/src/packages/components/ColorPicker/color-picker.scss +6 -0
- package/src/packages/components/DatePicker/createDateRender.multiple.tsx +1 -0
- package/src/packages/components/DatePicker/createDateRender.single.tsx +1 -0
- package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +33 -25
- package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +11 -3
- package/src/packages/components/DatePicker/date.utils.tsx +2 -1
- package/src/packages/components/DatePicker/index.tsx +1 -1
- package/src/packages/components/DatePicker/useRangeDateRender.tsx +1 -0
- package/src/packages/components/Form/form.scss +17 -0
- package/src/packages/components/Form/index.tsx +9 -1
- package/src/packages/components/Form/layout/useFormLayout.tsx +3 -1
- package/src/packages/components/Form/validate/createValidation.tsx +6 -2
- package/src/packages/components/Form/validate/validate.utils.tsx +4 -1
- package/src/packages/components/FormItem/index.tsx +3 -3
- package/src/packages/components/Input/index.scss +32 -10
- package/src/packages/components/Input/index.tsx +14 -6
- package/src/packages/components/Input/input.utils.ts +1 -2
- package/src/packages/components/Input/useMultipleInput.tsx +15 -13
- package/src/packages/components/Input/useSingleInput.tsx +15 -13
- package/src/packages/components/Input/useTextareaInput.tsx +23 -20
- package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +12 -8
- package/src/packages/components/InputNumber/number.scss +6 -0
- package/src/packages/components/PageCard/index.tsx +48 -0
- package/src/packages/components/PageCard/page-card.scss +124 -0
- package/src/packages/components/PageCardContent/index.tsx +44 -0
- package/src/packages/components/PageCardTitle/index.tsx +51 -0
- package/src/packages/components/PageThemeUtils/index.tsx +3 -0
- package/src/packages/components/RollingNumber/index.tsx +66 -0
- package/src/packages/components/Space/index.tsx +7 -1
- package/src/packages/components/Space/space.scss +13 -0
- package/src/packages/components/Table/standard/PlcExpand.tsx +7 -1
- package/src/packages/components/Table/table/utils/table.utils.ts +1 -0
- package/src/packages/components/TimePicker/createRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSingleTimeRender.tsx +1 -0
- package/src/packages/components/TimePicker/index.tsx +1 -1
- package/src/packages/components/TimePicker/time.utils.ts +2 -1
- package/src/packages/components/TimePicker/useRangeTimeRender.tsx +1 -0
- package/src/packages/components/Toggle/index.tsx +6 -2
- package/src/packages/components/Toggle/toggle.scss +102 -98
- package/src/packages/components/VirtualList/useVirtualList.tsx +55 -32
- package/src/packages/components/useTooltip/index.tsx +2 -1
- package/src/packages/entry.tsx +20 -2
- package/src/packages/i18n/lang/en-us.ts +2 -0
- package/src/packages/i18n/lang/zh-cn.ts +2 -0
- package/src/packages/styles/global.import.scss +16 -0
- package/src/packages/uses/useStyle.tsx +8 -4
- package/src/packages/utils/renderInputModeTextRangeValue.tsx +25 -0
@@ -2,7 +2,7 @@ import {useTimeHooks} from "./useTimeHooks";
|
|
2
2
|
import {PDate} from "../../utils/plainDate";
|
3
3
|
import {ComponentEvent, ComponentPropsType, computed, ExtractPropTypes, PropType, tSlotsType} from "plain-design-composition";
|
4
4
|
import {EditProps, tEditComputed} from "../../uses/useEdit";
|
5
|
-
import {StyleProps} from "../../uses/useStyle";
|
5
|
+
import {StyleProps, tStyleComputed} from "../../uses/useStyle";
|
6
6
|
import {TimePanelProps} from "./panel/TimePanel";
|
7
7
|
import Input from "../Input";
|
8
8
|
import {iPopupEditorUseOption} from "../usePopupEditor";
|
@@ -39,6 +39,7 @@ export type tTimeCompositionParams = {
|
|
39
39
|
emit: ComponentEvent<typeof TimeEmitsOption>["emit"],
|
40
40
|
props: iTimePropsType,
|
41
41
|
editComputed: tEditComputed,
|
42
|
+
styleComputed: tStyleComputed,
|
42
43
|
slots: tSlotsType<typeof TimeSlotsOption>,
|
43
44
|
/*获取popper公共的属性设置*/
|
44
45
|
getPublicPopperAttrs: () => any,
|
@@ -209,6 +209,7 @@ export function useRangeTimeRender({ props, emit, onBlur, slots, displayPattern,
|
|
209
209
|
);
|
210
210
|
|
211
211
|
const getInputAttrs = () => ({
|
212
|
+
className: getComponentCls('time-picker'),
|
212
213
|
ref: onRef.input,
|
213
214
|
suffixIcon: 'pi-clock-circle',
|
214
215
|
placeValue: [startModel.value, endModel.value].join('-'),
|
@@ -4,6 +4,7 @@ import './toggle.scss';
|
|
4
4
|
import {EditProps, useEdit} from "../../uses/useEdit";
|
5
5
|
import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
|
6
6
|
import {getKey, KEY} from "../KeyboardService";
|
7
|
+
import i18n from "../i18n";
|
7
8
|
|
8
9
|
export const Toggle = designComponent({
|
9
10
|
name: '-toggle',
|
@@ -14,7 +15,7 @@ export const Toggle = designComponent({
|
|
14
15
|
modelValue: {}, // 双向绑定值
|
15
16
|
trueValue: { default: true as any }, // 选中时绑定的值
|
16
17
|
falseValue: { default: false as any }, // 未选中时绑定的值
|
17
|
-
square: { type: Boolean },
|
18
|
+
square: { type: Boolean }, // 方形开关
|
18
19
|
},
|
19
20
|
inheritPropsType: HTMLDivElement,
|
20
21
|
emits: {
|
@@ -53,6 +54,7 @@ export const Toggle = designComponent({
|
|
53
54
|
'toggle-active': state.isActive,
|
54
55
|
'toggle-disabled': editComputed.value.disabled,
|
55
56
|
'toggle-square': props.square,
|
57
|
+
'toggle-input-mode-text': styleComputed.value.inputMode === 'text',
|
56
58
|
},
|
57
59
|
]));
|
58
60
|
|
@@ -93,7 +95,9 @@ export const Toggle = designComponent({
|
|
93
95
|
return {
|
94
96
|
refer: { refs },
|
95
97
|
render: () => (
|
96
|
-
|
98
|
+
styleComputed.value.inputMode === 'text' ? (
|
99
|
+
<span className={classes.value}>{isChecked.value ? i18n.$it('base.yes').d('是') : i18n.$it('base.no').d('否')}</span>
|
100
|
+
) : <div
|
97
101
|
ref={onRef.el}
|
98
102
|
className={classes.value}
|
99
103
|
tabIndex={0}
|
@@ -1,79 +1,53 @@
|
|
1
1
|
@include prefix(toggle) {
|
2
|
-
background-color: plv(secondary-2);
|
3
|
-
position: relative;
|
4
|
-
outline: none;
|
5
|
-
display: inline-block;
|
6
|
-
vertical-align: middle;
|
7
|
-
user-select: none;
|
8
|
-
transition: background-color 300ms;
|
9
|
-
cursor: pointer;
|
10
|
-
border-radius: 100px;
|
11
|
-
|
12
|
-
.toggle-inner {
|
13
|
-
content: '';
|
14
|
-
position: absolute;
|
15
|
-
left: 2px;
|
16
|
-
top: 2px;
|
17
|
-
bottom: 2px;
|
18
|
-
background: white;
|
19
|
-
box-shadow: 0 3px 12px rgba(0, 0, 0, .16), 0 3px 1px rgba(0, 0, 0, .1);
|
20
|
-
transition: all 0.3s cubic-bezier(0.3, 1.3, 0.3, 1);
|
21
|
-
border-radius: inherit;
|
22
|
-
}
|
23
2
|
|
24
|
-
&:
|
25
|
-
position: absolute;
|
26
|
-
left: 2px;
|
27
|
-
right: 2px;
|
28
|
-
top: 2px;
|
29
|
-
bottom: 2px;
|
30
|
-
border-radius: inherit;
|
3
|
+
&:not(.toggle-input-mode-text) {
|
31
4
|
background-color: plv(secondary-2);
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
5
|
+
position: relative;
|
6
|
+
outline: none;
|
7
|
+
display: inline-block;
|
8
|
+
vertical-align: middle;
|
9
|
+
user-select: none;
|
10
|
+
transition: background-color 300ms;
|
11
|
+
cursor: pointer;
|
12
|
+
border-radius: 100px;
|
37
13
|
|
38
|
-
@include sizeMixin(toggle, ()) {
|
39
|
-
height: calc(#{$height} - 6px);
|
40
|
-
width: calc((#{$height} - 6px) * 52 / 32);
|
41
|
-
|
42
|
-
&.toggle-on {
|
43
|
-
.toggle-inner {
|
44
|
-
left: calc((#{$height} - 6px) * 52 / 32 - 2px - (#{$height} - 6px - 4px));
|
45
|
-
}
|
46
|
-
}
|
47
14
|
.toggle-inner {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
15
|
+
content: '';
|
16
|
+
position: absolute;
|
17
|
+
left: 2px;
|
18
|
+
top: 2px;
|
19
|
+
bottom: 2px;
|
20
|
+
background: white;
|
21
|
+
box-shadow: 0 3px 12px rgba(0, 0, 0, .16), 0 3px 1px rgba(0, 0, 0, .1);
|
22
|
+
transition: all 0.3s cubic-bezier(0.3, 1.3, 0.3, 1);
|
23
|
+
border-radius: inherit;
|
58
24
|
}
|
59
|
-
}
|
60
25
|
|
61
|
-
|
62
|
-
|
63
|
-
|
26
|
+
&:before {
|
27
|
+
position: absolute;
|
28
|
+
left: 2px;
|
29
|
+
right: 2px;
|
30
|
+
top: 2px;
|
31
|
+
bottom: 2px;
|
32
|
+
border-radius: inherit;
|
33
|
+
background-color: plv(secondary-2);
|
34
|
+
content: "";
|
35
|
+
transform: scaleX(1);
|
36
|
+
/*transform: scale3d(0, 0, 0);*/
|
37
|
+
transition: transform .3s;
|
64
38
|
}
|
65
39
|
|
66
40
|
@include sizeMixin(toggle, ()) {
|
67
41
|
height: calc(#{$height} - 6px);
|
68
|
-
width: calc((#{$height} - 6px) * 52 /
|
42
|
+
width: calc((#{$height} - 6px) * 52 / 32);
|
69
43
|
|
70
44
|
&.toggle-on {
|
71
45
|
.toggle-inner {
|
72
|
-
left: calc((#{$height} - 6px) /
|
46
|
+
left: calc((#{$height} - 6px) * 52 / 32 - 2px - (#{$height} - 6px - 4px));
|
73
47
|
}
|
74
48
|
}
|
75
49
|
.toggle-inner {
|
76
|
-
right: calc((#{$height} - 6px) /
|
50
|
+
right: calc((#{$height} - 6px) * 52 / 32 - 2px - (#{$height} - 6px - 4px));
|
77
51
|
}
|
78
52
|
&.toggle-active {
|
79
53
|
.toggle-inner {
|
@@ -85,63 +59,93 @@
|
|
85
59
|
}
|
86
60
|
}
|
87
61
|
}
|
88
|
-
}
|
89
62
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
transform: scale3d(0, 0, 0);
|
63
|
+
&.toggle-square {
|
64
|
+
&, & > .toggle-inner & > :before {
|
65
|
+
border-radius: plv(box-size-normal-border-radius);;
|
94
66
|
}
|
95
67
|
|
96
|
-
|
97
|
-
|
68
|
+
@include sizeMixin(toggle, ()) {
|
69
|
+
height: calc(#{$height} - 6px);
|
70
|
+
width: calc((#{$height} - 6px) * 52 / 30);
|
71
|
+
|
72
|
+
&.toggle-on {
|
73
|
+
.toggle-inner {
|
74
|
+
left: calc((#{$height} - 6px) / 2 + 8px);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
.toggle-inner {
|
78
|
+
right: calc((#{$height} - 6px) / 2 + 8px);
|
79
|
+
}
|
80
|
+
&.toggle-active {
|
81
|
+
.toggle-inner {
|
82
|
+
right: calc((#{$height} - 6px) / 2);
|
83
|
+
}
|
84
|
+
|
85
|
+
&.toggle-on .toggle-inner {
|
86
|
+
left: calc((#{$height} - 6px) / 2);
|
87
|
+
}
|
88
|
+
}
|
98
89
|
}
|
99
90
|
}
|
100
|
-
}
|
101
91
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
92
|
+
&.toggle-on {
|
93
|
+
&, &.toggle-square {
|
94
|
+
&:before {
|
95
|
+
transform: scale3d(0, 0, 0);
|
96
|
+
}
|
107
97
|
|
108
|
-
|
109
|
-
|
98
|
+
.toggle-inner {
|
99
|
+
right: 2px;
|
100
|
+
}
|
110
101
|
}
|
111
102
|
}
|
112
|
-
}
|
113
103
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
background-color: $color-4;
|
104
|
+
&.toggle-active {
|
105
|
+
&, &.toggle-square {
|
106
|
+
.toggle-inner {
|
107
|
+
left: 2px;
|
108
|
+
}
|
109
|
+
|
110
|
+
&.toggle-on .toggle-inner {
|
111
|
+
right: 2px;
|
112
|
+
}
|
124
113
|
}
|
125
|
-
}
|
126
|
-
}
|
114
|
+
}
|
127
115
|
|
128
|
-
|
129
|
-
|
116
|
+
@include statusMixin(toggle) {
|
117
|
+
&.toggle-on {
|
118
|
+
background-color: $color-6;
|
119
|
+
}
|
120
|
+
&:after {
|
121
|
+
border-color: $color-6;
|
122
|
+
}
|
123
|
+
/*&:focus {
|
124
|
+
.toggle-inner {
|
125
|
+
background-color: $color-4;
|
126
|
+
}
|
127
|
+
}*/
|
128
|
+
}
|
130
129
|
|
131
|
-
|
130
|
+
&.toggle-disabled {
|
131
|
+
cursor: not-allowed;
|
132
132
|
|
133
|
-
&:before {
|
134
133
|
background-color: plv(secondary-3);
|
135
|
-
}
|
136
134
|
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
&:before {
|
136
|
+
background-color: plv(secondary-3);
|
137
|
+
}
|
140
138
|
|
141
|
-
|
142
|
-
|
143
|
-
|
139
|
+
.toggle-inner {
|
140
|
+
background-color: #eee;
|
141
|
+
}
|
142
|
+
|
143
|
+
&.toggle-on {
|
144
|
+
@include statusMixin(toggle) {
|
145
|
+
background-color: $color-3;
|
146
|
+
}
|
144
147
|
}
|
145
148
|
}
|
146
149
|
}
|
150
|
+
|
147
151
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {computed, getComponentCls, onMounted, onUpdated, reactive, useClasses, useStyles, watch} from "plain-design-composition";
|
1
|
+
import {computed, getComponentCls, onBeforeUnmount, onMounted, onUpdated, reactive, useClasses, useStyles, watch} from "plain-design-composition";
|
2
2
|
import {createCounter} from 'plain-utils/utils/createCounter';
|
3
3
|
import {delay} from "plain-utils/utils/delay";
|
4
4
|
import './virtual-list.scss';
|
@@ -6,6 +6,7 @@ import Scroll from "../Scroll";
|
|
6
6
|
import {unit} from "plain-utils/string/unit";
|
7
7
|
import {createEnum} from "plain-utils/utils/createEnum";
|
8
8
|
import {PlainObject} from "plain-utils/utils/event";
|
9
|
+
import {addWindowListener} from "plain-utils/dom/addWindowListener";
|
9
10
|
|
10
11
|
interface DataNode {
|
11
12
|
start: number;
|
@@ -71,10 +72,29 @@ export function useVirtualList(
|
|
71
72
|
/*响应式属性*/
|
72
73
|
const state = reactive({
|
73
74
|
scrollValue: 0, // 当前滚动scrollTop(非实时的)
|
74
|
-
|
75
|
+
hostSize: null as null | number, // 容器高度
|
75
76
|
scrollDirection: ScrollDirection.none as typeof ScrollDirection.TYPE,
|
76
77
|
id2size: {} as Record<string, number | undefined>,
|
77
|
-
|
78
|
+
});
|
79
|
+
|
80
|
+
const _avgSize = computed((): number => {
|
81
|
+
const total = Object.values(state.id2size).reduce((prev, item) => {
|
82
|
+
if (item != null) {
|
83
|
+
prev.total += item;
|
84
|
+
prev.count++;
|
85
|
+
}
|
86
|
+
return prev;
|
87
|
+
}, { total: 0, count: 0 });
|
88
|
+
if (!!total.count) {
|
89
|
+
return Math.floor(total.total / total.count);
|
90
|
+
} else {
|
91
|
+
return props.size;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
const _pageSize = computed(() => {
|
96
|
+
if (state.hostSize == null) {return null;}
|
97
|
+
return Math.floor(state.hostSize / _avgSize.value);
|
78
98
|
});
|
79
99
|
|
80
100
|
const idMap = new WeakMap<PlainObject, string>();
|
@@ -88,7 +108,7 @@ export function useVirtualList(
|
|
88
108
|
id = nextRowId();
|
89
109
|
idMap.set(item, id);
|
90
110
|
}
|
91
|
-
const size: number = state.id2size[id] ||
|
111
|
+
const size: number = state.id2size[id] || _avgSize.value;
|
92
112
|
let start = prevEnd;
|
93
113
|
let end = start + size;
|
94
114
|
prevEnd = end;
|
@@ -102,7 +122,8 @@ export function useVirtualList(
|
|
102
122
|
* @date 2020/11/15 9:28
|
103
123
|
*/
|
104
124
|
const offsetData = computed((): { list: { item: any, id: string, index: number }[], startPageIndex: number, startIndex: number } => {
|
105
|
-
const
|
125
|
+
const pageSize = _pageSize.value;
|
126
|
+
const { scrollValue } = state;
|
106
127
|
if (!pageSize) {
|
107
128
|
return { list: [], startPageIndex: 0, startIndex: 0 };
|
108
129
|
}
|
@@ -113,7 +134,7 @@ export function useVirtualList(
|
|
113
134
|
startPageIndex: 0,
|
114
135
|
};
|
115
136
|
}
|
116
|
-
const { startIndex, endIndex, pageIndex } = utils.getPageIndex(scrollValue
|
137
|
+
const { startIndex, endIndex, pageIndex } = utils.getPageIndex(scrollValue);
|
117
138
|
return {
|
118
139
|
list: nodes.value.slice(startIndex, endIndex),
|
119
140
|
startPageIndex: pageIndex,
|
@@ -142,7 +163,7 @@ export function useVirtualList(
|
|
142
163
|
* @date 2020/12/16 10:48
|
143
164
|
*/
|
144
165
|
const strutStyles = useStyles(style => {
|
145
|
-
if (!
|
166
|
+
if (!_pageSize.value) {
|
146
167
|
return;
|
147
168
|
}
|
148
169
|
if (props.disabled) {
|
@@ -180,7 +201,7 @@ export function useVirtualList(
|
|
180
201
|
*/
|
181
202
|
const contentStyles = useStyles(style => {
|
182
203
|
|
183
|
-
if (!
|
204
|
+
if (!_pageSize.value) {
|
184
205
|
return;
|
185
206
|
}
|
186
207
|
if (props.disabled) {
|
@@ -257,11 +278,20 @@ export function useVirtualList(
|
|
257
278
|
* @author 韦胜健
|
258
279
|
* @date 2020/12/14 22:44
|
259
280
|
*/
|
260
|
-
getPageIndex: (scrollValue: number
|
281
|
+
getPageIndex: (scrollValue: number) => {
|
261
282
|
if (scrollValue < 0) {
|
262
283
|
scrollValue = 0;
|
263
284
|
}
|
285
|
+
const pageSize = _pageSize.value;
|
264
286
|
const data = dataModel.value || [];
|
287
|
+
if (pageSize == null) {
|
288
|
+
return {
|
289
|
+
data,
|
290
|
+
startIndex: 0,
|
291
|
+
endIndex: 0,
|
292
|
+
pageIndex: 0,
|
293
|
+
};
|
294
|
+
}
|
265
295
|
/*当前scrollTop对应的数据中数据的索引*/
|
266
296
|
let scrollIndex = utils.getIndex(scrollValue);
|
267
297
|
let pageIndex = Math.floor(scrollIndex / pageSize);
|
@@ -306,21 +336,16 @@ export function useVirtualList(
|
|
306
336
|
pageIndex,
|
307
337
|
};
|
308
338
|
},
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
}
|
316
|
-
if (!!footEl) {
|
317
|
-
hostSize -= footEl[props.horizontal ? 'offsetWidth' : 'offsetHeight'];
|
318
|
-
}
|
339
|
+
resetHostSize: () => {
|
340
|
+
const hostEl = refs.scroll?.refs.host;
|
341
|
+
if (!hostEl) {return;}
|
342
|
+
let hostSize = hostEl[props.horizontal ? 'offsetWidth' : 'offsetHeight'];
|
343
|
+
const headEl = hostEl.querySelector('[data-virtual-head]') as undefined | HTMLDivElement;
|
344
|
+
const footEl = hostEl.querySelector('[data-virtual-foot]') as undefined | HTMLDivElement;
|
345
|
+
if (!!headEl) {hostSize -= headEl[props.horizontal ? 'offsetWidth' : 'offsetHeight'];}
|
346
|
+
if (!!footEl) {hostSize -= footEl[props.horizontal ? 'offsetWidth' : 'offsetHeight'];}
|
319
347
|
|
320
|
-
|
321
|
-
if (newPageSize != state.pageSize) {
|
322
|
-
state.pageSize = newPageSize;
|
323
|
-
}
|
348
|
+
if (state.hostSize != hostSize) {state.hostSize = hostSize;}
|
324
349
|
},
|
325
350
|
};
|
326
351
|
|
@@ -335,7 +360,7 @@ export function useVirtualList(
|
|
335
360
|
const newScrollValue = (e.target as HTMLDivElement)[props.horizontal ? 'scrollLeft' : 'scrollTop'];
|
336
361
|
state.scrollDirection = newScrollValue > freezeState.scrollValue ? ScrollDirection.end : ScrollDirection.start;
|
337
362
|
freezeState.scrollValue = newScrollValue;
|
338
|
-
const current = utils.getPageIndex((e.target as HTMLDivElement).scrollTop
|
363
|
+
const current = utils.getPageIndex((e.target as HTMLDivElement).scrollTop);
|
339
364
|
state.scrollValue = (e.target as HTMLDivElement)[props.horizontal ? 'scrollLeft' : 'scrollTop'];
|
340
365
|
freezeState.current = current;
|
341
366
|
emit.onPageIndexChange(current);
|
@@ -344,7 +369,7 @@ export function useVirtualList(
|
|
344
369
|
|
345
370
|
watch(() => dataModel.value || [], (data: any[]) => {
|
346
371
|
delay().then(() => {
|
347
|
-
utils.
|
372
|
+
utils.resetHostSize();
|
348
373
|
});
|
349
374
|
if (props.disabled) {
|
350
375
|
return;
|
@@ -357,9 +382,13 @@ export function useVirtualList(
|
|
357
382
|
|
358
383
|
onMounted(async () => {
|
359
384
|
await delay(23);
|
360
|
-
utils.
|
385
|
+
utils.resetHostSize();
|
361
386
|
});
|
362
387
|
|
388
|
+
onBeforeUnmount(
|
389
|
+
addWindowListener('resize', () => delay(23).then(utils.resetHostSize))
|
390
|
+
);
|
391
|
+
|
363
392
|
onUpdated(async () => {
|
364
393
|
if (props.disabled) {
|
365
394
|
return;
|
@@ -370,7 +399,6 @@ export function useVirtualList(
|
|
370
399
|
await delay();
|
371
400
|
// console.log('dynamic scan height')
|
372
401
|
const elNodes = (refs.content?.querySelectorAll('[data-vid],[vid]') || []) as HTMLElement[];
|
373
|
-
let newAvgSize = state.avgSize;
|
374
402
|
|
375
403
|
for (let i = 0; i < elNodes.length; i++) {
|
376
404
|
const el = elNodes[i];
|
@@ -381,13 +409,8 @@ export function useVirtualList(
|
|
381
409
|
}
|
382
410
|
if (state.id2size[vid] != size) {
|
383
411
|
state.id2size[vid] = size;
|
384
|
-
newAvgSize = Number(((state.avgSize + size) / 2).toFixed(0));
|
385
412
|
}
|
386
413
|
}
|
387
|
-
|
388
|
-
if (newAvgSize != state.avgSize) {
|
389
|
-
state.avgSize = newAvgSize;
|
390
|
-
}
|
391
414
|
});
|
392
415
|
|
393
416
|
return {
|
@@ -2,6 +2,7 @@ import {createEffects} from 'plain-utils/utils/createEffects';
|
|
2
2
|
import {getComponentCls, nextTick, onBeforeUnmount, reactive, watch} from "plain-design-composition";
|
3
3
|
import {iPopupService, usePopup} from "../usePopup/usePopup";
|
4
4
|
import {iPopupUseOption} from "../usePopup/utils/popup.utils";
|
5
|
+
import {delay} from "plain-utils/utils/delay";
|
5
6
|
|
6
7
|
/**
|
7
8
|
* 提供两种用法,第一种实时地创建tooltip
|
@@ -147,7 +148,7 @@ export function createTooltip(option: iTooltipServiceOption, popup: iPopupServic
|
|
147
148
|
},
|
148
149
|
)
|
149
150
|
);
|
150
|
-
const close = () => popup.$popup.hide(popup.popupId);
|
151
|
+
const close = () => {delay(23).then(() => {popup.$popup.hide(popup.popupId);});};
|
151
152
|
effects.push(close);
|
152
153
|
return { close };
|
153
154
|
})();
|
package/src/packages/entry.tsx
CHANGED
@@ -116,6 +116,11 @@ export {StackCard} from './components/StackCard';
|
|
116
116
|
export {StackCardItem} from './components/StackCardItem';
|
117
117
|
export {SortList} from './components/SortList';
|
118
118
|
export {Space} from './components/Space';
|
119
|
+
export {Box} from './components/Box';
|
120
|
+
export {PageCard} from './components/PageCard';
|
121
|
+
export {PageCardTitle} from './components/PageCardTitle';
|
122
|
+
export {PageCardContent} from './components/PageCardContent';
|
123
|
+
export {RollingNumber} from './components/RollingNumber';
|
119
124
|
|
120
125
|
export {VirtualTable} from './components/VirtualTable';
|
121
126
|
export {Table} from './components/Table';
|
@@ -174,7 +179,7 @@ export type {
|
|
174
179
|
iTableOuterOperationConfig,
|
175
180
|
iTableOperationPermitConfig
|
176
181
|
} from './components/Table/standard/PlcOperation/PlcOperation.utils';
|
177
|
-
export {iTreeProps, iTreeState, iTreeKey2CheckStatus, iTreeKeyOrNode, iTreeNodeComputedData} from './components/TreeCore/TreeCore.type';
|
182
|
+
export type {iTreeProps, iTreeState, iTreeKey2CheckStatus, iTreeKeyOrNode, iTreeNodeComputedData} from './components/TreeCore/TreeCore.type';
|
178
183
|
|
179
184
|
export {$configuration} from './components/$configuration';
|
180
185
|
export {createAddressService} from './components/createAddressService';
|
@@ -216,6 +221,19 @@ export {FormToggle} from './components/FormToggle';
|
|
216
221
|
export {FilterFormSingle} from './components/FilterFormSingle';
|
217
222
|
export {FilterFormMultiple} from './components/FilterFormMultiple';
|
218
223
|
export {FilterService} from './components/FilterService';
|
224
|
+
export type {
|
225
|
+
iValidateRule,
|
226
|
+
iValidateState,
|
227
|
+
iAnotherRule,
|
228
|
+
iFormItemValidatePropsType,
|
229
|
+
iFormValidatePropsType,
|
230
|
+
iRegistrationValidator,
|
231
|
+
iValidateResult,
|
232
|
+
iValidateValueGetter,
|
233
|
+
iValidationDisabledFields,
|
234
|
+
iValidationReadonlyFields,
|
235
|
+
iValidatorParam,
|
236
|
+
} from './components/Form/validate/validate.utils';
|
219
237
|
|
220
238
|
export {TableOptionUtils} from './components/TableOptionUtils';
|
221
239
|
export {TableOptionSpace} from './components/TableOptionSpace';
|
@@ -238,7 +256,7 @@ export {createProvider} from './components/createProvider';
|
|
238
256
|
export {usePopupManager} from './components/usePopupManager';
|
239
257
|
export {useEdit, EditProps, EDIT_PROVIDER} from './uses/useEdit';
|
240
258
|
export type {tEditComputed, tEditControl, EditProvideData} from './uses/useEdit';
|
241
|
-
export {useStyle, StyleProps, ThemeShape, ThemeSize, ThemeStatus} from './uses/useStyle';
|
259
|
+
export {useStyle, StyleProps, ThemeShape, ThemeSize, ThemeStatus, InputMode} from './uses/useStyle';
|
242
260
|
export type {tStyleComputed, UseStyleProvideData} from './uses/useStyle';
|
243
261
|
export {AutoLoadingObserver} from './components/AutoLoadingObserver';
|
244
262
|
export {lighter, darken} from './utils/color.utils';
|
@@ -98,6 +98,22 @@
|
|
98
98
|
#{$attr}: plv(box-size-#{$key}-#{$attr});
|
99
99
|
}
|
100
100
|
@content;
|
101
|
+
|
102
|
+
&.mt{margin-top: $margin}
|
103
|
+
&.mb{margin-bottom: $margin}
|
104
|
+
&.ml{margin-left: $margin}
|
105
|
+
&.mr{margin-right: $margin}
|
106
|
+
&.mx{margin-left: $margin;margin-right: $margin}
|
107
|
+
&.my{margin-top: $margin;margin-bottom: $margin}
|
108
|
+
&.margin {margin: $margin}
|
109
|
+
|
110
|
+
&.pt{padding-top: $margin}
|
111
|
+
&.pb{padding-bottom: $margin}
|
112
|
+
&.pl{padding-left: $margin}
|
113
|
+
&.pr{padding-right: $margin}
|
114
|
+
&.px{padding-left: $margin;padding-right: $margin}
|
115
|
+
&.py{padding-top: $margin;padding-bottom: $margin}
|
116
|
+
&.padding {padding: $margin}
|
101
117
|
}
|
102
118
|
}
|
103
119
|
}
|
@@ -12,22 +12,25 @@ export const ThemeMode = createEnum(['fill', 'flat', 'outline', 'text', 'stroke'
|
|
12
12
|
export const ThemeStatus = createEnum(['secondary', 'primary', 'success', 'warn', 'error'] as const);
|
13
13
|
export const ThemeShape = createEnum(['square', 'round', 'none'] as const);
|
14
14
|
export const ThemeSize = createEnum(['large', 'normal', 'small', 'mini'] as const);
|
15
|
-
export const InputMode = createEnum(['flat', 'stroke'] as const);
|
15
|
+
export const InputMode = createEnum(['flat', 'stroke', 'text'] as const);
|
16
16
|
|
17
17
|
export const StyleProps = {
|
18
18
|
shape: { type: String as PropType<typeof ThemeShape.TYPE> }, // 'square', 'round'
|
19
19
|
size: { type: String as PropType<typeof ThemeSize.TYPE> }, // 'large', 'normal', 'small', 'mini'
|
20
20
|
status: { type: String as PropType<typeof ThemeStatus.TYPE> }, // 'secondary', 'primary', 'success', 'warn', 'error'
|
21
|
+
inputMode: { type: String as PropType<typeof InputMode.TYPE> }, // input的样式类型,flat填充,stroke线型
|
21
22
|
} as const;
|
22
23
|
|
23
24
|
export interface UseStyleProvideData {
|
24
25
|
shape: typeof ThemeShape.TYPE,
|
25
26
|
size: typeof ThemeSize.TYPE,
|
26
27
|
status?: typeof ThemeStatus.TYPE,
|
28
|
+
inputMode?: typeof InputMode.TYPE,
|
29
|
+
|
27
30
|
default: {
|
28
31
|
shape: typeof ThemeShape.TYPE,
|
29
32
|
size: typeof ThemeSize.TYPE,
|
30
|
-
inputMode:
|
33
|
+
inputMode: typeof InputMode.TYPE,
|
31
34
|
buttonMode: typeof ThemeMode.TYPE,
|
32
35
|
},
|
33
36
|
}
|
@@ -44,14 +47,15 @@ export const useStyle = useFunctionWrapper('style', (ctx, option: UseStyleOption
|
|
44
47
|
const parent = inject(USE_STYLE_PROVIDER, null) as null | { value: UseStyleProvideData };
|
45
48
|
|
46
49
|
const styleComputed = computed(() => {
|
47
|
-
const defaultData = Object.assign({ shape: applicationConfiguration.value.default.shape, size: applicationConfiguration.value.default.size }, option);
|
50
|
+
const defaultData = Object.assign({ shape: applicationConfiguration.value.default.shape, size: applicationConfiguration.value.default.size, inputMode: applicationConfiguration.value.default.inputMode }, option);
|
48
51
|
|
49
|
-
const { shape, size, status } = ctx.props;
|
52
|
+
const { shape, size, status, inputMode } = ctx.props;
|
50
53
|
const parentData = !!parent ? parent.value : {} as any;
|
51
54
|
let data: UseStyleProvideData = {
|
52
55
|
shape: shape || parentData.shape || defaultData.shape,
|
53
56
|
size: size || parentData.size || defaultData.size,
|
54
57
|
status: status || parentData.status || defaultData.status,
|
58
|
+
inputMode: inputMode || parentData.inputMode || defaultData.inputMode,
|
55
59
|
default: applicationConfiguration.value.default
|
56
60
|
};
|
57
61
|
if (!!defaultData.adjust) {
|