bkui-vue 0.0.1-beta.331 → 0.0.1-beta.332
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.cjs.js +25 -25
- package/dist/index.esm.js +76 -33
- package/dist/index.umd.js +26 -26
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/alert/alert.css +4 -0
- package/lib/alert/alert.less +24 -19
- package/lib/alert/alert.variable.css +4 -0
- package/lib/checkbox/checkbox.css +10 -6
- package/lib/checkbox/checkbox.less +38 -32
- package/lib/checkbox/checkbox.variable.css +10 -6
- package/lib/checkbox/index.js +1 -1
- package/lib/form/form-item.d.ts +14 -3
- package/lib/form/form.css +13 -7
- package/lib/form/form.less +61 -52
- package/lib/form/form.variable.css +13 -7
- package/lib/form/index.d.ts +11 -2
- package/lib/form/index.js +1 -1
- package/lib/form/type.d.ts +1 -2
- package/lib/form/utils.d.ts +2 -0
- package/lib/message/message.css +1 -1
- package/lib/message/message.less +1 -1
- package/lib/message/message.variable.css +1 -1
- package/lib/pagination/pagination.less +9 -7
- package/lib/radio/index.js +1 -1
- package/lib/radio/radio.css +60 -63
- package/lib/radio/radio.less +74 -78
- package/lib/radio/radio.variable.css +60 -63
- package/lib/select/index.js +1 -1
- package/lib/shared/index.js +1 -1
- package/lib/table/index.js +1 -1
- package/lib/table/table.css +13 -6
- package/lib/table/table.less +6 -0
- package/lib/table/table.variable.css +13 -6
- package/lib/tree/tree.css +10 -6
- package/lib/tree/tree.variable.css +10 -6
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -7941,7 +7941,7 @@ class PropTypes extends propTypesNS {
|
|
7941
7941
|
const formKey = Symbol("form");
|
7942
7942
|
const formItemKey = Symbol("formItem");
|
7943
7943
|
const useForm = () => inject(formKey);
|
7944
|
-
const useFormItem = () => inject(formItemKey,
|
7944
|
+
const useFormItem = () => inject(formItemKey, void 0);
|
7945
7945
|
const on$2 = (() => {
|
7946
7946
|
if (document.addEventListener) {
|
7947
7947
|
return (element, event, handler) => {
|
@@ -9797,6 +9797,14 @@ var Component$w = defineComponent({
|
|
9797
9797
|
"is-disabled": this.isDisabled,
|
9798
9798
|
"is-indeterminated": this.indeterminate
|
9799
9799
|
});
|
9800
|
+
const renderLabel = () => {
|
9801
|
+
if (!this.label && !this.$slots.default) {
|
9802
|
+
return null;
|
9803
|
+
}
|
9804
|
+
return createVNode("span", {
|
9805
|
+
"class": "bk-checkbox-label"
|
9806
|
+
}, [this.$slots.default ? this.$slots.default() : this.label]);
|
9807
|
+
};
|
9800
9808
|
return createVNode("label", {
|
9801
9809
|
"class": checkboxClass
|
9802
9810
|
}, [createVNode("span", {
|
@@ -9808,9 +9816,7 @@ var Component$w = defineComponent({
|
|
9808
9816
|
"disabled": this.isDisabled,
|
9809
9817
|
"checked": this.isChecked,
|
9810
9818
|
"onChange": this.handleChange
|
9811
|
-
}, null)]),
|
9812
|
-
"class": "bk-checkbox-label"
|
9813
|
-
}, [this.label])]);
|
9819
|
+
}, null)]), renderLabel()]);
|
9814
9820
|
}
|
9815
9821
|
});
|
9816
9822
|
const checkboxGroupProps = {
|
@@ -13964,6 +13970,14 @@ var Component$o = defineComponent({
|
|
13964
13970
|
"is-disabled": this.isDisabled,
|
13965
13971
|
"is-checked": this.isChecked
|
13966
13972
|
});
|
13973
|
+
const renderLabel = () => {
|
13974
|
+
if (!this.label && !this.$slots.default) {
|
13975
|
+
return null;
|
13976
|
+
}
|
13977
|
+
return createVNode("span", {
|
13978
|
+
"class": "bk-radio-label"
|
13979
|
+
}, [this.$slots.default ? this.$slots.default() : this.label]);
|
13980
|
+
};
|
13967
13981
|
return createVNode("label", {
|
13968
13982
|
"class": radioClass,
|
13969
13983
|
"tabindex": "0"
|
@@ -13977,9 +13991,7 @@ var Component$o = defineComponent({
|
|
13977
13991
|
"onFocus": this.handleFocus,
|
13978
13992
|
"onBlur": this.handleBlur,
|
13979
13993
|
"onChange": this.handleChange
|
13980
|
-
}, null),
|
13981
|
-
"class": "bk-radio-text"
|
13982
|
-
}, [this.$slots.default ? this.$slots.default() : this.label])]);
|
13994
|
+
}, null), renderLabel()]);
|
13983
13995
|
}
|
13984
13996
|
});
|
13985
13997
|
const radioButtonProps = {
|
@@ -14022,6 +14034,14 @@ var RadioButton = defineComponent({
|
|
14022
14034
|
"is-disabled": this.isDisabled,
|
14023
14035
|
"is-checked": this.isChecked
|
14024
14036
|
});
|
14037
|
+
const renderLabel = () => {
|
14038
|
+
if (!this.label && !this.$slots.default) {
|
14039
|
+
return null;
|
14040
|
+
}
|
14041
|
+
return createVNode("span", {
|
14042
|
+
"class": "bk-radio-label"
|
14043
|
+
}, [this.$slots.default ? this.$slots.default() : this.label]);
|
14044
|
+
};
|
14025
14045
|
return createVNode("label", {
|
14026
14046
|
"class": radioClass,
|
14027
14047
|
"tabindex": "0"
|
@@ -14035,9 +14055,7 @@ var RadioButton = defineComponent({
|
|
14035
14055
|
"onFocus": this.handleFocus,
|
14036
14056
|
"onBlur": this.handleBlur,
|
14037
14057
|
"onChange": this.handleChange
|
14038
|
-
}, null),
|
14039
|
-
"class": "bk-radio-button-text"
|
14040
|
-
}, [this.$slots.default ? this.$slots.default() : this.label])]);
|
14058
|
+
}, null), renderLabel()]);
|
14041
14059
|
}
|
14042
14060
|
});
|
14043
14061
|
const radioGroupProps = {
|
@@ -15258,7 +15276,7 @@ var Component$j = defineComponent({
|
|
15258
15276
|
var _a;
|
15259
15277
|
handleSetSelectedData();
|
15260
15278
|
if (props2.withValidate) {
|
15261
|
-
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "
|
15279
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur");
|
15262
15280
|
}
|
15263
15281
|
}, {
|
15264
15282
|
deep: true
|
@@ -16457,7 +16475,8 @@ var usePagination = (props2, indexData) => {
|
|
16457
16475
|
count: 0,
|
16458
16476
|
limit: 10,
|
16459
16477
|
current: 1,
|
16460
|
-
align: "
|
16478
|
+
align: "right",
|
16479
|
+
layout: ["total", "limit", "list"]
|
16461
16480
|
});
|
16462
16481
|
pagination2 = resolvePaginationOption(props2.pagination, pagination2);
|
16463
16482
|
const localPagination = ref(null);
|
@@ -28758,8 +28777,14 @@ var Form = defineComponent({
|
|
28758
28777
|
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
|
28759
28778
|
}
|
28760
28779
|
});
|
28780
|
+
const getRuleMessage = (rule) => {
|
28781
|
+
if (typeof rule.message === "function") {
|
28782
|
+
return rule.message();
|
28783
|
+
}
|
28784
|
+
return rule.message;
|
28785
|
+
};
|
28761
28786
|
var defaultValidator = {
|
28762
|
-
required: (value) => value
|
28787
|
+
required: (value) => !_$1.isEmpty(value),
|
28763
28788
|
min: (value, min2) => value >= min2,
|
28764
28789
|
max: (value, max2) => max2 >= value,
|
28765
28790
|
email: (value) => /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(value),
|
@@ -28768,7 +28793,7 @@ var defaultValidator = {
|
|
28768
28793
|
};
|
28769
28794
|
const formItemProps = {
|
28770
28795
|
label: PropTypes.string,
|
28771
|
-
labelWidth: PropTypes.oneOfType([Number, String]),
|
28796
|
+
labelWidth: PropTypes.oneOfType([Number, String]).def(150),
|
28772
28797
|
labelPosition: PropTypes.oneOf(["left", "center", "right"]),
|
28773
28798
|
property: PropTypes.string.def(""),
|
28774
28799
|
required: PropTypes.bool.def(false),
|
@@ -28801,21 +28826,21 @@ const getRulesFromProps = (props2) => {
|
|
28801
28826
|
if (Number(props2.max) > -1) {
|
28802
28827
|
rules.push({
|
28803
28828
|
validator: (value) => defaultValidator.max(value, props2.max),
|
28804
|
-
message: `${props2.label}\u6700\u5927\u503C${props2.max}`,
|
28829
|
+
message: `${props2.label}\u6700\u5927\u503C ${props2.max}`,
|
28805
28830
|
trigger: "blur"
|
28806
28831
|
});
|
28807
28832
|
}
|
28808
28833
|
if (Number(props2.min) > -1) {
|
28809
28834
|
rules.push({
|
28810
28835
|
validator: (value) => defaultValidator.min(value, props2.min),
|
28811
|
-
message: `${props2.label}\u6700\u5C0F\u503C${props2.min}`,
|
28836
|
+
message: `${props2.label}\u6700\u5C0F\u503C ${props2.min}`,
|
28812
28837
|
trigger: "blur"
|
28813
28838
|
});
|
28814
28839
|
}
|
28815
28840
|
if (Number(props2.maxlength) > -1) {
|
28816
28841
|
rules.push({
|
28817
28842
|
validator: (value) => defaultValidator.maxlength(value, props2.maxlength),
|
28818
|
-
message: `${props2.label}\u6700\u5927\u957F\u5EA6${props2.maxlength}`,
|
28843
|
+
message: `${props2.label}\u6700\u5927\u957F\u5EA6 ${props2.maxlength}`,
|
28819
28844
|
trigger: "blur"
|
28820
28845
|
});
|
28821
28846
|
}
|
@@ -28843,8 +28868,8 @@ const mergeRules = (configRules, propsRules) => {
|
|
28843
28868
|
}
|
28844
28869
|
result.push({
|
28845
28870
|
validator: rulevalidator,
|
28846
|
-
message: rule.message,
|
28847
|
-
trigger: rule.trigger
|
28871
|
+
message: rule.message || "\u9A8C\u8BC1\u9519\u8BEF",
|
28872
|
+
trigger: rule.trigger || "blur"
|
28848
28873
|
});
|
28849
28874
|
return result;
|
28850
28875
|
}, []);
|
@@ -28868,37 +28893,51 @@ var FormItem = defineComponent({
|
|
28868
28893
|
bkTooltips: tooltips
|
28869
28894
|
},
|
28870
28895
|
props: formItemProps,
|
28871
|
-
setup(props2) {
|
28896
|
+
setup(props2, context) {
|
28897
|
+
const form2 = useForm();
|
28898
|
+
const isForm = Boolean(form2);
|
28899
|
+
const parentFormItem = useFormItem();
|
28900
|
+
const isNested = Boolean(parentFormItem);
|
28872
28901
|
const currentInstance = getCurrentInstance();
|
28873
28902
|
const state = reactive({
|
28874
28903
|
isError: false,
|
28875
28904
|
errorMessage: ""
|
28876
28905
|
});
|
28877
|
-
const form2 = useForm();
|
28878
|
-
const isForm = Boolean(form2);
|
28879
28906
|
const isFormTypeVertical = computed(() => {
|
28880
28907
|
if (!isForm) {
|
28881
28908
|
return false;
|
28882
28909
|
}
|
28883
28910
|
return form2.props.formType === "vertical";
|
28884
28911
|
});
|
28912
|
+
const isShowLabel = computed(() => {
|
28913
|
+
if (props2.label || context.slots.label) {
|
28914
|
+
return true;
|
28915
|
+
}
|
28916
|
+
return false;
|
28917
|
+
});
|
28885
28918
|
const labelStyles = computed(() => {
|
28886
28919
|
const styles = {
|
28887
28920
|
width: "",
|
28888
28921
|
paddingRight: "",
|
28889
28922
|
textAlign: ""
|
28890
28923
|
};
|
28924
|
+
const labelPosition = props2.labelPosition || isForm && form2.props.labelPosition;
|
28925
|
+
if (labelPosition) {
|
28926
|
+
styles["text-align"] = labelPosition;
|
28927
|
+
}
|
28928
|
+
if (form2.props.formType === "vertical" || !props2.label && isNested) {
|
28929
|
+
return styles;
|
28930
|
+
}
|
28891
28931
|
const labelWidth = isValid(props2.labelWidth) ? props2.labelWidth : isForm && form2.props.labelWidth;
|
28892
28932
|
if (isValid(labelWidth)) {
|
28893
28933
|
styles.width = `${labelWidth}px`;
|
28894
28934
|
styles.paddingRight = labelWidth ? "" : "0px";
|
28895
28935
|
}
|
28896
|
-
const labelPosition = props2.labelPosition || isForm && form2.props.labelPosition;
|
28897
|
-
if (labelPosition) {
|
28898
|
-
styles["text-align"] = labelPosition;
|
28899
|
-
}
|
28900
28936
|
return styles;
|
28901
28937
|
});
|
28938
|
+
const contentStyles = computed(() => ({
|
28939
|
+
["margin-left"]: labelStyles.value.width
|
28940
|
+
}));
|
28902
28941
|
const validate = (trigger) => {
|
28903
28942
|
if (!props2.property || isForm && !form2.props.model) {
|
28904
28943
|
return Promise.resolve(true);
|
@@ -28926,21 +28965,22 @@ var FormItem = defineComponent({
|
|
28926
28965
|
const rule = rules[stepIndex];
|
28927
28966
|
return Promise.resolve().then(() => {
|
28928
28967
|
const result = rule.validator(value);
|
28968
|
+
const errorMessage = getRuleMessage(rule);
|
28929
28969
|
if (typeof result !== "boolean" && typeof result.then === "function") {
|
28930
28970
|
return result.then((data2) => {
|
28931
28971
|
if (data2 === false) {
|
28932
|
-
return Promise.reject(
|
28972
|
+
return Promise.reject(errorMessage);
|
28933
28973
|
}
|
28934
28974
|
}).then(() => doValidate(), () => {
|
28935
28975
|
state.isError = true;
|
28936
|
-
state.errorMessage =
|
28937
|
-
return Promise.reject(
|
28976
|
+
state.errorMessage = errorMessage;
|
28977
|
+
return Promise.reject(errorMessage);
|
28938
28978
|
});
|
28939
28979
|
}
|
28940
28980
|
if (!result) {
|
28941
28981
|
state.isError = true;
|
28942
|
-
state.errorMessage =
|
28943
|
-
return Promise.reject(
|
28982
|
+
state.errorMessage = errorMessage;
|
28983
|
+
return Promise.reject(errorMessage);
|
28944
28984
|
}
|
28945
28985
|
return doValidate();
|
28946
28986
|
});
|
@@ -28967,7 +29007,9 @@ var FormItem = defineComponent({
|
|
28967
29007
|
}
|
28968
29008
|
});
|
28969
29009
|
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
29010
|
+
isShowLabel,
|
28970
29011
|
labelStyles,
|
29012
|
+
contentStyles,
|
28971
29013
|
isFormTypeVertical,
|
28972
29014
|
validate,
|
28973
29015
|
clearValidate
|
@@ -29008,11 +29050,12 @@ var FormItem = defineComponent({
|
|
29008
29050
|
};
|
29009
29051
|
return createVNode("div", {
|
29010
29052
|
"class": itemClassees
|
29011
|
-
}, [createVNode("div", {
|
29053
|
+
}, [this.isShowLabel && createVNode("div", {
|
29012
29054
|
"class": "bk-form-label",
|
29013
29055
|
"style": this.labelStyles
|
29014
29056
|
}, [renderLabel(), this.isFormTypeVertical && ((_b = (_a = this.$slots).labelAppend) == null ? void 0 : _b.call(_a))]), createVNode("div", {
|
29015
|
-
"class": "bk-form-content"
|
29057
|
+
"class": "bk-form-content",
|
29058
|
+
"style": this.contentStyles
|
29016
29059
|
}, [(_d = (_c = this.$slots).default) == null ? void 0 : _d.call(_c), renderError()])]);
|
29017
29060
|
}
|
29018
29061
|
});
|