shineout 3.5.6 → 3.5.7-beta.2
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/cjs/index.js +1 -1
- package/dist/shineout.js +70 -11
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -507,5 +507,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
507
507
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
508
508
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
509
509
|
var _default = exports.default = {
|
|
510
|
-
version: '3.5.
|
|
510
|
+
version: '3.5.7-beta.2'
|
|
511
511
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12040,7 +12040,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12040
12040
|
};
|
|
12041
12041
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12042
12042
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12043
|
-
/* harmony default export */ var version = ('3.5.
|
|
12043
|
+
/* harmony default export */ var version = ('3.5.7-beta.2');
|
|
12044
12044
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12045
12045
|
|
|
12046
12046
|
|
|
@@ -34313,6 +34313,34 @@ var getAllKeyPaths = function getAllKeyPaths(obj) {
|
|
|
34313
34313
|
return keys.concat(obj[key] !== null && typeof_default()(obj[key]) === 'object' ? getAllKeyPaths(obj[key], newKey) : newKey);
|
|
34314
34314
|
}, []);
|
|
34315
34315
|
};
|
|
34316
|
+
|
|
34317
|
+
/**
|
|
34318
|
+
* 获取完整的字段key
|
|
34319
|
+
* @param fields 字段key
|
|
34320
|
+
* @param allFields 所有字段key
|
|
34321
|
+
* @returns 完整的字段key
|
|
34322
|
+
* @example
|
|
34323
|
+
* const fields = ['user']
|
|
34324
|
+
* const allFields = ['user', 'user.name', 'user.age', 'user[0].name', 'user[0].age', 'user[1].name', 'user[1].age']
|
|
34325
|
+
* const completeFields = getCompleteFieldKeys(fields, allFields)
|
|
34326
|
+
* console.log(completeFields) // ['user', 'user.name', 'user.age', 'user[0].name', 'user[0].age', 'user[1].name', 'user[1].age']
|
|
34327
|
+
*/
|
|
34328
|
+
var getCompleteFieldKeys = function getCompleteFieldKeys(fields, allFields) {
|
|
34329
|
+
var fieldsArray = isArray(fields) ? fields : [fields];
|
|
34330
|
+
var completeFields = [];
|
|
34331
|
+
fieldsArray.forEach(function (field) {
|
|
34332
|
+
var na = "".concat(field, "[");
|
|
34333
|
+
var no = "".concat(field, ".");
|
|
34334
|
+
completeFields.push(field);
|
|
34335
|
+
var childFields = allFields.filter(function (f) {
|
|
34336
|
+
return f.startsWith(na) || f.startsWith(no);
|
|
34337
|
+
});
|
|
34338
|
+
if (childFields.length) {
|
|
34339
|
+
completeFields.push.apply(completeFields, toConsumableArray_default()(childFields));
|
|
34340
|
+
}
|
|
34341
|
+
});
|
|
34342
|
+
return completeFields;
|
|
34343
|
+
};
|
|
34316
34344
|
;// CONCATENATED MODULE: ../base/src/common/use-clear.ts
|
|
34317
34345
|
|
|
34318
34346
|
var useClear = function useClear(props) {
|
|
@@ -47789,6 +47817,7 @@ var useForm = function useForm(props) {
|
|
|
47789
47817
|
var _React$useRef = external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef({
|
|
47790
47818
|
defaultValues: {},
|
|
47791
47819
|
validateMap: {},
|
|
47820
|
+
ignoreValidateFields: [],
|
|
47792
47821
|
updateMap: {},
|
|
47793
47822
|
flowMap: {},
|
|
47794
47823
|
removeArr: new Set(),
|
|
@@ -47892,9 +47921,25 @@ var useForm = function useForm(props) {
|
|
|
47892
47921
|
var validateFields = use_persist_fn(function (fields) {
|
|
47893
47922
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
47894
47923
|
return new Promise(function (resolve, reject) {
|
|
47895
|
-
var finalFields =
|
|
47896
|
-
|
|
47897
|
-
|
|
47924
|
+
var finalFields = Object.keys(context.validateMap);
|
|
47925
|
+
if (fields) {
|
|
47926
|
+
if (config.ignoreChildren) {
|
|
47927
|
+
// 旧行为:仅校验当前字段
|
|
47928
|
+
finalFields = (isArray(fields) ? fields : [fields]).filter(function (key) {
|
|
47929
|
+
return context.validateMap[key];
|
|
47930
|
+
});
|
|
47931
|
+
} else {
|
|
47932
|
+
// 新行为:校验当前字段及其所有子字段
|
|
47933
|
+
// 假设进去的是['user'],那么最终的finalFields是['user', 'user.name', 'user.age']
|
|
47934
|
+
// 假设进去的是['users'],那么最终的finalFields是['users', 'users[0].name', 'users[0].age', 'users[1].name', 'users[1].age']
|
|
47935
|
+
finalFields = getCompleteFieldKeys(fields, finalFields);
|
|
47936
|
+
}
|
|
47937
|
+
}
|
|
47938
|
+
if (context.ignoreValidateFields.length > 0) {
|
|
47939
|
+
finalFields = finalFields.filter(function (key) {
|
|
47940
|
+
return !context.ignoreValidateFields.includes(key);
|
|
47941
|
+
});
|
|
47942
|
+
}
|
|
47898
47943
|
var validates = finalFields.map(function (key) {
|
|
47899
47944
|
var validateField = context.validateMap[key];
|
|
47900
47945
|
return Array.from(validateField).map(function (validate) {
|
|
@@ -48129,7 +48174,7 @@ var useForm = function useForm(props) {
|
|
|
48129
48174
|
}, 10);
|
|
48130
48175
|
};
|
|
48131
48176
|
};
|
|
48132
|
-
var validateFieldset = function validateFieldset(name) {
|
|
48177
|
+
var validateFieldset = function validateFieldset(name, config) {
|
|
48133
48178
|
var na = "".concat(name, "[");
|
|
48134
48179
|
var no = "".concat(name, ".");
|
|
48135
48180
|
var fields = [];
|
|
@@ -48138,6 +48183,15 @@ var useForm = function useForm(props) {
|
|
|
48138
48183
|
fields.push(key);
|
|
48139
48184
|
}
|
|
48140
48185
|
});
|
|
48186
|
+
|
|
48187
|
+
// 用户声明了跳过校验子字段
|
|
48188
|
+
if (config !== null && config !== void 0 && config.ignoreChildren) {
|
|
48189
|
+
var parentName = name.split('[')[0];
|
|
48190
|
+
context.ignoreValidateFields = getCompleteFieldKeys(parentName, Array.from(context.names));
|
|
48191
|
+
setTimeout(function () {
|
|
48192
|
+
context.ignoreValidateFields = [];
|
|
48193
|
+
});
|
|
48194
|
+
}
|
|
48141
48195
|
validateFields(fields).catch(function () {});
|
|
48142
48196
|
};
|
|
48143
48197
|
var getDefaultValue = function getDefaultValue() {
|
|
@@ -48850,7 +48904,9 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
48850
48904
|
|
|
48851
48905
|
var formFunc = useFormFunc();
|
|
48852
48906
|
var validateFieldSet = function validateFieldSet() {
|
|
48853
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name
|
|
48907
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name, {
|
|
48908
|
+
ignoreChildren: true
|
|
48909
|
+
}).catch(function (e) {
|
|
48854
48910
|
return e;
|
|
48855
48911
|
});
|
|
48856
48912
|
};
|
|
@@ -48908,13 +48964,15 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
48908
48964
|
value: v,
|
|
48909
48965
|
index: i,
|
|
48910
48966
|
error: errorList,
|
|
48911
|
-
onChange: function onChange(val) {
|
|
48967
|
+
onChange: function onChange(val, options) {
|
|
48912
48968
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
48913
48969
|
var newValue = form_fieldset_produce(oldValue, function (draft) {
|
|
48914
48970
|
draft[i] = val;
|
|
48915
48971
|
});
|
|
48916
48972
|
_onChange(newValue);
|
|
48917
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]")
|
|
48973
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"), {
|
|
48974
|
+
ignoreChildren: (options === null || options === void 0 ? void 0 : options.validate) === false
|
|
48975
|
+
});
|
|
48918
48976
|
},
|
|
48919
48977
|
onInsert: function onInsert(val) {
|
|
48920
48978
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
@@ -53278,7 +53336,7 @@ function Select(props0) {
|
|
|
53278
53336
|
});
|
|
53279
53337
|
var rootClass = classnames_default()(className, styles === null || styles === void 0 ? void 0 : styles.rootClass, styles === null || styles === void 0 ? void 0 : styles.wrapper, isEmpty && styles.wrapperEmpty, open && (styles === null || styles === void 0 ? void 0 : styles.wrapperOpen), open && trigger === 'hover' && (styles === null || styles === void 0 ? void 0 : styles.triggerHover), disabled === true && (styles === null || styles === void 0 ? void 0 : styles.wrapperDisabled), disabled !== true && focused && (styles === null || styles === void 0 ? void 0 : styles.wrapperFocus), innerTitle && (styles === null || styles === void 0 ? void 0 : styles.wrapperInnerTitle), size === 'small' && (styles === null || styles === void 0 ? void 0 : styles.wrapperSmall), size === 'large' && (styles === null || styles === void 0 ? void 0 : styles.wrapperLarge), (!!props.error || props.status === 'error') && (styles === null || styles === void 0 ? void 0 : styles.wrapperError), clearable && (styles === null || styles === void 0 ? void 0 : styles.clearable), !border && (styles === null || styles === void 0 ? void 0 : styles.wrapperNoBorder), !!underline && (styles === null || styles === void 0 ? void 0 : styles.wrapperUnderline), defineProperty_default()({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
|
|
53280
53338
|
var getRenderItem = function getRenderItem(data, index) {
|
|
53281
|
-
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : data[renderItemProp];
|
|
53339
|
+
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
|
|
53282
53340
|
};
|
|
53283
53341
|
var renderItem = getRenderItem;
|
|
53284
53342
|
var handleFocus = usePersistFn(function (e) {
|
|
@@ -53419,7 +53477,8 @@ function Select(props0) {
|
|
|
53419
53477
|
};
|
|
53420
53478
|
var getRenderResult = function getRenderResult(data, index) {
|
|
53421
53479
|
if (!renderResultProp) return renderItem(data, index);
|
|
53422
|
-
|
|
53480
|
+
var result = typeof renderResultProp === 'function' ? renderResultProp(data, index) : data[renderResultProp];
|
|
53481
|
+
return result !== null && result !== void 0 ? result : null;
|
|
53423
53482
|
};
|
|
53424
53483
|
var getDataByValues = function getDataByValues(values) {
|
|
53425
53484
|
return datum.getDataByValues(values, {
|
|
@@ -67331,7 +67390,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
67331
67390
|
|
|
67332
67391
|
|
|
67333
67392
|
/* harmony default export */ var src_0 = ({
|
|
67334
|
-
version: '3.5.
|
|
67393
|
+
version: '3.5.7-beta.2'
|
|
67335
67394
|
});
|
|
67336
67395
|
}();
|
|
67337
67396
|
/******/ return __webpack_exports__;
|