@sheinx/base 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/form/form-fieldset.js +7 -3
- package/cjs/form/form-fieldset.type.d.ts +5 -1
- package/cjs/form/form-fieldset.type.d.ts.map +1 -1
- package/cjs/select/select.d.ts.map +1 -1
- package/cjs/select/select.js +3 -2
- package/esm/form/form-fieldset.js +7 -3
- package/esm/form/form-fieldset.type.d.ts +5 -1
- package/esm/form/form-fieldset.type.d.ts.map +1 -1
- package/esm/select/select.d.ts.map +1 -1
- package/esm/select/select.js +3 -2
- package/package.json +2 -2
|
@@ -22,7 +22,9 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
22
22
|
|
|
23
23
|
var formFunc = (0, _hooks.useFormFunc)();
|
|
24
24
|
var validateFieldSet = function validateFieldSet() {
|
|
25
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name
|
|
25
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name, {
|
|
26
|
+
ignoreChildren: true
|
|
27
|
+
}).catch(function (e) {
|
|
26
28
|
return e;
|
|
27
29
|
});
|
|
28
30
|
};
|
|
@@ -80,13 +82,15 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
80
82
|
value: v,
|
|
81
83
|
index: i,
|
|
82
84
|
error: errorList,
|
|
83
|
-
onChange: function onChange(val) {
|
|
85
|
+
onChange: function onChange(val, options) {
|
|
84
86
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
85
87
|
var newValue = produce(oldValue, function (draft) {
|
|
86
88
|
draft[i] = val;
|
|
87
89
|
});
|
|
88
90
|
_onChange(newValue);
|
|
89
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]")
|
|
91
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"), {
|
|
92
|
+
ignoreChildren: (options === null || options === void 0 ? void 0 : options.validate) === false
|
|
93
|
+
});
|
|
90
94
|
},
|
|
91
95
|
onInsert: function onInsert(val) {
|
|
92
96
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { BaseFormFieldSetProps } from '@sheinx/hooks';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
interface FormFieldSetChildrenOnChangeOptions {
|
|
4
|
+
validate?: boolean;
|
|
5
|
+
}
|
|
3
6
|
export interface FormFieldSetChildrenFunc<ValueItem = any> {
|
|
4
7
|
(params: {
|
|
5
8
|
list: ValueItem[];
|
|
6
9
|
value: ValueItem;
|
|
7
|
-
onChange: (value: ValueItem) => void;
|
|
10
|
+
onChange: (value: ValueItem, options?: FormFieldSetChildrenOnChangeOptions) => void;
|
|
8
11
|
onRemove: () => void;
|
|
9
12
|
index: number;
|
|
10
13
|
onInsert: (value: ValueItem) => void;
|
|
@@ -48,4 +51,5 @@ export interface FormFieldSetProps<T> extends Partial<BaseFormFieldSetProps<T>>
|
|
|
48
51
|
*/
|
|
49
52
|
empty?: (insert: (val: any) => void) => React.ReactNode;
|
|
50
53
|
}
|
|
54
|
+
export {};
|
|
51
55
|
//# sourceMappingURL=form-fieldset.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-fieldset.type.d.ts","sourceRoot":"","sources":["form-fieldset.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB,CAAC,SAAS,GAAG,GAAG;IACvD,CAAC,MAAM,EAAE;QACP,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC;QACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"form-fieldset.type.d.ts","sourceRoot":"","sources":["form-fieldset.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,mCAAmC;IAE3C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,wBAAwB,CAAC,SAAS,GAAG,GAAG;IACvD,CAAC,MAAM,EAAE;QACP,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC;QACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mCAAmC,KAAK,IAAI,CAAC;QACpF,QAAQ,EAAE,MAAM,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;QACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;QACrC,KAAK,EAAE,KAAK,EAAE,CAAC;KAChB,GAAG,KAAK,CAAC,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC7E;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,EACJ,KAAK,CAAC,SAAS,GACf,wBAAwB,CAAC,CAAC,SAAS,CAAC,MAAM,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;IAChF;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["select.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAenE,iBAAS,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["select.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAenE,iBAAS,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,eA4vBxE;AAED,eAAe,MAAM,CAAC"}
|
package/cjs/select/select.js
CHANGED
|
@@ -316,7 +316,7 @@ function Select(props0) {
|
|
|
316
316
|
});
|
|
317
317
|
var rootClass = (0, _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({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
|
|
318
318
|
var getRenderItem = function getRenderItem(data, index) {
|
|
319
|
-
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : data[renderItemProp];
|
|
319
|
+
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
|
|
320
320
|
};
|
|
321
321
|
var renderItem = getRenderItem;
|
|
322
322
|
var handleFocus = (0, _hooks.usePersistFn)(function (e) {
|
|
@@ -457,7 +457,8 @@ function Select(props0) {
|
|
|
457
457
|
};
|
|
458
458
|
var getRenderResult = function getRenderResult(data, index) {
|
|
459
459
|
if (!renderResultProp) return renderItem(data, index);
|
|
460
|
-
|
|
460
|
+
var result = typeof renderResultProp === 'function' ? renderResultProp(data, index) : data[renderResultProp];
|
|
461
|
+
return result !== null && result !== void 0 ? result : null;
|
|
461
462
|
};
|
|
462
463
|
var getDataByValues = function getDataByValues(values) {
|
|
463
464
|
return datum.getDataByValues(values, {
|
|
@@ -15,7 +15,9 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
15
15
|
|
|
16
16
|
var formFunc = useFormFunc();
|
|
17
17
|
var validateFieldSet = function validateFieldSet() {
|
|
18
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name
|
|
18
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFields(props.name, {
|
|
19
|
+
ignoreChildren: true
|
|
20
|
+
}).catch(function (e) {
|
|
19
21
|
return e;
|
|
20
22
|
});
|
|
21
23
|
};
|
|
@@ -73,13 +75,15 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
73
75
|
value: v,
|
|
74
76
|
index: i,
|
|
75
77
|
error: errorList,
|
|
76
|
-
onChange: function onChange(val) {
|
|
78
|
+
onChange: function onChange(val, options) {
|
|
77
79
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
78
80
|
var newValue = produce(oldValue, function (draft) {
|
|
79
81
|
draft[i] = val;
|
|
80
82
|
});
|
|
81
83
|
_onChange(newValue);
|
|
82
|
-
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]")
|
|
84
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"), {
|
|
85
|
+
ignoreChildren: (options === null || options === void 0 ? void 0 : options.validate) === false
|
|
86
|
+
});
|
|
83
87
|
},
|
|
84
88
|
onInsert: function onInsert(val) {
|
|
85
89
|
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { BaseFormFieldSetProps } from '@sheinx/hooks';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
interface FormFieldSetChildrenOnChangeOptions {
|
|
4
|
+
validate?: boolean;
|
|
5
|
+
}
|
|
3
6
|
export interface FormFieldSetChildrenFunc<ValueItem = any> {
|
|
4
7
|
(params: {
|
|
5
8
|
list: ValueItem[];
|
|
6
9
|
value: ValueItem;
|
|
7
|
-
onChange: (value: ValueItem) => void;
|
|
10
|
+
onChange: (value: ValueItem, options?: FormFieldSetChildrenOnChangeOptions) => void;
|
|
8
11
|
onRemove: () => void;
|
|
9
12
|
index: number;
|
|
10
13
|
onInsert: (value: ValueItem) => void;
|
|
@@ -48,4 +51,5 @@ export interface FormFieldSetProps<T> extends Partial<BaseFormFieldSetProps<T>>
|
|
|
48
51
|
*/
|
|
49
52
|
empty?: (insert: (val: any) => void) => React.ReactNode;
|
|
50
53
|
}
|
|
54
|
+
export {};
|
|
51
55
|
//# sourceMappingURL=form-fieldset.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-fieldset.type.d.ts","sourceRoot":"","sources":["form-fieldset.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB,CAAC,SAAS,GAAG,GAAG;IACvD,CAAC,MAAM,EAAE;QACP,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,KAAK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,CAAC,SAAS,CAAC;CACzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["select.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAenE,iBAAS,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["select.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,eAAe,EAAqB,MAAM,eAAe,CAAC;AAenE,iBAAS,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,eA4vBxE;AAED,eAAe,MAAM,CAAC"}
|
package/esm/select/select.js
CHANGED
|
@@ -309,7 +309,7 @@ function Select(props0) {
|
|
|
309
309
|
});
|
|
310
310
|
var rootClass = classNames(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({}, styles === null || styles === void 0 ? void 0 : styles.multiple, multiple));
|
|
311
311
|
var getRenderItem = function getRenderItem(data, index) {
|
|
312
|
-
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : data[renderItemProp];
|
|
312
|
+
return typeof renderItemProp === 'function' ? renderItemProp(data, index) : (data === null || data === void 0 ? void 0 : data[renderItemProp]) || '';
|
|
313
313
|
};
|
|
314
314
|
var renderItem = getRenderItem;
|
|
315
315
|
var handleFocus = usePersistFn(function (e) {
|
|
@@ -450,7 +450,8 @@ function Select(props0) {
|
|
|
450
450
|
};
|
|
451
451
|
var getRenderResult = function getRenderResult(data, index) {
|
|
452
452
|
if (!renderResultProp) return renderItem(data, index);
|
|
453
|
-
|
|
453
|
+
var result = typeof renderResultProp === 'function' ? renderResultProp(data, index) : data[renderResultProp];
|
|
454
|
+
return result !== null && result !== void 0 ? result : null;
|
|
454
455
|
};
|
|
455
456
|
var getDataByValues = function getDataByValues(values) {
|
|
456
457
|
return datum.getDataByValues(values, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.7-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"module": "./esm/index.js",
|
|
11
11
|
"typings": "./cjs/index.d.ts",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@sheinx/hooks": "3.5.
|
|
13
|
+
"@sheinx/hooks": "3.5.7-beta.2",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|