@varlet/ui 2.4.3-alpha.1671119797012 → 2.4.3-alpha.1672073838506

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 (233) hide show
  1. package/es/action-sheet/index.js +4 -4
  2. package/es/action-sheet/props.js +3 -7
  3. package/es/back-top/props.js +2 -3
  4. package/es/bottom-navigation/BottomNavigation.js +8 -2
  5. package/es/bottom-navigation/props.js +5 -12
  6. package/es/bottom-navigation-item/props.js +2 -3
  7. package/es/breadcrumb/Breadcrumb.js +66 -0
  8. package/es/breadcrumb/BreadcrumbSfc.css +0 -0
  9. package/es/breadcrumb/breadcrumb.css +1 -0
  10. package/es/breadcrumb/index.js +8 -0
  11. package/es/breadcrumb/props.js +7 -0
  12. package/es/breadcrumb/provide.js +21 -0
  13. package/es/breadcrumb/style/index.js +3 -0
  14. package/es/breadcrumbs/Breadcrumbs.js +37 -0
  15. package/es/breadcrumbs/BreadcrumbsSfc.css +0 -0
  16. package/es/breadcrumbs/breadcrumbs.css +1 -0
  17. package/es/breadcrumbs/index.js +8 -0
  18. package/es/breadcrumbs/props.js +6 -0
  19. package/es/breadcrumbs/provide.js +17 -0
  20. package/es/breadcrumbs/style/index.js +3 -0
  21. package/es/button/Button.js +6 -4
  22. package/es/button/props.js +3 -7
  23. package/es/card/Card.js +1 -1
  24. package/es/card/card.css +1 -1
  25. package/es/card/props.js +8 -6
  26. package/es/checkbox/props.js +4 -9
  27. package/es/checkbox-group/props.js +3 -6
  28. package/es/chip/props.js +2 -4
  29. package/es/col/props.js +4 -4
  30. package/es/collapse/props.js +3 -6
  31. package/es/countdown/props.js +3 -6
  32. package/es/counter/props.js +6 -15
  33. package/es/date-picker/props.js +5 -9
  34. package/es/dialog/index.js +5 -5
  35. package/es/dialog/props.js +6 -14
  36. package/es/form/Form.js +28 -2
  37. package/es/form/props.js +12 -0
  38. package/es/form/provide.js +10 -1
  39. package/es/icon/Icon.js +1 -1
  40. package/es/icon/icon.css +1 -1
  41. package/es/icon/props.js +2 -3
  42. package/es/image/props.js +5 -9
  43. package/es/image-preview/index.js +3 -3
  44. package/es/image-preview/props.js +2 -4
  45. package/es/index-bar/props.js +3 -6
  46. package/es/index.js +10 -0
  47. package/es/input/Input.js +3 -1
  48. package/es/input/props.js +8 -21
  49. package/es/link/props.js +3 -3
  50. package/es/list/props.js +4 -9
  51. package/es/menu/Menu.js +1 -1
  52. package/es/menu/props.js +7 -15
  53. package/es/overlay/props.js +3 -6
  54. package/es/pagination/Pagination.js +8 -6
  55. package/es/pagination/porps.js +4 -9
  56. package/es/picker/index.js +5 -5
  57. package/es/picker/props.js +5 -11
  58. package/es/popup/Popup.js +6 -12
  59. package/es/popup/popup.css +1 -1
  60. package/es/popup/props.js +9 -21
  61. package/es/pull-refresh/PullRefresh.js +3 -5
  62. package/es/pull-refresh/props.js +3 -6
  63. package/es/radio/props.js +4 -9
  64. package/es/radio-group/props.js +3 -6
  65. package/es/rate/props.js +3 -6
  66. package/es/row/props.js +3 -3
  67. package/es/select/props.js +8 -21
  68. package/es/slider/props.js +6 -12
  69. package/es/snackbar/core.js +5 -7
  70. package/es/snackbar/index.js +7 -4
  71. package/es/snackbar/props.js +6 -20
  72. package/es/steps/props.js +3 -3
  73. package/es/sticky/props.js +2 -3
  74. package/es/style.css +1 -1
  75. package/es/style.js +2 -0
  76. package/es/swipe/props.js +2 -3
  77. package/es/switch/props.js +4 -9
  78. package/es/tab/Tab.js +2 -2
  79. package/es/tab/props.js +2 -3
  80. package/es/tabs/props.js +4 -10
  81. package/es/tabs-items/props.js +2 -3
  82. package/es/themes/dark/breadcrumb.js +3 -0
  83. package/es/themes/dark/card.js +1 -0
  84. package/es/themes/dark/index.js +2 -1
  85. package/es/time-picker/props.js +3 -6
  86. package/es/umdIndex.js +10 -0
  87. package/es/uploader/Uploader.js +23 -8
  88. package/es/uploader/props.js +7 -18
  89. package/es/utils/components.js +15 -3
  90. package/es/utils/types.js +1 -0
  91. package/es/varlet.esm.js +5769 -5811
  92. package/highlight/attributes.json +30 -14
  93. package/highlight/tags.json +14 -2
  94. package/highlight/web-types.json +90 -16
  95. package/lib/action-sheet/index.js +3 -3
  96. package/lib/action-sheet/props.js +2 -6
  97. package/lib/back-top/props.js +4 -3
  98. package/lib/bottom-navigation/BottomNavigation.js +7 -1
  99. package/lib/bottom-navigation/props.js +7 -12
  100. package/lib/bottom-navigation-item/props.js +4 -3
  101. package/lib/breadcrumb/Breadcrumb.js +79 -0
  102. package/lib/breadcrumb/BreadcrumbSfc.css +0 -0
  103. package/lib/breadcrumb/breadcrumb.css +1 -0
  104. package/lib/breadcrumb/index.js +17 -0
  105. package/lib/breadcrumb/props.js +14 -0
  106. package/lib/breadcrumb/provide.js +28 -0
  107. package/lib/breadcrumb/style/index.js +3 -0
  108. package/lib/breadcrumbs/Breadcrumbs.js +50 -0
  109. package/lib/breadcrumbs/BreadcrumbsSfc.css +0 -0
  110. package/lib/breadcrumbs/breadcrumbs.css +1 -0
  111. package/lib/breadcrumbs/index.js +17 -0
  112. package/lib/breadcrumbs/props.js +11 -0
  113. package/lib/breadcrumbs/provide.js +27 -0
  114. package/lib/breadcrumbs/style/index.js +3 -0
  115. package/lib/button/Button.js +6 -3
  116. package/lib/button/props.js +2 -6
  117. package/lib/card/Card.js +1 -1
  118. package/lib/card/card.css +1 -1
  119. package/lib/card/props.js +8 -6
  120. package/lib/checkbox/props.js +6 -9
  121. package/lib/checkbox-group/props.js +4 -6
  122. package/lib/chip/props.js +1 -3
  123. package/lib/col/props.js +4 -4
  124. package/lib/collapse/props.js +5 -6
  125. package/lib/countdown/props.js +5 -6
  126. package/lib/counter/props.js +8 -15
  127. package/lib/date-picker/props.js +5 -9
  128. package/lib/dialog/index.js +4 -4
  129. package/lib/dialog/props.js +5 -13
  130. package/lib/form/Form.js +31 -2
  131. package/lib/form/props.js +13 -0
  132. package/lib/form/provide.js +11 -1
  133. package/lib/icon/Icon.js +1 -1
  134. package/lib/icon/icon.css +1 -1
  135. package/lib/icon/props.js +4 -3
  136. package/lib/image/props.js +5 -9
  137. package/lib/image-preview/index.js +2 -2
  138. package/lib/image-preview/props.js +1 -3
  139. package/lib/index-bar/props.js +5 -6
  140. package/lib/index.js +6 -0
  141. package/lib/input/Input.js +3 -1
  142. package/lib/input/props.js +9 -21
  143. package/lib/link/props.js +3 -3
  144. package/lib/list/props.js +6 -9
  145. package/lib/menu/Menu.js +1 -1
  146. package/lib/menu/props.js +7 -15
  147. package/lib/overlay/props.js +5 -6
  148. package/lib/pagination/Pagination.js +7 -5
  149. package/lib/pagination/porps.js +6 -9
  150. package/lib/picker/index.js +4 -4
  151. package/lib/picker/props.js +4 -10
  152. package/lib/popup/Popup.js +5 -11
  153. package/lib/popup/popup.css +1 -1
  154. package/lib/popup/props.js +9 -21
  155. package/lib/pull-refresh/PullRefresh.js +2 -4
  156. package/lib/pull-refresh/props.js +5 -6
  157. package/lib/radio/props.js +6 -9
  158. package/lib/radio-group/props.js +4 -6
  159. package/lib/rate/props.js +5 -6
  160. package/lib/row/props.js +3 -3
  161. package/lib/select/props.js +9 -21
  162. package/lib/slider/props.js +6 -12
  163. package/lib/snackbar/core.js +4 -6
  164. package/lib/snackbar/index.js +6 -3
  165. package/lib/snackbar/props.js +5 -19
  166. package/lib/snackbar/style/index.js +1 -1
  167. package/lib/steps/props.js +3 -3
  168. package/lib/sticky/props.js +4 -3
  169. package/lib/style.css +1 -1
  170. package/lib/style.js +2 -0
  171. package/lib/swipe/props.js +4 -3
  172. package/lib/switch/props.js +6 -9
  173. package/lib/tab/Tab.js +1 -1
  174. package/lib/tab/props.js +4 -3
  175. package/lib/tabs/props.js +3 -9
  176. package/lib/tabs-items/props.js +4 -3
  177. package/lib/themes/dark/breadcrumb.js +8 -0
  178. package/lib/themes/dark/card.js +1 -0
  179. package/lib/themes/dark/index.js +3 -1
  180. package/lib/time-picker/props.js +5 -6
  181. package/lib/uploader/Uploader.js +22 -7
  182. package/lib/uploader/props.js +9 -18
  183. package/lib/utils/components.js +17 -3
  184. package/lib/utils/types.js +3 -0
  185. package/package.json +5 -5
  186. package/types/actionSheet.d.ts +9 -10
  187. package/types/backTop.d.ts +2 -2
  188. package/types/breadcrumb.d.ts +18 -0
  189. package/types/breadcrumbs.d.ts +16 -0
  190. package/types/button.d.ts +3 -3
  191. package/types/card.d.ts +3 -3
  192. package/types/checkbox.d.ts +4 -4
  193. package/types/checkboxGroup.d.ts +3 -3
  194. package/types/chip.d.ts +2 -2
  195. package/types/col.d.ts +2 -2
  196. package/types/collapse.d.ts +3 -3
  197. package/types/countdown.d.ts +3 -3
  198. package/types/counter.d.ts +6 -6
  199. package/types/datePicker.d.ts +4 -4
  200. package/types/dialog.d.ts +10 -10
  201. package/types/form.d.ts +4 -0
  202. package/types/icon.d.ts +2 -2
  203. package/types/image.d.ts +4 -4
  204. package/types/imagePreview.d.ts +7 -7
  205. package/types/index.d.ts +4 -0
  206. package/types/indexBar.d.ts +3 -3
  207. package/types/input.d.ts +8 -8
  208. package/types/link.d.ts +2 -2
  209. package/types/list.d.ts +4 -4
  210. package/types/menu.d.ts +6 -6
  211. package/types/overlay.d.ts +3 -3
  212. package/types/pagination.d.ts +4 -4
  213. package/types/picker.d.ts +4 -4
  214. package/types/popup.d.ts +7 -7
  215. package/types/pullRefresh.d.ts +3 -3
  216. package/types/radio.d.ts +4 -4
  217. package/types/radioGroup.d.ts +3 -3
  218. package/types/rate.d.ts +3 -3
  219. package/types/row.d.ts +2 -2
  220. package/types/select.d.ts +8 -8
  221. package/types/slider.d.ts +5 -5
  222. package/types/snackbar.d.ts +6 -6
  223. package/types/steps.d.ts +2 -2
  224. package/types/sticky.d.ts +2 -2
  225. package/types/swipe.d.ts +2 -2
  226. package/types/switch.d.ts +4 -4
  227. package/types/tab.d.ts +2 -2
  228. package/types/tabs.d.ts +4 -4
  229. package/types/tabsItems.d.ts +3 -3
  230. package/types/timePicker.d.ts +3 -3
  231. package/types/uploader.d.ts +8 -8
  232. package/types/varComponent.d.ts +2 -0
  233. package/umd/varlet.js +7 -7
@@ -1,7 +1,7 @@
1
1
  import VarActionSheet from './ActionSheet.js'
2
2
  import { nextTick, reactive } from 'vue';
3
3
  import { inBrowser } from '@varlet/shared';
4
- import { mountInstance } from '../utils/components';
4
+ import { call, mountInstance } from '../utils/components';
5
5
  var singletonOptions;
6
6
 
7
7
  function ActionSheet(options) {
@@ -18,15 +18,15 @@ function ActionSheet(options) {
18
18
  unmountInstance
19
19
  } = mountInstance(VarActionSheet, reactiveActionSheetOptions, {
20
20
  onSelect: action => {
21
- reactiveActionSheetOptions.onSelect == null ? void 0 : reactiveActionSheetOptions.onSelect(action);
21
+ call(reactiveActionSheetOptions.onSelect, action);
22
22
  resolve(action);
23
23
  },
24
24
  onClose: () => {
25
- reactiveActionSheetOptions.onClose == null ? void 0 : reactiveActionSheetOptions.onClose();
25
+ call(reactiveActionSheetOptions.onClose);
26
26
  resolve('close');
27
27
  },
28
28
  onClosed: () => {
29
- reactiveActionSheetOptions.onClosed == null ? void 0 : reactiveActionSheetOptions.onClosed();
29
+ call(reactiveActionSheetOptions.onClosed);
30
30
  unmountInstance();
31
31
  singletonOptions === reactiveActionSheetOptions && (singletonOptions = null);
32
32
  },
@@ -1,6 +1,6 @@
1
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
2
 
3
- import { pickProps } from '../utils/components';
3
+ import { defineListenerProp, pickProps } from '../utils/components';
4
4
  import { props as popupProps } from '../popup/props';
5
5
  export var props = _extends({
6
6
  show: {
@@ -18,11 +18,7 @@ export var props = _extends({
18
18
  type: Boolean,
19
19
  default: true
20
20
  },
21
- onSelect: {
22
- type: Function
23
- },
24
- 'onUpdate:show': {
25
- type: Function
26
- }
21
+ onSelect: defineListenerProp(),
22
+ 'onUpdate:show': defineListenerProp()
27
23
  }, pickProps(popupProps, ['overlay', 'overlayClass', 'overlayStyle', 'lockScroll', 'closeOnClickOverlay', 'teleport', 'onOpen', 'onClose', 'onOpened', 'onClosed', 'onClickOverlay', // internal for function call closes the dialog
28
24
  'onRouteChange']));
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  visibilityHeight: {
3
4
  type: [Number, String],
@@ -16,7 +17,5 @@ export var props = {
16
17
  target: {
17
18
  type: [String, Object]
18
19
  },
19
- onClick: {
20
- type: Function
21
- }
20
+ onClick: defineListenerProp()
22
21
  };
@@ -5,7 +5,7 @@ import { defineComponent, ref, computed, onMounted, onUpdated, watch } from 'vue
5
5
  import { props } from './props';
6
6
  import { useBottomNavigationItems } from './provide';
7
7
  import { createNamespace, call } from '../utils/components';
8
- import { isNumber } from '@varlet/shared';
8
+ import { isNumber, isArray } from '@varlet/shared';
9
9
  var {
10
10
  n,
11
11
  classes
@@ -115,7 +115,13 @@ export default defineComponent({
115
115
  };
116
116
 
117
117
  var handleBeforeChange = changedValue => {
118
- Promise.resolve(call(props.onBeforeChange, changedValue)).then(res => res && handleChange(changedValue));
118
+ var results = call(props.onBeforeChange, changedValue);
119
+ results = isArray(results) ? results : [results];
120
+ Promise.all(results).then(results => {
121
+ if (!results.some(result => !result)) {
122
+ handleChange(changedValue);
123
+ }
124
+ });
119
125
  };
120
126
 
121
127
  var handleChange = changedValue => {
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  active: {
3
4
  type: [Number, String],
@@ -25,18 +26,10 @@ export var props = {
25
26
  inactiveColor: {
26
27
  type: String
27
28
  },
28
- onChange: {
29
- type: Function
30
- },
31
- 'onUpdate:active': {
32
- type: Function
33
- },
34
- onBeforeChange: {
35
- type: Function
36
- },
37
- onFabClick: {
38
- type: Function
39
- },
29
+ onChange: defineListenerProp(),
30
+ 'onUpdate:active': defineListenerProp(),
31
+ onBeforeChange: defineListenerProp(),
32
+ onFabClick: defineListenerProp(),
40
33
  fabProps: {
41
34
  type: Object
42
35
  }
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  name: {
3
4
  type: String
@@ -16,7 +17,5 @@ export var props = {
16
17
  type: [Boolean, Object],
17
18
  default: false
18
19
  },
19
- onClick: {
20
- type: Function
21
- }
20
+ onClick: defineListenerProp()
22
21
  };
@@ -0,0 +1,66 @@
1
+ import { defineComponent, computed } from 'vue';
2
+ import { props } from './props';
3
+ import { useBreadcrumb } from './provide';
4
+ import { call, createNamespace } from '../utils/components';
5
+ var {
6
+ n,
7
+ classes
8
+ } = createNamespace('breadcrumb');
9
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, createCommentVNode as _createCommentVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
10
+ export function render(_ctx, _cache) {
11
+ return _openBlock(), _createElementBlock("div", {
12
+ class: _normalizeClass(_ctx.n())
13
+ }, [_createElementVNode("div", {
14
+ class: _normalizeClass(_ctx.classes(_ctx.n('content'), [!_ctx.isLast, _ctx.n('--active')])),
15
+ onClick: _cache[0] || (_cache[0] = function () {
16
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
17
+ })
18
+ }, [_renderSlot(_ctx.$slots, "default")], 2
19
+ /* CLASS */
20
+ ), !_ctx.isLast ? _renderSlot(_ctx.$slots, "separator", {
21
+ key: 0
22
+ }, () => {
23
+ var _ctx$separator;
24
+
25
+ return [_createElementVNode("div", {
26
+ class: _normalizeClass(_ctx.n('separator'))
27
+ }, _toDisplayString((_ctx$separator = _ctx.separator) != null ? _ctx$separator : _ctx.parentSeparator), 3
28
+ /* TEXT, CLASS */
29
+ )];
30
+ }) : _createCommentVNode("v-if", true)], 2
31
+ /* CLASS */
32
+ );
33
+ }
34
+ export default defineComponent({
35
+ render,
36
+ name: 'VarBreadcrumb',
37
+ props,
38
+
39
+ setup(props) {
40
+ var {
41
+ index,
42
+ breadcrumb,
43
+ bindBreadcrumb
44
+ } = useBreadcrumb();
45
+ var isLast = computed(() => index.value === breadcrumb.length.value - 1);
46
+ var parentSeparator = computed(() => breadcrumb.separator.value);
47
+
48
+ var handleClick = e => {
49
+ if (isLast.value) {
50
+ return;
51
+ }
52
+
53
+ call(props.onClick, e);
54
+ };
55
+
56
+ bindBreadcrumb(null);
57
+ return {
58
+ n,
59
+ classes,
60
+ isLast,
61
+ parentSeparator,
62
+ handleClick
63
+ };
64
+ }
65
+
66
+ });
File without changes
@@ -0,0 +1 @@
1
+ :root { --breadcrumb-active-color: var(--color-primary); --breadcrumb-inactive-color: #888; --breadcrumb-separator-margin: 0 10px; --breadcrumb-separator-font-size: 14px;}.var-breadcrumb { display: flex; align-items: center; color: var(--breadcrumb-inactive-color);}.var-breadcrumb__separator { margin: var(--breadcrumb-separator-margin); font-size: var(--breadcrumb-separator-font-size);}.var-breadcrumb--active { color: var(--breadcrumb-active-color); transition: opacity 0.25s;}.var-breadcrumb--active:hover { opacity: 0.7; cursor: pointer;}
@@ -0,0 +1,8 @@
1
+ import Breadcrumb from './Breadcrumb.js'
2
+
3
+ Breadcrumb.install = function (app) {
4
+ app.component(Breadcrumb.name, Breadcrumb);
5
+ };
6
+
7
+ export var _BreadcrumbComponent = Breadcrumb;
8
+ export default Breadcrumb;
@@ -0,0 +1,7 @@
1
+ import { defineListenerProp } from '../utils/components';
2
+ export var props = {
3
+ separator: {
4
+ type: String
5
+ },
6
+ onClick: defineListenerProp()
7
+ };
@@ -0,0 +1,21 @@
1
+ import { useAtParentIndex, useParent } from '../utils/components';
2
+ import { BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY, BREADCRUMBS_COUNT_BREADCRUMB_ITEM_KEY } from '../breadcrumbs/provide';
3
+ export function useBreadcrumb() {
4
+ var {
5
+ parentProvider,
6
+ bindParent
7
+ } = useParent(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
8
+ var {
9
+ index
10
+ } = useAtParentIndex(BREADCRUMBS_COUNT_BREADCRUMB_ITEM_KEY);
11
+
12
+ if (!parentProvider || !bindParent || !index) {
13
+ throw Error('<var-breadcrumb/> must in <var-breadcrumbs/>');
14
+ }
15
+
16
+ return {
17
+ index,
18
+ breadcrumb: parentProvider,
19
+ bindBreadcrumb: bindParent
20
+ };
21
+ }
@@ -0,0 +1,3 @@
1
+ import '../../styles/common.css'
2
+ import '../breadcrumb.css'
3
+ import '../BreadcrumbSfc.css'
@@ -0,0 +1,37 @@
1
+ import { defineComponent, computed } from 'vue';
2
+ import { props } from './props';
3
+ import { useBreadcrumbsList } from './provide';
4
+ import { createNamespace } from '../utils/components';
5
+ var {
6
+ n
7
+ } = createNamespace('breadcrumbs');
8
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
9
+ export function render(_ctx, _cache) {
10
+ return _openBlock(), _createElementBlock("div", {
11
+ class: _normalizeClass(_ctx.n())
12
+ }, [_renderSlot(_ctx.$slots, "default")], 2
13
+ /* CLASS */
14
+ );
15
+ }
16
+ export default defineComponent({
17
+ render,
18
+ name: 'VarBreadcrumbs',
19
+ props,
20
+
21
+ setup(props) {
22
+ var separator = computed(() => props.separator);
23
+ var {
24
+ bindBreadcrumbList,
25
+ length
26
+ } = useBreadcrumbsList();
27
+ var breadcrumbsProvider = {
28
+ length,
29
+ separator
30
+ };
31
+ bindBreadcrumbList(breadcrumbsProvider);
32
+ return {
33
+ n
34
+ };
35
+ }
36
+
37
+ });
File without changes
@@ -0,0 +1 @@
1
+ .var-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center;}
@@ -0,0 +1,8 @@
1
+ import Breadcrumbs from './Breadcrumbs.js'
2
+
3
+ Breadcrumbs.install = function (app) {
4
+ app.component(Breadcrumbs.name, Breadcrumbs);
5
+ };
6
+
7
+ export var _BreadcrumbsComponent = Breadcrumbs;
8
+ export default Breadcrumbs;
@@ -0,0 +1,6 @@
1
+ export var props = {
2
+ separator: {
3
+ type: String,
4
+ default: '/'
5
+ }
6
+ };
@@ -0,0 +1,17 @@
1
+ import { useAtChildrenCounter, useChildren } from '../utils/components';
2
+ export var BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY = Symbol('BREADCRUMBS_BIND_BREADCRUMB_KEY');
3
+ export var BREADCRUMBS_COUNT_BREADCRUMB_ITEM_KEY = Symbol('BREADCRUMBS_COUNT_BREADCRUMB_KEY');
4
+ export function useBreadcrumbsList() {
5
+ var {
6
+ childProviders,
7
+ bindChildren
8
+ } = useChildren(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
9
+ var {
10
+ length
11
+ } = useAtChildrenCounter(BREADCRUMBS_COUNT_BREADCRUMB_ITEM_KEY);
12
+ return {
13
+ length,
14
+ breadcrumbList: childProviders,
15
+ bindBreadcrumbList: bindChildren
16
+ };
17
+ }
@@ -0,0 +1,3 @@
1
+ import '../../styles/common.css'
2
+ import '../breadcrumbs.css'
3
+ import '../BreadcrumbsSfc.css'
@@ -2,7 +2,8 @@ import Ripple from '../ripple';
2
2
  import VarLoading from '../loading';
3
3
  import { defineComponent, ref } from 'vue';
4
4
  import { props } from './props';
5
- import { createNamespace } from '../utils/components';
5
+ import { call, createNamespace } from '../utils/components';
6
+ import { isArray } from '@varlet/shared';
6
7
  var {
7
8
  n,
8
9
  classes
@@ -67,7 +68,8 @@ export default defineComponent({
67
68
  var attemptAutoLoading = result => {
68
69
  if (props.autoLoading) {
69
70
  pending.value = true;
70
- Promise.resolve(result).then(() => {
71
+ result = isArray(result) ? result : [result];
72
+ Promise.all(result).then(() => {
71
73
  pending.value = false;
72
74
  }).catch(() => {
73
75
  pending.value = false;
@@ -86,7 +88,7 @@ export default defineComponent({
86
88
  return;
87
89
  }
88
90
 
89
- attemptAutoLoading(onClick(e));
91
+ attemptAutoLoading(call(onClick, e));
90
92
  };
91
93
 
92
94
  var handleTouchstart = e => {
@@ -100,7 +102,7 @@ export default defineComponent({
100
102
  return;
101
103
  }
102
104
 
103
- attemptAutoLoading(onTouchstart(e));
105
+ attemptAutoLoading(call(onTouchstart, e));
104
106
  };
105
107
 
106
108
  return {
@@ -1,7 +1,7 @@
1
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
2
 
3
3
  import { props as loadingProps } from '../loading/props';
4
- import { pickProps } from '../utils/components';
4
+ import { defineListenerProp, pickProps } from '../utils/components';
5
5
 
6
6
  function typeValidator(type) {
7
7
  return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
@@ -68,10 +68,6 @@ export var props = {
68
68
  loadingColor: _extends({}, pickProps(loadingProps, 'color'), {
69
69
  default: 'currentColor'
70
70
  }),
71
- onClick: {
72
- type: Function
73
- },
74
- onTouchstart: {
75
- type: Function
76
- }
71
+ onClick: defineListenerProp(),
72
+ onTouchstart: defineListenerProp()
77
73
  };
package/es/card/Card.js CHANGED
@@ -30,7 +30,7 @@ export function render(_ctx, _cache) {
30
30
 
31
31
  return _withDirectives((_openBlock(), _createElementBlock("div", {
32
32
  ref: "card",
33
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.isRow, _ctx.n('--layout-row')], [_ctx.elevation, _ctx.n("$-elevation--" + _ctx.elevation), _ctx.n('$-elevation--1')])),
33
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.isRow, _ctx.n('--layout-row')], [_ctx.outline, _ctx.n('--outline')], [_ctx.elevation, _ctx.n("$-elevation--" + _ctx.elevation), _ctx.n('$-elevation--1')])),
34
34
  style: _normalizeStyle({
35
35
  zIndex: _ctx.floated ? _ctx.zIndex : undefined
36
36
  }),
package/es/card/card.css CHANGED
@@ -1 +1 @@
1
- :root { --card-padding: 0 0 15px 0; --card-background: #fff; --card-border-radius: 4px; --card-image-width: 100%; --card-row-image-width: 140px; --card-image-height: 200px; --card-row-height: 140px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-title-row-margin: 12px 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0 12px; --card-subtitle-margin: 10px 0 0 0; --card-subtitle-row-margin: -8px 0 0 0; --card-description-color: rgba(0, 0, 0, 0.6); --card-description-font-size: 14px; --card-description-margin: 20px 0 0 0; --card-description-padding: 0 13px; --card-footer-padding: 0 12px; --card-footer-right: 13px; --card-footer-bottom: 9px; --card-footer-margin: 30px 0 0 0; --card-line-height: 22px; --card-row-line-height: 1.5; --card-floating-buttons-bottom: 16px; --card-floating-buttons-right: 16px; --card-floating-buttons-color: #fff; --card-close-button-icon-size: 24px; --card-close-button-size: 56px; --card-close-button-primary-color: #212121;}.var-card { border-radius: var(--card-border-radius); overflow: hidden; width: 100%;}.var-card__floater { display: flex; flex-direction: column; position: static; line-height: var(--card-line-height); background: var(--card-background); transition: background-color 0.25s, color 0.25s; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__container { padding: var(--card-padding); flex-grow: 1; min-width: 0;}.var-card--layout-row .var-card__floater { min-height: var(--card-row-height); height: 100%; flex-direction: row; position: relative; line-height: var(--card-row-line-height);}.var-card__image { width: var(--card-image-width); height: var(--card-image-height); display: block;}.var-card--layout-row .var-card__image { width: var(--card-row-image-width); height: auto; display: block; flex-shrink: 0;}.var-card__title { font-size: var(--card-title-font-size); padding: var(--card-title-padding); margin: var(--card-title-margin); color: var(--card-title-color); word-break: break-word;}.var-card--layout-row .var-card__title { max-width: 100%; overflow: hidden; margin: var(--card-title-row-margin); text-overflow: ellipsis; white-space: nowrap;}.var-card__subtitle { font-size: var(--card-subtitle-font-size); color: var(--card-subtitle-color); padding: var(--card-subtitle-padding); margin: var(--card-subtitle-margin); word-break: break-word;}.var-card--layout-row .var-card__subtitle { margin: var(--card-subtitle-row-margin); text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;}.var-card__description { font-size: var(--card-description-font-size); color: var(--card-description-color); margin: var(--card-description-margin); padding: var(--card-description-padding); word-break: break-all;}.var-card__footer { display: flex; justify-content: flex-end; padding: var(--card-footer-padding); margin: var(--card-footer-margin);}.var-card--layout-row .var-card__footer { position: absolute; padding: 0; right: var(--card-footer-right); bottom: var(--card-footer-bottom);}.var-card__floating-content { overflow: hidden; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__floating-buttons { position: fixed; bottom: var(--card-floating-buttons-bottom); right: var(--card-floating-buttons-right); color: var(--card-floating-buttons-color);}.var-card__close-button[var-card-cover] { padding: var(--card-close-button-padding); width: var(--card-close-button-size); height: var(--card-close-button-size); background-color: var(--card-close-button-primary-color);}.var-card__close-button-icon[var-card-cover] { font-size: var(--card-close-button-icon-size);}
1
+ :root { --card-padding: 0 0 15px 0; --card-background: #fff; --card-outline-color: rgba(0, 0, 0, 0.12); --card-border-radius: 4px; --card-image-width: 100%; --card-row-image-width: 140px; --card-image-height: 200px; --card-row-height: 140px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-title-row-margin: 12px 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0 12px; --card-subtitle-margin: 10px 0 0 0; --card-subtitle-row-margin: -8px 0 0 0; --card-description-color: rgba(0, 0, 0, 0.6); --card-description-font-size: 14px; --card-description-margin: 20px 0 0 0; --card-description-padding: 0 13px; --card-footer-padding: 0 12px; --card-footer-right: 13px; --card-footer-bottom: 9px; --card-footer-margin: 30px 0 0 0; --card-line-height: 22px; --card-row-line-height: 1.5; --card-floating-buttons-bottom: 16px; --card-floating-buttons-right: 16px; --card-floating-buttons-color: #fff; --card-close-button-icon-size: 24px; --card-close-button-size: 56px; --card-close-button-primary-color: #212121;}.var-card { border-radius: var(--card-border-radius); overflow: hidden; width: 100%;}.var-card--outline { border: thin solid var(--card-outline-color);}.var-card__floater { display: flex; flex-direction: column; position: static; line-height: var(--card-line-height); background: var(--card-background); transition: background-color 0.25s, color 0.25s; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__container { padding: var(--card-padding); flex-grow: 1; min-width: 0;}.var-card--layout-row .var-card__floater { min-height: var(--card-row-height); height: 100%; flex-direction: row; position: relative; line-height: var(--card-row-line-height);}.var-card__image { width: var(--card-image-width); height: var(--card-image-height); display: block;}.var-card--layout-row .var-card__image { width: var(--card-row-image-width); height: auto; display: block; flex-shrink: 0;}.var-card__title { font-size: var(--card-title-font-size); padding: var(--card-title-padding); margin: var(--card-title-margin); color: var(--card-title-color); word-break: break-word;}.var-card--layout-row .var-card__title { max-width: 100%; overflow: hidden; margin: var(--card-title-row-margin); text-overflow: ellipsis; white-space: nowrap;}.var-card__subtitle { font-size: var(--card-subtitle-font-size); color: var(--card-subtitle-color); padding: var(--card-subtitle-padding); margin: var(--card-subtitle-margin); word-break: break-word;}.var-card--layout-row .var-card__subtitle { margin: var(--card-subtitle-row-margin); text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;}.var-card__description { font-size: var(--card-description-font-size); color: var(--card-description-color); margin: var(--card-description-margin); padding: var(--card-description-padding); word-break: break-all;}.var-card__footer { display: flex; justify-content: flex-end; padding: var(--card-footer-padding); margin: var(--card-footer-margin);}.var-card--layout-row .var-card__footer { position: absolute; padding: 0; right: var(--card-footer-right); bottom: var(--card-footer-bottom);}.var-card__floating-content { overflow: hidden; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__floating-buttons { position: fixed; bottom: var(--card-floating-buttons-bottom); right: var(--card-floating-buttons-right); color: var(--card-floating-buttons-color);}.var-card__close-button[var-card-cover] { padding: var(--card-close-button-padding); width: var(--card-close-button-size); height: var(--card-close-button-size); background-color: var(--card-close-button-primary-color);}.var-card__close-button-icon[var-card-cover] { font-size: var(--card-close-button-icon-size);}
package/es/card/props.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { defineListenerProp } from '../utils/components';
2
+
1
3
  function fitValidator(fit) {
2
4
  return ['fill', 'contain', 'cover', 'none', 'scale-down'].includes(fit);
3
5
  }
@@ -17,6 +19,10 @@ export var props = {
17
19
  imageWidth: {
18
20
  type: [String, Number]
19
21
  },
22
+ outline: {
23
+ type: Boolean,
24
+ default: false
25
+ },
20
26
  layout: {
21
27
  type: String,
22
28
  default: 'column'
@@ -25,9 +31,6 @@ export var props = {
25
31
  type: Boolean,
26
32
  default: false
27
33
  },
28
- 'onUpdate:floating': {
29
- type: Function
30
- },
31
34
  floatingDuration: {
32
35
  type: Number,
33
36
  default: 250
@@ -51,7 +54,6 @@ export var props = {
51
54
  type: Boolean,
52
55
  default: false
53
56
  },
54
- onClick: {
55
- type: Function
56
- }
57
+ onClick: defineListenerProp(),
58
+ 'onUpdate:floating': defineListenerProp()
57
59
  };
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  modelValue: {
3
4
  type: [String, Number, Boolean, Object, Array],
@@ -39,13 +40,7 @@ export var props = {
39
40
  rules: {
40
41
  type: Array
41
42
  },
42
- onClick: {
43
- type: Function
44
- },
45
- onChange: {
46
- type: Function
47
- },
48
- 'onUpdate:modelValue': {
49
- type: Function
50
- }
43
+ onClick: defineListenerProp(),
44
+ onChange: defineListenerProp(),
45
+ 'onUpdate:modelValue': defineListenerProp()
51
46
  };
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export function directionValidator(direction) {
2
3
  return ['horizontal', 'vertical'].includes(direction);
3
4
  }
@@ -21,10 +22,6 @@ export var props = {
21
22
  rules: {
22
23
  type: Array
23
24
  },
24
- onChange: {
25
- type: Function
26
- },
27
- 'onUpdate:modelValue': {
28
- type: Function
29
- }
25
+ onChange: defineListenerProp(),
26
+ 'onUpdate:modelValue': defineListenerProp()
30
27
  };
package/es/chip/props.js CHANGED
@@ -1,4 +1,4 @@
1
- import { pickProps } from '../utils/components';
1
+ import { defineListenerProp, pickProps } from '../utils/components';
2
2
  import { props as iconProps } from '../icon/props';
3
3
 
4
4
  function typeValidator(type) {
@@ -43,7 +43,5 @@ export var props = {
43
43
  type: Boolean,
44
44
  default: false
45
45
  },
46
- onClose: {
47
- type: Function
48
- }
46
+ onClose: defineListenerProp()
49
47
  };
package/es/col/props.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { defineListenerProp } from '../utils/components';
2
+
1
3
  function directionValidator(direction) {
2
4
  return ['row', 'column'].includes(direction);
3
5
  }
@@ -16,9 +18,6 @@ export var props = {
16
18
  default: 'row',
17
19
  validator: directionValidator
18
20
  },
19
- onClick: {
20
- type: Function
21
- },
22
21
  xs: {
23
22
  type: [Object, Number, String]
24
23
  },
@@ -33,5 +32,6 @@ export var props = {
33
32
  },
34
33
  xl: {
35
34
  type: [Object, Number, String]
36
- }
35
+ },
36
+ onClick: defineListenerProp()
37
37
  };
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  modelValue: {
3
4
  type: [Array, String, Number]
@@ -10,10 +11,6 @@ export var props = {
10
11
  type: Boolean,
11
12
  default: true
12
13
  },
13
- onChange: {
14
- type: Function
15
- },
16
- 'onUpdate:modelValue': {
17
- type: Function
18
- }
14
+ onChange: defineListenerProp(),
15
+ 'onUpdate:modelValue': defineListenerProp()
19
16
  };
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  time: {
3
4
  type: [String, Number],
@@ -11,10 +12,6 @@ export var props = {
11
12
  type: Boolean,
12
13
  default: true
13
14
  },
14
- onEnd: {
15
- type: Function
16
- },
17
- onChange: {
18
- type: Function
19
- }
15
+ onEnd: defineListenerProp(),
16
+ onChange: defineListenerProp()
20
17
  };
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components';
1
2
  export var props = {
2
3
  modelValue: {
3
4
  type: [String, Number],
@@ -75,19 +76,9 @@ export var props = {
75
76
  rules: {
76
77
  type: Array
77
78
  },
78
- onBeforeChange: {
79
- type: Function
80
- },
81
- onChange: {
82
- type: Function
83
- },
84
- onIncrement: {
85
- type: Function
86
- },
87
- onDecrement: {
88
- type: Function
89
- },
90
- 'onUpdate:modelValue': {
91
- type: Function
92
- }
79
+ onBeforeChange: defineListenerProp(),
80
+ onChange: defineListenerProp(),
81
+ onIncrement: defineListenerProp(),
82
+ onDecrement: defineListenerProp(),
83
+ 'onUpdate:modelValue': defineListenerProp()
93
84
  };
@@ -1,3 +1,5 @@
1
+ import { defineListenerProp } from '../utils/components';
2
+
1
3
  function typeValidator(type) {
2
4
  return ['date', 'month'].includes(type);
3
5
  }
@@ -94,13 +96,7 @@ export var props = {
94
96
  type: Boolean,
95
97
  default: true
96
98
  },
97
- onPreview: {
98
- type: Function
99
- },
100
- onChange: {
101
- type: Function
102
- },
103
- 'onUpdate:modelValue': {
104
- type: Function
105
- }
99
+ onPreview: defineListenerProp(),
100
+ onChange: defineListenerProp(),
101
+ 'onUpdate:modelValue': defineListenerProp()
106
102
  };