@varlet/ui 2.7.4 → 2.8.0-alpha.1676441771603

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.
Files changed (55) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +6 -4
  3. package/es/app-bar/AppBar.mjs +30 -6
  4. package/es/app-bar/appBar.css +1 -1
  5. package/es/app-bar/props.mjs +6 -0
  6. package/es/badge/Badge.mjs +3 -2
  7. package/es/card/Card.mjs +7 -2
  8. package/es/cell/Cell.mjs +59 -31
  9. package/es/cell/cell.css +1 -1
  10. package/es/cell/props.mjs +11 -0
  11. package/es/chip/Chip.mjs +9 -3
  12. package/es/col/Col.mjs +7 -2
  13. package/es/collapse/Collapse.mjs +2 -2
  14. package/es/ellipsis/Ellipsis.mjs +106 -0
  15. package/es/ellipsis/EllipsisSfc.css +0 -0
  16. package/es/ellipsis/ellipsis.css +1 -0
  17. package/es/ellipsis/index.mjs +8 -0
  18. package/es/ellipsis/props.mjs +16 -0
  19. package/es/ellipsis/style/index.mjs +4 -0
  20. package/es/image/Image.mjs +8 -3
  21. package/es/index.bundle.mjs +13 -1
  22. package/es/index.mjs +11 -1
  23. package/es/paper/Paper.mjs +55 -0
  24. package/es/paper/PaperSfc.css +0 -0
  25. package/es/paper/index.mjs +9 -0
  26. package/es/paper/paper.css +1 -0
  27. package/es/paper/props.mjs +28 -0
  28. package/es/paper/style/index.mjs +4 -0
  29. package/es/picker/Picker.mjs +4 -3
  30. package/es/ripple/index.mjs +2 -2
  31. package/es/row/Row.mjs +8 -3
  32. package/es/snackbar/style/index.mjs +1 -1
  33. package/es/style.css +1 -1
  34. package/es/style.mjs +2 -0
  35. package/es/tabs/Tabs.mjs +5 -4
  36. package/es/themes/dark/index.mjs +2 -1
  37. package/es/themes/dark/paper.mjs +3 -0
  38. package/es/tooltip/Tooltip.mjs +6 -1
  39. package/es/tooltip/props.mjs +4 -0
  40. package/es/tooltip/tooltip.css +1 -1
  41. package/es/varlet.esm.js +7674 -7409
  42. package/highlight/web-types.en-US.json +180 -3
  43. package/highlight/web-types.zh-CN.json +180 -3
  44. package/lib/style.css +1 -1
  45. package/lib/varlet.cjs.js +5739 -5425
  46. package/package.json +5 -5
  47. package/types/appBar.d.ts +2 -0
  48. package/types/cell.d.ts +4 -1
  49. package/types/ellipsis.d.ts +23 -0
  50. package/types/index.d.ts +4 -0
  51. package/types/paper.d.ts +25 -0
  52. package/types/snackbar.d.ts +0 -1
  53. package/types/tooltip.d.ts +1 -0
  54. package/umd/style.css +1 -1
  55. package/umd/varlet.js +6 -6
package/README.md CHANGED
@@ -28,17 +28,19 @@ Varlet is a Material design mobile component library developed based on `Vue3`,
28
28
 
29
29
 
30
30
  ### Features
31
+
31
32
  - 🚀   Provide 50+ high quality general purpose components
32
33
  - 🚀   Components are very lightweight
33
34
  - 💪   Developed by Chinese, complete Chinese and English documentation and logistics support
34
35
  - 🛠️   Support on-demand introduction
35
36
  - 🛠️   Support theme customization
36
37
  - 🌍   Support internationalization
37
- - 💡   Support WebStorm, VS Code component syntax highlighting
38
+ - 💡   Support WebStorm syntax highlighting
38
39
  - 💪   Support the SSR
39
40
  - 💡   Support the Typescript
40
41
  - 💪   Make sure more than 90 percent unit test coverage, providing stability assurance
41
42
  - 🛠️   Support dark mode
43
+ - 🛠️   Provide official VSCode extension
42
44
 
43
45
  ### Install
44
46
 
package/README.zh-CN.md CHANGED
@@ -28,17 +28,19 @@
28
28
  Varlet 是一个基于 `Vue3` 开发的 Material 风格移动端组件库,全面拥抱 `Vue3` 生态,由 `varletjs` 社区团队进行维护。
29
29
 
30
30
  ### 特性
31
- - 🚀   提供50+个高质量通用组件
31
+
32
+ - 🚀   提供 50+ 个高质量通用组件
32
33
  - 🚀   组件十分轻量
33
34
  - 💪   由国人开发,完善的中英文文档和后勤保障
34
35
  - 🛠️   支持按需引入
35
36
  - 🛠️   支持主题定制
36
37
  - 🌍   支持国际化
37
- - 💡   支持 webstorm,vscode 组件属性高亮
38
+ - 💡   支持 webstorm 组件属性高亮
38
39
  - 💪   支持 SSR
39
- - 💡   支持 Typescript
40
- - 💪   确保90%以上单元测试覆盖率,提供稳定性保证
40
+ - 💡   支持 Typescript
41
+ - 💪   确保 90% 以上单元测试覆盖率,提供稳定性保证
41
42
  - 🛠️   支持暗黑模式
43
+ - 🛠️   提供官方的 VSCode 插件
42
44
 
43
45
  ### 安装
44
46
 
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, onUpdated } from 'vue';
1
+ import { defineComponent, ref, onMounted, onUpdated, computed } from 'vue';
2
2
  import { props } from './props.mjs';
3
3
  import { createNamespace } from '../utils/components.mjs';
4
4
  var {
@@ -10,10 +10,9 @@ import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createT
10
10
  function __render__(_ctx, _cache) {
11
11
  return _openBlock(), _createElementBlock("div", {
12
12
  class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.round, _ctx.n('--round')], [_ctx.elevation, _ctx.n('$-elevation--3')])),
13
- style: _normalizeStyle({
14
- background: _ctx.color,
15
- color: _ctx.textColor
16
- })
13
+ style: _normalizeStyle(_ctx.rootStyles)
14
+ }, [_createElementVNode("div", {
15
+ class: _normalizeClass(_ctx.n('toolbar'))
17
16
  }, [_createElementVNode("div", {
18
17
  class: _normalizeClass(_ctx.n('left'))
19
18
  }, [_renderSlot(_ctx.$slots, "left"), _ctx.titlePosition === 'left' ? (_openBlock(), _createElementBlock("div", {
@@ -49,7 +48,9 @@ function __render__(_ctx, _cache) {
49
48
  /* CLASS, STYLE */
50
49
  )) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "right")], 2
51
50
  /* CLASS */
52
- )], 6
51
+ )], 2
52
+ /* CLASS */
53
+ ), _renderSlot(_ctx.$slots, "content")], 6
53
54
  /* CLASS, STYLE */
54
55
  );
55
56
  }
@@ -70,11 +71,34 @@ var __sfc__ = defineComponent({
70
71
  paddingRight.value = slots.right ? 0 : undefined;
71
72
  };
72
73
 
74
+ var rootStyles = computed(() => {
75
+ var {
76
+ image,
77
+ color,
78
+ textColor,
79
+ imageLinearGradient
80
+ } = props;
81
+
82
+ if (image != null) {
83
+ var gradient = imageLinearGradient ? "linear-gradient(" + imageLinearGradient + "), " : '';
84
+ return {
85
+ 'background-image': gradient + "url(" + image + ")",
86
+ 'background-position': 'center center',
87
+ 'background-size': 'cover'
88
+ };
89
+ }
90
+
91
+ return {
92
+ background: color,
93
+ color: textColor
94
+ };
95
+ });
73
96
  onMounted(computePadding);
74
97
  onUpdated(computePadding);
75
98
  return {
76
99
  n,
77
100
  classes,
101
+ rootStyles,
78
102
  paddingLeft,
79
103
  paddingRight
80
104
  };
@@ -1 +1 @@
1
- :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-title-font-size: var(--font-size-lg); --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px; --app-bar-font-size: var(--font-size-lg);}.var-app-bar { position: relative; display: flex; width: 100%; font-size: var(--app-bar-font-size); justify-content: center; align-items: center; height: var(--app-bar-height); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__title { font-size: var(--app-bar-title-font-size); flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}.var-app-bar--round { border-radius: var(--app-bar-border-radius);}
1
+ :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-title-font-size: var(--font-size-lg); --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px; --app-bar-font-size: var(--font-size-lg);}.var-app-bar { position: relative; z-index: 0; width: 100%; font-size: var(--app-bar-font-size); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__toolbar { position: relative; display: flex; justify-content: center; align-items: center; height: var(--app-bar-height);}.var-app-bar__title { font-size: var(--app-bar-title-font-size); flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}.var-app-bar--round { border-radius: var(--app-bar-border-radius);}
@@ -24,5 +24,11 @@ export var props = {
24
24
  round: {
25
25
  type: Boolean,
26
26
  default: false
27
+ },
28
+ image: {
29
+ type: String
30
+ },
31
+ imageLinearGradient: {
32
+ type: String
27
33
  }
28
34
  };
@@ -90,8 +90,9 @@ var __sfc__ = defineComponent({
90
90
  position,
91
91
  dot
92
92
  } = props;
93
- if (dot && position.includes('right')) return n('dot--right');
94
- if (dot && position.includes('left')) return n('dot--left');
93
+ if (!dot) return;
94
+ if (position.includes('right')) return n('dot--right');
95
+ if (position.includes('left')) return n('dot--left');
95
96
  };
96
97
 
97
98
  return {
package/es/card/Card.mjs CHANGED
@@ -36,7 +36,7 @@ function __render__(_ctx, _cache) {
36
36
  zIndex: _ctx.floated ? _ctx.zIndex : undefined
37
37
  }),
38
38
  onClick: _cache[0] || (_cache[0] = function () {
39
- return _ctx.onClick && _ctx.onClick(...arguments);
39
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
40
40
  })
41
41
  }, [_createElementVNode("div", {
42
42
  ref: "cardFloater",
@@ -246,6 +246,10 @@ var __sfc__ = defineComponent({
246
246
  call(props['onUpdate:floating'], false);
247
247
  };
248
248
 
249
+ var handleClick = e => {
250
+ call(props.onClick, e);
251
+ };
252
+
249
253
  watch(() => props.floating, value => {
250
254
  if (isRow.value) return;
251
255
  nextTick(() => {
@@ -275,7 +279,8 @@ var __sfc__ = defineComponent({
275
279
  isRow,
276
280
  close,
277
281
  showFloatingButtons,
278
- floated
282
+ floated,
283
+ handleClick
279
284
  };
280
285
  }
281
286
 
package/es/cell/Cell.mjs CHANGED
@@ -1,52 +1,59 @@
1
- import { defineComponent } from 'vue';
2
- import { props } from './props.mjs';
3
1
  import VarIcon from '../icon/index.mjs';
4
- import { createNamespace } from '../utils/components.mjs';
2
+ import Ripple from '../ripple/index.mjs';
3
+ import { computed, defineComponent } from 'vue';
4
+ import { props } from './props.mjs';
5
+ import { call, createNamespace } from '../utils/components.mjs';
6
+ import { toSizeUnit } from '../utils/elements.mjs';
5
7
  var {
6
8
  n,
7
9
  classes
8
10
  } = createNamespace('cell');
9
- import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode } from "vue";
11
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
10
12
 
11
13
  function __render__(_ctx, _cache) {
12
14
  var _component_var_icon = _resolveComponent("var-icon");
13
15
 
14
- return _openBlock(), _createElementBlock("div", {
15
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.border, _ctx.n('--border')]))
16
- }, [_ctx.$slots.icon || _ctx.icon ? (_openBlock(), _createElementBlock("div", {
16
+ var _directive_ripple = _resolveDirective("ripple");
17
+
18
+ return _withDirectives((_openBlock(), _createElementBlock("div", {
19
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.border, _ctx.n('--border')], [_ctx.onClick, _ctx.n('--cursor')])),
20
+ style: _normalizeStyle(_ctx.borderOffsetStyles),
21
+ onClick: _cache[0] || (_cache[0] = function () {
22
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
23
+ })
24
+ }, [_renderSlot(_ctx.$slots, "icon", {}, () => [_ctx.icon ? (_openBlock(), _createElementBlock("div", {
17
25
  key: 0,
18
- class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.iconClass, _ctx.iconClass]))
19
- }, [_renderSlot(_ctx.$slots, "icon", {}, () => [_createVNode(_component_var_icon, {
26
+ class: _normalizeClass(_ctx.classes(_ctx.n('icon'), _ctx.iconClass))
27
+ }, [_createVNode(_component_var_icon, {
20
28
  name: _ctx.icon
21
29
  }, null, 8
22
30
  /* PROPS */
23
- , ["name"])])], 2
31
+ , ["name"])], 2
24
32
  /* CLASS */
25
- )) : _createCommentVNode("v-if", true), _createElementVNode("div", {
33
+ )) : _createCommentVNode("v-if", true)]), _createElementVNode("div", {
26
34
  class: _normalizeClass(_ctx.n('content'))
27
- }, [_createElementVNode("div", {
28
- class: _normalizeClass(_ctx.classes(_ctx.n('title'), [_ctx.titleClass, _ctx.titleClass]))
29
- }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
30
- /* TEXT */
31
- )])], 2
32
- /* CLASS */
33
- ), _ctx.$slots.description || _ctx.description ? (_openBlock(), _createElementBlock("div", {
35
+ }, [_renderSlot(_ctx.$slots, "default", {}, () => [_ctx.title ? (_openBlock(), _createElementBlock("div", {
34
36
  key: 0,
35
- class: _normalizeClass(_ctx.classes(_ctx.n('description'), [_ctx.descriptionClass, _ctx.descriptionClass]))
36
- }, [_renderSlot(_ctx.$slots, "description", {}, () => [_createTextVNode(_toDisplayString(_ctx.description), 1
37
- /* TEXT */
38
- )])], 2
39
- /* CLASS */
40
- )) : _createCommentVNode("v-if", true)], 2
37
+ class: _normalizeClass(_ctx.classes(_ctx.n('title'), _ctx.titleClass))
38
+ }, _toDisplayString(_ctx.title), 3
39
+ /* TEXT, CLASS */
40
+ )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "description", {}, () => [_ctx.description ? (_openBlock(), _createElementBlock("div", {
41
+ key: 0,
42
+ class: _normalizeClass(_ctx.classes(_ctx.n('description'), _ctx.descriptionClass))
43
+ }, _toDisplayString(_ctx.description), 3
44
+ /* TEXT, CLASS */
45
+ )) : _createCommentVNode("v-if", true)])], 2
41
46
  /* CLASS */
42
47
  ), _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", {
43
- key: 1,
44
- class: _normalizeClass(_ctx.classes(_ctx.n('extra'), [_ctx.extraClass, _ctx.extraClass]))
48
+ key: 0,
49
+ class: _normalizeClass(_ctx.classes(_ctx.n('extra'), _ctx.extraClass))
45
50
  }, [_renderSlot(_ctx.$slots, "extra")], 2
46
51
  /* CLASS */
47
- )) : _createCommentVNode("v-if", true)], 2
48
- /* CLASS */
49
- );
52
+ )) : _createCommentVNode("v-if", true)], 6
53
+ /* CLASS, STYLE */
54
+ )), [[_directive_ripple, {
55
+ disabled: !_ctx.ripple
56
+ }]]);
50
57
  }
51
58
 
52
59
  var __sfc__ = defineComponent({
@@ -54,12 +61,33 @@ var __sfc__ = defineComponent({
54
61
  components: {
55
62
  VarIcon
56
63
  },
64
+ directives: {
65
+ Ripple
66
+ },
57
67
  props,
58
68
 
59
- setup() {
69
+ setup(props) {
70
+ var borderOffsetStyles = computed(() => {
71
+ if (props.borderOffset == null) {
72
+ return {};
73
+ }
74
+
75
+ return {
76
+ '--cell-border-left': toSizeUnit(props.borderOffset),
77
+ '--cell-border-right': toSizeUnit(props.borderOffset)
78
+ };
79
+ });
80
+
81
+ var handleClick = e => {
82
+ call(props.onClick, e);
83
+ };
84
+
60
85
  return {
61
86
  n,
62
- classes
87
+ classes,
88
+ toSizeUnit,
89
+ borderOffsetStyles,
90
+ handleClick
63
91
  };
64
92
  }
65
93
 
package/es/cell/cell.css CHANGED
@@ -1 +1 @@
1
- :root { --cell-color: var(--color-text); --cell-font-size: var(--font-size-md); --cell-description-font-size: var(--font-size-sm); --cell-description-color: rgba(0, 0, 0, 0.6); --cell-padding: 10px 12px; --cell-min-height: 40px; --cell-border-color: #bcc2cb; --cell-border-left: 12px; --cell-border-right: 12px; --cell-icon-right: 8px; --cell-extra-left: 8px;}.var-cell { align-items: center; display: flex; min-height: var(--cell-min-height); outline: none; width: 100%; padding: var(--cell-padding); position: relative; box-sizing: border-box; font-size: var(--cell-font-size); color: var(--cell-color);}.var-cell--border::after { position: absolute; box-sizing: border-box; content: ' '; pointer-events: none; right: var(--cell-border-right); bottom: 0; left: var(--cell-border-left); border-bottom: 1px solid var(--cell-border-color); transform: scaleY(0.5);}.var-cell__icon { margin-right: var(--cell-icon-right); flex: 0;}.var-cell__content { flex: 1; overflow: hidden;}.var-cell__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.var-cell__description { font-size: var(--cell-description-font-size); color: var(--cell-description-color);}.var-cell__extra { flex: 0; margin-left: var(--cell-extra-left);}
1
+ :root { --cell-color: var(--color-text); --cell-font-size: var(--font-size-md); --cell-description-font-size: var(--font-size-sm); --cell-description-color: rgba(0, 0, 0, 0.6); --cell-description-margin-top: 4px; --cell-padding: 10px 12px; --cell-min-height: 40px; --cell-border-color: #bcc2cb; --cell-border-left: 12px; --cell-border-right: 12px; --cell-icon-right: 8px; --cell-extra-left: 8px;}.var-cell { align-items: center; display: flex; min-height: var(--cell-min-height); outline: none; width: 100%; padding: var(--cell-padding); position: relative; box-sizing: border-box; font-size: var(--cell-font-size); color: var(--cell-color);}.var-cell--border::after { position: absolute; box-sizing: border-box; content: ' '; pointer-events: none; bottom: 0; right: var(--cell-border-right); left: var(--cell-border-left); border-bottom: 1px solid var(--cell-border-color); transform: scaleY(0.5);}.var-cell__icon { margin-right: var(--cell-icon-right); flex: 0;}.var-cell__content { flex: 1; overflow: hidden;}.var-cell__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.var-cell__description { font-size: var(--cell-description-font-size); color: var(--cell-description-color); margin-top: var(--cell-description-margin-top);}.var-cell__extra { flex: 0; margin-left: var(--cell-extra-left);}.var-cell--cursor { cursor: pointer;}
package/es/cell/props.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components.mjs';
1
2
  export var props = {
2
3
  title: {
3
4
  type: [Number, String]
@@ -12,6 +13,9 @@ export var props = {
12
13
  type: Boolean,
13
14
  default: false
14
15
  },
16
+ borderOffset: {
17
+ type: [Number, String]
18
+ },
15
19
  iconClass: {
16
20
  type: String
17
21
  },
@@ -23,5 +27,12 @@ export var props = {
23
27
  },
24
28
  extraClass: {
25
29
  type: String
30
+ },
31
+ ripple: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ onClick: {
36
+ type: defineListenerProp
26
37
  }
27
38
  };
package/es/chip/Chip.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import VarIcon from '../icon/index.mjs';
2
2
  import { defineComponent, computed } from 'vue';
3
3
  import { props } from './props.mjs';
4
- import { createNamespace } from '../utils/components.mjs';
4
+ import { call, createNamespace } from '../utils/components.mjs';
5
5
  var {
6
6
  n,
7
7
  classes
@@ -25,7 +25,7 @@ function __render__(_ctx, _cache) {
25
25
  key: 0,
26
26
  class: _normalizeClass(_ctx.n('--close')),
27
27
  onClick: _cache[0] || (_cache[0] = function () {
28
- return _ctx.onClose && _ctx.onClose(...arguments);
28
+ return _ctx.handleClose && _ctx.handleClose(...arguments);
29
29
  })
30
30
  }, [_createVNode(_component_var_icon, {
31
31
  name: "" + (_ctx.iconName ? _ctx.iconName : 'close-circle')
@@ -85,11 +85,17 @@ var __sfc__ = defineComponent({
85
85
  var roundClass = round ? n('--round') : null;
86
86
  return [n("--" + size), blockClass, plainTypeClass, roundClass];
87
87
  });
88
+
89
+ var handleClose = e => {
90
+ call(props.onClose, e);
91
+ };
92
+
88
93
  return {
89
94
  n,
90
95
  classes,
91
96
  chipStyles,
92
- contentClass
97
+ contentClass,
98
+ handleClose
93
99
  };
94
100
  }
95
101
 
package/es/col/Col.mjs CHANGED
@@ -19,7 +19,7 @@ function __render__(_ctx, _cache) {
19
19
  paddingRight: _ctx.toSizeUnit(_ctx.padding.right)
20
20
  }),
21
21
  onClick: _cache[0] || (_cache[0] = function () {
22
- return _ctx.onClick && _ctx.onClick(...arguments);
22
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
23
23
  })
24
24
  }, [_renderSlot(_ctx.$slots, "default")], 6
25
25
  /* CLASS, STYLE */
@@ -69,6 +69,10 @@ var __sfc__ = defineComponent({
69
69
  return classes;
70
70
  };
71
71
 
72
+ var handleClick = e => {
73
+ call(props.onClick, e);
74
+ };
75
+
72
76
  watch([() => props.span, () => props.offset], () => {
73
77
  row == null ? void 0 : row.computePadding();
74
78
  });
@@ -81,7 +85,8 @@ var __sfc__ = defineComponent({
81
85
  toSizeUnit,
82
86
  getSize,
83
87
  span,
84
- offset
88
+ offset,
89
+ handleClick
85
90
  };
86
91
  }
87
92
 
@@ -82,7 +82,7 @@ var __sfc__ = defineComponent({
82
82
  index,
83
83
  name
84
84
  } = _ref3;
85
- return name.value === undefined ? props.modelValue === index.value : false;
85
+ return name.value === undefined && props.modelValue === index.value;
86
86
  });
87
87
  }
88
88
 
@@ -91,7 +91,7 @@ var __sfc__ = defineComponent({
91
91
  index,
92
92
  name
93
93
  } = _ref4;
94
- return name.value === undefined ? props.modelValue.includes(index.value) : false;
94
+ return name.value === undefined && props.modelValue.includes(index.value);
95
95
  });
96
96
  };
97
97
 
@@ -0,0 +1,106 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import VarTooltip from '../tooltip/index.mjs';
4
+ import { computed, defineComponent, ref } from 'vue';
5
+ import { createNamespace } from '../utils/components.mjs';
6
+ import { props } from './props.mjs';
7
+ var {
8
+ n,
9
+ classes
10
+ } = createNamespace('ellipsis');
11
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
+
13
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
14
+
15
+ var _hoisted_1 = {
16
+ key: 0
17
+ };
18
+
19
+ function __render__(_ctx, _cache) {
20
+ var _component_var_tooltip = _resolveComponent("var-tooltip");
21
+
22
+ return _openBlock(), _createBlock(_component_var_tooltip, _normalizeProps(_guardReactiveProps(_ctx.tooltip)), {
23
+ content: _withCtx(() => [_renderSlot(_ctx.$slots, "tooltip-content", {}, () => {
24
+ var _ctx$tooltip;
25
+
26
+ return [(_ctx$tooltip = _ctx.tooltip) != null && _ctx$tooltip.content ? (_openBlock(), _createElementBlock("span", _hoisted_1, _toDisplayString(_ctx.tooltip.content), 1
27
+ /* TEXT */
28
+ )) : _renderSlot(_ctx.$slots, "default", {
29
+ key: 1
30
+ })];
31
+ })]),
32
+ default: _withCtx(() => [_createElementVNode("span", {
33
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.lineClamp, _ctx.n('--clamp'), _ctx.n('--line')], [_ctx.expandTrigger, _ctx.n('--cursor')], [_ctx.expanding, _ctx.n('--expand')])),
34
+ style: _normalizeStyle(_ctx.rootStyles),
35
+ onClick: _cache[0] || (_cache[0] = function () {
36
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
37
+ })
38
+ }, [_renderSlot(_ctx.$slots, "default")], 6
39
+ /* CLASS, STYLE */
40
+ )]),
41
+ _: 3
42
+ /* FORWARDED */
43
+
44
+ }, 16
45
+ /* FULL_PROPS */
46
+ );
47
+ }
48
+
49
+ var __sfc__ = defineComponent({
50
+ name: 'VarEllipsis',
51
+ components: {
52
+ VarTooltip
53
+ },
54
+ props,
55
+
56
+ setup(props) {
57
+ var expanding = ref(false);
58
+ var rootStyles = computed(() => {
59
+ if (!props.lineClamp) {
60
+ return {};
61
+ }
62
+
63
+ return {
64
+ '-webkit-line-clamp': props.lineClamp
65
+ };
66
+ });
67
+ var tooltip = computed(() => {
68
+ if (props.tooltip === false) {
69
+ return {
70
+ disabled: true
71
+ };
72
+ }
73
+
74
+ if (props.tooltip === true) {
75
+ return {
76
+ sameWidth: true
77
+ };
78
+ }
79
+
80
+ return _extends({
81
+ sameWidth: true
82
+ }, props.tooltip);
83
+ });
84
+
85
+ var handleClick = () => {
86
+ if (!props.expandTrigger) {
87
+ return;
88
+ }
89
+
90
+ expanding.value = !expanding.value;
91
+ };
92
+
93
+ return {
94
+ n,
95
+ classes,
96
+ tooltip,
97
+ expanding,
98
+ rootStyles,
99
+ handleClick
100
+ };
101
+ }
102
+
103
+ });
104
+
105
+ __sfc__.render = __render__;
106
+ export default __sfc__;
File without changes
@@ -0,0 +1 @@
1
+ .var-ellipsis { width: 100%; overflow: hidden; vertical-align: bottom;}.var-ellipsis--clamp { display: -webkit-inline-box; -webkit-box-orient: vertical;}.var-ellipsis--line { display: inline-block; white-space: nowrap; text-overflow: ellipsis;}.var-ellipsis--cursor { cursor: pointer;}.var-ellipsis--expand { display: inline-block; white-space: wrap; overflow: visible;}
@@ -0,0 +1,8 @@
1
+ import Ellipsis from './Ellipsis.mjs';
2
+
3
+ Ellipsis.install = function (app) {
4
+ app.component(Ellipsis.name, Ellipsis);
5
+ };
6
+
7
+ export var _EllipsisComponent = Ellipsis;
8
+ export default Ellipsis;
@@ -0,0 +1,16 @@
1
+ export function expandTriggerValidator(expandTrigger) {
2
+ return ['click'].includes(expandTrigger);
3
+ }
4
+ export var props = {
5
+ expandTrigger: {
6
+ type: String,
7
+ validator: expandTriggerValidator
8
+ },
9
+ lineClamp: {
10
+ type: [Number, String]
11
+ },
12
+ tooltip: {
13
+ type: [Object, Boolean],
14
+ default: true
15
+ }
16
+ };
@@ -0,0 +1,4 @@
1
+ import '../../styles/common.css'
2
+ import '../../tooltip/tooltip.css'
3
+ import '../ellipsis.css'
4
+ import '../EllipsisSfc.css'
@@ -44,7 +44,7 @@ function __render__(_ctx, _cache) {
44
44
  return _ctx.handleError && _ctx.handleError(...arguments);
45
45
  }),
46
46
  onClick: _cache[2] || (_cache[2] = function () {
47
- return _ctx.onClick && _ctx.onClick(...arguments);
47
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
48
48
  })
49
49
  }, null, 46
50
50
  /* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
@@ -64,7 +64,7 @@ function __render__(_ctx, _cache) {
64
64
  return _ctx.handleError && _ctx.handleError(...arguments);
65
65
  }),
66
66
  onClick: _cache[5] || (_cache[5] = function () {
67
- return _ctx.onClick && _ctx.onClick(...arguments);
67
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
68
68
  })
69
69
  }, null, 46
70
70
  /* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
@@ -108,12 +108,17 @@ var __sfc__ = defineComponent({
108
108
  !lazy && call(onError, e);
109
109
  };
110
110
 
111
+ var handleClick = e => {
112
+ call(props.onClick, e);
113
+ };
114
+
111
115
  return {
112
116
  n,
113
117
  classes,
114
118
  toSizeUnit,
115
119
  handleLoad,
116
- handleError
120
+ handleError,
121
+ handleClick
117
122
  };
118
123
  }
119
124