@arcblock/ux 2.1.67 → 2.1.70
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/lib/CodeBlock/index.js +28 -28
- package/lib/Datatable/TableSearch.js +5 -16
- package/lib/Locale/selector.js +13 -13
- package/package.json +5 -5
- package/src/CodeBlock/index.js +1 -1
- package/src/Datatable/TableSearch.js +5 -14
- package/src/Locale/selector.js +5 -8
- package/lib/Locale/images/globe-dark.png +0 -0
- package/lib/Locale/images/globe-light.png +0 -0
- package/src/Locale/images/globe-dark.png +0 -0
- package/src/Locale/images/globe-light.png +0 -0
package/lib/CodeBlock/index.js
CHANGED
@@ -17,7 +17,7 @@ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
17
17
|
|
18
18
|
var _useMountedState = _interopRequireDefault(require("react-use/lib/useMountedState"));
|
19
19
|
|
20
|
-
var
|
20
|
+
var _core = _interopRequireDefault(require("highlight.js/lib/core"));
|
21
21
|
|
22
22
|
var _javascript = _interopRequireDefault(require("highlight.js/lib/languages/javascript"));
|
23
23
|
|
@@ -71,57 +71,57 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
71
71
|
|
72
72
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
73
73
|
|
74
|
-
|
74
|
+
_core.default.registerLanguage('javascript', _javascript.default);
|
75
75
|
|
76
|
-
|
76
|
+
_core.default.registerLanguage('js', _javascript.default);
|
77
77
|
|
78
|
-
|
78
|
+
_core.default.registerLanguage('jsx', _javascript.default);
|
79
79
|
|
80
|
-
|
80
|
+
_core.default.registerLanguage('typescript', _typescript.default);
|
81
81
|
|
82
|
-
|
82
|
+
_core.default.registerLanguage('ts', _typescript.default);
|
83
83
|
|
84
|
-
|
84
|
+
_core.default.registerLanguage('tsx', _typescript.default);
|
85
85
|
|
86
|
-
|
86
|
+
_core.default.registerLanguage('json', _json.default);
|
87
87
|
|
88
|
-
|
88
|
+
_core.default.registerLanguage('elixir', _elixir.default);
|
89
89
|
|
90
|
-
|
90
|
+
_core.default.registerLanguage('java', _java.default);
|
91
91
|
|
92
|
-
|
92
|
+
_core.default.registerLanguage('kotlin', _kotlin.default);
|
93
93
|
|
94
|
-
|
94
|
+
_core.default.registerLanguage('kt', _kotlin.default);
|
95
95
|
|
96
|
-
|
96
|
+
_core.default.registerLanguage('protobuf', _protobuf.default);
|
97
97
|
|
98
|
-
|
98
|
+
_core.default.registerLanguage('protobuffer', _protobuf.default);
|
99
99
|
|
100
|
-
|
100
|
+
_core.default.registerLanguage('python', _python.default);
|
101
101
|
|
102
|
-
|
102
|
+
_core.default.registerLanguage('py', _python.default);
|
103
103
|
|
104
|
-
|
104
|
+
_core.default.registerLanguage('yaml', _yaml.default);
|
105
105
|
|
106
|
-
|
106
|
+
_core.default.registerLanguage('yml', _yaml.default);
|
107
107
|
|
108
|
-
|
108
|
+
_core.default.registerLanguage('shell', _shell.default);
|
109
109
|
|
110
|
-
|
110
|
+
_core.default.registerLanguage('sh', _shell.default);
|
111
111
|
|
112
|
-
|
112
|
+
_core.default.registerLanguage('plaintext', _plaintext.default);
|
113
113
|
|
114
|
-
|
114
|
+
_core.default.registerLanguage('text', _plaintext.default);
|
115
115
|
|
116
|
-
|
116
|
+
_core.default.registerLanguage('patch', _diff.default);
|
117
117
|
|
118
|
-
|
118
|
+
_core.default.registerLanguage('diff', _diff.default);
|
119
119
|
|
120
|
-
|
120
|
+
_core.default.registerLanguage('swift', _swift.default);
|
121
121
|
|
122
|
-
|
122
|
+
_core.default.registerLanguage('objectivec', _objectivec.default);
|
123
123
|
|
124
|
-
|
124
|
+
_core.default.registerLanguage('oc', _objectivec.default);
|
125
125
|
|
126
126
|
function CodeBlock(_ref) {
|
127
127
|
let {
|
@@ -152,7 +152,7 @@ function CodeBlock(_ref) {
|
|
152
152
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
153
153
|
className: "hljs ".concat(language),
|
154
154
|
dangerouslySetInnerHTML: {
|
155
|
-
__html:
|
155
|
+
__html: _core.default.highlightAuto(source, [language]).value
|
156
156
|
}
|
157
157
|
})
|
158
158
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_IconButton.default, {
|
@@ -44,14 +44,13 @@ function TableSearch(_ref) {
|
|
44
44
|
searchAlwaysOpen
|
45
45
|
} = options;
|
46
46
|
const [inputExpand, setInputExpand] = (0, _react.useState)(!!searchText || searchOpen || false);
|
47
|
-
const [innerSearchText, setInnerSearchText] = (0, _react.useState)(
|
47
|
+
const [innerSearchText, setInnerSearchText] = (0, _react.useState)(searchText);
|
48
48
|
const inputTimer = (0, _react.useRef)(null);
|
49
49
|
const {
|
50
50
|
loading
|
51
51
|
} = (0, _DatatableContext.useDatatableContext)();
|
52
52
|
const {
|
53
|
-
searchDebounceTime
|
54
|
-
onOutSelfSearch
|
53
|
+
searchDebounceTime
|
55
54
|
} = options;
|
56
55
|
const searchExpand = searchAlwaysOpen || inputExpand;
|
57
56
|
|
@@ -69,14 +68,8 @@ function TableSearch(_ref) {
|
|
69
68
|
clearTimeout(inputTimer.current);
|
70
69
|
setInnerSearchText(value);
|
71
70
|
inputTimer.current = setTimeout(() => {
|
72
|
-
|
73
|
-
onOutSelfSearch(value);
|
74
|
-
} else {
|
75
|
-
searchTextUpdate(value);
|
76
|
-
}
|
71
|
+
searchTextUpdate(value);
|
77
72
|
}, searchDebounceTime);
|
78
|
-
} else if (onOutSelfSearch) {
|
79
|
-
onOutSelfSearch(value);
|
80
73
|
} else {
|
81
74
|
searchTextUpdate(value);
|
82
75
|
}
|
@@ -87,10 +80,6 @@ function TableSearch(_ref) {
|
|
87
80
|
searchClose();
|
88
81
|
setInnerSearchText('');
|
89
82
|
onSearchOpen(false);
|
90
|
-
|
91
|
-
if (onOutSelfSearch) {
|
92
|
-
onOutSelfSearch('');
|
93
|
-
}
|
94
83
|
};
|
95
84
|
|
96
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
@@ -116,14 +105,14 @@ function TableSearch(_ref) {
|
|
116
105
|
variant: "standard",
|
117
106
|
spacing: 2,
|
118
107
|
onChange: onChange,
|
119
|
-
value: searchDebounceTime ? innerSearchText : searchText
|
108
|
+
value: searchDebounceTime ? innerSearchText : searchText,
|
120
109
|
placeholder: searchPlaceholder || '',
|
121
110
|
autoFocus: !searchAlwaysOpen
|
122
111
|
}), loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
123
112
|
disabled: true,
|
124
113
|
variant: "standard",
|
125
114
|
spacing: 2,
|
126
|
-
value: searchDebounceTime ? innerSearchText : searchText
|
115
|
+
value: searchDebounceTime ? innerSearchText : searchText
|
127
116
|
})]
|
128
117
|
}), !searchAlwaysOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
129
118
|
className: "toolbar-search-close ".concat(searchExpand ? 'toolbar-btn-show' : ''),
|
package/lib/Locale/selector.js
CHANGED
@@ -31,17 +31,15 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
31
31
|
|
32
32
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
33
33
|
|
34
|
+
var _Globe = _interopRequireDefault(require("@arcblock/icons/lib/Globe"));
|
35
|
+
|
34
36
|
var _Util = require("../Util");
|
35
37
|
|
36
38
|
var _context = require("./context");
|
37
39
|
|
38
|
-
var _globeDark = _interopRequireDefault(require("./images/globe-dark.png"));
|
39
|
-
|
40
|
-
var _globeLight = _interopRequireDefault(require("./images/globe-light.png"));
|
41
|
-
|
42
40
|
var _jsxRuntime = require("react/jsx-runtime");
|
43
41
|
|
44
|
-
const _excluded = ["
|
42
|
+
const _excluded = ["showText", "popperProps", "popperType", "icon"];
|
45
43
|
|
46
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
47
45
|
|
@@ -56,8 +54,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
56
54
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
57
55
|
|
58
56
|
function LocaleSelector(props) {
|
57
|
+
var _theme$palette, _theme$palette2, _theme$palette2$text;
|
58
|
+
|
59
59
|
const {
|
60
|
-
dark,
|
61
60
|
showText,
|
62
61
|
popperProps,
|
63
62
|
popperType,
|
@@ -72,6 +71,7 @@ function LocaleSelector(props) {
|
|
72
71
|
const anchorEl = (0, _react.useRef)(null);
|
73
72
|
const [open, setOpen] = (0, _react.useState)(false);
|
74
73
|
const theme = (0, _styles.useTheme)();
|
74
|
+
const dark = (theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.mode) === 'dark';
|
75
75
|
|
76
76
|
const onSelect = newLocale => {
|
77
77
|
changeLocale(newLocale);
|
@@ -107,12 +107,14 @@ function LocaleSelector(props) {
|
|
107
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {});
|
108
108
|
}
|
109
109
|
|
110
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Globe.default, {
|
111
|
+
style: {
|
112
|
+
width: 26,
|
113
|
+
height: 24.76,
|
114
|
+
color: theme.palette.text.secondary
|
115
|
+
}
|
114
116
|
});
|
115
|
-
}, [Icon,
|
117
|
+
}, [Icon, theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : (_theme$palette2$text = _theme$palette2.text) === null || _theme$palette2$text === void 0 ? void 0 : _theme$palette2$text.secondary]);
|
116
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread(_objectSpread({
|
117
119
|
component: "div",
|
118
120
|
dark: dark,
|
@@ -162,7 +164,6 @@ function LocaleSelector(props) {
|
|
162
164
|
}
|
163
165
|
|
164
166
|
LocaleSelector.propTypes = {
|
165
|
-
dark: _propTypes.default.bool,
|
166
167
|
size: _propTypes.default.number,
|
167
168
|
showText: _propTypes.default.bool,
|
168
169
|
popperProps: _propTypes.default.object,
|
@@ -171,7 +172,6 @@ LocaleSelector.propTypes = {
|
|
171
172
|
icon: _propTypes.default.any
|
172
173
|
};
|
173
174
|
LocaleSelector.defaultProps = {
|
174
|
-
dark: false,
|
175
175
|
showText: true,
|
176
176
|
size: 24,
|
177
177
|
popperProps: {},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.70",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -48,10 +48,10 @@
|
|
48
48
|
"react": ">=18.1.0",
|
49
49
|
"react-ga": "^2.7.0"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "f8a19c44fc1814f7c191023297b38ef9af21efc6",
|
52
52
|
"dependencies": {
|
53
|
-
"@arcblock/icons": "^2.1.
|
54
|
-
"@arcblock/react-hooks": "^2.1.
|
53
|
+
"@arcblock/icons": "^2.1.70",
|
54
|
+
"@arcblock/react-hooks": "^2.1.70",
|
55
55
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
56
56
|
"@emotion/react": "^11.9.0",
|
57
57
|
"@emotion/styled": "^11.8.1",
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"d3-geo": "^1.11.6",
|
67
67
|
"dayjs": "^1.11.2",
|
68
68
|
"devices.css": "^0.1.15",
|
69
|
-
"highlight.js": "^
|
69
|
+
"highlight.js": "^11.6.0",
|
70
70
|
"is-svg": "^4.3.1",
|
71
71
|
"js-cookie": "^2.2.0",
|
72
72
|
"lodash": "^4.17.21",
|
package/src/CodeBlock/index.js
CHANGED
@@ -6,7 +6,7 @@ import Copy from 'copy-to-clipboard';
|
|
6
6
|
import Button from '@mui/material/IconButton';
|
7
7
|
import useMountedState from 'react-use/lib/useMountedState';
|
8
8
|
|
9
|
-
import hljs from 'highlight.js/lib/
|
9
|
+
import hljs from 'highlight.js/lib/core';
|
10
10
|
import javascript from 'highlight.js/lib/languages/javascript';
|
11
11
|
import typescript from 'highlight.js/lib/languages/typescript';
|
12
12
|
import json from 'highlight.js/lib/languages/json';
|
@@ -12,11 +12,11 @@ import { useDatatableContext } from './DatatableContext';
|
|
12
12
|
export default function TableSearch({ search, options, searchText, searchTextUpdate, searchClose, onSearchOpen }) {
|
13
13
|
const { searchOpen, searchPlaceholder, searchAlwaysOpen } = options;
|
14
14
|
const [inputExpand, setInputExpand] = useState(!!searchText || searchOpen || false);
|
15
|
-
const [innerSearchText, setInnerSearchText] = useState(
|
15
|
+
const [innerSearchText, setInnerSearchText] = useState(searchText);
|
16
16
|
const inputTimer = useRef(null);
|
17
17
|
const { loading } = useDatatableContext();
|
18
18
|
|
19
|
-
const { searchDebounceTime
|
19
|
+
const { searchDebounceTime } = options;
|
20
20
|
|
21
21
|
const searchExpand = searchAlwaysOpen || inputExpand;
|
22
22
|
|
@@ -31,14 +31,8 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
31
31
|
clearTimeout(inputTimer.current);
|
32
32
|
setInnerSearchText(value);
|
33
33
|
inputTimer.current = setTimeout(() => {
|
34
|
-
|
35
|
-
onOutSelfSearch(value);
|
36
|
-
} else {
|
37
|
-
searchTextUpdate(value);
|
38
|
-
}
|
34
|
+
searchTextUpdate(value);
|
39
35
|
}, searchDebounceTime);
|
40
|
-
} else if (onOutSelfSearch) {
|
41
|
-
onOutSelfSearch(value);
|
42
36
|
} else {
|
43
37
|
searchTextUpdate(value);
|
44
38
|
}
|
@@ -49,9 +43,6 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
49
43
|
searchClose();
|
50
44
|
setInnerSearchText('');
|
51
45
|
onSearchOpen(false);
|
52
|
-
if (onOutSelfSearch) {
|
53
|
-
onOutSelfSearch('');
|
54
|
-
}
|
55
46
|
};
|
56
47
|
|
57
48
|
return (
|
@@ -81,7 +72,7 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
81
72
|
variant="standard"
|
82
73
|
spacing={2}
|
83
74
|
onChange={onChange}
|
84
|
-
value={searchDebounceTime ? innerSearchText : searchText
|
75
|
+
value={searchDebounceTime ? innerSearchText : searchText}
|
85
76
|
placeholder={searchPlaceholder || ''}
|
86
77
|
autoFocus={!searchAlwaysOpen}
|
87
78
|
/>
|
@@ -92,7 +83,7 @@ export default function TableSearch({ search, options, searchText, searchTextUpd
|
|
92
83
|
disabled
|
93
84
|
variant="standard"
|
94
85
|
spacing={2}
|
95
|
-
value={searchDebounceTime ? innerSearchText : searchText
|
86
|
+
value={searchDebounceTime ? innerSearchText : searchText}
|
96
87
|
/>
|
97
88
|
)}
|
98
89
|
</div>
|
package/src/Locale/selector.js
CHANGED
@@ -13,20 +13,19 @@ import MenuItem from '@mui/material/MenuItem';
|
|
13
13
|
import MenuList from '@mui/material/MenuList';
|
14
14
|
import Box from '@mui/material/Box';
|
15
15
|
import CheckIcon from '@mui/icons-material/Check';
|
16
|
+
import GlobeIcon from '@arcblock/icons/lib/Globe';
|
16
17
|
|
17
18
|
import { getColor, getBackground } from '../Util';
|
18
19
|
|
19
20
|
import { LocaleContext, languages } from './context';
|
20
21
|
|
21
|
-
import globeDark from './images/globe-dark.png';
|
22
|
-
import globeLight from './images/globe-light.png';
|
23
|
-
|
24
22
|
function LocaleSelector(props) {
|
25
|
-
const {
|
23
|
+
const { showText, popperProps, popperType, icon: Icon, ...rest } = props;
|
26
24
|
const { locale, changeLocale } = useContext(LocaleContext);
|
27
25
|
const anchorEl = useRef(null);
|
28
26
|
const [open, setOpen] = useState(false);
|
29
27
|
const theme = useTheme();
|
28
|
+
const dark = theme?.palette?.mode === 'dark';
|
30
29
|
|
31
30
|
const onSelect = (newLocale) => {
|
32
31
|
changeLocale(newLocale);
|
@@ -64,8 +63,8 @@ function LocaleSelector(props) {
|
|
64
63
|
return <Icon />;
|
65
64
|
}
|
66
65
|
|
67
|
-
return <
|
68
|
-
}, [Icon,
|
66
|
+
return <GlobeIcon style={{ width: 26, height: 24.76, color: theme.palette.text.secondary }} />;
|
67
|
+
}, [Icon, theme?.palette?.text?.secondary]);
|
69
68
|
|
70
69
|
return (
|
71
70
|
<Div component="div" dark={dark} theme={theme} {...rest} {...handleEventProps}>
|
@@ -105,7 +104,6 @@ function LocaleSelector(props) {
|
|
105
104
|
}
|
106
105
|
|
107
106
|
LocaleSelector.propTypes = {
|
108
|
-
dark: PropTypes.bool,
|
109
107
|
size: PropTypes.number,
|
110
108
|
showText: PropTypes.bool,
|
111
109
|
popperProps: PropTypes.object,
|
@@ -115,7 +113,6 @@ LocaleSelector.propTypes = {
|
|
115
113
|
};
|
116
114
|
|
117
115
|
LocaleSelector.defaultProps = {
|
118
|
-
dark: false,
|
119
116
|
showText: true,
|
120
117
|
size: 24,
|
121
118
|
popperProps: {},
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|