@nutui/nutui-react 2.0.16 → 2.0.17-beta.0
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/CHANGELOG.md +15 -0
- package/dist/esm/Audio.js +1 -2
- package/dist/esm/Avatar.js +1 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/Form.js +51 -3
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/InputNumber.js +2 -2
- package/dist/esm/Picker.js +4 -6
- package/dist/esm/Table.js +4 -4
- package/dist/esm/VirtualList.js +3 -4
- package/dist/esm/cascader2.js +3 -3
- package/dist/esm/formitem2.js +29 -9
- package/dist/esm/types/src/packages/cascader/cascader.d.ts +2 -1
- package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/form/types.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/table/types.d.ts +1 -1
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +3 -6
- package/dist/esm/types/src/packages/virtuallist/utils.d.ts +1 -1
- package/dist/esm/types/src/utils/get-rect-by-taro.d.ts +12 -0
- package/dist/esm/types/src/utils/use-client-rect.d.ts +3 -9
- package/dist/esm/types/src/utils/use-uuid.d.ts +1 -0
- package/dist/locales/src/locales/base.js +5 -0
- package/dist/locales/{en-US.js → src/locales/en-US.js} +1 -1
- package/dist/locales/{id-ID.js → src/locales/id-ID.js} +1 -1
- package/dist/locales/{tr-TR.js → src/locales/tr-TR.js} +1 -1
- package/dist/locales/{zh-CN.js → src/locales/zh-CN.js} +1 -1
- package/dist/locales/{zh-TW.js → src/locales/zh-TW.js} +1 -1
- package/dist/locales/{zh-UG.js → src/locales/zh-UG.js} +1 -1
- package/dist/nutui.react.es.js +120 -37
- package/dist/nutui.react.umd.js +120 -37
- package/dist/packages/form/form.scss +9 -1
- package/dist/packages/formitem/formitem.scss +0 -11
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/cascader/cascader.d.ts +2 -1
- package/dist/types/packages/form/types.d.ts +1 -0
- package/dist/types/packages/formitem/formitem.d.ts +5 -0
- package/dist/types/packages/table/types.d.ts +1 -1
- package/dist/types/packages/virtuallist/utils.d.ts +1 -1
- package/dist/types/utils/use-client-rect.d.ts +3 -9
- package/package.json +1 -1
- package/dist/locales/base.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# v2.0.17
|
|
2
|
+
`2023-09-13`
|
|
3
|
+
|
|
4
|
+
* :sparkles: feat: form 增加 validateTrigger 和 getFieldsValue (#1411) @oasis-cloud
|
|
5
|
+
* :bug: fix: add popupProps (#1426) @oasis-cloud
|
|
6
|
+
* :bug: fix: form label position left (#1412) @oasis-cloud
|
|
7
|
+
* :bug: fix: lint errors (#1406) @xiaoyatong
|
|
8
|
+
* :bug: fix: review package update (#1423) @xiaoyatong
|
|
9
|
+
* :bug: fix: swipe component fails to slide in Alipay (#1399) @oasis-cloud
|
|
10
|
+
* :bug: fix: table expose rowIndex (#1400) @oasis-cloud
|
|
11
|
+
* :bug: fix: toast组件 duration 设置无效 (#1424) @oasis-cloud
|
|
12
|
+
* 🔨 chore: glob & prettier update (#1427) @xiaoyatong
|
|
13
|
+
* 🔨 chore: swc 版本恢复 (#1425) @oasis-cloud
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
# v2.0.16
|
|
2
17
|
`2023-09-06`
|
|
3
18
|
|
package/dist/esm/Audio.js
CHANGED
|
@@ -69,10 +69,9 @@ var Audio = function Audio2(props) {
|
|
|
69
69
|
handPlaying: false
|
|
70
70
|
});
|
|
71
71
|
var classPrefix = "nut-audio";
|
|
72
|
-
var warn = console.warn;
|
|
73
72
|
var handleEnded = function handleEnded2(e) {
|
|
74
73
|
if (props.loop) {
|
|
75
|
-
warn(locale.audio.tips || "onPlayEnd事件在loop=false时才会触发");
|
|
74
|
+
console.warn(locale.audio.tips || "onPlayEnd事件在loop=false时才会触发");
|
|
76
75
|
} else {
|
|
77
76
|
props.onEnd && props.onEnd(e);
|
|
78
77
|
}
|
package/dist/esm/Avatar.js
CHANGED
|
@@ -116,7 +116,7 @@ var Avatar = function Avatar2(props) {
|
|
|
116
116
|
className: "icon"
|
|
117
117
|
})), showMax && React__default.createElement("div", {
|
|
118
118
|
className: "text"
|
|
119
|
-
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - (parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.max)))));
|
|
119
|
+
}, parent !== null && parent !== void 0 && (_parent$propAvatarGro13 = parent.propAvatarGroup) !== null && _parent$propAvatarGro13 !== void 0 && _parent$propAvatarGro13.maxContent ? parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro14 = parent.propAvatarGroup) === null || _parent$propAvatarGro14 === void 0 ? void 0 : _parent$propAvatarGro14.maxContent : "+ ".concat(avatarIndex - Number((parent === null || parent === void 0 ? void 0 : (_parent$propAvatarGro15 = parent.propAvatarGroup) === null || _parent$propAvatarGro15 === void 0 ? void 0 : _parent$propAvatarGro15.max) || 0)))));
|
|
120
120
|
};
|
|
121
121
|
Avatar.defaultProps = defaultProps;
|
|
122
122
|
Avatar.displayName = "NutAvatar";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-cell-group{display:block}.nut-cell-group__title{display:inherit;padding:var(--nutui-cell-group-title-padding, 0 10px);color:var(--nutui-cell-group-title-color, #909ca4);font-size:var(--nutui-cell-group-title-font-size, var(--nutui-font-size-2, 14px));line-height:var(--nutui-cell-group-title-line-height, 20px);margin-top:30px;margin-bottom:10px}.nut-cell-group__description{display:inherit;padding:var(--nutui-cell-group-description-padding, 0 10px);color:var(--nutui-cell-group-description-color, #909ca4);font-size:var(--nutui-cell-group-description-font-size, var(--nutui-font-size-1, 12px));line-height:var(--nutui-cell-group-description-line-height, 16px);margin-top:10px;margin-bottom:10px}.nut-cell-group__wrap{display:inherit;border-radius:var(--nutui-cell-border-radius, 6px);overflow:hidden;background-color:var(--nutui-cell-group-background-color, var(--nutui-gray-6, #ffffff));margin:10px 0}.nut-cell-group__wrap .nut-cell{margin:0;box-shadow:none;border-radius:0}.nut-cell-group__wrap--divider .nut-cell__divider{position:absolute;box-sizing:border-box;pointer-events:none;right:var(--nutui-cell-divider-right, 16px);bottom:0;left:var(--nutui-cell-divider-left, 16px);transform:scaleY(.5);border-top:var(--nutui-cell-divider-border-bottom, 2px solid #f5f6f7)}.nut-cell-group__wrap--divider .nut-cell:last-child .nut-cell__divider{border-top:0!important}.nut-cell{position:relative;display:flex;width:100%;line-height:var(--nutui-cell-line-height, 20px);padding:var(--nutui-cell-padding, 13px 16px);background-color:var(--nutui-cell-background-color, var(--nutui-gray-6, #ffffff));border-radius:var(--nutui-cell-border-radius, 6px);box-shadow:var(--nutui-cell-box-shadow, 0px 1px 7px 0px rgb(237, 238, 241));font-size:var(--nutui-cell-title-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-title-color, var(--nutui-gray-1, #1a1a1a));margin:10px 0;box-sizing:border-box}.nut-cell__left{display:flex;flex-direction:column;flex:1}.nut-cell__description{font-size:var(--nutui-cell-description-font-size, var(--nutui-font-size-1, 12px));color:var(--nutui-cell-description-color, var(--nutui-gray-2, #757575))}.nut-cell__extra{display:inline-flex;justify-content:flex-end;align-items:center;flex:1;min-width:0;word-break:break-all;font-size:var(--nutui-cell-extra-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-extra-color, var(--nutui-gray-2, #757575))}.nut-form-item{display:flex}.nut-form-item
|
|
1
|
+
.nut-cell-group{display:block}.nut-cell-group__title{display:inherit;padding:var(--nutui-cell-group-title-padding, 0 10px);color:var(--nutui-cell-group-title-color, #909ca4);font-size:var(--nutui-cell-group-title-font-size, var(--nutui-font-size-2, 14px));line-height:var(--nutui-cell-group-title-line-height, 20px);margin-top:30px;margin-bottom:10px}.nut-cell-group__description{display:inherit;padding:var(--nutui-cell-group-description-padding, 0 10px);color:var(--nutui-cell-group-description-color, #909ca4);font-size:var(--nutui-cell-group-description-font-size, var(--nutui-font-size-1, 12px));line-height:var(--nutui-cell-group-description-line-height, 16px);margin-top:10px;margin-bottom:10px}.nut-cell-group__wrap{display:inherit;border-radius:var(--nutui-cell-border-radius, 6px);overflow:hidden;background-color:var(--nutui-cell-group-background-color, var(--nutui-gray-6, #ffffff));margin:10px 0}.nut-cell-group__wrap .nut-cell{margin:0;box-shadow:none;border-radius:0}.nut-cell-group__wrap--divider .nut-cell__divider{position:absolute;box-sizing:border-box;pointer-events:none;right:var(--nutui-cell-divider-right, 16px);bottom:0;left:var(--nutui-cell-divider-left, 16px);transform:scaleY(.5);border-top:var(--nutui-cell-divider-border-bottom, 2px solid #f5f6f7)}.nut-cell-group__wrap--divider .nut-cell:last-child .nut-cell__divider{border-top:0!important}.nut-cell{position:relative;display:flex;width:100%;line-height:var(--nutui-cell-line-height, 20px);padding:var(--nutui-cell-padding, 13px 16px);background-color:var(--nutui-cell-background-color, var(--nutui-gray-6, #ffffff));border-radius:var(--nutui-cell-border-radius, 6px);box-shadow:var(--nutui-cell-box-shadow, 0px 1px 7px 0px rgb(237, 238, 241));font-size:var(--nutui-cell-title-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-title-color, var(--nutui-gray-1, #1a1a1a));margin:10px 0;box-sizing:border-box}.nut-cell__left{display:flex;flex-direction:column;flex:1}.nut-cell__description{font-size:var(--nutui-cell-description-font-size, var(--nutui-font-size-1, 12px));color:var(--nutui-cell-description-color, var(--nutui-gray-2, #757575))}.nut-cell__extra{display:inline-flex;justify-content:flex-end;align-items:center;flex:1;min-width:0;word-break:break-all;font-size:var(--nutui-cell-extra-font-size, var(--nutui-font-size-2, 14px));color:var(--nutui-cell-extra-color, var(--nutui-gray-2, #757575))}.nut-form-item{display:flex}.nut-form-item.error.line:before{border-bottom:1px solid var(--nutui-form-item-error-line-color, var(--nutui-brand-color, #fa2c19));transform:scaleX(1);transition:transform .2s cubic-bezier(0,0,.2,1) 0ms}.nut-form-item__label{font-size:var(--nutui-form-item-label-font-size, 14px);font-weight:400;width:var(--nutui-form-item-label-width, 90px);margin-right:var(--nutui-form-item-label-margin-right, 10px);flex:none!important;display:inline-block!important;word-wrap:break-word;text-align:var(--nutui-form-item-label-text-align, left)}.nut-form-item__label .required:before{content:"*";color:var(--nutui-form-item-required-color, var(--nutui-brand-color, #fa2c19));margin-right:var(--nutui-form-item-required-margin-right, 4px)}.nut-form-item__body{flex:1;display:flex!important;flex-direction:column}.nut-form-item__body__slots{text-align:var(--nutui-form-item-body-slots-text-align, left)}.nut-form-item__body__slots .nut-input{padding:0;border:0}.nut-form-item__body__slots .nut-input-text{font-size:var(--nutui-form-item-body-font-size, 14px);text-align:var(--nutui-form-item-body-input-text-align, left);color:var(--nutui-gray-0, #000000);width:100%;outline:0 none;border:0;text-decoration:none;background:transparent}.nut-form-item__body__slots .nut-range-container{min-height:24px}.nut-form-item__body__slots .nut-textarea{padding:0!important}.nut-form-item__body__slots .nut-textarea .nut-textarea__textarea{font:inherit;text-align:var(--nutui-form-item-body-input-text-align, left)}.nut-form-item__body__tips{text-align:var(--nutui-form-item-tip-text-align, left);font-size:var(--nutui-form-item-tip-font-size, 10px);color:var(--nutui-form-item-error-message-color, var(--nutui-brand-color, #fa2c19))}.form-layout-right .nut-form-item__label{text-align:right;font-size:14px;padding-right:24px;white-space:nowrap}.form-layout-left .nut-form-item__label{position:relative;text-align:left;font-size:14px;padding-left:12px;white-space:nowrap}.form-layout-left .nut-form-item__label .required{display:block;line-height:1.5;position:absolute;left:.1em}.form-layout-top .nut-form-item{flex-direction:column;align-items:flex-start;white-space:nowrap}.form-layout-top .nut-form-item__label{padding-bottom:4px;display:block;font-size:14px;padding-right:24px}.form-layout-top .nut-form-item__body{margin-left:0;width:100%}
|
package/dist/esm/Form.js
CHANGED
|
@@ -1090,7 +1090,7 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1090
1090
|
_defineProperty(this, "store", {});
|
|
1091
1091
|
_defineProperty(this, "fieldEntities", []);
|
|
1092
1092
|
_defineProperty(this, "callbacks", {});
|
|
1093
|
-
_defineProperty(this, "errors",
|
|
1093
|
+
_defineProperty(this, "errors", {});
|
|
1094
1094
|
_defineProperty(this, "registerField", function(field) {
|
|
1095
1095
|
_this3.fieldEntities.push(field);
|
|
1096
1096
|
return function() {
|
|
@@ -1106,6 +1106,16 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1106
1106
|
var _this3$store;
|
|
1107
1107
|
return (_this3$store = _this3.store) === null || _this3$store === void 0 ? void 0 : _this3$store[name];
|
|
1108
1108
|
});
|
|
1109
|
+
_defineProperty(this, "getFieldsValue", function(name) {
|
|
1110
|
+
if (typeof name === "boolean") {
|
|
1111
|
+
return JSON.parse(JSON.stringify(_this3.store));
|
|
1112
|
+
}
|
|
1113
|
+
var fieldsValue = {};
|
|
1114
|
+
name.forEach(function(field) {
|
|
1115
|
+
fieldsValue[field] = _this3.getFieldValue(field);
|
|
1116
|
+
});
|
|
1117
|
+
return fieldsValue;
|
|
1118
|
+
});
|
|
1109
1119
|
_defineProperty(this, "setInitialValues", function(values, init) {
|
|
1110
1120
|
if (init) {
|
|
1111
1121
|
_this3.initialValues = values;
|
|
@@ -1147,15 +1157,47 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1147
1157
|
validator.messages();
|
|
1148
1158
|
validator.validate(_defineProperty({}, name, (_this3$store2 = _this3.store) === null || _this3$store2 === void 0 ? void 0 : _this3$store2[name]), function(errors) {
|
|
1149
1159
|
if (errors) {
|
|
1150
|
-
var _this3$errors;
|
|
1151
1160
|
err.push.apply(err, _toConsumableArray(errors));
|
|
1152
|
-
|
|
1161
|
+
_this3.errors[name] = errors;
|
|
1153
1162
|
}
|
|
1154
1163
|
entity.onStoreChange("validate");
|
|
1155
1164
|
});
|
|
1156
1165
|
});
|
|
1157
1166
|
return err;
|
|
1158
1167
|
});
|
|
1168
|
+
_defineProperty(this, "validateFields", function(nameList) {
|
|
1169
|
+
if (!nameList || nameList.length === 0) {
|
|
1170
|
+
_this3.validate();
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
_this3.fieldEntities.filter(function(_ref) {
|
|
1174
|
+
var name = _ref.props.name;
|
|
1175
|
+
return nameList.includes(name);
|
|
1176
|
+
}).forEach(function(entity) {
|
|
1177
|
+
var _this3$store3;
|
|
1178
|
+
var _entity$props2 = entity.props, name = _entity$props2.name, _entity$props2$rules = _entity$props2.rules, rules2 = _entity$props2$rules === void 0 ? [] : _entity$props2$rules;
|
|
1179
|
+
var descriptor = {};
|
|
1180
|
+
if (rules2.length) {
|
|
1181
|
+
if (rules2.length > 1) {
|
|
1182
|
+
descriptor[name] = [];
|
|
1183
|
+
rules2.forEach(function(v) {
|
|
1184
|
+
descriptor[name].push(v);
|
|
1185
|
+
});
|
|
1186
|
+
} else {
|
|
1187
|
+
descriptor[name] = rules2[0];
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
var validator = new Schema(descriptor);
|
|
1191
|
+
validator.messages();
|
|
1192
|
+
validator.validate(_defineProperty({}, name, (_this3$store3 = _this3.store) === null || _this3$store3 === void 0 ? void 0 : _this3$store3[name]), function(errors) {
|
|
1193
|
+
_this3.errors[name] = [];
|
|
1194
|
+
if (errors) {
|
|
1195
|
+
_this3.errors[name] = errors;
|
|
1196
|
+
}
|
|
1197
|
+
entity.onStoreChange("validate");
|
|
1198
|
+
});
|
|
1199
|
+
});
|
|
1200
|
+
});
|
|
1159
1201
|
_defineProperty(this, "submit", function() {
|
|
1160
1202
|
var errors = _this3.validate();
|
|
1161
1203
|
if (errors.length === 0) {
|
|
@@ -1173,12 +1215,18 @@ var FormStore = /* @__PURE__ */ _createClass(function FormStore2() {
|
|
|
1173
1215
|
entity.onStoreChange("reset");
|
|
1174
1216
|
});
|
|
1175
1217
|
});
|
|
1218
|
+
_defineProperty(this, "dispatch", function(_ref2) {
|
|
1219
|
+
var name = _ref2.name;
|
|
1220
|
+
_this3.validateFields([name]);
|
|
1221
|
+
});
|
|
1176
1222
|
_defineProperty(this, "getForm", function() {
|
|
1177
1223
|
return {
|
|
1224
|
+
dispatch: _this3.dispatch,
|
|
1178
1225
|
setInitialValues: _this3.setInitialValues,
|
|
1179
1226
|
setCallback: _this3.setCallback,
|
|
1180
1227
|
registerField: _this3.registerField,
|
|
1181
1228
|
getFieldValue: _this3.getFieldValue,
|
|
1229
|
+
getFieldsValue: _this3.getFieldsValue,
|
|
1182
1230
|
setFieldsValue: _this3.setFieldsValue,
|
|
1183
1231
|
resetFields: _this3.resetFields,
|
|
1184
1232
|
submit: _this3.submit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.nut-form-item{display:flex}.nut-form-item
|
|
1
|
+
.nut-form-item{display:flex}.nut-form-item.error.line:before{border-bottom:1px solid var(--nutui-form-item-error-line-color, var(--nutui-brand-color, #fa2c19));transform:scaleX(1);transition:transform .2s cubic-bezier(0,0,.2,1) 0ms}.nut-form-item__label{font-size:var(--nutui-form-item-label-font-size, 14px);font-weight:400;width:var(--nutui-form-item-label-width, 90px);margin-right:var(--nutui-form-item-label-margin-right, 10px);flex:none!important;display:inline-block!important;word-wrap:break-word;text-align:var(--nutui-form-item-label-text-align, left)}.nut-form-item__label .required:before{content:"*";color:var(--nutui-form-item-required-color, var(--nutui-brand-color, #fa2c19));margin-right:var(--nutui-form-item-required-margin-right, 4px)}.nut-form-item__body{flex:1;display:flex!important;flex-direction:column}.nut-form-item__body__slots{text-align:var(--nutui-form-item-body-slots-text-align, left)}.nut-form-item__body__slots .nut-input{padding:0;border:0}.nut-form-item__body__slots .nut-input-text{font-size:var(--nutui-form-item-body-font-size, 14px);text-align:var(--nutui-form-item-body-input-text-align, left);color:var(--nutui-gray-0, #000000);width:100%;outline:0 none;border:0;text-decoration:none;background:transparent}.nut-form-item__body__slots .nut-range-container{min-height:24px}.nut-form-item__body__slots .nut-textarea{padding:0!important}.nut-form-item__body__slots .nut-textarea .nut-textarea__textarea{font:inherit;text-align:var(--nutui-form-item-body-input-text-align, left)}.nut-form-item__body__tips{text-align:var(--nutui-form-item-tip-text-align, left);font-size:var(--nutui-form-item-tip-font-size, 10px);color:var(--nutui-form-item-error-message-color, var(--nutui-brand-color, #fa2c19))}
|
package/dist/esm/InputNumber.js
CHANGED
|
@@ -141,7 +141,7 @@ var InputNumber = function InputNumber2(props) {
|
|
|
141
141
|
};
|
|
142
142
|
var changeFormatValue = function changeFormatValue2(e) {
|
|
143
143
|
var input = e.target.value;
|
|
144
|
-
var numReg =
|
|
144
|
+
var numReg = /^[0-9]*$/;
|
|
145
145
|
var numValue = input.replace(/[^0-9|.]/gi, "");
|
|
146
146
|
if (formatter) {
|
|
147
147
|
if (!numReg.test(input[0]) && numValue) {
|
|
@@ -160,7 +160,7 @@ var InputNumber = function InputNumber2(props) {
|
|
|
160
160
|
};
|
|
161
161
|
var burFormatValue = function burFormatValue2(e) {
|
|
162
162
|
var input = e.target.value;
|
|
163
|
-
var numReg =
|
|
163
|
+
var numReg = /^[0-9]*$/;
|
|
164
164
|
var numValue = input.replace(/[^0-9|.]/gi, "");
|
|
165
165
|
if (formatter) {
|
|
166
166
|
if (formatter(numValue) === input) {
|
package/dist/esm/Picker.js
CHANGED
|
@@ -56,11 +56,9 @@ var InternalPickerPanel = function InternalPickerPanel2(props, ref) {
|
|
|
56
56
|
}
|
|
57
57
|
return false;
|
|
58
58
|
};
|
|
59
|
-
var setTransform = function setTransform2() {
|
|
60
|
-
var translateY = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
61
|
-
var type = arguments.length > 1 ? arguments[1] : void 0;
|
|
59
|
+
var setTransform = function setTransform2(type, deg) {
|
|
62
60
|
var time = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : DEFAULT_DURATION;
|
|
63
|
-
var
|
|
61
|
+
var translateY = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
|
|
64
62
|
var nTime = time;
|
|
65
63
|
if (type !== "end") {
|
|
66
64
|
nTime = 0;
|
|
@@ -80,7 +78,7 @@ var InternalPickerPanel = function InternalPickerPanel2(props, ref) {
|
|
|
80
78
|
}
|
|
81
79
|
var endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
|
|
82
80
|
var deg = "".concat((Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation, "deg");
|
|
83
|
-
setTransform(
|
|
81
|
+
setTransform(type, deg, time, endMove);
|
|
84
82
|
setCurrIndex(Math.abs(Math.round(endMove / lineSpacing)) + 1);
|
|
85
83
|
} else {
|
|
86
84
|
var _deg = 0;
|
|
@@ -89,7 +87,7 @@ var InternalPickerPanel = function InternalPickerPanel2(props, ref) {
|
|
|
89
87
|
var minDeg = 0;
|
|
90
88
|
_deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
|
|
91
89
|
if (minDeg < _deg && _deg < maxDeg) {
|
|
92
|
-
setTransform(
|
|
90
|
+
setTransform("", "".concat(_deg, "deg"), void 0, updateMove);
|
|
93
91
|
setCurrIndex(Math.abs(Math.round(updateMove / lineSpacing)) + 1);
|
|
94
92
|
}
|
|
95
93
|
}
|
package/dist/esm/Table.js
CHANGED
|
@@ -89,13 +89,13 @@ var Table = function Table2(props) {
|
|
|
89
89
|
return [columns2.key, columns2.render];
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
|
-
var renderBodyTds = function renderBodyTds2(item) {
|
|
93
|
-
return sortDataItem().map(function(_ref2
|
|
92
|
+
var renderBodyTds = function renderBodyTds2(item, rowIndex) {
|
|
93
|
+
return sortDataItem().map(function(_ref2) {
|
|
94
94
|
var _ref3 = _slicedToArray(_ref2, 2), value = _ref3[0], render = _ref3[1];
|
|
95
95
|
return React__default.createElement("span", {
|
|
96
96
|
className: classNames("".concat(bodyClassPrefix, "__td"), cellClasses(getColumnItem(value))),
|
|
97
97
|
key: value
|
|
98
|
-
}, typeof item[value] === "function" || typeof render === "function" ? React__default.createElement("div", null, render ? render(item) : item[value](item)) : item[value]);
|
|
98
|
+
}, typeof item[value] === "function" || typeof render === "function" ? React__default.createElement("div", null, render ? render(item, rowIndex) : item[value](item)) : item[value]);
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
var renderBoyTrs = function renderBoyTrs2() {
|
|
@@ -103,7 +103,7 @@ var Table = function Table2(props) {
|
|
|
103
103
|
return React__default.createElement("div", {
|
|
104
104
|
className: bodyClassPrefix,
|
|
105
105
|
key: index
|
|
106
|
-
}, renderBodyTds(item));
|
|
106
|
+
}, renderBodyTds(item, index));
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
109
|
return React__default.createElement("div", _objectSpread({
|
package/dist/esm/VirtualList.js
CHANGED
|
@@ -53,9 +53,8 @@ var getListTotalSize = function getListTotalSize2(positions, horizontal) {
|
|
|
53
53
|
}
|
|
54
54
|
return size;
|
|
55
55
|
};
|
|
56
|
-
var binarySearch = function binarySearch2(positionsList) {
|
|
57
|
-
var value = arguments.length >
|
|
58
|
-
var horizontal = arguments.length > 2 ? arguments[2] : void 0;
|
|
56
|
+
var binarySearch = function binarySearch2(positionsList, horizontal) {
|
|
57
|
+
var value = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
59
58
|
var start = 0;
|
|
60
59
|
var end = positionsList.length - 1;
|
|
61
60
|
var tempIndex = null;
|
|
@@ -205,7 +204,7 @@ var VirtualList = function VirtualList2(props) {
|
|
|
205
204
|
var scroll = useCallback(function() {
|
|
206
205
|
requestAnimationFrame(function(e) {
|
|
207
206
|
var scrollSize = getElement()[scrollKey];
|
|
208
|
-
var startIndex = binarySearch(positions,
|
|
207
|
+
var startIndex = binarySearch(positions, horizontal, scrollSize);
|
|
209
208
|
var overStart = startIndex - overscan > -1 ? startIndex - overscan : 0;
|
|
210
209
|
if (!itemEqual) {
|
|
211
210
|
updateTotalSize();
|
package/dist/esm/cascader2.js
CHANGED
|
@@ -213,7 +213,7 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
var InternalCascader = function InternalCascader2(props, ref) {
|
|
216
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, activeColor = _defaultProps$props.activeColor, activeIcon = _defaultProps$props.activeIcon, popup = _defaultProps$props.popup, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
|
|
216
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), className = _defaultProps$props.className, style = _defaultProps$props.style, activeColor = _defaultProps$props.activeColor, activeIcon = _defaultProps$props.activeIcon, popup = _defaultProps$props.popup, _defaultProps$props$p = _defaultProps$props.popupProps, popupProps = _defaultProps$props$p === void 0 ? {} : _defaultProps$props$p, visible = _defaultProps$props.visible, options = _defaultProps$props.options, value = _defaultProps$props.value, defaultValue = _defaultProps$props.defaultValue, optionKey = _defaultProps$props.optionKey, format = _defaultProps$props.format, closeable = _defaultProps$props.closeable, closeIconPosition = _defaultProps$props.closeIconPosition, closeIcon = _defaultProps$props.closeIcon, lazy = _defaultProps$props.lazy, onLoad2 = _defaultProps$props.onLoad, onClose2 = _defaultProps$props.onClose, onChange2 = _defaultProps$props.onChange, onPathChange2 = _defaultProps$props.onPathChange;
|
|
217
217
|
var _useState = useState("c1"), _useState2 = _slicedToArray(_useState, 2), tabvalue = _useState2[0], setTabvalue = _useState2[1];
|
|
218
218
|
var _useState3 = useState([]), _useState4 = _slicedToArray(_useState3, 2), optionsData = _useState4[0], setOptionsData = _useState4[1];
|
|
219
219
|
var isLazy = function isLazy2() {
|
|
@@ -609,7 +609,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
609
609
|
className: classesPane
|
|
610
610
|
}))));
|
|
611
611
|
};
|
|
612
|
-
return React__default.createElement(React__default.Fragment, null, popup ? React__default.createElement(Popup, {
|
|
612
|
+
return React__default.createElement(React__default.Fragment, null, popup ? React__default.createElement(Popup, _objectSpread(_objectSpread({}, popupProps), {}, {
|
|
613
613
|
visible,
|
|
614
614
|
position: "bottom",
|
|
615
615
|
round: true,
|
|
@@ -621,7 +621,7 @@ var InternalCascader = function InternalCascader2(props, ref) {
|
|
|
621
621
|
// todo 只关闭,不处理逻辑。和popup的逻辑不一致。关闭时需要增加是否要处理回调
|
|
622
622
|
onOverlayClick: closePopup,
|
|
623
623
|
onCloseIconClick: closePopup
|
|
624
|
-
}, renderTabs()) : renderTabs());
|
|
624
|
+
}), renderTabs()) : renderTabs());
|
|
625
625
|
};
|
|
626
626
|
var Cascader = React__default.forwardRef(InternalCascader);
|
|
627
627
|
Cascader.defaultProps = defaultProps;
|
package/dist/esm/formitem2.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -75,7 +76,8 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
75
76
|
required: false,
|
|
76
77
|
message: ""
|
|
77
78
|
}],
|
|
78
|
-
errorMessageAlign: "left"
|
|
79
|
+
errorMessageAlign: "left",
|
|
80
|
+
validateTrigger: "onChange"
|
|
79
81
|
});
|
|
80
82
|
var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
81
83
|
_inherits(FormItem2, _React__default$Compo);
|
|
@@ -88,7 +90,7 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
88
90
|
_defineProperty(_assertThisInitialized(_this), "componentRef", void 0);
|
|
89
91
|
_defineProperty(_assertThisInitialized(_this), "getControlled", function(children) {
|
|
90
92
|
var _children$props, _objectSpread2;
|
|
91
|
-
var _this$context = _this.context, setFieldsValue = _this$context.setFieldsValue, getFieldValue = _this$context.getFieldValue;
|
|
93
|
+
var _this$context = _this.context, setFieldsValue = _this$context.setFieldsValue, getFieldValue = _this$context.getFieldValue, dispatch = _this$context.dispatch;
|
|
92
94
|
var _this$props$name = _this.props.name, name = _this$props$name === void 0 ? "" : _this$props$name;
|
|
93
95
|
if (children !== null && children !== void 0 && (_children$props = children.props) !== null && _children$props !== void 0 && _children$props.defaultValue) {
|
|
94
96
|
console.warn("通过 initialValue 设置初始值");
|
|
@@ -109,6 +111,24 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
109
111
|
}
|
|
110
112
|
setFieldsValue(_defineProperty({}, name, next));
|
|
111
113
|
}), _objectSpread2));
|
|
114
|
+
var validateTrigger = _this.props.validateTrigger;
|
|
115
|
+
var validateTriggers = [_this.props.trigger || "onChange"];
|
|
116
|
+
if (validateTrigger) {
|
|
117
|
+
validateTriggers = typeof validateTrigger === "string" ? [].concat(_toConsumableArray(validateTriggers), [validateTrigger]) : [].concat(_toConsumableArray(validateTriggers), _toConsumableArray(validateTrigger));
|
|
118
|
+
validateTriggers.forEach(function(trigger) {
|
|
119
|
+
var originTrigger = controlled[trigger];
|
|
120
|
+
controlled[trigger] = function() {
|
|
121
|
+
if (originTrigger) {
|
|
122
|
+
originTrigger.apply(void 0, arguments);
|
|
123
|
+
}
|
|
124
|
+
if (_this.props.rules && _this.props.rules.length) {
|
|
125
|
+
dispatch({
|
|
126
|
+
name: _this.props.name
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
}
|
|
112
132
|
if (isForwardRefComponent(children)) {
|
|
113
133
|
controlled.ref = function(componentInstance) {
|
|
114
134
|
var originRef = children.ref;
|
|
@@ -141,13 +161,13 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
141
161
|
}
|
|
142
162
|
});
|
|
143
163
|
_defineProperty(_assertThisInitialized(_this), "renderLayout", function(childNode) {
|
|
144
|
-
var _this$
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
var _defaultProps$_this$p = _objectSpread(_objectSpread({}, defaultProps), _this.props), label = _defaultProps$_this$p.label, name = _defaultProps$_this$p.name, required = _defaultProps$_this$p.required, rules = _defaultProps$_this$p.rules, className = _defaultProps$_this$p.className, style = _defaultProps$_this$p.style, errorMessageAlign = _defaultProps$_this$p.errorMessageAlign;
|
|
165
|
+
var requiredInRules = rules === null || rules === void 0 ? void 0 : rules.some(function(rule) {
|
|
166
|
+
return rule.required;
|
|
167
|
+
});
|
|
168
|
+
var item = name ? _this.context.errors[name] : [];
|
|
149
169
|
var starPosition = _this.context.starPosition;
|
|
150
|
-
var renderStar = required && React__default.createElement("i", {
|
|
170
|
+
var renderStar = (required || requiredInRules) && React__default.createElement("i", {
|
|
151
171
|
className: "required"
|
|
152
172
|
});
|
|
153
173
|
var renderLabel = React__default.createElement(React__default.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
@@ -163,7 +183,7 @@ var FormItem = /* @__PURE__ */ function(_React__default$Compo) {
|
|
|
163
183
|
className: "nut-cell__value nut-form-item__body"
|
|
164
184
|
}, React__default.createElement("div", {
|
|
165
185
|
className: "nut-form-item__body__slots"
|
|
166
|
-
}, childNode), item.length > 0 && React__default.createElement("div", {
|
|
186
|
+
}, childNode), item && item.length > 0 && React__default.createElement("div", {
|
|
167
187
|
className: "nut-form-item__body__tips",
|
|
168
188
|
style: {
|
|
169
189
|
textAlign: errorMessageAlign
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopupProps } from '@/packages/popup/popup';
|
|
3
3
|
import { CascaderOption, CascaderValue, CascaderOptionKey } from './types';
|
|
4
|
-
export interface CascaderProps extends PopupProps {
|
|
4
|
+
export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' | 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'> {
|
|
5
5
|
popup: boolean;
|
|
6
|
+
popupProps: Partial<Omit<PopupProps, 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'>>;
|
|
6
7
|
visible: boolean;
|
|
7
8
|
activeColor: string;
|
|
8
9
|
activeIcon: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopupProps } from '@/packages/popup/popup.taro';
|
|
3
3
|
import { CascaderOption, CascaderValue, CascaderOptionKey } from './types';
|
|
4
|
-
export interface CascaderProps extends PopupProps {
|
|
4
|
+
export interface CascaderProps extends Pick<PopupProps, 'className' | 'style' | 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'> {
|
|
5
5
|
popup: boolean;
|
|
6
|
+
popupProps: Partial<Omit<PopupProps, 'closeIcon' | 'closeable' | 'title' | 'left' | 'closeIconPosition' | 'onClose'>>;
|
|
6
7
|
visible: boolean;
|
|
7
8
|
activeColor: string;
|
|
8
9
|
activeIcon: string;
|
|
@@ -17,6 +17,7 @@ export interface Store {
|
|
|
17
17
|
export interface FormInstance<Values = any> {
|
|
18
18
|
registerField: (entity: FieldEntity) => () => void;
|
|
19
19
|
getFieldValue: (name: NamePath) => StoreValue;
|
|
20
|
+
getFieldsValue: (name: NamePath) => StoreValue;
|
|
20
21
|
setInitialValues: (values: any, init: boolean) => void;
|
|
21
22
|
setFieldsValue: (value: any) => void;
|
|
22
23
|
resetFields: (fields?: NamePath[]) => void;
|
|
@@ -11,6 +11,7 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
|
|
|
11
11
|
getValueFromEvent: (...args: any) => any;
|
|
12
12
|
onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
|
|
13
13
|
errorMessageAlign: TextAlign;
|
|
14
|
+
validateTrigger: string | string[];
|
|
14
15
|
}
|
|
15
16
|
export declare class FormItem extends React.Component<Partial<FormItemProps>, {
|
|
16
17
|
resetCount: number;
|
|
@@ -11,6 +11,7 @@ export interface FormItemProps extends BasicComponent, BaseFormField {
|
|
|
11
11
|
getValueFromEvent: (...args: any) => any;
|
|
12
12
|
onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
|
|
13
13
|
errorMessageAlign: TextAlign;
|
|
14
|
+
validateTrigger: string | string[];
|
|
14
15
|
}
|
|
15
16
|
export declare class FormItem extends React.Component<Partial<FormItemProps>, {
|
|
16
17
|
resetCount: number;
|
|
@@ -16,5 +16,5 @@ export interface TableColumnProps {
|
|
|
16
16
|
title?: string;
|
|
17
17
|
align?: string;
|
|
18
18
|
sorter?: ((a: any, b: any) => number) | boolean | string;
|
|
19
|
-
render?: (rowData
|
|
19
|
+
render?: (rowData: any, rowIndex: number) => string | React.ReactNode;
|
|
20
20
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
3
|
export type ToastPositionType = 'top' | 'bottom' | 'center';
|
|
4
|
+
export type ToastSize = 'small' | 'base' | 'large';
|
|
4
5
|
export interface ToastProps extends BasicComponent {
|
|
5
6
|
id?: string;
|
|
6
7
|
maskClassName?: string;
|
|
@@ -15,7 +16,7 @@ export interface ToastProps extends BasicComponent {
|
|
|
15
16
|
title: string;
|
|
16
17
|
closeOnOverlayClick: boolean;
|
|
17
18
|
lockScroll: boolean;
|
|
18
|
-
size:
|
|
19
|
+
size: ToastSize;
|
|
19
20
|
visible: boolean;
|
|
20
21
|
onClose: () => void;
|
|
21
22
|
}
|
|
@@ -23,11 +24,7 @@ export declare const Toast: FunctionComponent<Partial<ToastProps> & React.HTMLAt
|
|
|
23
24
|
show: typeof show;
|
|
24
25
|
hide: typeof hide;
|
|
25
26
|
};
|
|
26
|
-
export interface ToastOptions {
|
|
27
|
-
title: string;
|
|
28
|
-
msg?: string;
|
|
29
|
-
type?: string;
|
|
30
|
-
duration?: number;
|
|
27
|
+
export interface ToastOptions extends Partial<Omit<ToastProps, 'visible'>> {
|
|
31
28
|
}
|
|
32
29
|
export declare function show(selector: string, options: ToastOptions): void;
|
|
33
30
|
export declare function hide(selector: string): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PositionType, Data } from './type';
|
|
2
2
|
declare const initPositinoCache: (reaItemSize: number, length?: number) => PositionType[];
|
|
3
3
|
declare const getListTotalSize: (positions: Array<PositionType>, horizontal: true | false) => number;
|
|
4
|
-
declare const binarySearch: (positionsList: Array<PositionType>,
|
|
4
|
+
declare const binarySearch: (positionsList: Array<PositionType>, horizontal: true | false, value?: number) => number;
|
|
5
5
|
declare const getEndIndex: ({ list, startIndex, visibleCount, itemEqual, positions, offSetSize, overscan, sizeKey, }: {
|
|
6
6
|
list: Array<Data>;
|
|
7
7
|
startIndex: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Rect {
|
|
2
|
+
dataset: Record<string, any>;
|
|
3
|
+
id: string;
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
left: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function makeRect(width: number, height: number): Rect;
|
|
12
|
+
export declare const getRectByTaro: (element: any) => Promise<Rect>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const inBrowser: boolean;
|
|
2
|
+
export declare function isWindow(val: unknown): val is Window;
|
|
1
3
|
/**
|
|
2
4
|
获取元素的大小及其相对于视口的位置,等价于 Element.getBoundingClientRect。
|
|
3
5
|
width 宽度 number
|
|
@@ -7,12 +9,4 @@
|
|
|
7
9
|
right 右侧与视图窗口左上角的距离 number
|
|
8
10
|
bottom 底部与视图窗口左上角的距离 number
|
|
9
11
|
*/
|
|
10
|
-
export declare const getRect: (elementRef: Element | Window | undefined) =>
|
|
11
|
-
top: number;
|
|
12
|
-
left: number;
|
|
13
|
-
right: number;
|
|
14
|
-
bottom: number;
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
};
|
|
18
|
-
export declare const getRectByTaro: (element: any) => Promise<any>;
|
|
12
|
+
export declare const getRect: (elementRef: Element | Window | undefined) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useUuid(): string;
|