rsuite 5.35.1 → 5.37.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/RadioGroup/styles/index.less +25 -14
  3. package/cjs/Cascader/Cascader.js +2 -1
  4. package/cjs/InputPicker/InputPicker.d.ts +9 -0
  5. package/cjs/InputPicker/InputPicker.js +9 -3
  6. package/cjs/MultiCascader/MultiCascader.js +0 -1
  7. package/cjs/Picker/PickerToggle.d.ts +1 -0
  8. package/cjs/Picker/PickerToggle.js +4 -2
  9. package/cjs/Picker/utils.js +3 -2
  10. package/cjs/Uploader/Uploader.d.ts +3 -2
  11. package/cjs/locales/index.d.ts +1 -0
  12. package/cjs/locales/index.js +6 -2
  13. package/cjs/locales/ja_JP.d.ts +117 -0
  14. package/cjs/locales/ja_JP.js +89 -0
  15. package/cjs/utils/ajaxUpload.d.ts +1 -1
  16. package/dist/rsuite-no-reset-rtl.css +15 -200
  17. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  18. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  19. package/dist/rsuite-no-reset.css +15 -200
  20. package/dist/rsuite-no-reset.min.css +1 -1
  21. package/dist/rsuite-no-reset.min.css.map +1 -1
  22. package/dist/rsuite-rtl.css +15 -200
  23. package/dist/rsuite-rtl.min.css +1 -1
  24. package/dist/rsuite-rtl.min.css.map +1 -1
  25. package/dist/rsuite.css +15 -200
  26. package/dist/rsuite.js +7 -7
  27. package/dist/rsuite.min.css +1 -1
  28. package/dist/rsuite.min.css.map +1 -1
  29. package/dist/rsuite.min.js +1 -1
  30. package/dist/rsuite.min.js.map +1 -1
  31. package/esm/Cascader/Cascader.js +2 -1
  32. package/esm/InputPicker/InputPicker.d.ts +9 -0
  33. package/esm/InputPicker/InputPicker.js +9 -3
  34. package/esm/MultiCascader/MultiCascader.js +0 -1
  35. package/esm/Picker/PickerToggle.d.ts +1 -0
  36. package/esm/Picker/PickerToggle.js +4 -2
  37. package/esm/Picker/utils.js +3 -2
  38. package/esm/Uploader/Uploader.d.ts +3 -2
  39. package/esm/locales/index.d.ts +1 -0
  40. package/esm/locales/index.js +2 -1
  41. package/esm/locales/ja_JP.d.ts +117 -0
  42. package/esm/locales/ja_JP.js +79 -0
  43. package/esm/utils/ajaxUpload.d.ts +1 -1
  44. package/locales/ja_JP/package.json +7 -0
  45. package/package.json +5 -2
@@ -260,12 +260,13 @@ var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
260
260
  }
261
261
 
262
262
  if (!shallowEqual(value, focusItemValue)) {
263
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(focusItem, pathTowardsActiveItem, event);
263
264
  onChange === null || onChange === void 0 ? void 0 : onChange(focusItemValue !== null && focusItemValue !== void 0 ? focusItemValue : null, event);
264
265
  }
265
266
 
266
267
  handleClose();
267
268
  }
268
- }, [childrenKey, data, focusItemValue, handleClose, onChange, pathTowardsActiveItem, setLayer, setValue, value, valueKey]);
269
+ }, [childrenKey, data, focusItemValue, handleClose, onChange, pathTowardsActiveItem, setLayer, setValue, value, valueKey, onSelect]);
269
270
  var onPickerKeyDown = useToggleKeyDownEvent(_extends({
270
271
  toggle: !focusItemValue || !active,
271
272
  triggerRef: triggerRef,
@@ -36,6 +36,15 @@ export interface InputPickerProps<T = ValueType> extends FormControlPickerProps<
36
36
  onFocus?: React.FocusEventHandler;
37
37
  /** Called when the option is created */
38
38
  onCreate?: (value: ValueType, item: ItemDataType, event: React.SyntheticEvent) => void;
39
+ /**
40
+ * Customize whether to display "Create option" action with given textbox value
41
+ *
42
+ * By default, InputPicker hides "Create option" action when textbox value matches any filtered item's [valueKey] property
43
+ *
44
+ * @param searchKeyword Value of the textbox
45
+ * @param filteredData The items filtered by the searchKeyword
46
+ */
47
+ shouldDisplayCreateOption?: (searchKeyword: string, filteredData: InputItemDataType[]) => boolean;
39
48
  }
40
49
  declare const InputPicker: PickerComponent<InputPickerProps>;
41
50
  export default InputPicker;
@@ -66,6 +66,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
66
  _props$menuMaxHeight = props.menuMaxHeight,
67
67
  menuMaxHeight = _props$menuMaxHeight === void 0 ? 320 : _props$menuMaxHeight,
68
68
  creatable = props.creatable,
69
+ shouldDisplayCreateOption = props.shouldDisplayCreateOption,
69
70
  valueProp = props.value,
70
71
  _props$valueKey = props.valueKey,
71
72
  valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
@@ -97,7 +98,7 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
97
98
  searchBy = props.searchBy,
98
99
  _props$placement = props.placement,
99
100
  placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
100
- rest = _objectWithoutPropertiesLoose(props, ["as", "appearance", "cleanable", "cacheData", "classPrefix", "data", "disabled", "readOnly", "plaintext", "defaultValue", "defaultOpen", "disabledItemValues", "locale", "toggleAs", "style", "searchable", "open", "placeholder", "groupBy", "menuClassName", "menuStyle", "menuAutoWidth", "menuMaxHeight", "creatable", "value", "valueKey", "virtualized", "labelKey", "listProps", "id", "tabIndex", "sort", "renderMenu", "renderExtraFooter", "renderValue", "renderMenuItem", "renderMenuGroup", "onEnter", "onEntered", "onExit", "onExited", "onChange", "onClean", "onCreate", "onSearch", "onSelect", "onOpen", "onClose", "onBlur", "onFocus", "searchBy", "placement"]);
101
+ rest = _objectWithoutPropertiesLoose(props, ["as", "appearance", "cleanable", "cacheData", "classPrefix", "data", "disabled", "readOnly", "plaintext", "defaultValue", "defaultOpen", "disabledItemValues", "locale", "toggleAs", "style", "searchable", "open", "placeholder", "groupBy", "menuClassName", "menuStyle", "menuAutoWidth", "menuMaxHeight", "creatable", "shouldDisplayCreateOption", "value", "valueKey", "virtualized", "labelKey", "listProps", "id", "tabIndex", "sort", "renderMenu", "renderExtraFooter", "renderValue", "renderMenuItem", "renderMenuGroup", "onEnter", "onEntered", "onExit", "onExited", "onChange", "onClean", "onCreate", "onSearch", "onSelect", "onOpen", "onClose", "onBlur", "onFocus", "searchBy", "placement"]);
101
102
 
102
103
  var _useContext = useContext(InputPickerContext),
103
104
  multi = _useContext.multi,
@@ -333,6 +334,11 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
333
334
  };
334
335
 
335
336
  var handleTagKeyPress = useCallback(function (event) {
337
+ // When composing, ignore the keypress event.
338
+ if (event.nativeEvent.isComposing) {
339
+ return;
340
+ }
341
+
336
342
  var val = cloneValue();
337
343
  var data = getAllData();
338
344
 
@@ -592,9 +598,9 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
592
598
 
593
599
  var items = filterNodesOfTree(getAllData(), checkShouldDisplay);
594
600
 
595
- if (creatable && searchKeyword && !items.find(function (item) {
601
+ if (creatable && (typeof shouldDisplayCreateOption === 'function' ? shouldDisplayCreateOption(searchKeyword, items) : searchKeyword && !items.find(function (item) {
596
602
  return item[valueKey] === searchKeyword;
597
- })) {
603
+ }))) {
598
604
  items = [].concat(items, [createOption(searchKeyword)]);
599
605
  } // Create a tree structure data when set `groupBy`
600
606
 
@@ -225,7 +225,6 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
225
225
  (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$u = _triggerRef$current.updatePosition) === null || _triggerRef$current$u === void 0 ? void 0 : _triggerRef$current$u.call(_triggerRef$current);
226
226
  }, [onSelect, getChildren, childrenKey, inline, addFlattenData, addColumn, removeColumnByIndex]);
227
227
  var handleCheck = useCallback(function (node, event, checked) {
228
- console.log('handleCheck');
229
228
  var nodeValue = node[valueKey];
230
229
  var nextValue = [];
231
230
 
@@ -17,6 +17,7 @@ export interface PickerToggleProps extends ToggleButtonProps {
17
17
  tabIndex?: number;
18
18
  loading?: boolean;
19
19
  editable?: boolean;
20
+ name?: string;
20
21
  inputPlaceholder?: string;
21
22
  inputMask?: (string | RegExp)[];
22
23
  onInputChange?: (value: string, event: React.ChangeEvent) => void;
@@ -56,7 +56,8 @@ var PickerToggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
56
56
  _props$caretAs = props.caretAs,
57
57
  caretAs = _props$caretAs === void 0 ? caretComponent : _props$caretAs,
58
58
  label = props.label,
59
- rest = _objectWithoutPropertiesLoose(props, ["active", "as", "classPrefix", "children", "caret", "className", "disabled", "readOnly", "plaintext", "hasValue", "editable", "loading", "cleanable", "tabIndex", "id", "value", "inputPlaceholder", "inputValue", "inputMask", "onInputChange", "onInputPressEnter", "onInputBlur", "onInputFocus", "onClean", "onFocus", "onBlur", "placement", "caretComponent", "caretAs", "label"]);
59
+ name = props.name,
60
+ rest = _objectWithoutPropertiesLoose(props, ["active", "as", "classPrefix", "children", "caret", "className", "disabled", "readOnly", "plaintext", "hasValue", "editable", "loading", "cleanable", "tabIndex", "id", "value", "inputPlaceholder", "inputValue", "inputMask", "onInputChange", "onInputPressEnter", "onInputBlur", "onInputFocus", "onClean", "onFocus", "onBlur", "placement", "caretComponent", "caretAs", "label", "name"]);
60
61
 
61
62
  var inputRef = useRef(null);
62
63
  var comboboxRef = useRef(null);
@@ -150,11 +151,12 @@ var PickerToggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
150
151
  var renderInput = useCallback(function (ref, props) {
151
152
  return /*#__PURE__*/React.createElement("input", _extends({
152
153
  ref: mergeRefs(inputRef, ref),
154
+ name: name,
153
155
  style: {
154
156
  pointerEvents: editable ? undefined : 'none'
155
157
  }
156
158
  }, props));
157
- }, [editable]);
159
+ }, [editable, name]);
158
160
  var ToggleCaret = useToggleCaret(placement);
159
161
  var Caret = caretAs !== null && caretAs !== void 0 ? caretAs : ToggleCaret;
160
162
 
@@ -73,8 +73,9 @@ export function usePickerClassName(props) {
73
73
  withClassPrefix = _useClassNames.withClassPrefix,
74
74
  merge = _useClassNames.merge;
75
75
 
76
- var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(placementPolyfill(placement))] = placement, _withClassPrefix['read-only'] = readOnly, _withClassPrefix['has-value'] = hasValue, _withClassPrefix.cleanable = cleanable, _withClassPrefix.block = block, _withClassPrefix.disabled = disabled, _withClassPrefix.countable = countable, _withClassPrefix.plaintext = plaintext, _withClassPrefix)));
77
- var usedClassNamePropKeys = Object.keys(omit(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext'])));
76
+ var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(placementPolyfill(placement))] = placement, _withClassPrefix['read-only'] = readOnly, _withClassPrefix['has-value'] = hasValue, _withClassPrefix.cleanable = cleanable, _withClassPrefix.block = block, _withClassPrefix.disabled = disabled, _withClassPrefix.countable = countable, _withClassPrefix.plaintext = plaintext, _withClassPrefix))); // Those props that're used for composing the className
77
+
78
+ var usedClassNamePropKeys = Object.keys(omit(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext', 'name'])));
78
79
  return [classes, usedClassNamePropKeys];
79
80
  }
80
81
 
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { UploadTriggerProps } from './UploadTrigger';
3
3
  import { WithAsProps } from '../@types/common';
4
4
  import { UploaderLocale } from '../locales';
5
+ import type { ErrorStatus } from '../utils/ajaxUpload';
5
6
  export interface FileType {
6
7
  /** File Name */
7
8
  name?: string;
@@ -86,8 +87,8 @@ export interface UploaderProps extends WithAsProps, Omit<UploadTriggerProps, 'on
86
87
  onReupload?: (file: FileType) => void;
87
88
  /** In the file list, click the callback function for the uploaded file */
88
89
  onPreview?: (file: FileType, event: React.SyntheticEvent) => void;
89
- /** Upload callback function with erro */
90
- onError?: (status: any, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
90
+ /** Upload callback function with error */
91
+ onError?: (status: ErrorStatus, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
91
92
  /** callback function after successful upload */
92
93
  onSuccess?: (response: any, file: FileType, event: ProgressEvent, xhr: XMLHttpRequest) => void;
93
94
  /** Callback functions that upload progress change */
@@ -20,6 +20,7 @@ export { default as zhCN } from './zh_CN';
20
20
  export { default as zhTW } from './zh_TW';
21
21
  export { default as faIR } from './fa_IR';
22
22
  export { default as frFR } from './fr_FR';
23
+ export { default as jaJP } from './ja_JP';
23
24
  declare type PickKeys<T> = {
24
25
  [keys in keyof T]?: T[keys];
25
26
  };
@@ -18,4 +18,5 @@ export { default as trTR } from './tr_TR';
18
18
  export { default as zhCN } from './zh_CN';
19
19
  export { default as zhTW } from './zh_TW';
20
20
  export { default as faIR } from './fa_IR';
21
- export { default as frFR } from './fr_FR';
21
+ export { default as frFR } from './fr_FR';
22
+ export { default as jaJP } from './ja_JP';
@@ -0,0 +1,117 @@
1
+ declare const _default: {
2
+ common: {
3
+ loading: string;
4
+ emptyMessage: string;
5
+ };
6
+ Plaintext: {
7
+ unfilled: string;
8
+ notSelected: string;
9
+ notUploaded: string;
10
+ };
11
+ Pagination: {
12
+ more: string;
13
+ prev: string;
14
+ next: string;
15
+ first: string;
16
+ last: string;
17
+ limit: string;
18
+ total: string;
19
+ skip: string;
20
+ };
21
+ Calendar: {
22
+ sunday: string;
23
+ monday: string;
24
+ tuesday: string;
25
+ wednesday: string;
26
+ thursday: string;
27
+ friday: string;
28
+ saturday: string;
29
+ ok: string;
30
+ today: string;
31
+ yesterday: string;
32
+ hours: string;
33
+ minutes: string;
34
+ seconds: string;
35
+ /**
36
+ * Format of the string is based on Unicode Technical Standard #35:
37
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
38
+ **/
39
+ formattedMonthPattern: string;
40
+ formattedDayPattern: string;
41
+ dateLocale: any;
42
+ };
43
+ DatePicker: {
44
+ sunday: string;
45
+ monday: string;
46
+ tuesday: string;
47
+ wednesday: string;
48
+ thursday: string;
49
+ friday: string;
50
+ saturday: string;
51
+ ok: string;
52
+ today: string;
53
+ yesterday: string;
54
+ hours: string;
55
+ minutes: string;
56
+ seconds: string;
57
+ /**
58
+ * Format of the string is based on Unicode Technical Standard #35:
59
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
60
+ **/
61
+ formattedMonthPattern: string;
62
+ formattedDayPattern: string;
63
+ dateLocale: any;
64
+ };
65
+ DateRangePicker: {
66
+ last7Days: string;
67
+ sunday: string;
68
+ monday: string;
69
+ tuesday: string;
70
+ wednesday: string;
71
+ thursday: string;
72
+ friday: string;
73
+ saturday: string;
74
+ ok: string;
75
+ today: string;
76
+ yesterday: string;
77
+ hours: string;
78
+ minutes: string;
79
+ seconds: string;
80
+ /**
81
+ * Format of the string is based on Unicode Technical Standard #35:
82
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
83
+ **/
84
+ formattedMonthPattern: string;
85
+ formattedDayPattern: string;
86
+ dateLocale: any;
87
+ };
88
+ Picker: {
89
+ noResultsText: string;
90
+ placeholder: string;
91
+ searchPlaceholder: string;
92
+ checkAll: string;
93
+ };
94
+ InputPicker: {
95
+ newItem: string;
96
+ createOption: string;
97
+ };
98
+ Uploader: {
99
+ inited: string;
100
+ progress: string;
101
+ error: string;
102
+ complete: string;
103
+ emptyFile: string;
104
+ upload: string;
105
+ };
106
+ CloseButton: {
107
+ closeLabel: string;
108
+ };
109
+ Breadcrumb: {
110
+ expandText: string;
111
+ };
112
+ Toggle: {
113
+ on: string;
114
+ off: string;
115
+ };
116
+ };
117
+ export default _default;
@@ -0,0 +1,79 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import ja from 'date-fns/locale/ja';
3
+ var Calendar = {
4
+ sunday: '日',
5
+ monday: '月',
6
+ tuesday: '火',
7
+ wednesday: '水',
8
+ thursday: '木',
9
+ friday: '金',
10
+ saturday: '土',
11
+ ok: '確認',
12
+ today: '今日',
13
+ yesterday: '昨日',
14
+ hours: '時',
15
+ minutes: '分',
16
+ seconds: '秒',
17
+
18
+ /**
19
+ * Format of the string is based on Unicode Technical Standard #35:
20
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
21
+ **/
22
+ formattedMonthPattern: 'yyyy年 MMM',
23
+ formattedDayPattern: 'yyyy年 MMM dd',
24
+ dateLocale: ja
25
+ };
26
+ export default {
27
+ common: {
28
+ loading: '読み込み中...',
29
+ emptyMessage: 'データはありません。'
30
+ },
31
+ Plaintext: {
32
+ unfilled: '未記入',
33
+ notSelected: '選択しない',
34
+ notUploaded: 'アップロードされない'
35
+ },
36
+ Pagination: {
37
+ more: 'もっと見る',
38
+ prev: '前へ',
39
+ next: '次へ',
40
+ first: '最初',
41
+ last: '最後',
42
+ limit: '{0} / ページ',
43
+ total: '合計: {0}',
44
+ skip: '{0}に逝く'
45
+ },
46
+ Calendar: Calendar,
47
+ DatePicker: _extends({}, Calendar),
48
+ DateRangePicker: _extends({}, Calendar, {
49
+ last7Days: '直近7日間'
50
+ }),
51
+ Picker: {
52
+ noResultsText: '結果は見つかりませんでした。',
53
+ placeholder: '選択',
54
+ searchPlaceholder: '検索',
55
+ checkAll: 'すべて'
56
+ },
57
+ InputPicker: {
58
+ newItem: '新要素',
59
+ createOption: 'オプション作成: "{0}"'
60
+ },
61
+ Uploader: {
62
+ inited: '始動',
63
+ progress: 'アップロード中',
64
+ error: 'エラー',
65
+ complete: '終了',
66
+ emptyFile: '空',
67
+ upload: 'アップロード'
68
+ },
69
+ CloseButton: {
70
+ closeLabel: '終了'
71
+ },
72
+ Breadcrumb: {
73
+ expandText: 'パス表示'
74
+ },
75
+ Toggle: {
76
+ on: '開く',
77
+ off: '閉じる'
78
+ }
79
+ };
@@ -1,4 +1,4 @@
1
- interface ErrorStatus {
1
+ export interface ErrorStatus {
2
2
  type: 'timeout' | 'server_error' | 'xhr_error';
3
3
  response?: any;
4
4
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "rsuite/locales/ja_JP",
3
+ "private": true,
4
+ "main": "../../cjs/locales/ja_JP.js",
5
+ "module": "../../esm/locales/ja_JP.js",
6
+ "types": "../../esm/locales/ja_JP.d.ts"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.35.1",
3
+ "version": "5.37.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -38,13 +38,16 @@
38
38
  "prop-types": "^15.8.1",
39
39
  "react-use-set": "^1.0.0",
40
40
  "react-window": "^1.8.8",
41
- "rsuite-table": "^5.10.6",
41
+ "rsuite-table": "^5.11.0",
42
42
  "schema-typed": "^2.1.3"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=16.8.0",
46
46
  "react-dom": ">=16.8.0"
47
47
  },
48
+ "overrides": {
49
+ "aria-query@>5.1.3": "5.1.3"
50
+ },
48
51
  "browserslist": [
49
52
  "> 1%",
50
53
  "last 2 versions",