@varlet/ui 2.9.6 → 2.10.0-alpha.1681657406626

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.
@@ -0,0 +1,4 @@
1
+ export default {
2
+ '--field-decorator-text-color': '#fff',
3
+ '--field-decorator-blur-color': 'rgb(255, 255, 255, .7)'
4
+ };
@@ -11,7 +11,7 @@ import collapse from './collapse.mjs';
11
11
  import datePicker from './datePicker.mjs';
12
12
  import dialog from './dialog.mjs';
13
13
  import divider from './divider.mjs';
14
- import input from './input.mjs';
14
+ import fieldDecorator from './fieldDecorator.mjs';
15
15
  import pagination from './pagination.mjs';
16
16
  import picker from './picker.mjs';
17
17
  import popup from './popup.mjs';
@@ -45,4 +45,4 @@ export default _extends({
45
45
  '--color-danger': '#ef5350',
46
46
  '--color-disabled': '#404040',
47
47
  '--color-text-disabled': '#757575'
48
- }, button, cell, card, timePicker, datePicker, skeleton, tabs, tab, popup, dialog, actionSheet, chip, badge, uploader, collapse, pullRefresh, switchThemes, steps, pagination, table, input, select, radio, checkbox, divider, picker, appBar, bottomNavigation, bottomNavigationItem, menu, result, breadcrumb, paper, avatar);
48
+ }, button, cell, card, timePicker, datePicker, skeleton, tabs, tab, popup, dialog, actionSheet, chip, badge, uploader, collapse, pullRefresh, switchThemes, steps, pagination, table, fieldDecorator, select, radio, checkbox, divider, picker, appBar, bottomNavigation, bottomNavigationItem, menu, result, breadcrumb, paper, avatar);
@@ -1,5 +1,3 @@
1
1
  export default {
2
- '--select-select-text-color': '#fff',
3
- '--select-blur-color': 'rgb(255, 255, 255, .7)',
4
2
  '--select-scroller-background': '#303030'
5
3
  };
@@ -5,7 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  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); }
6
6
 
7
7
  import { useEventListener } from '@varlet/use';
8
- import { createApp, h, getCurrentInstance, isVNode, ref, onActivated, onDeactivated, Comment, Fragment } from 'vue';
8
+ import { createApp, h, getCurrentInstance, isVNode, ref, onActivated, onDeactivated, Comment, Fragment, computed, watch } from 'vue';
9
9
  import { inBrowser, isArray } from '@varlet/shared';
10
10
  export function pickProps(props, propsKey) {
11
11
  return Array.isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
@@ -232,4 +232,41 @@ export function formatElevation(elevation, defaultLevel) {
232
232
  }
233
233
 
234
234
  return "var-elevation--" + elevation;
235
+ }
236
+ export function useVModel(props, key, options) {
237
+ if (options === void 0) {
238
+ options = {};
239
+ }
240
+
241
+ var {
242
+ passive = true,
243
+ eventName,
244
+ defaultValue,
245
+ emit
246
+ } = options;
247
+ var event = eventName != null ? eventName : "onUpdate:" + key.toString();
248
+
249
+ var getValue = () => props[key] != null ? props[key] : defaultValue;
250
+
251
+ if (!passive) {
252
+ return computed({
253
+ get() {
254
+ return getValue();
255
+ },
256
+
257
+ set(value) {
258
+ emit ? emit(event, value) : call(props[event], value);
259
+ }
260
+
261
+ });
262
+ }
263
+
264
+ var proxy = ref(getValue());
265
+ watch(() => props[key], () => {
266
+ proxy.value = getValue();
267
+ });
268
+ watch(() => proxy.value, newValue => {
269
+ emit ? emit(event, newValue) : call(props[event], newValue);
270
+ });
271
+ return proxy;
235
272
  }