dtable-ui-component 4.3.11 → 4.4.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.
|
@@ -33,6 +33,10 @@ class PCCollaboratorEditorPopover extends React.Component {
|
|
|
33
33
|
this.state = {
|
|
34
34
|
searchValue: ''
|
|
35
35
|
};
|
|
36
|
+
this.editorInputRef = React.createRef();
|
|
37
|
+
}
|
|
38
|
+
componentDidMount() {
|
|
39
|
+
this.editorInputRef.current.focus();
|
|
36
40
|
}
|
|
37
41
|
render() {
|
|
38
42
|
let {
|
|
@@ -58,7 +62,8 @@ class PCCollaboratorEditorPopover extends React.Component {
|
|
|
58
62
|
value: searchValue,
|
|
59
63
|
onChange: this.onValueChanged,
|
|
60
64
|
onClick: this.onInputClick,
|
|
61
|
-
placeholder: getLocale('Find_a_collaborator')
|
|
65
|
+
placeholder: getLocale('Find_a_collaborator'),
|
|
66
|
+
ref: this.editorInputRef
|
|
62
67
|
})), /*#__PURE__*/React.createElement("div", {
|
|
63
68
|
className: "collaborator-list-container"
|
|
64
69
|
}, collaborators.length > 0 && collaborators.map((collaborator, index) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { Popover } from 'reactstrap';
|
|
4
|
+
import { searchCollaborators } from 'dtable-utils';
|
|
4
5
|
import SelectOptionGroup from '../SelectOptionGroup';
|
|
5
|
-
import { searchCollaborators } from './utils';
|
|
6
6
|
import './index.css';
|
|
7
7
|
class CollaboratorSelect extends Component {
|
|
8
8
|
constructor(props) {
|
package/lib/DateEditor/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "2.0.5",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"dayjs": "1.10.7",
|
|
13
13
|
"deepmerge": "^2.1.0",
|
|
14
|
-
"dtable-utils": "
|
|
14
|
+
"dtable-utils": "4.4.0",
|
|
15
15
|
"hast-util-sanitize": "^1.1.2",
|
|
16
16
|
"hast-util-to-html": "3.1.0",
|
|
17
17
|
"is-hotkey": "0.2.0",
|
|
@@ -118,6 +118,9 @@
|
|
|
118
118
|
"file-loader": "4.3.0",
|
|
119
119
|
"fs-extra": "^8.1.0",
|
|
120
120
|
"html-webpack-plugin": "4.0.0-beta.11",
|
|
121
|
+
"i18next": "22.4.9",
|
|
122
|
+
"i18next-browser-languagedetector": "7.0.1",
|
|
123
|
+
"i18next-xhr-backend": "3.2.2",
|
|
121
124
|
"identity-obj-proxy": "3.0.0",
|
|
122
125
|
"jest": "24.9.0",
|
|
123
126
|
"jest-environment-jsdom-fourteen": "1.0.1",
|
|
@@ -133,6 +136,7 @@
|
|
|
133
136
|
"postcss-safe-parser": "4.0.1",
|
|
134
137
|
"react-dev-utils": "^12.0.1",
|
|
135
138
|
"react-element-to-jsx-string": "^14.3.1",
|
|
139
|
+
"react-i18next": "12.1.4",
|
|
136
140
|
"resolve": "1.15.0",
|
|
137
141
|
"resolve-url-loader": "3.1.5",
|
|
138
142
|
"sass-loader": "8.0.2",
|
|
@@ -142,10 +146,6 @@
|
|
|
142
146
|
"ts-pnp": "1.1.5",
|
|
143
147
|
"url-loader": "2.3.0",
|
|
144
148
|
"webpack": "4.41.5",
|
|
145
|
-
"i18next": "22.4.9",
|
|
146
|
-
"i18next-browser-languagedetector": "7.0.1",
|
|
147
|
-
"i18next-xhr-backend": "3.2.2",
|
|
148
|
-
"react-i18next": "12.1.4",
|
|
149
149
|
"webpack-dev-server": "3.11.3",
|
|
150
150
|
"webpack-manifest-plugin": "2.2.0",
|
|
151
151
|
"workbox-webpack-plugin": "4.3.1"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const searchCollaborators = (collaborators, searchValue) => {
|
|
2
|
-
const validSearchValue = searchValue ? searchValue.trim().toLowerCase() : '';
|
|
3
|
-
const validCollaborators = Array.isArray(collaborators) && collaborators.length > 0 ? collaborators : [];
|
|
4
|
-
if (!validSearchValue) return validCollaborators;
|
|
5
|
-
return validCollaborators.filter(collaborator => {
|
|
6
|
-
const {
|
|
7
|
-
name,
|
|
8
|
-
name_pinyin = ''
|
|
9
|
-
} = collaborator;
|
|
10
|
-
if (name.toString().toLowerCase().indexOf(validSearchValue) > -1) return true;
|
|
11
|
-
if (!name_pinyin) return false;
|
|
12
|
-
const validNamePinyin = name_pinyin.toString().toLowerCase();
|
|
13
|
-
const validSearchPinyinValue = validSearchValue.replace(/ |'/g, '');
|
|
14
|
-
|
|
15
|
-
// complete
|
|
16
|
-
if (validNamePinyin.indexOf(validSearchPinyinValue) > -1) return true;
|
|
17
|
-
if (validNamePinyin.replace(/'/g, '').indexOf(validSearchPinyinValue) > -1) return true;
|
|
18
|
-
const validNamePinyinList = validNamePinyin.split('\'');
|
|
19
|
-
// acronym
|
|
20
|
-
const namePinyinAcronym = validNamePinyinList.map(item => item && item.trim() ? item.trim().slice(0, 1) : '');
|
|
21
|
-
if (namePinyinAcronym.join('').indexOf(validSearchPinyinValue) > -1) return true;
|
|
22
|
-
return false;
|
|
23
|
-
});
|
|
24
|
-
};
|