@fangzhongya/fang-ui 0.1.58 → 0.1.59

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,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("vue");
4
- function useModel(props, emit, defaultValue) {
5
- const internalValue = vue.ref(defaultValue);
4
+ function useModel(props, emit, filter = (value) => value) {
5
+ const internalValue = vue.ref();
6
6
  const instance = vue.getCurrentInstance();
7
7
  const hasExternalValue = vue.computed(() => {
8
8
  if (!instance) return false;
@@ -11,7 +11,8 @@ function useModel(props, emit, defaultValue) {
11
11
  });
12
12
  return vue.computed({
13
13
  get() {
14
- return hasExternalValue.value ? props.modelValue ?? defaultValue : internalValue.value;
14
+ const v = hasExternalValue.value ? props.modelValue : internalValue.value;
15
+ return filter(v);
15
16
  },
16
17
  set(v) {
17
18
  if (hasExternalValue.value) {
@@ -1,2 +1,2 @@
1
1
  import { WritableComputedRef } from 'vue';
2
- export declare function useModel(props: ObjAny, emit: Function, defaultValue?: any): WritableComputedRef<any, any>;
2
+ export declare function useModel(props: ObjAny, emit: Function, filter?: (value: any) => any): WritableComputedRef<any, any>;
@@ -1,6 +1,6 @@
1
1
  import { ref, getCurrentInstance, computed } from "vue";
2
- function useModel(props, emit, defaultValue) {
3
- const internalValue = ref(defaultValue);
2
+ function useModel(props, emit, filter = (value) => value) {
3
+ const internalValue = ref();
4
4
  const instance = getCurrentInstance();
5
5
  const hasExternalValue = computed(() => {
6
6
  if (!instance) return false;
@@ -9,7 +9,8 @@ function useModel(props, emit, defaultValue) {
9
9
  });
10
10
  return computed({
11
11
  get() {
12
- return hasExternalValue.value ? props.modelValue ?? defaultValue : internalValue.value;
12
+ const v = hasExternalValue.value ? props.modelValue : internalValue.value;
13
+ return filter(v);
13
14
  },
14
15
  set(v) {
15
16
  if (hasExternalValue.value) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1768221514324,
4
+ "lastModified": 1768223728173,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": " <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\" ></path> "
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.58",
4
+ "version": "0.1.59",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -51,13 +51,13 @@
51
51
  "vue-tsc": "^3.2.2",
52
52
  "vxe-table": "4.6.20",
53
53
  "@fang-ui/components": "0.0.1-0",
54
- "@fang-ui/directives": "0.0.1-0",
55
54
  "@fang-ui/icons": "0.0.1-0",
55
+ "@fang-ui/directives": "0.0.1-0",
56
56
  "@fang-ui/hooks": "0.0.1-0",
57
- "@fang-ui/locale": "0.0.1-0",
58
57
  "@fang-ui/theme": "0.0.1-0",
59
- "@fang-ui/types": "0.0.1-0",
60
- "@fang-ui/utils": "0.0.1-0"
58
+ "@fang-ui/locale": "0.0.1-0",
59
+ "@fang-ui/utils": "0.0.1-0",
60
+ "@fang-ui/types": "0.0.1-0"
61
61
  },
62
62
  "main": "./dist/index.cjs",
63
63
  "module": "./dist/index.js",
File without changes