@deot/vc 1.0.27 → 1.0.28

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.
package/dist/index.d.ts CHANGED
@@ -7865,6 +7865,18 @@ export declare const Components: {
7865
7865
  type: StringConstructor;
7866
7866
  default: string;
7867
7867
  };
7868
+ width: {
7869
+ type: NumberConstructor;
7870
+ default: number;
7871
+ };
7872
+ height: {
7873
+ type: NumberConstructor;
7874
+ default: number;
7875
+ };
7876
+ borderWidth: {
7877
+ type: NumberConstructor;
7878
+ default: number;
7879
+ };
7868
7880
  }>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("click" | "change" | "update:modelValue")[], "click" | "change" | "update:modelValue", PublicProps, Readonly<ExtractPropTypes< {
7869
7881
  modelValue: {
7870
7882
  type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
@@ -7893,6 +7905,18 @@ export declare const Components: {
7893
7905
  type: StringConstructor;
7894
7906
  default: string;
7895
7907
  };
7908
+ width: {
7909
+ type: NumberConstructor;
7910
+ default: number;
7911
+ };
7912
+ height: {
7913
+ type: NumberConstructor;
7914
+ default: number;
7915
+ };
7916
+ borderWidth: {
7917
+ type: NumberConstructor;
7918
+ default: number;
7919
+ };
7896
7920
  }>> & Readonly<{
7897
7921
  onChange?: ((...args: any[]) => any) | undefined;
7898
7922
  onClick?: ((...args: any[]) => any) | undefined;
@@ -7902,6 +7926,9 @@ export declare const Components: {
7902
7926
  disabled: boolean;
7903
7927
  checkedValue: string | number | boolean;
7904
7928
  uncheckedValue: string | number | boolean;
7929
+ height: number;
7930
+ width: number;
7931
+ borderWidth: number;
7905
7932
  checkedText: string;
7906
7933
  uncheckedText: string;
7907
7934
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
@@ -7933,6 +7960,18 @@ export declare const Components: {
7933
7960
  type: StringConstructor;
7934
7961
  default: string;
7935
7962
  };
7963
+ width: {
7964
+ type: NumberConstructor;
7965
+ default: number;
7966
+ };
7967
+ height: {
7968
+ type: NumberConstructor;
7969
+ default: number;
7970
+ };
7971
+ borderWidth: {
7972
+ type: NumberConstructor;
7973
+ default: number;
7974
+ };
7936
7975
  }>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("click" | "change" | "update:modelValue")[], "click" | "change" | "update:modelValue", PublicProps, Readonly<ExtractPropTypes< {
7937
7976
  modelValue: {
7938
7977
  type: (StringConstructor | BooleanConstructor | NumberConstructor)[];
@@ -7961,6 +8000,18 @@ export declare const Components: {
7961
8000
  type: StringConstructor;
7962
8001
  default: string;
7963
8002
  };
8003
+ width: {
8004
+ type: NumberConstructor;
8005
+ default: number;
8006
+ };
8007
+ height: {
8008
+ type: NumberConstructor;
8009
+ default: number;
8010
+ };
8011
+ borderWidth: {
8012
+ type: NumberConstructor;
8013
+ default: number;
8014
+ };
7964
8015
  }>> & Readonly<{
7965
8016
  onChange?: ((...args: any[]) => any) | undefined;
7966
8017
  onClick?: ((...args: any[]) => any) | undefined;
@@ -7970,6 +8021,9 @@ export declare const Components: {
7970
8021
  disabled: boolean;
7971
8022
  checkedValue: string | number | boolean;
7972
8023
  uncheckedValue: string | number | boolean;
8024
+ height: number;
8025
+ width: number;
8026
+ borderWidth: number;
7973
8027
  checkedText: string;
7974
8028
  uncheckedText: string;
7975
8029
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
@@ -34642,6 +34642,8 @@ var Vc = (function (exports, vue) {
34642
34642
  "is-validating": validateState.value === "validating",
34643
34643
  "is-inline": form.props.inline,
34644
34644
  "is-nest": isNest.value,
34645
+ "is-alone": !props2.showMessage,
34646
+ // 用于单独去除form-item的默认margin_bottom
34645
34647
  [`is-${labelPosition.value}`]: true
34646
34648
  };
34647
34649
  });
@@ -39032,6 +39034,18 @@ var Vc = (function (exports, vue) {
39032
39034
  uncheckedText: {
39033
39035
  type: String,
39034
39036
  default: ""
39037
+ },
39038
+ width: {
39039
+ type: Number,
39040
+ default: 36
39041
+ },
39042
+ height: {
39043
+ type: Number,
39044
+ default: 20
39045
+ },
39046
+ borderWidth: {
39047
+ type: Number,
39048
+ default: 1
39035
39049
  }
39036
39050
  };
39037
39051
  const useSwitch = (expose) => {
@@ -39110,28 +39124,65 @@ var Vc = (function (exports, vue) {
39110
39124
  expose
39111
39125
  }) {
39112
39126
  const {
39127
+ checked,
39113
39128
  classes,
39114
39129
  currentValue,
39115
39130
  isLoading,
39116
39131
  handleToggle
39117
39132
  } = useSwitch(expose);
39133
+ const size = vue.computed(() => {
39134
+ return props2.height - props2.borderWidth * 4;
39135
+ });
39136
+ const lefts = vue.computed(() => {
39137
+ return {
39138
+ inner: checked.value ? props2.width - props2.borderWidth * 3 - size.value : props2.borderWidth,
39139
+ loading: checked.value ? props2.height - props2.borderWidth * 2 : props2.borderWidth * 2
39140
+ };
39141
+ });
39142
+ const contentOffset = vue.computed(() => {
39143
+ return Math.max(props2.height / 2, size.value) + props2.borderWidth * 2;
39144
+ });
39118
39145
  return () => {
39119
- return vue.createVNode("span", {
39120
- "class": [classes.value, "vc-switch"],
39146
+ return vue.createVNode("div", {
39147
+ "style": {
39148
+ width: `${props2.width}px`
39149
+ },
39150
+ "class": [classes.value, "vc-switch"]
39151
+ }, [vue.createVNode("span", {
39152
+ "style": {
39153
+ height: `${props2.height}px`,
39154
+ borderWidth: `${props2.borderWidth}px`
39155
+ },
39156
+ "class": "vc-switch__wrapper",
39121
39157
  "onClick": handleToggle
39122
39158
  }, [vue.createVNode("input", {
39123
39159
  "name": props2.name,
39124
39160
  "value": currentValue.value,
39125
39161
  "type": "hidden"
39126
39162
  }, null), vue.createVNode("span", {
39127
- "class": "vc-switch__content"
39163
+ "class": "vc-switch__content",
39164
+ "style": {
39165
+ left: `${checked.value ? props2.height / 4 : contentOffset.value}px`,
39166
+ right: `${checked.value ? contentOffset.value : props2.height / 4}px`,
39167
+ top: 0,
39168
+ bottom: 0
39169
+ }
39128
39170
  }, [currentValue.value === props2.checkedValue ? slots.checked ? slots.checked() : props2.checkedText : null, currentValue.value === props2.uncheckedValue ? slots.unchecked ? slots.unchecked() : props2.uncheckedText : null]), vue.createVNode("span", {
39129
- "class": "vc-switch__inner"
39171
+ "class": "vc-switch__inner",
39172
+ "style": {
39173
+ width: `${size.value}px`,
39174
+ height: `${size.value}px`,
39175
+ left: `${lefts.value.inner}px`,
39176
+ top: `${props2.borderWidth}px`
39177
+ }
39130
39178
  }, null), isLoading.value && vue.createVNode(Spin, {
39131
39179
  "size": 14,
39132
39180
  "foreground": "#fff",
39133
- "class": "vc-switch__loading"
39134
- }, null)]);
39181
+ "class": "vc-switch__loading",
39182
+ "style": {
39183
+ left: `${lefts.value.loading}px`
39184
+ }
39185
+ }, null)])]);
39135
39186
  };
39136
39187
  }
39137
39188
  });
@@ -34645,6 +34645,8 @@
34645
34645
  "is-validating": validateState.value === "validating",
34646
34646
  "is-inline": form.props.inline,
34647
34647
  "is-nest": isNest.value,
34648
+ "is-alone": !props2.showMessage,
34649
+ // 用于单独去除form-item的默认margin_bottom
34648
34650
  [`is-${labelPosition.value}`]: true
34649
34651
  };
34650
34652
  });
@@ -39035,6 +39037,18 @@
39035
39037
  uncheckedText: {
39036
39038
  type: String,
39037
39039
  default: ""
39040
+ },
39041
+ width: {
39042
+ type: Number,
39043
+ default: 36
39044
+ },
39045
+ height: {
39046
+ type: Number,
39047
+ default: 20
39048
+ },
39049
+ borderWidth: {
39050
+ type: Number,
39051
+ default: 1
39038
39052
  }
39039
39053
  };
39040
39054
  const useSwitch = (expose) => {
@@ -39113,28 +39127,65 @@
39113
39127
  expose
39114
39128
  }) {
39115
39129
  const {
39130
+ checked,
39116
39131
  classes,
39117
39132
  currentValue,
39118
39133
  isLoading,
39119
39134
  handleToggle
39120
39135
  } = useSwitch(expose);
39136
+ const size = vue.computed(() => {
39137
+ return props2.height - props2.borderWidth * 4;
39138
+ });
39139
+ const lefts = vue.computed(() => {
39140
+ return {
39141
+ inner: checked.value ? props2.width - props2.borderWidth * 3 - size.value : props2.borderWidth,
39142
+ loading: checked.value ? props2.height - props2.borderWidth * 2 : props2.borderWidth * 2
39143
+ };
39144
+ });
39145
+ const contentOffset = vue.computed(() => {
39146
+ return Math.max(props2.height / 2, size.value) + props2.borderWidth * 2;
39147
+ });
39121
39148
  return () => {
39122
- return vue.createVNode("span", {
39123
- "class": [classes.value, "vc-switch"],
39149
+ return vue.createVNode("div", {
39150
+ "style": {
39151
+ width: `${props2.width}px`
39152
+ },
39153
+ "class": [classes.value, "vc-switch"]
39154
+ }, [vue.createVNode("span", {
39155
+ "style": {
39156
+ height: `${props2.height}px`,
39157
+ borderWidth: `${props2.borderWidth}px`
39158
+ },
39159
+ "class": "vc-switch__wrapper",
39124
39160
  "onClick": handleToggle
39125
39161
  }, [vue.createVNode("input", {
39126
39162
  "name": props2.name,
39127
39163
  "value": currentValue.value,
39128
39164
  "type": "hidden"
39129
39165
  }, null), vue.createVNode("span", {
39130
- "class": "vc-switch__content"
39166
+ "class": "vc-switch__content",
39167
+ "style": {
39168
+ left: `${checked.value ? props2.height / 4 : contentOffset.value}px`,
39169
+ right: `${checked.value ? contentOffset.value : props2.height / 4}px`,
39170
+ top: 0,
39171
+ bottom: 0
39172
+ }
39131
39173
  }, [currentValue.value === props2.checkedValue ? slots.checked ? slots.checked() : props2.checkedText : null, currentValue.value === props2.uncheckedValue ? slots.unchecked ? slots.unchecked() : props2.uncheckedText : null]), vue.createVNode("span", {
39132
- "class": "vc-switch__inner"
39174
+ "class": "vc-switch__inner",
39175
+ "style": {
39176
+ width: `${size.value}px`,
39177
+ height: `${size.value}px`,
39178
+ left: `${lefts.value.inner}px`,
39179
+ top: `${props2.borderWidth}px`
39180
+ }
39133
39181
  }, null), isLoading.value && vue.createVNode(Spin, {
39134
39182
  "size": 14,
39135
39183
  "foreground": "#fff",
39136
- "class": "vc-switch__loading"
39137
- }, null)]);
39184
+ "class": "vc-switch__loading",
39185
+ "style": {
39186
+ left: `${lefts.value.loading}px`
39187
+ }
39188
+ }, null)])]);
39138
39189
  };
39139
39190
  }
39140
39191
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@deot/vc-components": "^1.0.27",
23
- "@deot/vc-hooks": "^1.0.27",
24
- "@deot/vc-shared": "^1.0.27"
22
+ "@deot/vc-components": "^1.0.28",
23
+ "@deot/vc-hooks": "^1.0.28",
24
+ "@deot/vc-shared": "^1.0.28"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vue": "*"