@sheinx/base 3.2.0 → 3.2.2-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/checkbox/use-checkbox-inputable.d.ts +1 -1
- package/cjs/form/form-fieldset.d.ts.map +1 -1
- package/cjs/form/form-fieldset.js +17 -7
- package/cjs/icons/config.d.ts +0 -1
- package/cjs/icons/config.d.ts.map +1 -1
- package/cjs/input/use-input-common.d.ts +2 -2
- package/cjs/menu/item.js +2 -2
- package/esm/checkbox/use-checkbox-inputable.d.ts +1 -1
- package/esm/form/form-fieldset.d.ts.map +1 -1
- package/esm/form/form-fieldset.js +18 -8
- package/esm/icons/config.d.ts +0 -1
- package/esm/icons/config.d.ts.map +1 -1
- package/esm/input/use-input-common.d.ts +2 -2
- package/esm/menu/item.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckboxProps } from './checkbox.type';
|
|
2
|
-
declare const useCheckboxInputable: <T>(props: Pick<CheckboxProps<T>, "
|
|
2
|
+
declare const useCheckboxInputable: <T>(props: Pick<CheckboxProps<T>, "onChange" | "value" | "checked" | "inputable">) => {
|
|
3
3
|
checked: boolean | "indeterminate" | ((d: T) => boolean | "indeterminate") | undefined;
|
|
4
4
|
onInputableCheckboxChange: (c: boolean) => void;
|
|
5
5
|
onInputChange: (value?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-fieldset.d.ts","sourceRoot":"","sources":["form-fieldset.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"form-fieldset.d.ts","sourceRoot":"","sources":["form-fieldset.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,YAAY,iDA0FjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -16,6 +16,7 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
16
16
|
ids: []
|
|
17
17
|
}),
|
|
18
18
|
context = _React$useRef.current;
|
|
19
|
+
var formFunc = (0, _hooks.useFormFunc)();
|
|
19
20
|
var getValidateProps = (0, _hooks.usePersistFn)(function () {
|
|
20
21
|
return props;
|
|
21
22
|
});
|
|
@@ -29,16 +30,16 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
29
30
|
}),
|
|
30
31
|
Provider = _useFormFieldSet.Provider,
|
|
31
32
|
ProviderValue = _useFormFieldSet.ProviderValue,
|
|
32
|
-
value = _useFormFieldSet.value,
|
|
33
33
|
error = _useFormFieldSet.error,
|
|
34
|
-
_onChange = _useFormFieldSet.onChange
|
|
34
|
+
_onChange = _useFormFieldSet.onChange,
|
|
35
|
+
name = _useFormFieldSet.name;
|
|
35
36
|
if (typeof children !== 'function') {
|
|
36
37
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
37
38
|
value: ProviderValue,
|
|
38
39
|
children: children
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
var valueArr =
|
|
42
|
+
var valueArr = (formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name)) || [];
|
|
42
43
|
valueArr = Array.isArray(valueArr) ? valueArr : [valueArr];
|
|
43
44
|
var result = [];
|
|
44
45
|
if (valueArr.length === 0 && valueArr && empty) {
|
|
@@ -49,6 +50,7 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
49
50
|
});
|
|
50
51
|
_onChange(newValue);
|
|
51
52
|
context.ids.push(_hooks.util.generateUUID());
|
|
53
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, 0);
|
|
52
54
|
})
|
|
53
55
|
}, 'empty'));
|
|
54
56
|
}
|
|
@@ -70,31 +72,39 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
70
72
|
index: i,
|
|
71
73
|
error: errorList,
|
|
72
74
|
onChange: function onChange(val) {
|
|
73
|
-
var
|
|
75
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
76
|
+
var newValue = produce(oldValue, function (draft) {
|
|
74
77
|
draft[i] = val;
|
|
75
78
|
});
|
|
76
79
|
_onChange(newValue);
|
|
80
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"));
|
|
77
81
|
},
|
|
78
82
|
onInsert: function onInsert(val) {
|
|
79
|
-
var
|
|
83
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
84
|
+
var newValue = produce(oldValue, function (draft) {
|
|
80
85
|
draft.splice(i, 0, val);
|
|
81
86
|
});
|
|
82
87
|
_onChange(newValue);
|
|
83
88
|
context.ids.splice(i, 0, _hooks.util.generateUUID());
|
|
89
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, i);
|
|
84
90
|
},
|
|
85
91
|
onAppend: function onAppend(val) {
|
|
86
|
-
var
|
|
92
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
93
|
+
var newValue = produce(oldValue, function (draft) {
|
|
87
94
|
draft.splice(i + 1, 0, val);
|
|
88
95
|
});
|
|
89
96
|
_onChange(newValue);
|
|
90
97
|
context.ids.splice(i + 1, 0, _hooks.util.generateUUID());
|
|
98
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, i + 1);
|
|
91
99
|
},
|
|
92
100
|
onRemove: function onRemove() {
|
|
93
|
-
var
|
|
101
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
102
|
+
var newValue = produce(oldValue, function (draft) {
|
|
94
103
|
draft.splice(i, 1);
|
|
95
104
|
});
|
|
96
105
|
_onChange(newValue);
|
|
97
106
|
context.ids.splice(i, 1);
|
|
107
|
+
formFunc === null || formFunc === void 0 || formFunc.spliceError(name, i);
|
|
98
108
|
}
|
|
99
109
|
})
|
|
100
110
|
}, ids[i]));
|
package/cjs/icons/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.tsx"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIX,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AACF,KAAK,cAAc,GAAG,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC;AAGjD,eAAO,MAAM,QAAQ,cAAe,cAAc,SAYjD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputCommonProps } from './input.type';
|
|
3
|
-
declare const useInputCommon: <Value, Props extends InputCommonProps<Value>>(props0: Props) => Omit<Props, "
|
|
3
|
+
declare const useInputCommon: <Value, Props extends InputCommonProps<Value>>(props0: Props) => Omit<Props, "width" | "onChange" | "value" | "delay" | "defaultValue" | "beforeChange" | "disabled" | "error" | "status" | "style" | "size" | "onBlur" | "clearable" | "innerTitle" | "placeTitle" | "info" | "popover" | "tip" | "popoverProps" | "suffix" | "forwardRef" | "forwardedRef" | "htmlName" | "clearToUndefined"> & {
|
|
4
4
|
name: string | undefined;
|
|
5
5
|
style: React.CSSProperties;
|
|
6
6
|
suffix: JSX.Element;
|
|
7
7
|
status: "error" | undefined;
|
|
8
8
|
disabled: boolean | undefined;
|
|
9
|
-
size: "small" | "
|
|
9
|
+
size: "small" | "default" | "large" | undefined;
|
|
10
10
|
rootRef: React.RefObject<HTMLElement>;
|
|
11
11
|
inputRef: React.Ref<HTMLInputElement> | undefined;
|
|
12
12
|
renderInput: (el: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => JSX.Element;
|
package/cjs/menu/item.js
CHANGED
|
@@ -10,7 +10,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _hooks = require("@sheinx/hooks");
|
|
11
11
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
12
12
|
var _config = require("../config");
|
|
13
|
-
var _popover = _interopRequireDefault(require("
|
|
13
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -150,7 +150,7 @@ var MenuItem = function MenuItem(props) {
|
|
|
150
150
|
}
|
|
151
151
|
}) : null;
|
|
152
152
|
var item = _hooks.util.render(props.renderItem, props.dataItem, props.index);
|
|
153
|
-
var link = props.linkKey ? _hooks.util.getKey(props.linkKey, props.dataItem, props.index) : undefined;
|
|
153
|
+
var link = props.linkKey ? _hooks.util.getKey(props.linkKey, props.dataItem, props.index, true) : undefined;
|
|
154
154
|
var title = null;
|
|
155
155
|
if (_hooks.util.isLink(item)) {
|
|
156
156
|
var mergeClass = (0, _classnames.default)(classes === null || classes === void 0 ? void 0 : classes.title, item.props && item.props.className);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckboxProps } from './checkbox.type';
|
|
2
|
-
declare const useCheckboxInputable: <T>(props: Pick<CheckboxProps<T>, "
|
|
2
|
+
declare const useCheckboxInputable: <T>(props: Pick<CheckboxProps<T>, "onChange" | "value" | "checked" | "inputable">) => {
|
|
3
3
|
checked: boolean | "indeterminate" | ((d: T) => boolean | "indeterminate") | undefined;
|
|
4
4
|
onInputableCheckboxChange: (c: boolean) => void;
|
|
5
5
|
onInputChange: (value?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-fieldset.d.ts","sourceRoot":"","sources":["form-fieldset.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"form-fieldset.d.ts","sourceRoot":"","sources":["form-fieldset.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,QAAA,MAAM,YAAY,iDA0FjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useFormFieldSet, util, usePersistFn } from '@sheinx/hooks';
|
|
1
|
+
import { useFormFieldSet, util, usePersistFn, useFormFunc } from '@sheinx/hooks';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -10,6 +10,7 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
10
10
|
ids: []
|
|
11
11
|
}),
|
|
12
12
|
context = _React$useRef.current;
|
|
13
|
+
var formFunc = useFormFunc();
|
|
13
14
|
var getValidateProps = usePersistFn(function () {
|
|
14
15
|
return props;
|
|
15
16
|
});
|
|
@@ -23,16 +24,16 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
23
24
|
}),
|
|
24
25
|
Provider = _useFormFieldSet.Provider,
|
|
25
26
|
ProviderValue = _useFormFieldSet.ProviderValue,
|
|
26
|
-
value = _useFormFieldSet.value,
|
|
27
27
|
error = _useFormFieldSet.error,
|
|
28
|
-
_onChange = _useFormFieldSet.onChange
|
|
28
|
+
_onChange = _useFormFieldSet.onChange,
|
|
29
|
+
name = _useFormFieldSet.name;
|
|
29
30
|
if (typeof children !== 'function') {
|
|
30
31
|
return /*#__PURE__*/_jsx(Provider, {
|
|
31
32
|
value: ProviderValue,
|
|
32
33
|
children: children
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
var valueArr =
|
|
36
|
+
var valueArr = (formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name)) || [];
|
|
36
37
|
valueArr = Array.isArray(valueArr) ? valueArr : [valueArr];
|
|
37
38
|
var result = [];
|
|
38
39
|
if (valueArr.length === 0 && valueArr && empty) {
|
|
@@ -43,6 +44,7 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
43
44
|
});
|
|
44
45
|
_onChange(newValue);
|
|
45
46
|
context.ids.push(util.generateUUID());
|
|
47
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, 0);
|
|
46
48
|
})
|
|
47
49
|
}, 'empty'));
|
|
48
50
|
}
|
|
@@ -64,31 +66,39 @@ var FormFieldSet = function FormFieldSet(props) {
|
|
|
64
66
|
index: i,
|
|
65
67
|
error: errorList,
|
|
66
68
|
onChange: function onChange(val) {
|
|
67
|
-
var
|
|
69
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
70
|
+
var newValue = produce(oldValue, function (draft) {
|
|
68
71
|
draft[i] = val;
|
|
69
72
|
});
|
|
70
73
|
_onChange(newValue);
|
|
74
|
+
formFunc === null || formFunc === void 0 || formFunc.validateFieldset("".concat(name, "[").concat(i, "]"));
|
|
71
75
|
},
|
|
72
76
|
onInsert: function onInsert(val) {
|
|
73
|
-
var
|
|
77
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
78
|
+
var newValue = produce(oldValue, function (draft) {
|
|
74
79
|
draft.splice(i, 0, val);
|
|
75
80
|
});
|
|
76
81
|
_onChange(newValue);
|
|
77
82
|
context.ids.splice(i, 0, util.generateUUID());
|
|
83
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, i);
|
|
78
84
|
},
|
|
79
85
|
onAppend: function onAppend(val) {
|
|
80
|
-
var
|
|
86
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
87
|
+
var newValue = produce(oldValue, function (draft) {
|
|
81
88
|
draft.splice(i + 1, 0, val);
|
|
82
89
|
});
|
|
83
90
|
_onChange(newValue);
|
|
84
91
|
context.ids.splice(i + 1, 0, util.generateUUID());
|
|
92
|
+
formFunc === null || formFunc === void 0 || formFunc.insertError(name, i + 1);
|
|
85
93
|
},
|
|
86
94
|
onRemove: function onRemove() {
|
|
87
|
-
var
|
|
95
|
+
var oldValue = formFunc === null || formFunc === void 0 ? void 0 : formFunc.getValue(name);
|
|
96
|
+
var newValue = produce(oldValue, function (draft) {
|
|
88
97
|
draft.splice(i, 1);
|
|
89
98
|
});
|
|
90
99
|
_onChange(newValue);
|
|
91
100
|
context.ids.splice(i, 1);
|
|
101
|
+
formFunc === null || formFunc === void 0 || formFunc.spliceError(name, i);
|
|
92
102
|
}
|
|
93
103
|
})
|
|
94
104
|
}, ids[i]));
|
package/esm/icons/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.tsx"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwIX,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AACF,KAAK,cAAc,GAAG,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC;AAGjD,eAAO,MAAM,QAAQ,cAAe,cAAc,SAYjD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InputCommonProps } from './input.type';
|
|
3
|
-
declare const useInputCommon: <Value, Props extends InputCommonProps<Value>>(props0: Props) => Omit<Props, "
|
|
3
|
+
declare const useInputCommon: <Value, Props extends InputCommonProps<Value>>(props0: Props) => Omit<Props, "width" | "onChange" | "value" | "delay" | "defaultValue" | "beforeChange" | "disabled" | "error" | "status" | "style" | "size" | "onBlur" | "clearable" | "innerTitle" | "placeTitle" | "info" | "popover" | "tip" | "popoverProps" | "suffix" | "forwardRef" | "forwardedRef" | "htmlName" | "clearToUndefined"> & {
|
|
4
4
|
name: string | undefined;
|
|
5
5
|
style: React.CSSProperties;
|
|
6
6
|
suffix: JSX.Element;
|
|
7
7
|
status: "error" | undefined;
|
|
8
8
|
disabled: boolean | undefined;
|
|
9
|
-
size: "small" | "
|
|
9
|
+
size: "small" | "default" | "large" | undefined;
|
|
10
10
|
rootRef: React.RefObject<HTMLElement>;
|
|
11
11
|
inputRef: React.Ref<HTMLInputElement> | undefined;
|
|
12
12
|
renderInput: (el: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => JSX.Element;
|
package/esm/menu/item.js
CHANGED
|
@@ -15,7 +15,7 @@ import classNames from 'classnames';
|
|
|
15
15
|
import { useMenuItem, usePersistFn, util } from '@sheinx/hooks';
|
|
16
16
|
import Icons from "../icons";
|
|
17
17
|
import { useConfig } from "../config";
|
|
18
|
-
import Popover from "
|
|
18
|
+
import Popover from "../popover";
|
|
19
19
|
import { createElement as _createElement } from "react";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -144,7 +144,7 @@ var MenuItem = function MenuItem(props) {
|
|
|
144
144
|
}
|
|
145
145
|
}) : null;
|
|
146
146
|
var item = util.render(props.renderItem, props.dataItem, props.index);
|
|
147
|
-
var link = props.linkKey ? util.getKey(props.linkKey, props.dataItem, props.index) : undefined;
|
|
147
|
+
var link = props.linkKey ? util.getKey(props.linkKey, props.dataItem, props.index, true) : undefined;
|
|
148
148
|
var title = null;
|
|
149
149
|
if (util.isLink(item)) {
|
|
150
150
|
var mergeClass = classNames(classes === null || classes === void 0 ? void 0 : classes.title, item.props && item.props.className);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheinx/base",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2-beta.1",
|
|
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.2.
|
|
13
|
+
"@sheinx/hooks": "3.2.2-beta.1",
|
|
14
14
|
"immer": "^10.0.0",
|
|
15
15
|
"classnames": "^2.0.0",
|
|
16
16
|
"@shined/reactive": "^0.1.3-alpha.0"
|