acud 1.1.13 → 1.1.15

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 (55) hide show
  1. package/dist/acud.css +123 -34
  2. package/dist/acud.css.map +1 -1
  3. package/dist/acud.js +13029 -7326
  4. package/dist/acud.js.map +1 -1
  5. package/dist/acud.min.css +1 -1
  6. package/dist/acud.min.css.map +1 -1
  7. package/dist/acud.min.js +3 -3
  8. package/dist/acud.min.js.map +1 -1
  9. package/es/form/style/index.css +1 -1
  10. package/es/form/style/index.less +2 -1
  11. package/es/input/Input.d.ts +1 -0
  12. package/es/input/Input.js +8 -2
  13. package/es/input/Label.d.ts +3 -1
  14. package/es/input/Label.js +12 -1
  15. package/es/input/TextArea.d.ts +1 -0
  16. package/es/input/TextArea.js +8 -2
  17. package/es/input/style/index.css +24 -23
  18. package/es/input/style/index.less +2 -1
  19. package/es/toast/base.js +1 -1
  20. package/es/toast/index.js +13 -8
  21. package/es/toast/style/index.css +9 -9
  22. package/es/toast/style/index.less +215 -206
  23. package/es/tree/style/index.css +44 -0
  24. package/es/tree/style/mixin.less +64 -0
  25. package/es/tree/tree.d.ts +5 -2
  26. package/es/tree/tree.js +3 -1
  27. package/es/tree/utils/iconHelper.d.ts +2 -2
  28. package/es/tree/utils/iconHelper.js +20 -5
  29. package/es/tree-select/index.js +1 -1
  30. package/es/tree-select/src/OptionList.js +35 -1
  31. package/es/tree-select/style/index.css +44 -0
  32. package/lib/form/style/index.css +1 -1
  33. package/lib/form/style/index.less +2 -1
  34. package/lib/input/Input.d.ts +1 -0
  35. package/lib/input/Input.js +8 -2
  36. package/lib/input/Label.d.ts +3 -1
  37. package/lib/input/Label.js +12 -1
  38. package/lib/input/TextArea.d.ts +1 -0
  39. package/lib/input/TextArea.js +8 -2
  40. package/lib/input/style/index.css +24 -23
  41. package/lib/input/style/index.less +2 -1
  42. package/lib/toast/base.js +1 -1
  43. package/lib/toast/index.js +12 -7
  44. package/lib/toast/style/index.css +9 -9
  45. package/lib/toast/style/index.less +215 -206
  46. package/lib/tree/style/index.css +44 -0
  47. package/lib/tree/style/mixin.less +64 -0
  48. package/lib/tree/tree.d.ts +5 -2
  49. package/lib/tree/tree.js +3 -1
  50. package/lib/tree/utils/iconHelper.d.ts +2 -2
  51. package/lib/tree/utils/iconHelper.js +20 -5
  52. package/lib/tree-select/index.js +1 -1
  53. package/lib/tree-select/src/OptionList.js +35 -1
  54. package/lib/tree-select/style/index.css +44 -0
  55. package/package.json +24 -24
@@ -7,15 +7,30 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.renderSwitcherIcon = renderSwitcherIcon;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _OutlinedDown = _interopRequireDefault(require("acud-icon/lib/icons/OutlinedDown"));
10
- function renderSwitcherIcon(prefixCls, nodeProps) {
11
- var switcherCls = "".concat(prefixCls, "-switcher-icon");
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _reactNode = require("../../_util/reactNode");
12
+ function renderSwitcherIcon(prefixCls, switcherIcon, showLine, nodeProps) {
12
13
  var isLeaf = nodeProps.isLeaf;
13
14
  if (isLeaf) {
14
- return null;
15
+ if (!showLine) {
16
+ return null;
17
+ }
18
+ return /*#__PURE__*/_react["default"].createElement("span", {
19
+ className: "".concat(prefixCls, "-switcher-leaf-line")
20
+ });
21
+ }
22
+ var switcherCls = "".concat(prefixCls, "-switcher-icon");
23
+ var switcher = typeof switcherIcon === 'function' ? switcherIcon(nodeProps) : switcherIcon;
24
+ if ((0, _reactNode.isValidElement)(switcher)) {
25
+ return (0, _reactNode.cloneElement)(switcher, {
26
+ className: (0, _classnames["default"])(switcher.props.className || '', switcherCls)
27
+ });
28
+ }
29
+ if (switcher) {
30
+ return switcher;
15
31
  }
16
32
  return /*#__PURE__*/_react["default"].createElement(_OutlinedDown["default"], {
17
- className: switcherCls,
18
- width: '16px'
33
+ className: switcherCls
19
34
  });
20
35
  }
21
36
  ;
@@ -155,7 +155,7 @@ var InternalTreeSelect = function InternalTreeSelect(_a, ref) {
155
155
  removeIcon: removeIcon,
156
156
  clearIcon: clearIcon,
157
157
  switcherIcon: function switcherIcon(nodeProps) {
158
- return (0, _iconHelper.renderSwitcherIcon)(treePrefixCls, nodeProps);
158
+ return (0, _iconHelper.renderSwitcherIcon)(treePrefixCls, null, false, nodeProps);
159
159
  },
160
160
  showTreeIcon: treeIcon,
161
161
  notFoundContent: mergedNotFound,
@@ -252,6 +252,40 @@ var OptionList = function OptionList(_, ref) {
252
252
  triggerChange([].concat((0, _toConsumableArray2["default"])(allDisabledCheckedKeys), (0, _toConsumableArray2["default"])(allAbleKeys)));
253
253
  }
254
254
  }, [selectAllStatus, allAbleKeys, allDisabledCheckedKeys]);
255
+ var formatContent = React.useCallback(function (content, searchValue, prefixCls) {
256
+ if (typeof content !== 'string' && typeof content !== 'number') {
257
+ return /*#__PURE__*/React.createElement(React.Fragment, null, content);
258
+ }
259
+ var contentStr = content.toString();
260
+ var lowerContent = contentStr.toLowerCase();
261
+ var lowerSearch = searchValue.toLowerCase().trim();
262
+ var searchStartIndex = lowerContent.indexOf(lowerSearch);
263
+ var len = lowerSearch.length;
264
+ // 存在搜索值不在content的情况,比如key与children不一致时
265
+ if (searchStartIndex === -1) {
266
+ return /*#__PURE__*/React.createElement(React.Fragment, null, content);
267
+ }
268
+ return /*#__PURE__*/React.createElement(React.Fragment, null, contentStr.slice(0, searchStartIndex), /*#__PURE__*/React.createElement("span", {
269
+ className: "".concat(prefixCls, "-search-highlight")
270
+ }, contentStr.slice(searchStartIndex, searchStartIndex + len)), contentStr.slice(searchStartIndex + len));
271
+ }, []);
272
+ var formatTreeData = React.useMemo(function () {
273
+ if ((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toString().trim()) === '') {
274
+ return memoTreeData;
275
+ }
276
+ var loopTree = function loopTree(arr) {
277
+ return arr.map(function (item) {
278
+ var newItem = (0, _extends2["default"])((0, _extends2["default"])({}, item), {
279
+ title: formatContent(item.title, searchValue, prefixCls)
280
+ });
281
+ if (newItem.children && newItem.children.length) {
282
+ newItem.children = loopTree(newItem.children);
283
+ }
284
+ return newItem;
285
+ });
286
+ };
287
+ return loopTree(memoTreeData);
288
+ }, [memoTreeData, searchValue, prefixCls, formatContent]);
255
289
  // ========================== Render ==========================
256
290
  if (memoTreeData.length === 0) {
257
291
  return /*#__PURE__*/React.createElement("div", {
@@ -275,7 +309,7 @@ var OptionList = function OptionList(_, ref) {
275
309
  ref: treeRef,
276
310
  focusable: false,
277
311
  prefixCls: "".concat(prefixCls, "-tree"),
278
- treeData: memoTreeData,
312
+ treeData: formatTreeData,
279
313
  height: listHeight,
280
314
  itemHeight: listItemHeight,
281
315
  virtual: virtual !== false && dropdownMatchSelectWidth !== false,
@@ -404,6 +404,7 @@
404
404
  }
405
405
  .acud-select-tree-switcher .acud-tree-switcher-icon svg,
406
406
  .acud-select-tree-switcher .acud-select-tree-switcher-icon svg {
407
+ width: 16px!important;
407
408
  transition: transform 0.3s;
408
409
  }
409
410
  .acud-select-tree-switcher-noop {
@@ -412,6 +413,29 @@
412
413
  .acud-select-tree-switcher_close .acud-select-tree-switcher-icon svg {
413
414
  transform: rotate(-90deg);
414
415
  }
416
+ .acud-select-tree-switcher-leaf-line {
417
+ position: relative;
418
+ z-index: 1;
419
+ display: inline-block;
420
+ width: 100%;
421
+ height: 100%;
422
+ }
423
+ .acud-select-tree-switcher-leaf-line::before {
424
+ position: absolute;
425
+ top: 0;
426
+ right: 8px;
427
+ bottom: -4px;
428
+ margin-left: -1px;
429
+ border-right: 1px solid #B8BABF;
430
+ content: ' ';
431
+ }
432
+ .acud-select-tree-switcher-leaf-line::after {
433
+ position: absolute;
434
+ width: 10px;
435
+ height: 14px;
436
+ border-bottom: 1px solid #B8BABF;
437
+ content: ' ';
438
+ }
415
439
  .acud-select-tree .acud-select-tree-node-content-wrapper {
416
440
  position: relative;
417
441
  z-index: auto;
@@ -503,6 +527,26 @@
503
527
  .acud-select-tree-treenode:hover .acud-select-tree-draggable-icon {
504
528
  opacity: 0.45;
505
529
  }
530
+ .acud-select-tree-show-line .acud-select-tree-indent-unit {
531
+ position: relative;
532
+ height: 100%;
533
+ }
534
+ .acud-select-tree-show-line .acud-select-tree-indent-unit::before {
535
+ position: absolute;
536
+ top: 0;
537
+ right: 16px;
538
+ bottom: -4px;
539
+ border-right: 1px solid #B8BABF;
540
+ content: '';
541
+ }
542
+ .acud-select-tree-show-line .acud-select-tree-indent-unit-end::before {
543
+ display: none;
544
+ }
545
+ .acud-select-tree .acud-select-tree-treenode-leaf-last .acud-select-tree-switcher-leaf-line::before {
546
+ top: auto !important;
547
+ bottom: auto !important;
548
+ height: 14px !important;
549
+ }
506
550
  .acud-select-tree-checkbox {
507
551
  margin: 2px 0 0 8px;
508
552
  top: 0.1em;
package/package.json CHANGED
@@ -1,29 +1,45 @@
1
1
  {
2
2
  "name": "acud",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "acg react 组件库",
5
+ "license": "ISC",
6
+ "author": "acg",
7
+ "sideEffects": [
8
+ "dist/*",
9
+ "es/**/style/*",
10
+ "lib/**/style/*",
11
+ "*.less"
12
+ ],
5
13
  "main": "lib/index.js",
6
- "module": "es/index.js",
7
14
  "unpkg": "dist/aucd.min.js",
15
+ "module": "es/index.js",
8
16
  "typings": "lib/index.d.ts",
17
+ "files": [
18
+ "dist",
19
+ "lib",
20
+ "es"
21
+ ],
9
22
  "scripts": {
10
23
  "build": "npm run compile && NODE_OPTIONS='--max-old-space-size=4096' npm run dist",
11
24
  "compile": "node ./tools/bin/acud-tools-run compile",
12
25
  "compile:less": "node ./tools/bin/acud-tools-run compile:less",
13
26
  "dist": "node ./tools/bin/acud-tools-run dist",
14
27
  "dist:esbuild": "ESBUILD=true npm run dist",
15
- "start": "node ./tools/bin/acud-tools-run clean && cross-env NODE_ENV=development bisheng start -c ./site/bisheng.config.js",
16
- "site": "bisheng build --ssr -c ./site/bisheng.config.js",
17
- "test": "jest --cache=false --env=jsdom",
18
28
  "lint": "npm run lint:script && npm run lint:style",
19
29
  "lint-fix": "npm run lint-fix:script && npm run lint-fix:style",
20
- "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
21
- "lint:style": "stylelint 'components/**/*.less' --syntax less",
22
30
  "lint-fix:script": "npm run lint:script -- --fix",
23
31
  "lint-fix:style": "npm run lint:style -- --fix",
32
+ "lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
33
+ "lint:style": "stylelint 'components/**/*.less' --syntax less",
24
34
  "prepare": "curl -s http://icode.baidu.com/tools/hooks/commit-msg > .husky/commit-msg && echo '\nsh \".husky/commit-msg.sh\"' >> .husky/commit-msg && chmod u+x .husky/commit-msg && husky install",
25
35
  "prepublishOnly": "npm run build",
26
- "pub": "node ./scripts/publish.js --registry=https://registry.npmjs.org"
36
+ "pub": "node ./scripts/publish.js --registry=https://registry.npmjs.org",
37
+ "site": "bisheng build --ssr -c ./site/bisheng.config.js",
38
+ "start": "node ./tools/bin/acud-tools-run clean && cross-env NODE_ENV=development bisheng start -c ./site/bisheng.config.js",
39
+ "test": "jest --cache=false --env=jsdom"
40
+ },
41
+ "lint-staged": {
42
+ "components/**/*.{ts,tsx,js,jsx}": "npm run lint"
27
43
  },
28
44
  "dependencies": {
29
45
  "acud-icon": "^1.0.7",
@@ -189,21 +205,5 @@
189
205
  "peerDependencies": {
190
206
  "react": ">=16.9.0",
191
207
  "react-dom": ">=16.9.0"
192
- },
193
- "sideEffects": [
194
- "dist/*",
195
- "es/**/style/*",
196
- "lib/**/style/*",
197
- "*.less"
198
- ],
199
- "author": "acg",
200
- "files": [
201
- "dist",
202
- "lib",
203
- "es"
204
- ],
205
- "license": "ISC",
206
- "lint-staged": {
207
- "components/**/*.{ts,tsx,js,jsx}": "npm run lint"
208
208
  }
209
209
  }