shineout 3.5.6 → 3.5.7-beta.1

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 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.6'
510
+ version: '3.5.7-beta.1'
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.6');
12043
+ /* harmony default export */ var version = ('3.5.7-beta.1');
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) {
@@ -47892,9 +47920,12 @@ var useForm = function useForm(props) {
47892
47920
  var validateFields = use_persist_fn(function (fields) {
47893
47921
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
47894
47922
  return new Promise(function (resolve, reject) {
47895
- var finalFields = fields ? (isArray(fields) ? fields : [fields]).filter(function (key) {
47896
- return context.validateMap[key];
47897
- }) : Object.keys(context.validateMap);
47923
+ var finalFields = Object.keys(context.validateMap);
47924
+ if (fields) {
47925
+ // 假设进去的是['user'],那么最终的finalFields是['user', 'user.name', 'user.age']
47926
+ // 假设进去的是['users'],那么最终的finalFields是['users', 'users[0].name', 'users[0].age', 'users[1].name', 'users[1].age']
47927
+ finalFields = getCompleteFieldKeys(fields, finalFields);
47928
+ }
47898
47929
  var validates = finalFields.map(function (key) {
47899
47930
  var validateField = context.validateMap[key];
47900
47931
  return Array.from(validateField).map(function (validate) {
@@ -48908,13 +48939,15 @@ var FormFieldSet = function FormFieldSet(props) {
48908
48939
  value: v,
48909
48940
  index: i,
48910
48941
  error: errorList,
48911
- onChange: function onChange(val) {
48942
+ onChange: function onChange(val, options) {
48912
48943
  var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
48913
48944
  var newValue = form_fieldset_produce(oldValue, function (draft) {
48914
48945
  draft[i] = val;
48915
48946
  });
48916
48947
  _onChange(newValue);
48917
- formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"));
48948
+ if (options === undefined || options !== null && options !== void 0 && options.validate) {
48949
+ formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"));
48950
+ }
48918
48951
  },
48919
48952
  onInsert: function onInsert(val) {
48920
48953
  var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
@@ -53278,7 +53311,7 @@ function Select(props0) {
53278
53311
  });
53279
53312
  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
53313
  var getRenderItem = function getRenderItem(data, index) {
53281
- return typeof renderItemProp === 'function' ? renderItemProp(data, index) : data[renderItemProp];
53314
+ return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
53282
53315
  };
53283
53316
  var renderItem = getRenderItem;
53284
53317
  var handleFocus = usePersistFn(function (e) {
@@ -53419,7 +53452,8 @@ function Select(props0) {
53419
53452
  };
53420
53453
  var getRenderResult = function getRenderResult(data, index) {
53421
53454
  if (!renderResultProp) return renderItem(data, index);
53422
- return typeof renderResultProp === 'function' ? renderResultProp(data, index) : data[renderResultProp];
53455
+ var result = typeof renderResultProp === 'function' ? renderResultProp(data, index) : data[renderResultProp];
53456
+ return result !== null && result !== void 0 ? result : null;
53423
53457
  };
53424
53458
  var getDataByValues = function getDataByValues(values) {
53425
53459
  return datum.getDataByValues(values, {
@@ -67331,7 +67365,7 @@ var upload_interface = __webpack_require__(8821);
67331
67365
 
67332
67366
 
67333
67367
  /* harmony default export */ var src_0 = ({
67334
- version: '3.5.6'
67368
+ version: '3.5.7-beta.1'
67335
67369
  });
67336
67370
  }();
67337
67371
  /******/ return __webpack_exports__;