snail.vue 1.0.24 → 1.0.26

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.
@@ -1,4 +1,5 @@
1
- import { AlignStyle, SizeOptions } from 'snail.view';
1
+ import * as snail_view from 'snail.view';
2
+ import { AlignStyle, WidthStyle, FlexStyle, BorderStyle, PaddingStyle, HeightStyle } from 'snail.view';
2
3
  import * as vue from 'vue';
3
4
  import { Component, App, Ref, ShallowRef } from 'vue';
4
5
  import { IScope } from 'snail.core';
@@ -13,10 +14,11 @@ type LoadingOptions = {
13
14
  */
14
15
  show: boolean;
15
16
  /**
16
- * 展示遮罩层
17
- * - 默认值:false,显示遮罩层
17
+ * 禁用【遮罩层】
18
+ * - false 显示遮罩层
19
+ * - true 不显示遮罩层
18
20
  */
19
- disabledMask?: boolean;
21
+ maskDisabled?: boolean;
20
22
  /**
21
23
  * loading的根样式
22
24
  * - 外部传入后,可进行自由定制loading样式
@@ -116,7 +118,7 @@ type InputOptions = {
116
118
  * - 对齐方式
117
119
  * - 标题区域宽度
118
120
  */
119
- titleStyle?: AlignStyle & SizeOptions;
121
+ titleStyle?: AlignStyle & WidthStyle & FlexStyle;
120
122
  };
121
123
  /**
122
124
  * 输入框事件
@@ -202,73 +204,17 @@ type TableStyleOptions = {
202
204
  /**
203
205
  * 高度
204
206
  */
205
- height?: number;
206
- /**
207
- * 高度单位
208
- * - 默认 px
209
- */
210
- heightUnit?: "px" | "rem" | "vw" | "vh";
207
+ height?: string;
211
208
  };
212
209
  /**
213
210
  * Table 行配置选项
214
211
  */
215
- type TableRowOptions = {
216
- /**
217
- * 行高
218
- */
219
- height: number;
220
- /**
221
- * 行高单位
222
- * - 默认px
223
- */
224
- unit?: "px" | "rem" | "vw" | "vh";
225
- };
212
+ type TableRowOptions = HeightStyle & {};
226
213
  /**
227
214
  * Table 列配置选项
215
+ * - border 样式需要配合TableOptions.border使用,否则会导致边框线重叠
228
216
  */
229
- type TableColOptions = {
230
- /**
231
- * 列占比
232
- * - 存在时,width属性无效
233
- */
234
- flex?: number;
235
- /**
236
- * 列宽
237
- */
238
- width?: number;
239
- /**
240
- * 列最小宽度
241
- * - width属性未指定、或者无效时生效;
242
- * - 推荐和flex搭配使用
243
- */
244
- minWidth?: number;
245
- /**
246
- * 列最大宽度
247
- * - width属性未指定、或者无效时生效;
248
- * - 推荐和flex搭配使用
249
- */
250
- maxWidth?: number;
251
- /**
252
- * 列宽单位
253
- * - 默认px
254
- */
255
- unit?: "px" | "rem" | "vw" | "vh";
256
- /**
257
- * 列对齐方式
258
- * - 默认left
259
- */
260
- align?: "left" | "center" | "right";
261
- /**
262
- * border样式
263
- * - 完整的border样式;如 1px soloid #000000
264
- * - 需要配合TableOptions.border使用,否则会导致边框线重叠
265
- */
266
- borderStyle?: string;
267
- /**
268
- * padding样式
269
- */
270
- paddingStyle?: string;
271
- };
217
+ type TableColOptions = FlexStyle & WidthStyle & Pick<AlignStyle, "align"> & Pick<BorderStyle, "border"> & Pick<PaddingStyle, "padding">;
272
218
 
273
219
  /**
274
220
  * 折叠面板配置选项
@@ -284,10 +230,10 @@ type FoldOptions = {
284
230
  */
285
231
  subtitle?: string;
286
232
  /**
287
- * 使用禁用【折叠】功能
233
+ * 禁用【折叠】功能
288
234
  * - true 则禁用折叠,始终展开内容区域
289
235
  */
290
- disable?: boolean;
236
+ disabled?: boolean;
291
237
  };
292
238
  /**
293
239
  * 折叠状态
@@ -438,7 +384,7 @@ type HeaderOptions = {
438
384
  /** 禁用【关闭】按钮
439
385
  * - 默认值false
440
386
  */
441
- closeDisable?: boolean;
387
+ closeDisabled?: boolean;
442
388
  };
443
389
  /**
444
390
  * 头部事件
@@ -473,7 +419,7 @@ type FooterOptions = {
473
419
  * 禁用【取消】按钮
474
420
  * - 为true时,不显示【取消】按钮
475
421
  */
476
- cancelDisable?: boolean;
422
+ cancelDisabled?: boolean;
477
423
  /**
478
424
  * 【确定】按钮名称
479
425
  * - 默认【确定】
@@ -483,7 +429,7 @@ type FooterOptions = {
483
429
  * 禁用【确定】按钮
484
430
  * - 为true时,不显示【确定】按钮
485
431
  */
486
- confirmDisable?: boolean;
432
+ confirmDisabled?: boolean;
487
433
  };
488
434
  /**
489
435
  * 底部组件事件
@@ -699,7 +645,7 @@ type ConfirmOptions = {
699
645
  * 禁用【取消】按钮
700
646
  * - 为true时,不显示【取消】按钮
701
647
  */
702
- cancelDisable?: boolean;
648
+ cancelDisabled?: boolean;
703
649
  /**
704
650
  * 【确定】按钮名称
705
651
  * - 默认【确定】
@@ -709,7 +655,7 @@ type ConfirmOptions = {
709
655
  * 禁用【确定】按钮
710
656
  * - 为true时,不显示【确定】按钮
711
657
  */
712
- confirmDisable?: boolean;
658
+ confirmDisabled?: boolean;
713
659
  };
714
660
  /**
715
661
  * 确认弹窗句柄
@@ -945,18 +891,18 @@ declare const components: {
945
891
  };
946
892
  });
947
893
  TableRow: {
948
- new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<TableRowOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
894
+ new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<snail_view.HeightStyle> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, true, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
949
895
  P: {};
950
896
  B: {};
951
897
  D: {};
952
898
  C: {};
953
899
  M: {};
954
900
  Defaults: {};
955
- }, Readonly<TableRowOptions> & Readonly<{}>, {}, {}, {}, {}, {}>;
901
+ }, Readonly<snail_view.HeightStyle> & Readonly<{}>, {}, {}, {}, {}, {}>;
956
902
  __isFragment?: never;
957
903
  __isTeleport?: never;
958
904
  __isSuspense?: never;
959
- } & vue.ComponentOptionsBase<Readonly<TableRowOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
905
+ } & vue.ComponentOptionsBase<Readonly<snail_view.HeightStyle> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
960
906
  $slots: {
961
907
  default?: (props: {}) => any;
962
908
  };
package/dist/snail.vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  //@ sourceURL=/snail.vue.js
2
2
  import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList, useTemplateRef, onUnmounted, createVNode, normalizeStyle, TransitionGroup, withModifiers, createApp, onMounted } from 'vue';
3
3
  import { tidyString, throwError, mustString, mustFunction, useScope, isStringNotEmpty, isObject, script, delay, getMessage, useHook, mustObject, defer, newId, isFunction } from 'snail.core';
4
- import { link, useAnimation, style, useObserver } from 'snail.view';
4
+ import { link, useAnimation, css, useObserver } from 'snail.view';
5
5
 
6
6
  var _sfc_main$h = defineComponent({
7
7
  ...{
@@ -23,6 +23,10 @@ var _sfc_main$h = defineComponent({
23
23
  }
24
24
  });
25
25
 
26
+ var addLink = href => setTimeout(link.register, 0, href);
27
+
28
+ addLink("/styles/snail.vue.vue.css");
29
+
26
30
  var _sfc_main$g = defineComponent({
27
31
  ...{
28
32
  name: "Footer",
@@ -35,11 +39,11 @@ var _sfc_main$g = defineComponent({
35
39
  type: Boolean
36
40
  },
37
41
  cancelName: {},
38
- cancelDisable: {
42
+ cancelDisabled: {
39
43
  type: Boolean
40
44
  },
41
45
  confirmName: {},
42
- confirmDisable: {
46
+ confirmDisabled: {
43
47
  type: Boolean
44
48
  }
45
49
  },
@@ -55,13 +59,13 @@ var _sfc_main$g = defineComponent({
55
59
  class: normalizeClass(["snail-footer", {
56
60
  "start-divider": props.divider
57
61
  }, props.align || "right"])
58
- }, [renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisable != true ? (openBlock(), createBlock(_sfc_main$h, {
62
+ }, [renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisabled != true ? (openBlock(), createBlock(_sfc_main$h, {
59
63
  key: 0,
60
64
  size: "max",
61
65
  type: "default",
62
66
  onClick: _cache[0] || (_cache[0] = $event => emit("cancel")),
63
67
  textContent: toDisplayString(props.cancelName || "取消")
64
- }, null, 8, ["textContent"])) : createCommentVNode("", true), props.confirmDisable != true ? (openBlock(), createBlock(_sfc_main$h, {
68
+ }, null, 8, ["textContent"])) : createCommentVNode("", true), props.confirmDisabled != true ? (openBlock(), createBlock(_sfc_main$h, {
65
69
  key: 1,
66
70
  size: "max",
67
71
  type: "primary",
@@ -135,10 +139,6 @@ var _sfc_main$f = defineComponent({
135
139
  }
136
140
  });
137
141
 
138
- var addLink = href => setTimeout(link.register, 0, href);
139
-
140
- addLink("/styles/snail.vue.vue.css");
141
-
142
142
  const _hoisted_1$8 = ["textContent"];
143
143
  var _sfc_main$e = defineComponent({
144
144
  ...{
@@ -159,7 +159,7 @@ var _sfc_main$e = defineComponent({
159
159
  titleAlign: {
160
160
  default: "center"
161
161
  },
162
- closeDisable: {
162
+ closeDisabled: {
163
163
  type: Boolean,
164
164
  default: false
165
165
  }
@@ -184,7 +184,7 @@ var _sfc_main$e = defineComponent({
184
184
  key: 0,
185
185
  textContent: toDisplayString(_ctx.title),
186
186
  class: normalizeClass(["header-title", _ctx.titleAlign])
187
- }, null, 10, _hoisted_1$8)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), _ctx.closeDisable != true ? (openBlock(), createBlock(_sfc_main$f, mergeProps({
187
+ }, null, 10, _hoisted_1$8)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), _ctx.closeDisabled != true ? (openBlock(), createBlock(_sfc_main$f, mergeProps({
188
188
  key: 1,
189
189
  class: "close-icon"
190
190
  }, closeIconOptions.value, {
@@ -274,7 +274,7 @@ var _sfc_main$c = defineComponent({
274
274
  type: Boolean,
275
275
  default: false
276
276
  },
277
- disabledMask: {
277
+ maskDisabled: {
278
278
  type: Boolean,
279
279
  default: false
280
280
  },
@@ -293,7 +293,7 @@ var _sfc_main$c = defineComponent({
293
293
  default: withCtx(() => [_ctx.show ? (openBlock(), createElementBlock("div", {
294
294
  key: 0,
295
295
  class: normalizeClass(["snail-loading", {
296
- "show-mask": _ctx.disabledMask != true
296
+ "show-mask": _ctx.maskDisabled != true
297
297
  }, _ctx.rootClass])
298
298
  }, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.$attrs)))], 2)) : createCommentVNode("", true)]),
299
299
  _: 3
@@ -406,7 +406,7 @@ var _sfc_main$a = defineComponent({
406
406
  props: mergeModels({
407
407
  title: {},
408
408
  subtitle: {},
409
- disable: {
409
+ disabled: {
410
410
  type: Boolean
411
411
  }
412
412
  }, {
@@ -490,7 +490,7 @@ var _sfc_main$a = defineComponent({
490
490
  key: 0,
491
491
  class: "subtitle",
492
492
  textContent: toDisplayString(props.subtitle)
493
- }, null, 8, _hoisted_3$2)) : createCommentVNode("", true), props.disable != true ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("span", {
493
+ }, null, 8, _hoisted_3$2)) : createCommentVNode("", true), props.disabled != true ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("span", {
494
494
  title: status.value == "expand" ? "收起" : "展开",
495
495
  ref: "foldStatusSpan"
496
496
  }, [createVNode(_sfc_main$f, {
@@ -560,7 +560,7 @@ var _sfc_main$8 = defineComponent({
560
560
  styleOptions = styleOptions || {};
561
561
  const style = Object.create(null);
562
562
  styleOptions.background && (style.background = styleOptions.background);
563
- styleOptions.height && (style.height = styleOptions.height + (styleOptions.heightUnit || "px"));
563
+ styleOptions.height && (style.height = styleOptions.height);
564
564
  return style;
565
565
  }
566
566
  return (_ctx, _cache) => {
@@ -571,10 +571,10 @@ var _sfc_main$8 = defineComponent({
571
571
  "scroll-x": props.scrollX,
572
572
  "scroll-y": props.scrollY
573
573
  }, {
574
- default: withCtx(() => [createElementVNode("header", {
574
+ default: withCtx(() => [createElementVNode("div", {
575
575
  class: "table-header",
576
576
  style: normalizeStyle(getStyle(props.headerStyle))
577
- }, [renderSlot(_ctx.$slots, "header")], 4), createElementVNode("main", _hoisted_1$6, [renderSlot(_ctx.$slots, "default")]), createElementVNode("footer", {
577
+ }, [renderSlot(_ctx.$slots, "header")], 4), createElementVNode("div", _hoisted_1$6, [renderSlot(_ctx.$slots, "default")]), createElementVNode("div", {
578
578
  class: "table-footer",
579
579
  style: normalizeStyle(getStyle(props.footerStyle))
580
580
  }, [renderSlot(_ctx.$slots, "footer")], 4)]),
@@ -592,15 +592,12 @@ var _sfc_main$7 = defineComponent({
592
592
  __name: "table-row",
593
593
  props: {
594
594
  height: {},
595
- unit: {}
595
+ minHeight: {},
596
+ maxHeight: {}
596
597
  },
597
598
  setup(__props) {
598
599
  const props = __props;
599
- const rowStyle = computed(() => {
600
- const style = Object.create(null);
601
- props.height > 0 && (style.height = props.height + (props.unit || "px"));
602
- return style;
603
- });
600
+ const rowStyle = computed(() => css.buildStyle(props));
604
601
  return (_ctx, _cache) => {
605
602
  return openBlock(), createElementBlock("div", {
606
603
  class: "table-row",
@@ -618,27 +615,19 @@ var _sfc_main$6 = defineComponent({
618
615
  __name: "table-col",
619
616
  props: {
620
617
  flex: {},
618
+ flexBasis: {},
619
+ flexGrow: {},
620
+ flexShrink: {},
621
621
  width: {},
622
622
  minWidth: {},
623
623
  maxWidth: {},
624
- unit: {},
625
624
  align: {},
626
- borderStyle: {},
627
- paddingStyle: {}
625
+ border: {},
626
+ padding: {}
628
627
  },
629
628
  setup(__props) {
630
629
  const props = __props;
631
- const colStyle = computed(() => {
632
- const style = Object.create(null);
633
- props.flex != void 0 ? style.flex = String(props.flex) : props.width && (style.width = props.width + (props.unit || "px"));
634
- if (props.flex != void 0 || props.width == void 0) {
635
- props.minWidth && (style.minWidth = props.minWidth + (props.unit || "px"));
636
- props.maxWidth && (style.maxWidth = props.maxWidth + (props.unit || "px"));
637
- }
638
- props.borderStyle && (style.border = props.borderStyle);
639
- props.paddingStyle && (style.padding = props.paddingStyle);
640
- return style;
641
- });
630
+ const colStyle = computed(() => css.buildStyle(props));
642
631
  return (_ctx, _cache) => {
643
632
  return openBlock(), createElementBlock("div", {
644
633
  class: normalizeClass(["table-col", props.align]),
@@ -782,10 +771,7 @@ const initVueApp = (() => {
782
771
  })();
783
772
 
784
773
  function getTitleStyle(options, isFlex) {
785
- return options && options.titleStyle ? style.build({
786
- ...options.titleStyle,
787
- width: options.titleStyle
788
- }, isFlex) : Object.create(null);
774
+ return options && options.titleStyle ? css.buildStyle(options.titleStyle, isFlex) : Object.create(null);
789
775
  }
790
776
 
791
777
  const _hoisted_1$4 = ["textContent"];
@@ -968,11 +954,11 @@ var _sfc_main$2 = defineComponent({
968
954
  title: {},
969
955
  message: {},
970
956
  cancelName: {},
971
- cancelDisable: {
957
+ cancelDisabled: {
972
958
  type: Boolean
973
959
  },
974
960
  confirmName: {},
975
- confirmDisable: {
961
+ confirmDisabled: {
976
962
  type: Boolean
977
963
  },
978
964
  inDialog: {
@@ -997,9 +983,9 @@ var _sfc_main$2 = defineComponent({
997
983
  }, null, 8, _hoisted_2$1), createVNode(_sfc_main$g, {
998
984
  align: "right",
999
985
  "cancel-name": props.cancelName,
1000
- "cancel-disable": props.cancelDisable,
986
+ "cancel-disable": props.cancelDisabled,
1001
987
  "confirm-name": props.confirmName,
1002
- "confirm-disable": props.confirmDisable,
988
+ "confirm-disable": props.confirmDisabled,
1003
989
  onCancel: _cache[1] || (_cache[1] = $event => props.closeDialog(false)),
1004
990
  onConfirm: _cache[2] || (_cache[2] = $event => props.closeDialog(true))
1005
991
  }, null, 8, ["cancel-name", "cancel-disable", "confirm-name", "confirm-disable"])]);
@@ -1069,6 +1055,7 @@ var _sfc_main$1 = defineComponent({
1069
1055
  emit: __emit
1070
1056
  } = _ref;
1071
1057
  const emit = __emit;
1058
+ const observer = useObserver();
1072
1059
  const isTouch = "ontouchstart" in window;
1073
1060
  const dragHandle = useTemplateRef("dragHandle");
1074
1061
  const dragInfo = ref({
@@ -1106,10 +1093,11 @@ var _sfc_main$1 = defineComponent({
1106
1093
  }
1107
1094
  }
1108
1095
  }
1109
- isTouch || onMounted(() => {
1110
- addEventListener("mousemove", onDragMove);
1111
- addEventListener("mouseup", onDragEnd);
1096
+ isTouch || onMounted(function () {
1097
+ observer.onEvent(window, "mousemove", onDragMove);
1098
+ observer.onEvent(window, "mouseup", onDragEnd);
1112
1099
  });
1100
+ onUnmounted(observer.destroy);
1113
1101
  return (_ctx, _cache) => {
1114
1102
  return openBlock(), createElementBlock("div", {
1115
1103
  class: normalizeClass(["snail-drag-verify", {
@@ -37,11 +37,11 @@
37
37
  type: Boolean
38
38
  },
39
39
  cancelName: {},
40
- cancelDisable: {
40
+ cancelDisabled: {
41
41
  type: Boolean
42
42
  },
43
43
  confirmName: {},
44
- confirmDisable: {
44
+ confirmDisabled: {
45
45
  type: Boolean
46
46
  }
47
47
  },
@@ -57,13 +57,13 @@
57
57
  class: vue.normalizeClass(["snail-footer", {
58
58
  "start-divider": props.divider
59
59
  }, props.align || "right"])
60
- }, [vue.renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisable != true ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
60
+ }, [vue.renderSlot(_ctx.$slots, "default", {}, () => [props.cancelDisabled != true ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
61
61
  key: 0,
62
62
  size: "max",
63
63
  type: "default",
64
64
  onClick: _cache[0] || (_cache[0] = $event => emit("cancel")),
65
65
  textContent: vue.toDisplayString(props.cancelName || "取消")
66
- }, null, 8, ["textContent"])) : vue.createCommentVNode("", true), props.confirmDisable != true ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
66
+ }, null, 8, ["textContent"])) : vue.createCommentVNode("", true), props.confirmDisabled != true ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
67
67
  key: 1,
68
68
  size: "max",
69
69
  type: "primary",
@@ -157,7 +157,7 @@
157
157
  titleAlign: {
158
158
  default: "center"
159
159
  },
160
- closeDisable: {
160
+ closeDisabled: {
161
161
  type: Boolean,
162
162
  default: false
163
163
  }
@@ -182,7 +182,7 @@
182
182
  key: 0,
183
183
  textContent: vue.toDisplayString(_ctx.title),
184
184
  class: vue.normalizeClass(["header-title", _ctx.titleAlign])
185
- }, null, 10, _hoisted_1$8)) : vue.createCommentVNode("", true), vue.renderSlot(_ctx.$slots, "default"), _ctx.closeDisable != true ? (vue.openBlock(), vue.createBlock(_sfc_main$f, vue.mergeProps({
185
+ }, null, 10, _hoisted_1$8)) : vue.createCommentVNode("", true), vue.renderSlot(_ctx.$slots, "default"), _ctx.closeDisabled != true ? (vue.openBlock(), vue.createBlock(_sfc_main$f, vue.mergeProps({
186
186
  key: 1,
187
187
  class: "close-icon"
188
188
  }, closeIconOptions.value, {
@@ -272,7 +272,7 @@
272
272
  type: Boolean,
273
273
  default: false
274
274
  },
275
- disabledMask: {
275
+ maskDisabled: {
276
276
  type: Boolean,
277
277
  default: false
278
278
  },
@@ -291,7 +291,7 @@
291
291
  default: vue.withCtx(() => [_ctx.show ? (vue.openBlock(), vue.createElementBlock("div", {
292
292
  key: 0,
293
293
  class: vue.normalizeClass(["snail-loading", {
294
- "show-mask": _ctx.disabledMask != true
294
+ "show-mask": _ctx.maskDisabled != true
295
295
  }, _ctx.rootClass])
296
296
  }, [vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)))], 2)) : vue.createCommentVNode("", true)]),
297
297
  _: 3
@@ -404,7 +404,7 @@
404
404
  props: vue.mergeModels({
405
405
  title: {},
406
406
  subtitle: {},
407
- disable: {
407
+ disabled: {
408
408
  type: Boolean
409
409
  }
410
410
  }, {
@@ -488,7 +488,7 @@
488
488
  key: 0,
489
489
  class: "subtitle",
490
490
  textContent: vue.toDisplayString(props.subtitle)
491
- }, null, 8, _hoisted_3$2)) : vue.createCommentVNode("", true), props.disable != true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [vue.createElementVNode("span", {
491
+ }, null, 8, _hoisted_3$2)) : vue.createCommentVNode("", true), props.disabled != true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [vue.createElementVNode("span", {
492
492
  title: status.value == "expand" ? "收起" : "展开",
493
493
  ref: "foldStatusSpan"
494
494
  }, [vue.createVNode(_sfc_main$f, {
@@ -558,7 +558,7 @@
558
558
  styleOptions = styleOptions || {};
559
559
  const style = Object.create(null);
560
560
  styleOptions.background && (style.background = styleOptions.background);
561
- styleOptions.height && (style.height = styleOptions.height + (styleOptions.heightUnit || "px"));
561
+ styleOptions.height && (style.height = styleOptions.height);
562
562
  return style;
563
563
  }
564
564
  return (_ctx, _cache) => {
@@ -569,10 +569,10 @@
569
569
  "scroll-x": props.scrollX,
570
570
  "scroll-y": props.scrollY
571
571
  }, {
572
- default: vue.withCtx(() => [vue.createElementVNode("header", {
572
+ default: vue.withCtx(() => [vue.createElementVNode("div", {
573
573
  class: "table-header",
574
574
  style: vue.normalizeStyle(getStyle(props.headerStyle))
575
- }, [vue.renderSlot(_ctx.$slots, "header")], 4), vue.createElementVNode("main", _hoisted_1$6, [vue.renderSlot(_ctx.$slots, "default")]), vue.createElementVNode("footer", {
575
+ }, [vue.renderSlot(_ctx.$slots, "header")], 4), vue.createElementVNode("div", _hoisted_1$6, [vue.renderSlot(_ctx.$slots, "default")]), vue.createElementVNode("div", {
576
576
  class: "table-footer",
577
577
  style: vue.normalizeStyle(getStyle(props.footerStyle))
578
578
  }, [vue.renderSlot(_ctx.$slots, "footer")], 4)]),
@@ -590,15 +590,12 @@
590
590
  __name: "table-row",
591
591
  props: {
592
592
  height: {},
593
- unit: {}
593
+ minHeight: {},
594
+ maxHeight: {}
594
595
  },
595
596
  setup(__props) {
596
597
  const props = __props;
597
- const rowStyle = vue.computed(() => {
598
- const style = Object.create(null);
599
- props.height > 0 && (style.height = props.height + (props.unit || "px"));
600
- return style;
601
- });
598
+ const rowStyle = vue.computed(() => snail_view.css.buildStyle(props));
602
599
  return (_ctx, _cache) => {
603
600
  return vue.openBlock(), vue.createElementBlock("div", {
604
601
  class: "table-row",
@@ -616,27 +613,19 @@
616
613
  __name: "table-col",
617
614
  props: {
618
615
  flex: {},
616
+ flexBasis: {},
617
+ flexGrow: {},
618
+ flexShrink: {},
619
619
  width: {},
620
620
  minWidth: {},
621
621
  maxWidth: {},
622
- unit: {},
623
622
  align: {},
624
- borderStyle: {},
625
- paddingStyle: {}
623
+ border: {},
624
+ padding: {}
626
625
  },
627
626
  setup(__props) {
628
627
  const props = __props;
629
- const colStyle = vue.computed(() => {
630
- const style = Object.create(null);
631
- props.flex != void 0 ? style.flex = String(props.flex) : props.width && (style.width = props.width + (props.unit || "px"));
632
- if (props.flex != void 0 || props.width == void 0) {
633
- props.minWidth && (style.minWidth = props.minWidth + (props.unit || "px"));
634
- props.maxWidth && (style.maxWidth = props.maxWidth + (props.unit || "px"));
635
- }
636
- props.borderStyle && (style.border = props.borderStyle);
637
- props.paddingStyle && (style.padding = props.paddingStyle);
638
- return style;
639
- });
628
+ const colStyle = vue.computed(() => snail_view.css.buildStyle(props));
640
629
  return (_ctx, _cache) => {
641
630
  return vue.openBlock(), vue.createElementBlock("div", {
642
631
  class: vue.normalizeClass(["table-col", props.align]),
@@ -780,10 +769,7 @@
780
769
  })();
781
770
 
782
771
  function getTitleStyle(options, isFlex) {
783
- return options && options.titleStyle ? snail_view.style.build({
784
- ...options.titleStyle,
785
- width: options.titleStyle
786
- }, isFlex) : Object.create(null);
772
+ return options && options.titleStyle ? snail_view.css.buildStyle(options.titleStyle, isFlex) : Object.create(null);
787
773
  }
788
774
 
789
775
  const _hoisted_1$4 = ["textContent"];
@@ -966,11 +952,11 @@
966
952
  title: {},
967
953
  message: {},
968
954
  cancelName: {},
969
- cancelDisable: {
955
+ cancelDisabled: {
970
956
  type: Boolean
971
957
  },
972
958
  confirmName: {},
973
- confirmDisable: {
959
+ confirmDisabled: {
974
960
  type: Boolean
975
961
  },
976
962
  inDialog: {
@@ -995,9 +981,9 @@
995
981
  }, null, 8, _hoisted_2$1), vue.createVNode(_sfc_main$g, {
996
982
  align: "right",
997
983
  "cancel-name": props.cancelName,
998
- "cancel-disable": props.cancelDisable,
984
+ "cancel-disable": props.cancelDisabled,
999
985
  "confirm-name": props.confirmName,
1000
- "confirm-disable": props.confirmDisable,
986
+ "confirm-disable": props.confirmDisabled,
1001
987
  onCancel: _cache[1] || (_cache[1] = $event => props.closeDialog(false)),
1002
988
  onConfirm: _cache[2] || (_cache[2] = $event => props.closeDialog(true))
1003
989
  }, null, 8, ["cancel-name", "cancel-disable", "confirm-name", "confirm-disable"])]);
@@ -1067,6 +1053,7 @@
1067
1053
  emit: __emit
1068
1054
  } = _ref;
1069
1055
  const emit = __emit;
1056
+ const observer = snail_view.useObserver();
1070
1057
  const isTouch = "ontouchstart" in window;
1071
1058
  const dragHandle = vue.useTemplateRef("dragHandle");
1072
1059
  const dragInfo = vue.ref({
@@ -1104,10 +1091,11 @@
1104
1091
  }
1105
1092
  }
1106
1093
  }
1107
- isTouch || vue.onMounted(() => {
1108
- addEventListener("mousemove", onDragMove);
1109
- addEventListener("mouseup", onDragEnd);
1094
+ isTouch || vue.onMounted(function () {
1095
+ observer.onEvent(window, "mousemove", onDragMove);
1096
+ observer.onEvent(window, "mouseup", onDragEnd);
1110
1097
  });
1098
+ vue.onUnmounted(observer.destroy);
1111
1099
  return (_ctx, _cache) => {
1112
1100
  return vue.openBlock(), vue.createElementBlock("div", {
1113
1101
  class: vue.normalizeClass(["snail-drag-verify", {
@@ -1,21 +1,21 @@
1
+ /* src:base\icon.vue index:0 */
2
+ .snail-icon{cursor:pointer;opacity:1}
3
+ /* src:base\header.vue index:0 */
4
+ .snail-header{align-items:center;background-color:#fff;display:flex;flex-direction:row;flex-shrink:0;position:relative;width:100%}.snail-header>.header-title{color:#2e3033;flex:1;line-height:48px;overflow:hidden;padding-left:24px;text-overflow:ellipsis;white-space:nowrap}.snail-header>.header-title.center{text-align:center}.snail-header>.header-title.right{text-align:right}.snail-header.start-divider{border-bottom:1px solid #dddfed}.snail-header.page{height:48px}.snail-header.page>.header-title{font-size:16px;font-weight:700}.snail-header.page>.close-icon{margin-right:18px}.snail-header.dialog{height:64px;padding-top:16px}.snail-header.dialog>.header-title{font-size:20px}.snail-header.dialog>.close-icon{position:absolute;right:8px;top:8px}
1
5
  /* src:base\button.vue index:0 */
2
6
  .snail-button{align-items:center;border-radius:2px;cursor:pointer;display:inline-flex;font-size:14px;justify-content:center;white-space:nowrap}.snail-button.max{height:40px;width:120px}.snail-button.middle{height:32px;width:90px}.snail-button.normal{height:28px;width:54px}.snail-button.small{height:20px;width:30px}.snail-button.primary{background-color:#5ca3ff;color:#fff}.snail-button.default{background-color:#fff;border:1px solid #dddfed;color:#2e2f33}.snail-button.link{color:#4c9aff}
3
7
  /* src:base\footer.vue index:0 */
4
8
  .snail-footer{align-items:center;background-color:#fff;display:flex;flex-shrink:0;height:72px;padding:0 40px;width:100%}.snail-footer>.snail-button:nth-child(n+2){margin-left:20px}.snail-footer.start-divider{border-top:1px solid #dddfed}.snail-footer.left{justify-content:left}.snail-footer.center{justify-content:center}.snail-footer.right{justify-content:right}
5
- /* src:base\switch.vue index:0 */
6
- .snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
7
- /* src:base\header.vue index:0 */
8
- .snail-header{align-items:center;background-color:#fff;display:flex;flex-direction:row;flex-shrink:0;position:relative;width:100%}.snail-header>.header-title{color:#2e3033;flex:1;line-height:48px;overflow:hidden;padding-left:24px;text-overflow:ellipsis;white-space:nowrap}.snail-header>.header-title.center{text-align:center}.snail-header>.header-title.right{text-align:right}.snail-header.start-divider{border-bottom:1px solid #dddfed}.snail-header.page{height:48px}.snail-header.page>.header-title{font-size:16px;font-weight:700}.snail-header.page>.close-icon{margin-right:18px}.snail-header.dialog{height:64px;padding-top:16px}.snail-header.dialog>.header-title{font-size:20px}.snail-header.dialog>.close-icon{position:absolute;right:8px;top:8px}
9
- /* src:base\icon.vue index:0 */
10
- .snail-icon{cursor:pointer;opacity:1}
11
9
  /* src:container\dynamic.vue index:0 */
12
10
  .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
11
+ /* src:base\switch.vue index:0 */
12
+ .snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
13
13
  /* src:container\fold.vue index:0 */
14
14
  .snail-fold{flex-shrink:0}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;white-space:nowrap}.snail-fold>div.fold-header>.title{color:#2e3033;font-size:14px;font-weight:700;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{display:flex;flex:1;justify-content:right;justify-self:right}.snail-fold>div.fold-body{padding-left:20px}
15
15
  /* src:container\scroll.vue index:0 */
16
16
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
17
17
  /* src:container\table.vue index:0 */
18
- .snail-table{display:flex;flex-direction:column}.snail-table>footer.table-footer,.snail-table>header.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>header.table-header{position:sticky!important;top:0}.snail-table>main.table-body{flex:1;width:100%}.snail-table.start-border>footer.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>header.table-header>.table-col:nth-child(n+2),.snail-table.start-border>main.table-body>.table-row>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>footer.table-footer>.table-col,.snail-table.start-border>main.table-body>.table-row>.table-col{border-top:none!important}
18
+ .snail-table{display:flex;flex-direction:column}.snail-table>div.table-footer,.snail-table>div.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>div.table-header{position:sticky!important;top:0}.snail-table>div.table-body{flex:1;width:100%}.snail-table.start-border>div.table-body>.table-row>.table-col:nth-child(n+2),.snail-table.start-border>div.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>div.table-header>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>div.table-body>.table-row>.table-col,.snail-table.start-border>div.table-footer>.table-col{border-top:none!important}
19
19
  /* src:container\components\table-row.vue index:0 */
20
20
  .table-row{align-items:center;display:flex;min-width:100%}
21
21
  /* src:container\components\table-col.vue index:0 */
@@ -30,7 +30,7 @@
30
30
  .snail-loading{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
31
31
  /* src:prompt\components\toast.vue index:0 */
32
32
  .snail-toast{background:rgba(0,0,0,.7);border-radius:5px;color:#fff;display:flex;max-height:200px;max-width:500px;min-width:200px;opacity:.2;overflow:hidden;padding:20px 30px 20px 20px;position:fixed;transition:opacity .2s ease;z-index:99999}.snail-toast.show-toast{opacity:1}.snail-toast>svg.close-icon{position:absolute;right:10px;top:12px}.snail-toast>div.icon{align-items:center;align-self:center;background:hsla(0,0%,100%,.15);border-radius:50%;display:flex;height:26px;justify-content:center;margin-right:6px;width:26px}.snail-toast>div.icon>svg{background:#fff;border-radius:50%;cursor:none!important}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
33
- /* src:prompt\components\confirm.vue index:0 */
34
- .snail-confirm{background-color:#fff;border-radius:4px;box-sizing:border-box;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>main{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word;box-sizing:border-box}
35
33
  /* src:container\components\dialog-wrapper.vue index:0 */
36
- .snail-dialog{align-items:center;bottom:0;display:flex;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;position:absolute;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);box-sizing:border-box;position:relative}.snail-dialog.unactive:before{display:none!important}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}.snail-dialog-enter-active,.snail-dialog-leave-active{transition:scale .1s ease-in-out,opacity .1s ease}.snail-dialog-enter-from{opacity:0;scale:.4}.snail-dialog-leave-to{opacity:0;scale:0}
34
+ .snail-dialog{align-items:center;bottom:0;display:flex;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;position:absolute;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);box-sizing:border-box;position:relative}.snail-dialog.unactive:before{display:none!important}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}.snail-dialog-enter-active,.snail-dialog-leave-active{transition:scale .1s ease-in-out,opacity .1s ease}.snail-dialog-enter-from{opacity:0;scale:.4}.snail-dialog-leave-to{opacity:0;scale:0}
35
+ /* src:prompt\components\confirm.vue index:0 */
36
+ .snail-confirm{background-color:#fff;border-radius:4px;box-sizing:border-box;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>main{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word;box-sizing:border-box}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "依赖【snail】,基于vue封装常用UI组件",
4
4
  "author": "snail_dev@163.com",
5
5
  "license": "MIT",
6
- "version": "1.0.24",
6
+ "version": "1.0.26",
7
7
  "type": "module",
8
8
  "main": "dist/snail.vue.js",
9
9
  "module": "dist/snail.vue.js",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "vue": "^3.5.14",
18
- "snail.core": ">=2.0.4",
19
- "snail.view": ">=1.0.4"
18
+ "snail.core": ">=2.0.6",
19
+ "snail.view": ">=1.0.10"
20
20
  },
21
21
  "devDependencies": {
22
22
  "vue-tsc": "^2.2.10",