rsuite 5.66.0 → 5.68.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/AutoComplete/styles/index.css +0 -1
- package/Button/styles/index.css +0 -1
- package/Button/styles/index.less +0 -1
- package/CHANGELOG.md +34 -0
- package/Calendar/styles/index.css +0 -1
- package/Cascader/styles/index.css +0 -1
- package/CheckPicker/styles/index.css +0 -1
- package/CheckTree/styles/index.css +0 -1
- package/CheckTreePicker/styles/index.css +0 -1
- package/DatePicker/styles/index.css +0 -1
- package/DateRangePicker/styles/index.css +0 -1
- package/Dropdown/styles/index.css +0 -1
- package/IconButton/styles/index.css +0 -1
- package/InputGroup/styles/index.css +0 -1
- package/InputNumber/styles/index.css +0 -1
- package/InputPicker/styles/index.css +0 -1
- package/MultiCascadeTree/styles/index.css +0 -1
- package/MultiCascader/styles/index.css +0 -1
- package/Nav/styles/index.css +68 -1
- package/Nav/styles/index.less +37 -0
- package/NavItem/package.json +3 -3
- package/Navbar/styles/index.css +0 -1
- package/Pagination/styles/index.css +0 -1
- package/SelectPicker/styles/index.css +0 -1
- package/Tabs/styles/index.css +68 -4
- package/Tabs/styles/index.less +0 -4
- package/TagInput/styles/index.css +0 -1
- package/TagPicker/styles/index.css +0 -1
- package/Uploader/styles/index.css +0 -1
- package/cjs/DateInput/DateInput.js +18 -2
- package/cjs/DateInput/hooks/useDateInputState.d.ts +1 -0
- package/cjs/DateInput/hooks/useDateInputState.js +10 -9
- package/cjs/DateInput/hooks/useKeyboardInputEvent.js +5 -0
- package/cjs/DateRangeInput/DateRangeInput.js +24 -2
- package/cjs/Form/Form.js +4 -10
- package/cjs/Form/FormContext.d.ts +2 -4
- package/cjs/Form/hooks/useFormValidate.d.ts +2 -2
- package/cjs/Form/hooks/useFormValidate.js +99 -35
- package/cjs/FormControl/FormControl.js +6 -22
- package/cjs/Nav/AdaptiveNavItem.d.ts +9 -0
- package/cjs/Nav/AdaptiveNavItem.js +89 -0
- package/cjs/Nav/Nav.d.ts +28 -9
- package/cjs/Nav/Nav.js +4 -74
- package/cjs/Nav/NavContext.d.ts +2 -2
- package/cjs/Nav/NavItem.d.ts +1 -1
- package/cjs/Navbar/NavbarItem.d.ts +1 -1
- package/cjs/Sidenav/Sidenav.d.ts +3 -3
- package/cjs/Stack/Stack.js +6 -1
- package/cjs/Tabs/Tabs.d.ts +20 -17
- package/cjs/Tabs/Tabs.js +5 -1
- package/cjs/Uploader/Uploader.d.ts +2 -2
- package/cjs/Uploader/Uploader.js +11 -9
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/cjs/internals/Overlay/OverlayTrigger.js +17 -8
- package/cjs/internals/utils/BrowserDetection.js +6 -0
- package/cjs/internals/utils/ReactChildren.d.ts +6 -0
- package/cjs/internals/utils/ReactChildren.js +1 -0
- package/cjs/locales/ca_ES.d.ts +120 -0
- package/cjs/locales/ca_ES.js +87 -0
- package/cjs/locales/index.d.ts +1 -0
- package/cjs/locales/index.js +3 -1
- package/dist/rsuite-no-reset-rtl.css +65 -4
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +65 -4
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +65 -4
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +65 -4
- package/dist/rsuite.js +25 -14
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/DateInput/DateInput.js +18 -2
- package/esm/DateInput/hooks/useDateInputState.d.ts +1 -0
- package/esm/DateInput/hooks/useDateInputState.js +11 -10
- package/esm/DateInput/hooks/useKeyboardInputEvent.js +5 -0
- package/esm/DateRangeInput/DateRangeInput.js +24 -2
- package/esm/Form/Form.js +4 -10
- package/esm/Form/FormContext.d.ts +2 -4
- package/esm/Form/hooks/useFormValidate.d.ts +2 -2
- package/esm/Form/hooks/useFormValidate.js +98 -34
- package/esm/FormControl/FormControl.js +6 -22
- package/esm/Nav/AdaptiveNavItem.d.ts +9 -0
- package/esm/Nav/AdaptiveNavItem.js +83 -0
- package/esm/Nav/Nav.d.ts +28 -9
- package/esm/Nav/Nav.js +6 -76
- package/esm/Nav/NavContext.d.ts +2 -2
- package/esm/Nav/NavItem.d.ts +1 -1
- package/esm/Navbar/NavbarItem.d.ts +1 -1
- package/esm/Sidenav/Sidenav.d.ts +3 -3
- package/esm/Stack/Stack.js +6 -1
- package/esm/Tabs/Tabs.d.ts +20 -17
- package/esm/Tabs/Tabs.js +6 -1
- package/esm/Uploader/Uploader.d.ts +2 -2
- package/esm/Uploader/Uploader.js +11 -9
- package/esm/internals/Overlay/OverlayTrigger.d.ts +2 -2
- package/esm/internals/Overlay/OverlayTrigger.js +18 -9
- package/esm/internals/utils/BrowserDetection.js +6 -0
- package/esm/internals/utils/ReactChildren.d.ts +6 -0
- package/esm/internals/utils/ReactChildren.js +1 -1
- package/esm/locales/ca_ES.d.ts +120 -0
- package/esm/locales/ca_ES.js +82 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/locales/ca_ES/package.json +7 -0
- package/package.json +1 -1
- package/styles/color-modes/dark.less +7 -0
- package/styles/color-modes/high-contrast.less +7 -0
- package/styles/color-modes/light.less +8 -0
- package/styles/plugins/palette.js +34 -6
|
@@ -131,6 +131,7 @@ export declare function useDateInputState({ formatStr, locale, date, isControlle
|
|
|
131
131
|
};
|
|
132
132
|
setDateOffset: (pattern: string, offset: number, callback?: ((newDate: Date | null) => void) | undefined) => void;
|
|
133
133
|
setDateField: (pattern: string, value: number | null, callback?: ((newDate: Date | null) => void) | undefined) => void;
|
|
134
|
+
setNewDate: (value: Date | null) => void;
|
|
134
135
|
getDateField: (pattern: string) => {
|
|
135
136
|
name: any;
|
|
136
137
|
value: any;
|
|
@@ -101,25 +101,26 @@ function useDateInputState(_ref) {
|
|
|
101
101
|
// if date is not valid, return uncontrolled date string
|
|
102
102
|
return toDateString();
|
|
103
103
|
};
|
|
104
|
+
var setNewDate = (0, _react.useCallback)(function (value) {
|
|
105
|
+
dispatch({
|
|
106
|
+
type: 'setNewDate',
|
|
107
|
+
value: value
|
|
108
|
+
});
|
|
109
|
+
}, [dispatch]);
|
|
104
110
|
(0, _react.useEffect)(function () {
|
|
105
111
|
if (isControlledDate) {
|
|
106
112
|
if (date && (0, _date.isValid)(date)) {
|
|
107
|
-
|
|
108
|
-
type: 'setNewDate',
|
|
109
|
-
value: date
|
|
110
|
-
});
|
|
113
|
+
setNewDate(date);
|
|
111
114
|
} else if (date === null) {
|
|
112
|
-
|
|
113
|
-
type: 'setNewDate',
|
|
114
|
-
value: null
|
|
115
|
-
});
|
|
115
|
+
setNewDate(null);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
}, [date, dispatch, isControlledDate]);
|
|
118
|
+
}, [date, dispatch, isControlledDate, setNewDate]);
|
|
119
119
|
return {
|
|
120
120
|
dateField: dateField,
|
|
121
121
|
setDateOffset: setDateOffset,
|
|
122
122
|
setDateField: setDateField,
|
|
123
|
+
setNewDate: setNewDate,
|
|
123
124
|
getDateField: getDateField,
|
|
124
125
|
toDateString: isControlledDate ? toControlledDateString : toDateString,
|
|
125
126
|
isEmptyValue: isEmptyValue
|
|
@@ -33,6 +33,11 @@ function useKeyboardInputEvent(_ref) {
|
|
|
33
33
|
onSegmentValueChangeWithNumericKeys === null || onSegmentValueChangeWithNumericKeys === void 0 ? void 0 : onSegmentValueChangeWithNumericKeys(event);
|
|
34
34
|
event.preventDefault();
|
|
35
35
|
case (_key$match2 = key.match(/[a-z]/)) === null || _key$match2 === void 0 ? void 0 : _key$match2[0]:
|
|
36
|
+
// Determine whether the Ctrl or Command key is pressed, does not affect user copy and paste
|
|
37
|
+
if (event.ctrlKey || event.metaKey) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
// Prevent letters from being entered
|
|
37
42
|
event.preventDefault();
|
|
38
43
|
break;
|
|
@@ -9,11 +9,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _Input = _interopRequireDefault(require("../Input"));
|
|
12
|
+
var _date = require("../internals/utils/date");
|
|
12
13
|
var _hooks = require("../internals/hooks");
|
|
13
14
|
var _utils = require("../internals/utils");
|
|
14
15
|
var _DateInput = require("../DateInput");
|
|
15
16
|
var _utils2 = require("./utils");
|
|
16
|
-
var _excluded = ["className", "classPrefix", "character", "format", "value", "defaultValue", "placeholder", "onChange", "onKeyDown", "onBlur", "onFocus"];
|
|
17
|
+
var _excluded = ["className", "classPrefix", "character", "format", "value", "defaultValue", "placeholder", "onChange", "onKeyDown", "onBlur", "onFocus", "onPaste"];
|
|
17
18
|
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); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
20
|
/**
|
|
@@ -37,6 +38,7 @@ var DateRangeInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
37
38
|
onKeyDown = props.onKeyDown,
|
|
38
39
|
onBlur = props.onBlur,
|
|
39
40
|
onFocus = props.onFocus,
|
|
41
|
+
onPaste = props.onPaste,
|
|
40
42
|
rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
41
43
|
var _useClassNames = (0, _hooks.useClassNames)(classPrefix),
|
|
42
44
|
withClassPrefix = _useClassNames.withClassPrefix,
|
|
@@ -47,7 +49,8 @@ var DateRangeInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
47
49
|
selectedState = _useSelectedState.selectedState,
|
|
48
50
|
setSelectedState = _useSelectedState.setSelectedState;
|
|
49
51
|
var _useCustom = (0, _hooks.useCustom)('Calendar'),
|
|
50
|
-
locale = _useCustom.locale
|
|
52
|
+
locale = _useCustom.locale,
|
|
53
|
+
parseDate = _useCustom.parseDate;
|
|
51
54
|
var rangeFormatStr = "" + formatStr + character + formatStr;
|
|
52
55
|
var dateLocale = locale.dateLocale;
|
|
53
56
|
var _useControlled = (0, _hooks.useControlled)(valueProp, defaultValue),
|
|
@@ -218,6 +221,24 @@ var DateRangeInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
218
221
|
reset();
|
|
219
222
|
}
|
|
220
223
|
});
|
|
224
|
+
var handlePaste = (0, _hooks.useEventCallback)(function (event) {
|
|
225
|
+
var _event$clipboardData;
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
var pasteText = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text');
|
|
228
|
+
var _ref = pasteText.split(character).map(function (date) {
|
|
229
|
+
return parseDate(date, formatStr);
|
|
230
|
+
}),
|
|
231
|
+
start = _ref[0],
|
|
232
|
+
end = _ref[1];
|
|
233
|
+
if ((0, _date.isValid)(start) && (0, _date.isValid)(end)) {
|
|
234
|
+
var nextValue = [start, end];
|
|
235
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
236
|
+
setValue(nextValue);
|
|
237
|
+
startDateState.setNewDate(start);
|
|
238
|
+
endDateState.setNewDate(end);
|
|
239
|
+
}
|
|
240
|
+
onPaste === null || onPaste === void 0 ? void 0 : onPaste(event);
|
|
241
|
+
});
|
|
221
242
|
var onKeyboardInput = (0, _DateInput.useKeyboardInputEvent)({
|
|
222
243
|
onSegmentChange: onSegmentChange,
|
|
223
244
|
onSegmentValueChange: onSegmentValueChange,
|
|
@@ -234,6 +255,7 @@ var DateRangeInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
234
255
|
ref: (0, _utils.mergeRefs)(inputRef, ref),
|
|
235
256
|
onKeyDown: onKeyboardInput,
|
|
236
257
|
onClick: handleClick,
|
|
258
|
+
onPaste: handlePaste,
|
|
237
259
|
value: renderedValue,
|
|
238
260
|
placeholder: placeholder || rangeFormatStr
|
|
239
261
|
}, focusEventProps, rest));
|
package/cjs/Form/Form.js
CHANGED
|
@@ -79,12 +79,13 @@ var Form = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
79
79
|
};
|
|
80
80
|
var _useFormValidate = (0, _useFormValidate2.default)(controlledFormError, formValidateProps),
|
|
81
81
|
formError = _useFormValidate.formError,
|
|
82
|
-
setFieldError = _useFormValidate.setFieldError,
|
|
83
82
|
onRemoveError = _useFormValidate.onRemoveError,
|
|
84
83
|
check = _useFormValidate.check,
|
|
85
84
|
checkAsync = _useFormValidate.checkAsync,
|
|
86
85
|
checkForField = _useFormValidate.checkForField,
|
|
86
|
+
checkFieldForNextValue = _useFormValidate.checkFieldForNextValue,
|
|
87
87
|
checkForFieldAsync = _useFormValidate.checkForFieldAsync,
|
|
88
|
+
checkFieldAsyncForNextValue = _useFormValidate.checkFieldAsyncForNextValue,
|
|
88
89
|
cleanErrors = _useFormValidate.cleanErrors,
|
|
89
90
|
resetErrors = _useFormValidate.resetErrors,
|
|
90
91
|
cleanErrorForField = _useFormValidate.cleanErrorForField;
|
|
@@ -150,12 +151,6 @@ var Form = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
150
151
|
var removeFieldError = (0, _hooks.useEventCallback)(function (name) {
|
|
151
152
|
onRemoveError(name);
|
|
152
153
|
});
|
|
153
|
-
var onFieldError = (0, _hooks.useEventCallback)(function (name, checkResult) {
|
|
154
|
-
setFieldError(name, checkResult);
|
|
155
|
-
});
|
|
156
|
-
var onFieldSuccess = (0, _hooks.useEventCallback)(function (name) {
|
|
157
|
-
removeFieldError(name);
|
|
158
|
-
});
|
|
159
154
|
var onFieldChange = (0, _hooks.useEventCallback)(function (name, value, event) {
|
|
160
155
|
var nextFormValue = setFieldValue(name, value);
|
|
161
156
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextFormValue, event);
|
|
@@ -169,13 +164,12 @@ var Form = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
169
164
|
formError: formError,
|
|
170
165
|
nestedField: nestedField,
|
|
171
166
|
pushFieldRule: pushFieldRule,
|
|
172
|
-
getCombinedModel: getCombinedModel,
|
|
173
167
|
removeFieldValue: removeFieldValue,
|
|
174
168
|
removeFieldError: removeFieldError,
|
|
175
169
|
removeFieldRule: removeFieldRule,
|
|
176
|
-
onFieldSuccess: onFieldSuccess,
|
|
177
170
|
onFieldChange: onFieldChange,
|
|
178
|
-
|
|
171
|
+
checkFieldForNextValue: checkFieldForNextValue,
|
|
172
|
+
checkFieldAsyncForNextValue: checkFieldAsyncForNextValue
|
|
179
173
|
};
|
|
180
174
|
return /*#__PURE__*/_react.default.createElement("form", (0, _extends2.default)({}, rest, {
|
|
181
175
|
ref: formRef,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TypeAttributes } from '../internals/types';
|
|
3
|
-
import type { Schema, CheckResult } from 'schema-typed';
|
|
4
3
|
import type { FieldRuleType } from './hooks/useSchemaModel';
|
|
5
4
|
type RecordAny = Record<string, any>;
|
|
6
5
|
interface TrulyFormContextValue<T = RecordAny, M = any, E = {
|
|
@@ -8,14 +7,13 @@ interface TrulyFormContextValue<T = RecordAny, M = any, E = {
|
|
|
8
7
|
}> {
|
|
9
8
|
formError: E;
|
|
10
9
|
nestedField: boolean;
|
|
11
|
-
getCombinedModel: () => Schema;
|
|
12
10
|
removeFieldValue: (name: string) => void;
|
|
13
11
|
removeFieldError: (name: string) => void;
|
|
14
12
|
removeFieldRule: (name: string) => void;
|
|
15
13
|
pushFieldRule: (name: string, fieldRule: FieldRuleType) => void;
|
|
16
|
-
onFieldError: (name: string, fieldError: string | CheckResult) => void;
|
|
17
14
|
onFieldChange: (name: string, value: any, event: React.SyntheticEvent) => void;
|
|
18
|
-
|
|
15
|
+
checkFieldForNextValue: (name: string, nextValue: Record<string, unknown>, callback?: (checkResult: Record<string, unknown>) => void) => boolean;
|
|
16
|
+
checkFieldAsyncForNextValue: (name: string, nextValue: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
19
17
|
}
|
|
20
18
|
type ExternalPropsContextValue = {
|
|
21
19
|
checkTrigger?: TypeAttributes.CheckTrigger;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
|
-
import type { CheckResult } from 'schema-typed';
|
|
3
2
|
export interface FormErrorProps {
|
|
4
3
|
formValue: any;
|
|
5
4
|
getCombinedModel: () => any;
|
|
@@ -11,11 +10,12 @@ export default function useFormValidate(formError: any, props: FormErrorProps):
|
|
|
11
10
|
formError: any;
|
|
12
11
|
check: (...args: any[]) => any;
|
|
13
12
|
checkForField: (...args: any[]) => any;
|
|
13
|
+
checkFieldForNextValue: (...args: any[]) => any;
|
|
14
14
|
checkAsync: (...args: any[]) => any;
|
|
15
15
|
checkForFieldAsync: (...args: any[]) => any;
|
|
16
|
+
checkFieldAsyncForNextValue: (...args: any[]) => any;
|
|
16
17
|
cleanErrors: (...args: any[]) => any;
|
|
17
18
|
resetErrors: (...args: any[]) => any;
|
|
18
19
|
cleanErrorForField: (...args: any[]) => any;
|
|
19
|
-
setFieldError: (fieldName: string, checkResult: string | CheckResult) => any;
|
|
20
20
|
onRemoveError: (name: string) => import("lodash").Omit<any, string>;
|
|
21
21
|
};
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.default = useFormValidate;
|
|
7
|
-
var
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _react = require("react");
|
|
9
10
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
10
11
|
var _set = _interopRequireDefault(require("lodash/set"));
|
|
11
12
|
var _hooks = require("../../internals/hooks");
|
|
12
13
|
var _utils = require("../../FormControl/utils");
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
16
|
function useFormValidate(formError, props) {
|
|
14
17
|
var formValue = props.formValue,
|
|
15
18
|
getCombinedModel = props.getCombinedModel,
|
|
@@ -19,6 +22,9 @@ function useFormValidate(formError, props) {
|
|
|
19
22
|
var _useControlled = (0, _hooks.useControlled)(formError, {}),
|
|
20
23
|
realFormError = _useControlled[0],
|
|
21
24
|
setFormError = _useControlled[1];
|
|
25
|
+
var checkOptions = {
|
|
26
|
+
nestedObject: nestedField
|
|
27
|
+
};
|
|
22
28
|
var realFormErrorRef = (0, _react.useRef)(realFormError);
|
|
23
29
|
realFormErrorRef.current = realFormError;
|
|
24
30
|
|
|
@@ -32,7 +38,7 @@ function useFormValidate(formError, props) {
|
|
|
32
38
|
var errorCount = 0;
|
|
33
39
|
var model = getCombinedModel();
|
|
34
40
|
Object.keys(model.getSchemaSpec()).forEach(function (key) {
|
|
35
|
-
var checkResult = model.checkForField(key, formValue || {});
|
|
41
|
+
var checkResult = model.checkForField(key, formValue || {}, checkOptions);
|
|
36
42
|
if (checkResult.hasError === true) {
|
|
37
43
|
errorCount += 1;
|
|
38
44
|
formError[key] = (checkResult === null || checkResult === void 0 ? void 0 : checkResult.errorMessage) || checkResult;
|
|
@@ -47,24 +53,56 @@ function useFormValidate(formError, props) {
|
|
|
47
53
|
}
|
|
48
54
|
return true;
|
|
49
55
|
});
|
|
50
|
-
|
|
56
|
+
var checkFieldForNextValue = (0, _hooks.useEventCallback)(function (fieldName, nextValue, callback) {
|
|
57
|
+
var model = getCombinedModel();
|
|
58
|
+
var resultOfCurrentField = model.checkForField(fieldName, nextValue, checkOptions);
|
|
59
|
+
var nextFormError = (0, _extends2.default)({}, formError);
|
|
60
|
+
/**
|
|
61
|
+
* when using proxy of schema-typed, we need to use getCheckResult to get all errors,
|
|
62
|
+
* but if nestedField is used, it is impossible to distinguish whether the nested object has an error here,
|
|
63
|
+
* so nestedField does not support proxy here
|
|
64
|
+
*/
|
|
65
|
+
if (nestedField) {
|
|
66
|
+
nextFormError = (0, _set.default)(nextFormError, (0, _utils.nameToPath)(fieldName), resultOfCurrentField);
|
|
67
|
+
setFormError(nextFormError);
|
|
68
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
69
|
+
callback === null || callback === void 0 ? void 0 : callback(resultOfCurrentField);
|
|
70
|
+
if (resultOfCurrentField.hasError) {
|
|
71
|
+
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
72
|
+
}
|
|
73
|
+
return !resultOfCurrentField.hasError;
|
|
74
|
+
} else {
|
|
75
|
+
var allResults = model.getCheckResult();
|
|
76
|
+
var hasError = false;
|
|
77
|
+
Object.keys(allResults).forEach(function (key) {
|
|
78
|
+
var currentResult = allResults[key];
|
|
79
|
+
if (currentResult.hasError) {
|
|
80
|
+
nextFormError[key] = currentResult.errorMessage || currentResult;
|
|
81
|
+
hasError = true;
|
|
82
|
+
} else {
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
84
|
+
var _nextFormError = nextFormError,
|
|
85
|
+
_ = _nextFormError[key],
|
|
86
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(_nextFormError, [key].map(_toPropertyKey));
|
|
87
|
+
nextFormError = rest;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
setFormError(nextFormError);
|
|
91
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
92
|
+
callback === null || callback === void 0 ? void 0 : callback(resultOfCurrentField);
|
|
93
|
+
if (hasError) {
|
|
94
|
+
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
95
|
+
}
|
|
96
|
+
return !hasError;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
51
99
|
/**
|
|
52
100
|
* Check the data field
|
|
53
101
|
* @param fieldName
|
|
54
102
|
* @param callback
|
|
55
103
|
*/
|
|
56
104
|
var checkForField = (0, _hooks.useEventCallback)(function (fieldName, callback) {
|
|
57
|
-
|
|
58
|
-
var model = getCombinedModel();
|
|
59
|
-
var checkResult = model.checkForField(fieldName, formValue || {});
|
|
60
|
-
var nextFormError = (0, _extends5.default)({}, formError, (_extends2 = {}, _extends2[fieldName] = (checkResult === null || checkResult === void 0 ? void 0 : checkResult.errorMessage) || checkResult, _extends2));
|
|
61
|
-
setFormError(nextFormError);
|
|
62
|
-
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
63
|
-
callback === null || callback === void 0 ? void 0 : callback(checkResult);
|
|
64
|
-
if (checkResult.hasError) {
|
|
65
|
-
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
66
|
-
}
|
|
67
|
-
return !checkResult.hasError;
|
|
105
|
+
return checkFieldForNextValue(fieldName, formValue || {}, callback);
|
|
68
106
|
});
|
|
69
107
|
|
|
70
108
|
/**
|
|
@@ -76,7 +114,7 @@ function useFormValidate(formError, props) {
|
|
|
76
114
|
var model = getCombinedModel();
|
|
77
115
|
Object.keys(model.getSchemaSpec()).forEach(function (key) {
|
|
78
116
|
keys.push(key);
|
|
79
|
-
promises.push(model.checkForFieldAsync(key, formValue || {}));
|
|
117
|
+
promises.push(model.checkForFieldAsync(key, formValue || {}, checkOptions));
|
|
80
118
|
});
|
|
81
119
|
return Promise.all(promises).then(function (values) {
|
|
82
120
|
var formError = {};
|
|
@@ -98,23 +136,56 @@ function useFormValidate(formError, props) {
|
|
|
98
136
|
};
|
|
99
137
|
});
|
|
100
138
|
});
|
|
139
|
+
var checkFieldAsyncForNextValue = (0, _hooks.useEventCallback)(function (fieldName, nextValue) {
|
|
140
|
+
var model = getCombinedModel();
|
|
141
|
+
return model.checkForFieldAsync(fieldName, nextValue, checkOptions).then(function (resultOfCurrentField) {
|
|
142
|
+
var nextFormError = (0, _extends2.default)({}, formError);
|
|
143
|
+
/**
|
|
144
|
+
* when using proxy of schema-typed, we need to use getCheckResult to get all errors,
|
|
145
|
+
* but if nestedField is used, it is impossible to distinguish whether the nested object has an error here,
|
|
146
|
+
* so nestedField does not support proxy here
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
if (nestedField) {
|
|
150
|
+
nextFormError = (0, _set.default)(nextFormError, (0, _utils.nameToPath)(fieldName), resultOfCurrentField);
|
|
151
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
152
|
+
setFormError(nextFormError);
|
|
153
|
+
if (resultOfCurrentField.hasError) {
|
|
154
|
+
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
155
|
+
}
|
|
156
|
+
return resultOfCurrentField;
|
|
157
|
+
} else {
|
|
158
|
+
var allResults = model.getCheckResult();
|
|
159
|
+
var hasError = false;
|
|
160
|
+
Object.keys(allResults).forEach(function (key) {
|
|
161
|
+
var currentResult = allResults[key];
|
|
162
|
+
if (currentResult.hasError) {
|
|
163
|
+
nextFormError[key] = currentResult.errorMessage || currentResult;
|
|
164
|
+
hasError = true;
|
|
165
|
+
} else {
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
167
|
+
var _nextFormError2 = nextFormError,
|
|
168
|
+
_ = _nextFormError2[key],
|
|
169
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(_nextFormError2, [key].map(_toPropertyKey));
|
|
170
|
+
nextFormError = rest;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
setFormError(nextFormError);
|
|
174
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
175
|
+
if (hasError) {
|
|
176
|
+
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
177
|
+
}
|
|
178
|
+
return resultOfCurrentField;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
});
|
|
101
182
|
|
|
102
183
|
/**
|
|
103
184
|
* Asynchronously check form fields and return Promise
|
|
104
185
|
* @param fieldName
|
|
105
186
|
*/
|
|
106
187
|
var checkForFieldAsync = (0, _hooks.useEventCallback)(function (fieldName) {
|
|
107
|
-
|
|
108
|
-
return model.checkForFieldAsync(fieldName, formValue || {}).then(function (checkResult) {
|
|
109
|
-
var _extends3;
|
|
110
|
-
var nextFormError = (0, _extends5.default)({}, formError, (_extends3 = {}, _extends3[fieldName] = checkResult.errorMessage, _extends3));
|
|
111
|
-
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
112
|
-
setFormError(nextFormError);
|
|
113
|
-
if (checkResult.hasError) {
|
|
114
|
-
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
115
|
-
}
|
|
116
|
-
return checkResult;
|
|
117
|
-
});
|
|
188
|
+
return checkFieldAsyncForNextValue(fieldName, formValue || {});
|
|
118
189
|
});
|
|
119
190
|
var onRemoveError = (0, _react.useCallback)(function (name) {
|
|
120
191
|
/**
|
|
@@ -127,14 +198,6 @@ function useFormValidate(formError, props) {
|
|
|
127
198
|
onCheck === null || onCheck === void 0 ? void 0 : onCheck(formError);
|
|
128
199
|
return formError;
|
|
129
200
|
}, [nestedField, onCheck, setFormError]);
|
|
130
|
-
var setFieldError = (0, _react.useCallback)(function (fieldName, checkResult) {
|
|
131
|
-
var _extends4;
|
|
132
|
-
var nextFormError = nestedField ? (0, _set.default)((0, _extends5.default)({}, formError), (0, _utils.nameToPath)(fieldName), checkResult) : (0, _extends5.default)({}, formError, (_extends4 = {}, _extends4[fieldName] = checkResult, _extends4));
|
|
133
|
-
setFormError(nextFormError);
|
|
134
|
-
onError === null || onError === void 0 ? void 0 : onError(nextFormError);
|
|
135
|
-
onCheck === null || onCheck === void 0 ? void 0 : onCheck(nextFormError);
|
|
136
|
-
return nextFormError;
|
|
137
|
-
}, [formError, nestedField, onCheck, onError, setFormError]);
|
|
138
201
|
var cleanErrors = (0, _hooks.useEventCallback)(function () {
|
|
139
202
|
setFormError({});
|
|
140
203
|
});
|
|
@@ -151,12 +214,13 @@ function useFormValidate(formError, props) {
|
|
|
151
214
|
formError: realFormError,
|
|
152
215
|
check: check,
|
|
153
216
|
checkForField: checkForField,
|
|
217
|
+
checkFieldForNextValue: checkFieldForNextValue,
|
|
154
218
|
checkAsync: checkAsync,
|
|
155
219
|
checkForFieldAsync: checkForFieldAsync,
|
|
220
|
+
checkFieldAsyncForNextValue: checkFieldAsyncForNextValue,
|
|
156
221
|
cleanErrors: cleanErrors,
|
|
157
222
|
resetErrors: resetErrors,
|
|
158
223
|
cleanErrorForField: cleanErrorForField,
|
|
159
|
-
setFieldError: setFieldError,
|
|
160
224
|
onRemoveError: onRemoveError
|
|
161
225
|
};
|
|
162
226
|
}
|
|
@@ -42,10 +42,9 @@ var FormControl = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
42
42
|
removeFieldValue = _useContext.removeFieldValue,
|
|
43
43
|
removeFieldError = _useContext.removeFieldError,
|
|
44
44
|
onFieldChange = _useContext.onFieldChange,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
contextCheckTrigger = _useContext.checkTrigger;
|
|
45
|
+
contextCheckTrigger = _useContext.checkTrigger,
|
|
46
|
+
checkFieldForNextValue = _useContext.checkFieldForNextValue,
|
|
47
|
+
checkFieldAsyncForNextValue = _useContext.checkFieldAsyncForNextValue;
|
|
49
48
|
var _props$as = props.as,
|
|
50
49
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
51
50
|
_props$accepter = props.accepter,
|
|
@@ -120,27 +119,12 @@ var FormControl = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
120
119
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
121
120
|
});
|
|
122
121
|
var handleFieldCheck = (0, _hooks.useEventCallback)(function (value) {
|
|
123
|
-
var callbackEvents = function callbackEvents(checkResult) {
|
|
124
|
-
if (checkResult.hasError) {
|
|
125
|
-
var _errorMessage = checkResult.errorMessage;
|
|
126
|
-
var _fieldError = nestedField ? checkResult : _errorMessage || checkResult;
|
|
127
|
-
onFieldError === null || onFieldError === void 0 ? void 0 : onFieldError(name, _fieldError);
|
|
128
|
-
} else {
|
|
129
|
-
onFieldSuccess === null || onFieldSuccess === void 0 ? void 0 : onFieldSuccess(name);
|
|
130
|
-
}
|
|
131
|
-
return checkResult;
|
|
132
|
-
};
|
|
133
122
|
var nextFormValue = setFieldValue(name, value);
|
|
134
|
-
var model = getCombinedModel();
|
|
135
|
-
var checkOptions = {
|
|
136
|
-
nestedObject: nestedField
|
|
137
|
-
};
|
|
138
123
|
if (checkAsync) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
checkFieldAsyncForNextValue(name, nextFormValue);
|
|
125
|
+
} else {
|
|
126
|
+
checkFieldForNextValue(name, nextFormValue);
|
|
142
127
|
}
|
|
143
|
-
return Promise.resolve(callbackEvents(model === null || model === void 0 ? void 0 : model.checkForField(name, nextFormValue, checkOptions)));
|
|
144
128
|
});
|
|
145
129
|
var fieldHasError = Boolean(fieldError);
|
|
146
130
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavItemProps } from './NavItem';
|
|
3
|
+
/**
|
|
4
|
+
* The <Nav.Item> API
|
|
5
|
+
* When used as direct child of <Nav>, render the NavItem
|
|
6
|
+
* When used within a <Nav.Menu>, render the NavDropdownItem
|
|
7
|
+
*/
|
|
8
|
+
declare const AdaptiveNavItem: React.ForwardRefExoticComponent<NavItemProps<string | number> & React.RefAttributes<any>>;
|
|
9
|
+
export default AdaptiveNavItem;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _NavItem = _interopRequireDefault(require("./NavItem"));
|
|
10
|
+
var _hooks = require("../internals/hooks");
|
|
11
|
+
var _Navbar = require("../Navbar/Navbar");
|
|
12
|
+
var _Sidenav = require("../Sidenav/Sidenav");
|
|
13
|
+
var _NavContext = _interopRequireDefault(require("./NavContext"));
|
|
14
|
+
var _NavMenu = require("./NavMenu");
|
|
15
|
+
var _NavDropdownItem = _interopRequireDefault(require("./NavDropdownItem"));
|
|
16
|
+
var _NavbarDropdownItem = _interopRequireDefault(require("../Navbar/NavbarDropdownItem"));
|
|
17
|
+
var _SidenavDropdownItem = _interopRequireDefault(require("../Sidenav/SidenavDropdownItem"));
|
|
18
|
+
var _NavbarItem = _interopRequireDefault(require("../Navbar/NavbarItem"));
|
|
19
|
+
var _SidenavItem = _interopRequireDefault(require("../Sidenav/SidenavItem"));
|
|
20
|
+
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); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
/**
|
|
23
|
+
* The <Nav.Item> API
|
|
24
|
+
* When used as direct child of <Nav>, render the NavItem
|
|
25
|
+
* When used within a <Nav.Menu>, render the NavDropdownItem
|
|
26
|
+
*/
|
|
27
|
+
var AdaptiveNavItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
28
|
+
var nav = (0, _react.useContext)(_NavContext.default);
|
|
29
|
+
if (!nav) {
|
|
30
|
+
throw new Error('<Nav.Item> must be rendered within a <Nav> component.');
|
|
31
|
+
}
|
|
32
|
+
var parentNavMenu = (0, _react.useContext)(_NavMenu.NavMenuContext);
|
|
33
|
+
var navbar = (0, _react.useContext)(_Navbar.NavbarContext);
|
|
34
|
+
var sidenav = (0, _react.useContext)(_Sidenav.SidenavContext);
|
|
35
|
+
var _ref = parentNavMenu !== null && parentNavMenu !== void 0 ? parentNavMenu : [],
|
|
36
|
+
dispatch = _ref[1];
|
|
37
|
+
var _id = (0, _hooks.useInternalId)('Nav.Item');
|
|
38
|
+
(0, _react.useEffect)(function () {
|
|
39
|
+
if (dispatch) {
|
|
40
|
+
var _props$active;
|
|
41
|
+
dispatch({
|
|
42
|
+
type: _NavMenu.NavMenuActionType.RegisterItem,
|
|
43
|
+
payload: {
|
|
44
|
+
_id: _id,
|
|
45
|
+
eventKey: props.eventKey,
|
|
46
|
+
active: (_props$active = props.active) !== null && _props$active !== void 0 ? _props$active : false
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return function () {
|
|
50
|
+
dispatch({
|
|
51
|
+
type: _NavMenu.NavMenuActionType.UnregisterItem,
|
|
52
|
+
payload: {
|
|
53
|
+
_id: _id
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}, [dispatch, _id, props.eventKey, props.active]);
|
|
59
|
+
if (parentNavMenu) {
|
|
60
|
+
if (navbar) {
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_NavbarDropdownItem.default, (0, _extends2.default)({
|
|
62
|
+
ref: ref
|
|
63
|
+
}, props));
|
|
64
|
+
}
|
|
65
|
+
if (sidenav) {
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_SidenavDropdownItem.default, (0, _extends2.default)({
|
|
67
|
+
ref: ref
|
|
68
|
+
}, props));
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_NavDropdownItem.default, (0, _extends2.default)({
|
|
71
|
+
ref: ref
|
|
72
|
+
}, props));
|
|
73
|
+
}
|
|
74
|
+
if (navbar) {
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_NavbarItem.default, (0, _extends2.default)({
|
|
76
|
+
ref: ref
|
|
77
|
+
}, props));
|
|
78
|
+
}
|
|
79
|
+
if (sidenav) {
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_SidenavItem.default, (0, _extends2.default)({
|
|
81
|
+
ref: ref
|
|
82
|
+
}, props));
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_NavItem.default, (0, _extends2.default)({
|
|
85
|
+
ref: ref
|
|
86
|
+
}, props));
|
|
87
|
+
});
|
|
88
|
+
AdaptiveNavItem.displayName = 'Nav.Item';
|
|
89
|
+
var _default = exports.default = AdaptiveNavItem;
|
package/cjs/Nav/Nav.d.ts
CHANGED
|
@@ -4,21 +4,40 @@ import { WithAsProps, RsRefForwardingComponent } from '../internals/types';
|
|
|
4
4
|
import NavDropdown from './NavDropdown';
|
|
5
5
|
import NavMenu from './NavMenu';
|
|
6
6
|
export interface NavProps<T = any> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The appearance style of the Nav component.
|
|
9
|
+
*
|
|
10
|
+
* @default 'default'
|
|
11
|
+
* @version 'pills' is supported in version 5.68.0
|
|
12
|
+
*/
|
|
13
|
+
appearance?: 'default' | 'subtle' | 'tabs' | 'pills';
|
|
14
|
+
/**
|
|
15
|
+
* Whether the Nav component is reversed.
|
|
16
|
+
*/
|
|
10
17
|
reversed?: boolean;
|
|
11
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Whether the Nav component is justified.
|
|
20
|
+
*/
|
|
12
21
|
justified?: boolean;
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Whether the Nav component is vertical.
|
|
24
|
+
*/
|
|
14
25
|
vertical?: boolean;
|
|
15
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Whether the Nav component is pulled to the right.
|
|
28
|
+
*/
|
|
16
29
|
pullRight?: boolean;
|
|
17
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* The active key of the Nav component.
|
|
32
|
+
*/
|
|
18
33
|
activeKey?: T;
|
|
19
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The default active key of the Nav component.
|
|
36
|
+
*/
|
|
20
37
|
defaultActiveKey?: T;
|
|
21
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Event handler for selecting a Nav item.
|
|
40
|
+
*/
|
|
22
41
|
onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
|
|
23
42
|
}
|
|
24
43
|
interface NavComponent extends RsRefForwardingComponent<'div', NavProps> {
|