plain-design 1.0.0-beta.95 → 1.0.0-beta.97

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.95",
3
+ "version": "1.0.0-beta.97",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -4,6 +4,7 @@
4
4
  border-radius: plv(box-size-normal-border-radius);
5
5
  position: relative;
6
6
  padding: 8px 16px;
7
+ line-height: initial;
7
8
 
8
9
  .alert-label {
9
10
  font-size: plv(font-size-small);
@@ -23,7 +24,7 @@
23
24
  position: absolute;
24
25
  width: $icon-width-normal;
25
26
  left: 0;
26
- top: 0.15em;
27
+ top: 0.075em;
27
28
  padding-top: inherit;
28
29
  display: inline-flex;
29
30
  align-items: center;
@@ -49,6 +49,12 @@
49
49
  .form-item-content {
50
50
  display: inline-block;
51
51
  box-sizing: border-box;
52
+
53
+ .form-item-content-inner {
54
+ & > .#{componentName(form-item)}:first-child {
55
+ margin-top: 0 !important;
56
+ }
57
+ }
52
58
  }
53
59
 
54
60
  &.form-item-label-align-left {
@@ -21,15 +21,19 @@ export function createScrollDraggier(
21
21
  getScroll,
22
22
  dataModel,
23
23
  getItemElements,
24
+ getHost,
25
+ getStrut,
24
26
  onDraggierStart,
25
27
  onDraggierMove,
26
28
  onDraggierEnd,
27
29
  onDraggierTap,
28
30
  }: {
29
31
  props: { horizontal: boolean },
30
- getScroll: () => PlainScroll | undefined,
32
+ getScroll: undefined | null | (() => PlainScroll | undefined),
31
33
  dataModel: { value: any[] | undefined | null },
32
34
  getItemElements: () => HTMLElement[],
35
+ getHost?: () => HTMLElement,
36
+ getStrut?: () => HTMLElement,
33
37
 
34
38
  onDraggierStart?: iVirtualDraggierHandler,
35
39
  onDraggierMove?: iVirtualDraggierHandler,
@@ -39,7 +43,7 @@ export function createScrollDraggier(
39
43
  ) {
40
44
 
41
45
  /*管理自动滚动*/
42
- const autoScrollManager = createAutoScrollManager(getScroll);
46
+ const autoScrollManager = !getScroll ? null : createAutoScrollManager(getScroll);
43
47
 
44
48
  /*静态变量*/
45
49
  const dragStaticState = {
@@ -83,11 +87,11 @@ export function createScrollDraggier(
83
87
  throw new Error(`Can't find [data-vid] elements!`);
84
88
  }
85
89
 
86
- dragStaticState.hostElement = findParentElement(dragStaticState.dragElement, el => hasClass(el, getComponentCls('scroll')))!;
90
+ dragStaticState.hostElement = getHost ? getHost() : findParentElement(dragStaticState.dragElement, el => hasClass(el, getComponentCls('scroll')))!;
87
91
  if (!dragStaticState.hostElement) {
88
92
  throw new Error(`Can't find host elements`);
89
93
  }
90
- dragStaticState.strutElement = findParentElement(dragStaticState.dragElement, el => hasClass(el, 'scroll-content'))!;
94
+ dragStaticState.strutElement = getStrut ? getStrut() : findParentElement(dragStaticState.dragElement, el => hasClass(el, 'scroll-content'))!;
91
95
  if (!dragStaticState.strutElement) {
92
96
  throw new Error(`Can't find strut elements`);
93
97
  }
@@ -200,14 +204,14 @@ export function createScrollDraggier(
200
204
  dragReactiveState.onScroll = (e: Event) => {
201
205
  update();
202
206
  };
203
- const ejectOnScroll = getScroll()!.on.onScroll(dragReactiveState.onScroll);
207
+ const ejectOnScroll = !getScroll ? null : getScroll()?.on.onScroll(dragReactiveState.onScroll);
204
208
  draggierEffects.push(() => {
205
- ejectOnScroll();
209
+ ejectOnScroll?.();
206
210
  dragReactiveState.onScroll = doNothing;
207
211
  });
208
212
 
209
213
  /*拖拽结束的时候停止自动滚动*/
210
- draggierEffects.push(() => getScroll()?.methods.stopAutoScroll());
214
+ draggierEffects.push(() => getScroll?.()?.methods.stopAutoScroll());
211
215
  draggierEffects.push(async () => {
212
216
  await dragReactiveState.endingDefer.promise;
213
217
  dragReactiveState.pointIndex = null;
@@ -301,11 +305,11 @@ export function createScrollDraggier(
301
305
  const resultStart = Math.max(minStart, Math.min(maxStart, newStart));
302
306
 
303
307
  if (resultStart == minStart) {
304
- autoScrollManager.set(props.horizontal ? 'left' : 'top');
308
+ autoScrollManager?.set(props.horizontal ? 'left' : 'top');
305
309
  } else if (resultStart == maxStart) {
306
- autoScrollManager.set(props.horizontal ? 'right' : 'bottom');
310
+ autoScrollManager?.set(props.horizontal ? 'right' : 'bottom');
307
311
  } else {
308
- autoScrollManager.set(null);
312
+ autoScrollManager?.set(null);
309
313
  }
310
314
 
311
315
  const styleName = props.horizontal ? 'left' : 'top';