@varlet/ui 2.18.3 → 2.19.0-alpha.1699554867300

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,11 +1,12 @@
1
1
  import Button from "./Button.mjs";
2
- import { withInstall } from "../utils/components.mjs";
2
+ import { props as buttonProps } from "./props.mjs";
3
+ import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
3
4
  withInstall(Button);
4
- import { props } from "./props.mjs";
5
+ withPropsDefaultsSetter(Button, buttonProps);
5
6
  const _ButtonComponent = Button;
6
7
  var stdin_default = Button;
7
8
  export {
8
9
  _ButtonComponent,
9
- props as buttonProps,
10
+ buttonProps,
10
11
  stdin_default as default
11
12
  };
@@ -259,7 +259,7 @@ import './tooltip/style/index.mjs'
259
259
  import './uploader/style/index.mjs'
260
260
  import './watermark/style/index.mjs'
261
261
 
262
- const version = '2.18.3'
262
+ const version = '2.19.0-alpha.1699554867300'
263
263
 
264
264
  function install(app) {
265
265
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -172,7 +172,7 @@ export * from './tooltip/index.mjs'
172
172
  export * from './uploader/index.mjs'
173
173
  export * from './watermark/index.mjs'
174
174
 
175
- const version = '2.18.3'
175
+ const version = '2.19.0-alpha.1699554867300'
176
176
 
177
177
  function install(app) {
178
178
  ActionSheet.install && app.use(ActionSheet)
@@ -1,8 +1,8 @@
1
1
  import '../../styles/common.css'
2
- import '../SnackbarSfc.css'
3
2
  import '../../styles/elevation.css'
4
3
  import '../../loading/loading.css'
5
4
  import '../../button/button.css'
6
5
  import '../../icon/icon.css'
7
6
  import '../snackbar.css'
8
7
  import '../coreSfc.css'
8
+ import '../SnackbarSfc.css'
@@ -44,7 +44,7 @@ import {
44
44
  Comment,
45
45
  Fragment
46
46
  } from "vue";
47
- import { createNamespaceFn, isArray } from "@varlet/shared";
47
+ import { createNamespaceFn, isArray, isPlainObject } from "@varlet/shared";
48
48
  function pickProps(props, propsKey) {
49
49
  return Array.isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
50
50
  pickedProps[key] = props[key];
@@ -61,6 +61,23 @@ function withInstall(component, target) {
61
61
  };
62
62
  return componentWithInstall;
63
63
  }
64
+ function withPropsDefaultsSetter(target, props) {
65
+ target.setPropsDefaults = function(defaults) {
66
+ Object.entries(defaults).forEach(([key, value]) => {
67
+ const prop = props[key];
68
+ if (prop == null) {
69
+ return;
70
+ }
71
+ if (isPlainObject(prop)) {
72
+ prop.default = value;
73
+ }
74
+ props[key] = {
75
+ type: prop,
76
+ default: value
77
+ };
78
+ });
79
+ };
80
+ }
64
81
  function mount(component) {
65
82
  const app = createApp(component);
66
83
  const host = document.createElement("div");
@@ -172,5 +189,6 @@ export {
172
189
  useRouteListener,
173
190
  useTeleport,
174
191
  useValidation,
175
- withInstall
192
+ withInstall,
193
+ withPropsDefaultsSetter
176
194
  };