tntd 3.0.70 → 3.0.73

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 (64) hide show
  1. package/es/array-input/index.js +3 -0
  2. package/es/array-input/index.js.map +1 -1
  3. package/es/button/button.js +2 -2
  4. package/es/button/button.js.map +1 -1
  5. package/es/button/button.less +175 -0
  6. package/es/button/style/index.less +7 -0
  7. package/es/button/style/mixin.less +119 -66
  8. package/es/checkbox/checkbox-group.js +12 -0
  9. package/es/checkbox/checkbox-group.js.map +1 -0
  10. package/es/prev-locale.js +4 -0
  11. package/es/prev-locale.js.map +1 -1
  12. package/es/radio/radio-group.js +12 -0
  13. package/es/radio/radio-group.js.map +1 -0
  14. package/es/steps/stepStyle/small.less +5 -0
  15. package/es/style/themes/default.less +2 -4
  16. package/es/table/style/size.less +4 -2
  17. package/es/table/total-shower.js +16 -0
  18. package/es/table/total-shower.js.map +1 -0
  19. package/es/tntd-action/index.js +61 -7
  20. package/es/tntd-action/index.js.map +1 -1
  21. package/es/tntd-action/index.less +35 -0
  22. package/es/utils/simple-template.js +19 -0
  23. package/es/utils/simple-template.js.map +1 -0
  24. package/lib/array-input/index.d.ts.map +1 -1
  25. package/lib/array-input/index.js +3 -0
  26. package/lib/array-input/index.js.map +1 -1
  27. package/lib/button/button.d.ts +2 -2
  28. package/lib/button/button.d.ts.map +1 -1
  29. package/lib/button/button.js +2 -2
  30. package/lib/button/button.js.map +1 -1
  31. package/lib/button/button.less +175 -0
  32. package/lib/button/style/index.less +7 -0
  33. package/lib/button/style/mixin.less +119 -66
  34. package/lib/checkbox/checkbox-group.d.ts +8 -0
  35. package/lib/checkbox/checkbox-group.d.ts.map +1 -0
  36. package/lib/checkbox/checkbox-group.js +16 -0
  37. package/lib/checkbox/checkbox-group.js.map +1 -0
  38. package/lib/prev-locale.d.ts +3 -0
  39. package/lib/prev-locale.d.ts.map +1 -1
  40. package/lib/prev-locale.js +4 -0
  41. package/lib/prev-locale.js.map +1 -1
  42. package/lib/radio/radio-group.d.ts +8 -0
  43. package/lib/radio/radio-group.d.ts.map +1 -0
  44. package/lib/radio/radio-group.js +16 -0
  45. package/lib/radio/radio-group.js.map +1 -0
  46. package/lib/steps/stepStyle/small.less +5 -0
  47. package/lib/style/themes/default.less +2 -4
  48. package/lib/table/style/size.less +4 -2
  49. package/lib/table/total-shower.d.ts +9 -0
  50. package/lib/table/total-shower.d.ts.map +1 -0
  51. package/lib/table/total-shower.js +20 -0
  52. package/lib/table/total-shower.js.map +1 -0
  53. package/lib/tntd-action/index.d.ts +1 -2
  54. package/lib/tntd-action/index.d.ts.map +1 -1
  55. package/lib/tntd-action/index.js +61 -7
  56. package/lib/tntd-action/index.js.map +1 -1
  57. package/lib/tntd-action/index.less +35 -0
  58. package/lib/utils/simple-template.d.ts +9 -0
  59. package/lib/utils/simple-template.d.ts.map +1 -0
  60. package/lib/utils/simple-template.js +19 -0
  61. package/lib/utils/simple-template.js.map +1 -0
  62. package/package.json +115 -114
  63. package/themes/default/variables.less +8 -0
  64. package/themes/default/variablesVar.less +9 -0
@@ -6,8 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = _default;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _Action = _interopRequireDefault(require("./Action"));
10
9
  var _tooltip = _interopRequireDefault(require("../tooltip"));
10
+ var _popconfirm = _interopRequireDefault(require("../popconfirm"));
11
+ var _dropdown = _interopRequireDefault(require("../dropdown"));
12
+ var _button = _interopRequireDefault(require("../button"));
13
+ var _icon = _interopRequireDefault(require("../icon"));
14
+ var _menu = _interopRequireDefault(require("../menu"));
15
+ var _prevLocale = require("../prev-locale");
11
16
  require("./index.less");
12
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
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); }
@@ -26,16 +31,29 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
26
31
  }
27
32
  return t;
28
33
  };
34
+
35
+ // import Action from './Action'
36
+
29
37
  var _checkShowChild = function checkShowChild(child) {
30
38
  var _ref = child.props || {},
31
39
  disabled = _ref.disabled,
32
40
  children = _ref.children,
33
41
  check = _ref.check,
34
42
  text = _ref.text;
35
- if (check && !disabled) {
43
+ // if (check && !disabled) {
44
+ if (check) {
36
45
  return _react["default"].cloneElement(child, text ? {
37
- children: _react["default"].createElement(_react["default"].Fragment, null, children, text)
38
- } : {});
46
+ // children: (
47
+ // <>
48
+ // {children}
49
+ // <span>{text}</span>
50
+ // </>
51
+ // ),
52
+ children: text,
53
+ type: 'link'
54
+ } : {
55
+ type: 'link'
56
+ });
39
57
  } else if (children) {
40
58
  var newChild = _react["default"].Children.map(children, function (child) {
41
59
  return _checkShowChild(child);
@@ -48,12 +66,30 @@ var _checkShowChild = function checkShowChild(child) {
48
66
  };
49
67
  if (child.type === _tooltip["default"]) {
50
68
  newProps.visible = false;
69
+ } else if (child.type === _popconfirm["default"]) {
70
+ newProps.hiddenArrow = true;
51
71
  }
52
72
  return _react["default"].cloneElement(child, newProps);
53
73
  }
54
74
  }
55
75
  return false;
56
76
  };
77
+ var _checkIsDisabled = function checkIsDisabled(child) {
78
+ var _ref2 = child.props || {},
79
+ disabled = _ref2.disabled,
80
+ children = _ref2.children,
81
+ check = _ref2.check;
82
+ if (check) {
83
+ return disabled;
84
+ } else if (children) {
85
+ return _react["default"].Children.map(children, function (child) {
86
+ return _checkIsDisabled(child);
87
+ }).filter(function (i) {
88
+ return !!i;
89
+ }).length > 0;
90
+ }
91
+ return false;
92
+ };
57
93
  function _default(_a) {
58
94
  var children = _a.children,
59
95
  other = __rest(_a, ["children"]);
@@ -80,7 +116,25 @@ function _default(_a) {
80
116
  _useMemo2 = _slicedToArray(_useMemo, 2),
81
117
  thisChild = _useMemo2[0],
82
118
  popChild = _useMemo2[1];
83
- return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_Action["default"], Object.assign({
84
- data: popChild
85
- }, other)));
119
+ var createMenu = function createMenu(list) {
120
+ return _react["default"].createElement(_menu["default"], null, list.map(function (it, i) {
121
+ return _react["default"].createElement(_menu["default"].Item, {
122
+ key: i,
123
+ disabled: _checkIsDisabled(it)
124
+ }, it);
125
+ }));
126
+ };
127
+ if (popChild.length <= 1) {
128
+ // 如果只有一个,直接返回
129
+ return children;
130
+ }
131
+ var batchOperation = (0, _prevLocale.getText)('batchOperation', (0, _prevLocale.getLanguage)());
132
+ return _react["default"].createElement(_react["default"].Fragment, null, thisChild, _react["default"].createElement(_dropdown["default"], {
133
+ overlay: createMenu(popChild),
134
+ overlayClassName: "tnt-action-dropdown"
135
+ }, _react["default"].createElement(_button["default"], {
136
+ className: "tnt-action-dropdown-btn"
137
+ }, batchOperation, " ", _react["default"].createElement(_icon["default"], {
138
+ type: "down"
139
+ }))));
86
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,cAAc,CAAA;AAErB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAA;IAC7D,IAAI,KAAK,IAAI,CAAC,QAAQ,EAAE;QACtB,OAAO,KAAK,CAAC,YAAY,CACvB,KAAK,EACL,IAAI;YACF,CAAC,CAAC;gBACE,QAAQ,EAAE,CACR;oBACG,QAAQ;oBACR,IAAI,CACJ,CACJ;aACF;YACH,CAAC,CAAC,EAAE,CACP,CAAA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AAC,CAAA;oBACvC,IAAI,SAAS,EAAE;wBACb,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;qBACzB;iBACF;aACF;QACH,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL;QACG,SAAS;QAEV,oBAAC,MAAM,kBAAC,IAAI,EAAE,QAAQ,IAAM,KAAK,EAAI,CACpC,CACJ,CAAA;AACH,CAAC","sourcesContent":["import React, { useMemo } from 'react'\nimport Action from './Action'\nimport Tooltip from '../tooltip';\nimport './index.less'\n\nconst checkShowChild = (child) => {\n const { disabled, children, check, text } = child.props || {}\n if (check && !disabled) {\n return React.cloneElement(\n child,\n text\n ? {\n children: (\n <>\n {children}\n {text}\n </>\n ),\n }\n : {}\n )\n } else if (children) {\n const newChild = React.Children.map(children, (child) => {\n return checkShowChild(child)\n }).filter((i) => !!i)\n if (newChild.length > 0) {\n const newProps = { children: newChild };\n if (child.type === Tooltip) {\n newProps.visible = false\n }\n return React.cloneElement(child, newProps)\n }\n }\n return false\n}\n\nexport default function ({ children, ...other }) {\n const [thisChild, popChild] = useMemo(() => {\n const thisChild = []\n const popChild = []\n React.Children.forEach(children, (child) => {\n if (child && child.props) {\n const { exclude } = child.props\n if (exclude) {\n thisChild.push(React.cloneElement(child, { exclude: undefined }))\n } else {\n const showChild = checkShowChild(child)\n if (showChild) {\n popChild.push(showChild)\n }\n }\n }\n })\n return [thisChild, popChild]\n }, [children])\n\n return (\n <>\n {thisChild}\n\n <Action data={popChild} {...other} />\n </>\n )\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-action/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,gCAAgC;AAChC,OAAO,OAAO,MAAM,YAAY,CAAA;AA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C,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;iBAClE;qBAAM;oBACL,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;oBACvC,IAAI,SAAS,EAAE;wBACb,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;qBACzB;iBACF;aACF;QACH,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,EAAE;QAC1B,OAAO,CACL,oBAAC,IAAI,QACF,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;YAClB,OAAO,CACL,oBAAC,IAAI,CAAC,IAAI,IAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC,IAC7C,EAAE,CACO,CACb,CAAA;QACH,CAAC,CAAC,CACG,CACR,CAAA;IACH,CAAC,CAAA;IAED,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;QACxB,cAAc;QACd,OAAO,QAAQ,CAAA;KAChB;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE,WAAW,EAAE,CAAC,CAAA;IAE/D,OAAO,CACL;QACG,SAAS;QAGV,oBAAC,QAAQ,IAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,gBAAgB,EAAC,qBAAqB;YAC7E,oBAAC,MAAM,IAAC,SAAS,EAAC,yBAAyB;gBACxC,cAAc;;gBAAE,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CAC9B,CACA,CACV,CACJ,CAAA;AACH,CAAC","sourcesContent":["import React, { useMemo } from 'react'\n// import Action from './Action'\nimport Tooltip from '../tooltip'\nimport Popconfirm from '../popconfirm'\nimport Dropdown from '../dropdown'\nimport Button from '../button'\nimport Icon from '../icon'\nimport Menu from '../menu'\nimport { getLanguage, getText } from '../prev-locale'\nimport './index.less'\n\nconst checkShowChild = (child) => {\n const { disabled, children, check, text } = child.props || {}\n // if (check && !disabled) {\n if (check) {\n return React.cloneElement(\n child,\n text\n ? {\n // children: (\n // <>\n // {children}\n // <span>{text}</span>\n // </>\n // ),\n children: text,\n type: 'link',\n }\n : { type: 'link' }\n )\n } else if (children) {\n const newChild = React.Children.map(children, (child) => {\n return checkShowChild(child)\n }).filter((i) => !!i)\n if (newChild.length > 0) {\n const newProps = { children: newChild }\n if (child.type === Tooltip) {\n newProps.visible = false\n } else if (child.type === Popconfirm) {\n newProps.hiddenArrow = true\n }\n return React.cloneElement(child, newProps)\n }\n }\n return false\n}\n\nconst checkIsDisabled = (child) => {\n const { disabled, children, check } = child.props || {}\n if (check) {\n return disabled\n } else if (children) {\n return (\n React.Children.map(children, (child) => {\n return checkIsDisabled(child)\n }).filter((i) => !!i).length > 0\n )\n }\n return false\n}\n\nexport default function ({ children, ...other }) {\n const [thisChild, popChild] = useMemo(() => {\n const thisChild = []\n const popChild = []\n React.Children.forEach(children, (child) => {\n if (child && child.props) {\n const { exclude } = child.props\n if (exclude) {\n thisChild.push(React.cloneElement(child, { exclude: undefined }))\n } else {\n const showChild = checkShowChild(child)\n if (showChild) {\n popChild.push(showChild)\n }\n }\n }\n })\n return [thisChild, popChild]\n }, [children])\n\n const createMenu = (list) => {\n return (\n <Menu>\n {list.map((it, i) => {\n return (\n <Menu.Item key={i} disabled={checkIsDisabled(it)}>\n {it}\n </Menu.Item>\n )\n })}\n </Menu>\n )\n }\n\n if (popChild.length <= 1) {\n // 如果只有一个,直接返回\n return children\n }\n\n const batchOperation = getText('batchOperation', getLanguage())\n\n return (\n <>\n {thisChild}\n\n {/* <Action data={popChild} {...other} /> */}\n <Dropdown overlay={createMenu(popChild)} overlayClassName=\"tnt-action-dropdown\">\n <Button className=\"tnt-action-dropdown-btn\">\n {batchOperation} <Icon type=\"down\" />\n </Button>\n </Dropdown>\n </>\n )\n}\n"]}
@@ -58,4 +58,39 @@
58
58
  }
59
59
  }
60
60
  }
61
+ &-dropdown {
62
+ &-btn {
63
+ margin-left: 8px !important;
64
+ border-radius: @border-radius-base !important;
65
+ }
66
+ .ant-dropdown-menu-item {
67
+ .ant-btn {
68
+ display: inline;
69
+ padding: 0;
70
+ height: auto;
71
+ border: none;
72
+ background-color: transparent;
73
+ color: inherit;
74
+ &:hover,
75
+ &:active {
76
+ color: inherit;
77
+ }
78
+ &[disabled] {
79
+ color: @disabled-color;
80
+ &:hover,
81
+ &:active {
82
+ color: @disabled-color;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+
90
+ // 全局设置
91
+ .ant-btn-group:has(.tnt-action-dropdown-btn) {
92
+ & > .ant-btn:nth-last-child(2) {
93
+ border-top-right-radius: @border-radius-base;
94
+ border-bottom-right-radius: @border-radius-base;
95
+ }
61
96
  }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.simpleTemplate = simpleTemplate;
7
+ /**
8
+ * 简单的模板替换
9
+ *
10
+ * @param template
11
+ * @param data
12
+ * @returns
13
+ */
14
+ function simpleTemplate(template) {
15
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
+ return template === null || template === void 0 ? void 0 : template.replace(/\${(.*?)}/g, function (match, key) {
17
+ return data[key.trim()].toString();
18
+ });
19
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-template.js","sourceRoot":"","sources":["../../src/utils/simple-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAiB,EAAE,OAAwC,EAAE;IAC1F,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;AACrF,CAAC","sourcesContent":["/**\n * 简单的模板替换\n *\n * @param template\n * @param data\n * @returns\n */\nexport function simpleTemplate(template?: string, data: Record<string, string | number> = {}) {\n return template?.replace(/\\${(.*?)}/g, (match, key) => data[key.trim()].toString())\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array-input/index.js"],"names":[],"mappings":"AA8VA,sEAQC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array-input/index.js"],"names":[],"mappings":"AAgWA,sEAQC"}
@@ -223,6 +223,8 @@ function ArrayInput(_ref) {
223
223
  _ref$defaultAddData = _ref.defaultAddData,
224
224
  defaultAddData = _ref$defaultAddData === void 0 ? {} : _ref$defaultAddData,
225
225
  renderAction = _ref.renderAction,
226
+ _ref$actionFixed = _ref.actionFixed,
227
+ actionFixed = _ref$actionFixed === void 0 ? false : _ref$actionFixed,
226
228
  _ref$actionWidth = _ref.actionWidth,
227
229
  actionWidth = _ref$actionWidth === void 0 ? 80 : _ref$actionWidth,
228
230
  _ref$disabled = _ref.disabled,
@@ -454,6 +456,7 @@ function ArrayInput(_ref) {
454
456
  title: locale.action,
455
457
  width: actionWidth,
456
458
  className: "tntd-array-input-action",
459
+ fixed: actionFixed,
457
460
  render: function render(text, row, index) {
458
461
  if (renderAction) {
459
462
  return renderAction(row, index, onDelete, onAdd);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/array-input/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA0C;AAC1C,kDAA2D;AAC3D,gDAK0B;AAC1B,kDAAwC;AACxC,4FAAmE;AACnE,mCAA6E;AAC7E,+CAAoG;AACpG,uDAA8B;AAC9B,iDAAwB;AACxB,mDAA0B;AAC1B,iDAAwB;AACxB,qDAA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;IAC1C,OAAO,CACL,8BAAC,wBAAc,IAAC,aAAa,EAAC,YAAY,IACvC,CAAC,MAAM,EAAE,EAAE;QACV,OAAO,8BAAC,UAAU,oBAAK,KAAK,IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;IAClD,CAAC,CACc,CAClB,CAAA;AACH,CAAC;AARD,iCAQC","sourcesContent":["import { DndContext } from '@dnd-kit/core'\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers'\nimport {\n SortableContext,\n arrayMove,\n useSortable,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable'\nimport { CSS } from '@dnd-kit/utilities'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport { get, isArray, isFunction, set, sum, sumBy, cloneDeep } from 'lodash'\nimport React, { isValidElement, useCallback, useContext, useEffect, useMemo, useState } from 'react'\nimport Button from '../button'\nimport Col from '../col'\nimport Icon from '../icon'\nimport Row from '../row'\nimport Table from '../table'\nimport Tooltip from '../tooltip'\nimport './index.less'\n\nconst { Column } = Table\nconst RowContext = React.createContext({})\nlet key = 1\n\nfunction DragHandle() {\n const { setActivatorNodeRef, listeners } = useContext(RowContext)\n return (\n <Button\n className=\"drag-btn\"\n type=\"tertiary\"\n size=\"small\"\n icon=\"drag\"\n ref={setActivatorNodeRef}\n {...listeners}\n />\n )\n}\nfunction BodyRow(props) {\n const {\n attributes,\n listeners,\n setNodeRef,\n setActivatorNodeRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id: props['data-row-key'],\n })\n const style = {\n ...props.style,\n transform: CSS.Translate.toString(transform),\n transition,\n ...(isDragging\n ? {\n position: 'relative',\n zIndex: 9999,\n }\n : {}),\n }\n const contextValue = useMemo(\n () => ({\n setActivatorNodeRef,\n listeners,\n }),\n [setActivatorNodeRef, listeners]\n )\n return (\n <RowContext.Provider value={contextValue}>\n <tr {...props} ref={setNodeRef} style={style} {...attributes} />\n </RowContext.Provider>\n )\n}\n\nfunction ArrayInput({\n children,\n defaultValue,\n value,\n onChange,\n mode = 'list',\n drag = false, // 只做了table的拖拽排序\n gutter = 10,\n require = false,\n errorMap,\n deleteTip = '',\n plusTip = '',\n addText,\n locale,\n xProps = {},\n defaultAddData = {},\n renderAction,\n actionWidth = 80,\n disabled = false,\n}) {\n if (!isFunction(children)) {\n throw new Error(locale.error)\n }\n if (addText === undefined) {\n addText = locale?.add\n }\n\n const [_value, setValue] = useState(value || defaultValue)\n\n useEffect(() => {\n let newValue = value\n // 如果数组没有key\n if (Array.isArray(value) && value.some((obj) => !obj.key)) {\n newValue = value.map((obj) => ({ ...obj, key: obj.key || key++ }))\n _onChange(newValue)\n } else {\n setValue(newValue)\n }\n }, [value])\n\n const _onChange = useCallback((value) => {\n if (onChange) {\n onChange(value)\n } else {\n setValue(value)\n }\n }, [])\n\n let inValue = _value || []\n if (require && inValue.length === 0) {\n inValue = [{ key: key++ }]\n }\n\n const changeValue = (index, name, value) => {\n inValue[index] = {\n ...inValue[index],\n [name]: value,\n }\n _onChange([...inValue])\n }\n\n const onAdd = (index) => {\n const newData = { ...cloneDeep(defaultAddData), key: key++ }\n if (index === undefined) {\n _onChange([...inValue, newData])\n } else {\n inValue.splice(index + 1, 0, newData)\n _onChange([...inValue])\n }\n }\n\n const onDelete = (i) => {\n inValue.splice(i, 1)\n _onChange([...inValue])\n }\n\n const onDragEnd = ({ active, over }) => {\n if (active.id !== over?.id) {\n _onChange((prevState) => {\n const activeIndex = prevState.findIndex((record) => record.key === active?.id)\n const overIndex = prevState.findIndex((record) => record.key === over?.id)\n return arrayMove(prevState, activeIndex, overIndex)\n })\n }\n }\n\n if (mode === 'list') {\n return (\n <div className=\"tntd-array-input\">\n {inValue.map((item, index) => {\n let fields = children(item, index)\n if (!isArray(fields)) {\n fields = get(fields, 'props.children', [])\n }\n const actionSpan = 24 - (sum(fields.map((f) => get(f, 'props.span', 4))) % 24)\n return (\n <Row gutter={gutter} key={index} className=\"tntd-array-input-item\">\n {fields.map((field, i) => {\n if (!isValidElement(field)) {\n return field ? (\n <Col span={4} key={i}>\n {field}\n </Col>\n ) : (\n ''\n )\n }\n const { name, span = 4, onChange: fieldChange, ...other } = field?.props\n const isError = errorMap ? errorMap[`${index}-${name}`] : ''\n return (\n <Col span={span} key={i}>\n <div className={!isError ? 'tntd-array-input-hide-error' : ''}>\n {React.cloneElement(field, {\n value: item[name] || undefined,\n onChange: (e) => {\n fieldChange && fieldChange(e, index, changeValue)\n const newValue = e.target ? e.target.value : e\n changeValue(index, name, newValue)\n },\n disabled,\n ...other,\n })}\n </div>\n {isError && <div className=\"ant-form-item-explain-error\">{isError}</div>}\n </Col>\n )\n })}\n {!disabled && (\n <Col span={actionSpan}>\n <span className=\"tntd-array-input-action\">\n {renderAction ? (\n renderAction(item, index, onDelete, onAdd)\n ) : (\n <>\n {deleteTip ? (\n <Tooltip title={deleteTip}>\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n </Tooltip>\n ) : (\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n )}\n </>\n )}\n </span>\n </Col>\n )}\n </Row>\n )\n })}\n {!disabled && (\n <Button type=\"link\" onClick={() => onAdd()}>\n <Icon type=\"plus\" />\n {addText}\n </Button>\n )}\n </div>\n )\n } else {\n let fields = children({}, 0)\n if (!isArray(fields)) {\n fields = get(fields, 'props.children', [])\n }\n const dataSource = inValue.map((value, index) => {\n const fields = children(value, index)\n const back = { key: value.key }\n fields.forEach((field) => {\n const name = field?.props?.name\n name && set(back, name, field)\n })\n return back\n })\n\n return (\n <div className=\"tntd-array-input\">\n <DndContext modifiers={[restrictToVerticalAxis]} onDragEnd={onDragEnd}>\n <SortableContext\n items={dataSource.map((i) => i.key)}\n strategy={verticalListSortingStrategy}\n >\n <Table\n dataSource={dataSource}\n pagination={false}\n components={{\n body: {\n row: BodyRow,\n },\n }}\n bordered\n {...xProps}\n >\n {drag && (\n <Column\n key=\"dragger\"\n dataIndex=\"dragger\"\n width={60}\n render={() => <DragHandle />}\n ></Column>\n )}\n {fields.map((field) => {\n const { name, width = 160, title } = field?.props || {}\n return (\n <Column\n key={name}\n dataIndex={name}\n title={title}\n width={width}\n render={(field, row, index) => {\n if (!isValidElement(field)) {\n return field\n }\n const { name, onChange: fieldChange } = field.props\n const isError = errorMap ? errorMap[`${index}-${name}`] : ''\n return (\n <div className={!isError ? 'tntd-array-input-hide-error' : ''}>\n {React.cloneElement(field, {\n value: inValue[index][name] || undefined,\n onChange: (e) => {\n fieldChange && fieldChange(e, index, changeValue)\n const newValue = e.target ? e.target.value : e\n changeValue(index, name, newValue), disabled\n },\n })}\n {isError && <div className=\"ant-form-item-explain-error\">{isError}</div>}\n </div>\n )\n }}\n ></Column>\n )\n })}\n {!disabled && (\n <Column\n key=\"action\"\n dataIndex=\"action\"\n title={locale.action}\n width={actionWidth}\n className=\"tntd-array-input-action\"\n render={(text, row, index) => {\n if (renderAction) {\n return renderAction(row, index, onDelete, onAdd)\n }\n return (\n <>\n {deleteTip ? (\n <Tooltip title={deleteTip}>\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n </Tooltip>\n ) : (\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n )}\n </>\n )\n }}\n ></Column>\n )}\n </Table>\n </SortableContext>\n </DndContext>\n {!disabled && (\n <Button type=\"dashed\" block className=\"mt10\" onClick={() => onAdd()}>\n <Icon type=\"plus\" />\n {addText}\n </Button>\n )}\n </div>\n )\n }\n}\n\nexport default function WarpArrayInput(props) {\n return (\n <LocaleReceiver componentName=\"ArrayInput\">\n {(locale) => {\n return <ArrayInput {...props} locale={locale} />\n }}\n </LocaleReceiver>\n )\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/array-input/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA0C;AAC1C,kDAA2D;AAC3D,gDAK0B;AAC1B,kDAAwC;AACxC,4FAAmE;AACnE,m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K,EAAE;gBACjE,8BAAC,cAAI,IAAC,IAAI,EAAC,MAAM,GAAG;gBACnB,OAAO,CACD,CACV,CACG,CACP,CAAA;KACF;AACH,CAAC;AAED,SAAwB,cAAc,CAAC,KAAK;IAC1C,OAAO,CACL,8BAAC,wBAAc,IAAC,aAAa,EAAC,YAAY,IACvC,CAAC,MAAM,EAAE,EAAE;QACV,OAAO,8BAAC,UAAU,oBAAK,KAAK,IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;IAClD,CAAC,CACc,CAClB,CAAA;AACH,CAAC;AARD,iCAQC","sourcesContent":["import { DndContext } from '@dnd-kit/core'\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers'\nimport {\n SortableContext,\n arrayMove,\n useSortable,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable'\nimport { CSS } from '@dnd-kit/utilities'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport { get, isArray, isFunction, set, sum, sumBy, cloneDeep } from 'lodash'\nimport React, { isValidElement, useCallback, useContext, useEffect, useMemo, useState } from 'react'\nimport Button from '../button'\nimport Col from '../col'\nimport Icon from '../icon'\nimport Row from '../row'\nimport Table from '../table'\nimport Tooltip from '../tooltip'\nimport './index.less'\n\nconst { Column } = Table\nconst RowContext = React.createContext({})\nlet key = 1\n\nfunction DragHandle() {\n const { setActivatorNodeRef, listeners } = useContext(RowContext)\n return (\n <Button\n className=\"drag-btn\"\n type=\"tertiary\"\n size=\"small\"\n icon=\"drag\"\n ref={setActivatorNodeRef}\n {...listeners}\n />\n )\n}\nfunction BodyRow(props) {\n const {\n attributes,\n listeners,\n setNodeRef,\n setActivatorNodeRef,\n transform,\n transition,\n isDragging,\n } = useSortable({\n id: props['data-row-key'],\n })\n const style = {\n ...props.style,\n transform: CSS.Translate.toString(transform),\n transition,\n ...(isDragging\n ? {\n position: 'relative',\n zIndex: 9999,\n }\n : {}),\n }\n const contextValue = useMemo(\n () => ({\n setActivatorNodeRef,\n listeners,\n }),\n [setActivatorNodeRef, listeners]\n )\n return (\n <RowContext.Provider value={contextValue}>\n <tr {...props} ref={setNodeRef} style={style} {...attributes} />\n </RowContext.Provider>\n )\n}\n\nfunction ArrayInput({\n children,\n defaultValue,\n value,\n onChange,\n mode = 'list',\n drag = false, // 只做了table的拖拽排序\n gutter = 10,\n require = false,\n errorMap,\n deleteTip = '',\n plusTip = '',\n addText,\n locale,\n xProps = {},\n defaultAddData = {},\n renderAction,\n actionFixed = false,\n actionWidth = 80,\n disabled = false,\n}) {\n if (!isFunction(children)) {\n throw new Error(locale.error)\n }\n if (addText === undefined) {\n addText = locale?.add\n }\n\n const [_value, setValue] = useState(value || defaultValue)\n\n useEffect(() => {\n let newValue = value\n // 如果数组没有key\n if (Array.isArray(value) && value.some((obj) => !obj.key)) {\n newValue = value.map((obj) => ({ ...obj, key: obj.key || key++ }))\n _onChange(newValue)\n } else {\n setValue(newValue)\n }\n }, [value])\n\n const _onChange = useCallback((value) => {\n if (onChange) {\n onChange(value)\n } else {\n setValue(value)\n }\n }, [])\n\n let inValue = _value || []\n if (require && inValue.length === 0) {\n inValue = [{ key: key++ }]\n }\n\n const changeValue = (index, name, value) => {\n inValue[index] = {\n ...inValue[index],\n [name]: value,\n }\n _onChange([...inValue])\n }\n\n const onAdd = (index) => {\n const newData = { ...cloneDeep(defaultAddData), key: key++ }\n if (index === undefined) {\n _onChange([...inValue, newData])\n } else {\n inValue.splice(index + 1, 0, newData)\n _onChange([...inValue])\n }\n }\n\n const onDelete = (i) => {\n inValue.splice(i, 1)\n _onChange([...inValue])\n }\n\n const onDragEnd = ({ active, over }) => {\n if (active.id !== over?.id) {\n _onChange((prevState) => {\n const activeIndex = prevState.findIndex((record) => record.key === active?.id)\n const overIndex = prevState.findIndex((record) => record.key === over?.id)\n return arrayMove(prevState, activeIndex, overIndex)\n })\n }\n }\n\n if (mode === 'list') {\n return (\n <div className=\"tntd-array-input\">\n {inValue.map((item, index) => {\n let fields = children(item, index)\n if (!isArray(fields)) {\n fields = get(fields, 'props.children', [])\n }\n const actionSpan = 24 - (sum(fields.map((f) => get(f, 'props.span', 4))) % 24)\n return (\n <Row gutter={gutter} key={index} className=\"tntd-array-input-item\">\n {fields.map((field, i) => {\n if (!isValidElement(field)) {\n return field ? (\n <Col span={4} key={i}>\n {field}\n </Col>\n ) : (\n ''\n )\n }\n const { name, span = 4, onChange: fieldChange, ...other } = field?.props\n const isError = errorMap ? errorMap[`${index}-${name}`] : ''\n return (\n <Col span={span} key={i}>\n <div className={!isError ? 'tntd-array-input-hide-error' : ''}>\n {React.cloneElement(field, {\n value: item[name] || undefined,\n onChange: (e) => {\n fieldChange && fieldChange(e, index, changeValue)\n const newValue = e.target ? e.target.value : e\n changeValue(index, name, newValue)\n },\n disabled,\n ...other,\n })}\n </div>\n {isError && <div className=\"ant-form-item-explain-error\">{isError}</div>}\n </Col>\n )\n })}\n {!disabled && (\n <Col span={actionSpan}>\n <span className=\"tntd-array-input-action\">\n {renderAction ? (\n renderAction(item, index, onDelete, onAdd)\n ) : (\n <>\n {deleteTip ? (\n <Tooltip title={deleteTip}>\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n </Tooltip>\n ) : (\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n )}\n </>\n )}\n </span>\n </Col>\n )}\n </Row>\n )\n })}\n {!disabled && (\n <Button type=\"link\" onClick={() => onAdd()}>\n <Icon type=\"plus\" />\n {addText}\n </Button>\n )}\n </div>\n )\n } else {\n let fields = children({}, 0)\n if (!isArray(fields)) {\n fields = get(fields, 'props.children', [])\n }\n const dataSource = inValue.map((value, index) => {\n const fields = children(value, index)\n const back = { key: value.key }\n fields.forEach((field) => {\n const name = field?.props?.name\n name && set(back, name, field)\n })\n return back\n })\n\n return (\n <div className=\"tntd-array-input\">\n <DndContext modifiers={[restrictToVerticalAxis]} onDragEnd={onDragEnd}>\n <SortableContext\n items={dataSource.map((i) => i.key)}\n strategy={verticalListSortingStrategy}\n >\n <Table\n dataSource={dataSource}\n pagination={false}\n components={{\n body: {\n row: BodyRow,\n },\n }}\n bordered\n {...xProps}\n >\n {drag && (\n <Column\n key=\"dragger\"\n dataIndex=\"dragger\"\n width={60}\n render={() => <DragHandle />}\n ></Column>\n )}\n {fields.map((field) => {\n const { name, width = 160, title } = field?.props || {}\n return (\n <Column\n key={name}\n dataIndex={name}\n title={title}\n width={width}\n render={(field, row, index) => {\n if (!isValidElement(field)) {\n return field\n }\n const { name, onChange: fieldChange } = field.props\n const isError = errorMap ? errorMap[`${index}-${name}`] : ''\n return (\n <div className={!isError ? 'tntd-array-input-hide-error' : ''}>\n {React.cloneElement(field, {\n value: inValue[index][name] || undefined,\n onChange: (e) => {\n fieldChange && fieldChange(e, index, changeValue)\n const newValue = e.target ? e.target.value : e\n changeValue(index, name, newValue), disabled\n },\n })}\n {isError && <div className=\"ant-form-item-explain-error\">{isError}</div>}\n </div>\n )\n }}\n ></Column>\n )\n })}\n {!disabled && (\n <Column\n key=\"action\"\n dataIndex=\"action\"\n title={locale.action}\n width={actionWidth}\n className=\"tntd-array-input-action\"\n fixed={actionFixed}\n render={(text, row, index) => {\n if (renderAction) {\n return renderAction(row, index, onDelete, onAdd)\n }\n return (\n <>\n {deleteTip ? (\n <Tooltip title={deleteTip}>\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n </Tooltip>\n ) : (\n <span onClick={() => onDelete(index)}>\n <Icon type=\"delete\" />\n </span>\n )}\n </>\n )\n }}\n ></Column>\n )}\n </Table>\n </SortableContext>\n </DndContext>\n {!disabled && (\n <Button type=\"dashed\" block className=\"mt10\" onClick={() => onAdd()}>\n <Icon type=\"plus\" />\n {addText}\n </Button>\n )}\n </div>\n )\n }\n}\n\nexport default function WarpArrayInput(props) {\n return (\n <LocaleReceiver componentName=\"ArrayInput\">\n {(locale) => {\n return <ArrayInput {...props} locale={locale} />\n }}\n </LocaleReceiver>\n )\n}\n"]}
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import type { ButtonProps as AntdButtonProps, ButtonGroupProps as AntdButtonGroupProps, ButtonType } from 'antd/lib/button';
3
3
  import { default as AntdButton } from 'antd/lib/button';
4
4
  export * from 'antd/lib/button';
5
- export declare type TntButtonType = ButtonType | 'tertiary';
5
+ export declare type TntButtonType = ButtonType | 'tertiary' | 'ai';
6
6
  export interface ButtonProps extends Omit<AntdButtonProps, 'size' | 'type'> {
7
7
  upperCaseIgnore?: [];
8
8
  unUpperConverted?: boolean;
9
9
  size?: 'large' | 'default' | 'small' | 'mini';
10
- type?: 'default' | 'primary' | 'tertiary' | 'ghost' | 'dashed' | 'danger' | 'link';
10
+ type?: 'default' | 'primary' | 'tertiary' | 'ai' | 'ghost' | 'dashed' | 'danger' | 'link';
11
11
  }
12
12
  export interface ButtonGroupProps extends Omit<AntdButtonGroupProps, 'size'> {
13
13
  size?: 'large' | 'default' | 'small' | 'mini';
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,gBAAgB,IAAI,oBAAoB,EACxC,UAAU,EACX,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAItD,cAAc,gBAAgB,CAAA;AAE9B,oBAAY,aAAa,GAAG,UAAU,GAAG,UAAU,CAAA;AACnD,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACzE,eAAe,CAAC,EAAE,EAAE,CAAA;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;IAC7C,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG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,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;CAC9C;AAED,UAAU,eACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACtF,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAA;CAClC;AAID,eAAO,MAAM,MAAM,iBA2BC,CAAA"}
@@ -117,9 +117,9 @@ var Button = exports.Button = (0, _react.forwardRef)(function (_a, ref) {
117
117
  return _react["default"].createElement(_configProvider.ConfigConsumer, null, function (_ref) {
118
118
  var getPrefixCls = _ref.getPrefixCls;
119
119
  return _react["default"].createElement(_button["default"], Object.assign({}, rest, {
120
- type: type === 'tertiary' ? undefined : type,
120
+ type: type === 'tertiary' || type === 'ai' ? undefined : type,
121
121
  size: size === 'mini' ? undefined : size,
122
- className: (0, _classnames["default"])(className, tntPrefixCls, _defineProperty(_defineProperty({}, "".concat(tntPrefixCls, "-mini"), size === 'mini'), "".concat(tntPrefixCls, "-tertiary"), type === 'tertiary')),
122
+ className: (0, _classnames["default"])(className, tntPrefixCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(tntPrefixCls, "-mini"), size === 'mini'), "".concat(tntPrefixCls, "-tertiary"), type === 'tertiary'), "".concat(tntPrefixCls, "-ai"), type === 'ai')),
123
123
  children: newChildren,
124
124
  ref: ref
125
125
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,+CAAyC;AAMzC,wDAAmD;AACnD,4DAAsD;AACtD,wCAA4C;AAC5C,4DAAmC;AAEnC,iDAA8B;AAkB9B,MAAM,YAAY,GAAG,SAAS,CAAA;AAEjB,QAAA,MAAM,GAAG,IAAA,kBAAU,EAC9B,CAAC,EAA+E,EAAE,GAAG,EAAE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AAU,EAAC,SAAS,EAAE;gBAC/B,CAAC,GAAG,YAAY,aAAa,CAAC,EAAE,IAAI,KAAK,MAAM;aAChD,CAAC,IACF,CACH,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA;AAED,cAAM,CAAC,KAAK,GAAG,WAAW,CAAA","sourcesContent":["/*\n * @Author: 周泽飞 zefei.zhou@tongdun.net\n * @Date: 2023-10-26 09:46:28\n * @LastEditors: 周泽飞 zefei.zhou@tongdun.net\n * @LastEditTime: 2023-10-31 09:59:35\n * @FilePath: /tntd/packages/tntd/src/button/button.tsx\n * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\n */\nimport React, { forwardRef } from 'react'\nimport type {\n ButtonProps as AntdButtonProps,\n ButtonGroupProps as AntdButtonGroupProps,\n ButtonType,\n} from 'antd/lib/button'\nimport { ConfigConsumer } from '../config-provider'\nimport { default as AntdButton } from 'antd/lib/button'\nimport { doUpperTitle } from '../utils/lang'\nimport classNames from 'classnames'\n\nexport * from 'antd/lib/button'\n\nexport type TntButtonType = ButtonType | 'tertiary'\nexport interface ButtonProps extends Omit<AntdButtonProps, 'size' | 'type'> {\n upperCaseIgnore?: []\n unUpperConverted?: boolean\n size?: 'large' | 'default' | 'small' | 'mini'\n type?: 'default' | 'primary' | 'tertiary' | 'ghost' | 'dashed' | 'danger' | 'link'\n}\nexport interface ButtonGroupProps extends Omit<AntdButtonGroupProps, 'size'> {\n size?: 'large' | 'default' | 'small' | 'mini'\n}\n\ninterface ButtonComponent\n extends React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<AntdButton>> {\n Group: React.FC<ButtonGroupProps>\n}\n\nconst tntPrefixCls = 'tnt-btn'\n\nexport const Button = forwardRef<AntdButton, ButtonProps>(\n ({ className, size, type, children, unUpperConverted, upperCaseIgnore, ...rest }, ref) => {\n let newChildren = children\n if (!unUpperConverted) {\n newChildren = doUpperTitle(newChildren, upperCaseIgnore)\n }\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return (\n <AntdButton\n {...rest}\n type={type === 'tertiary' ? undefined : type}\n size={size === 'mini' ? undefined : size}\n className={classNames(className, tntPrefixCls, {\n [`${tntPrefixCls}-mini`]: size === 'mini',\n [`${tntPrefixCls}-tertiary`]: type === 'tertiary',\n })}\n children={newChildren}\n ref={ref}\n />\n )\n }}\n </ConfigConsumer>\n )\n }\n) as ButtonComponent\n\nconst ButtonGroup: React.FC<ButtonGroupProps> = ({ className, size, ...rest }) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return (\n <AntdButton.Group\n {...rest}\n size={size === 'mini' ? undefined : size}\n className={classNames(className, {\n [`${tntPrefixCls}-group-mini`]: size === 'mini',\n })}\n />\n )\n }}\n </ConfigConsumer>\n )\n}\n\nButton.Group = ButtonGroup\n"]}
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,+CAAyC;AAMzC,wDAAmD;AACnD,4DAAsD;AACtD,wCAA4C;AAC5C,4DAAmC;AAEnC,iDAA8B;AAkB9B,MAAM,YAAY,GAAG,SAAS,CAAA;AAEjB,QAAA,MAAM,GAAG,IAAA,kBAAU,EAC9B,CAAC,EAA+E,EAAE,GAAG,EAAE,EAAE;QAAxF,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,OAAW,EAAN,IAAI,cAA7E,gFAA+E,CAAF;IAC5E,IAAI,WAAW,GAAG,QAAQ,CAAA;IAC1B,IAAI,CAAC,gBAAgB,EAAE;QACrB,WAAW,GAAG,IAAA,mBAAY,EAAC,WAAW,EAAE,eAAe,CAAC,CAAA;KACzD;IACD,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,Y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dun.net\n * @Date: 2023-10-26 09:46:28\n * @LastEditors: 周泽飞 zefei.zhou@tongdun.net\n * @LastEditTime: 2023-10-31 09:59:35\n * @FilePath: /tntd/packages/tntd/src/button/button.tsx\n * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\n */\nimport React, { forwardRef } from 'react'\nimport type {\n ButtonProps as AntdButtonProps,\n ButtonGroupProps as AntdButtonGroupProps,\n ButtonType,\n} from 'antd/lib/button'\nimport { ConfigConsumer } from '../config-provider'\nimport { default as AntdButton } from 'antd/lib/button'\nimport { doUpperTitle } from '../utils/lang'\nimport classNames from 'classnames'\n\nexport * from 'antd/lib/button'\n\nexport type TntButtonType = ButtonType | 'tertiary' | 'ai'\nexport interface ButtonProps extends Omit<AntdButtonProps, 'size' | 'type'> {\n upperCaseIgnore?: []\n unUpperConverted?: boolean\n size?: 'large' | 'default' | 'small' | 'mini'\n type?: 'default' | 'primary' | 'tertiary' | 'ai' | 'ghost' | 'dashed' | 'danger' | 'link'\n}\nexport interface ButtonGroupProps extends Omit<AntdButtonGroupProps, 'size'> {\n size?: 'large' | 'default' | 'small' | 'mini'\n}\n\ninterface ButtonComponent\n extends React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<AntdButton>> {\n Group: React.FC<ButtonGroupProps>\n}\n\nconst tntPrefixCls = 'tnt-btn'\n\nexport const Button = forwardRef<AntdButton, ButtonProps>(\n ({ className, size, type, children, unUpperConverted, upperCaseIgnore, ...rest }, ref) => {\n let newChildren = children\n if (!unUpperConverted) {\n newChildren = doUpperTitle(newChildren, upperCaseIgnore)\n }\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return (\n <AntdButton\n {...rest}\n type={type === 'tertiary' || type === 'ai' ? undefined : type}\n size={size === 'mini' ? undefined : size}\n className={classNames(className, tntPrefixCls, {\n [`${tntPrefixCls}-mini`]: size === 'mini',\n [`${tntPrefixCls}-tertiary`]: type === 'tertiary',\n [`${tntPrefixCls}-ai`]: type === 'ai',\n })}\n children={newChildren}\n ref={ref}\n />\n )\n }}\n </ConfigConsumer>\n )\n }\n) as ButtonComponent\n\nconst ButtonGroup: React.FC<ButtonGroupProps> = ({ className, size, ...rest }) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return (\n <AntdButton.Group\n {...rest}\n size={size === 'mini' ? undefined : size}\n className={classNames(className, {\n [`${tntPrefixCls}-group-mini`]: size === 'mini',\n })}\n />\n )\n }}\n </ConfigConsumer>\n )\n}\n\nButton.Group = ButtonGroup\n"]}
@@ -37,6 +37,9 @@
37
37
  &-tertiary {
38
38
  .button-variant-tertiary(@btn-default-color, @primary-color, @btn-tertiary-bg);
39
39
  }
40
+ &-ai {
41
+ .button-variant-ai(@btn-primary-color, @primary-color, @btn-ai-bg);
42
+ }
40
43
  &.@{btn-prefix-cls}-primary {
41
44
  .button-disabled(@btn-primary-color, @blue-3, @blue-3);
42
45
  }
@@ -75,3 +78,175 @@
75
78
 
76
79
  .button-disabled(@btn-disable-color; @btn-disable-bg; transparent);
77
80
  }
81
+
82
+ // AI按钮
83
+ @ai-animation-duration: 0.3s;
84
+ @ai-animation-easing: cubic-bezier(0.645, 0.045, 0.355, 1);
85
+ @ai-overlay-opacity: 0.2;
86
+
87
+ .ai-gradient-overlay(@overlay-color; @base-gradient) {
88
+ background: linear-gradient(0deg, @overlay-color 0%, @overlay-color 100%), @base-gradient;
89
+ }
90
+
91
+ .generate-hover-in-animation(@name; @background) {
92
+ @keyframes @name {
93
+ 0% {
94
+ background: @background;
95
+ }
96
+ 10% {
97
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.02), @background);
98
+ }
99
+ 20% {
100
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.04), @background);
101
+ }
102
+ 30% {
103
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.06), @background);
104
+ }
105
+ 40% {
106
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.08), @background);
107
+ }
108
+ 50% {
109
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.1), @background);
110
+ }
111
+ 60% {
112
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.12), @background);
113
+ }
114
+ 70% {
115
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.14), @background);
116
+ }
117
+ 80% {
118
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.16), @background);
119
+ }
120
+ 90% {
121
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.18), @background);
122
+ }
123
+ 100% {
124
+ .ai-gradient-overlay(rgba(255, 255, 255, @ai-overlay-opacity), @background);
125
+ }
126
+ }
127
+ }
128
+
129
+ .generate-hover-out-animation(@name; @background) {
130
+ @keyframes @name {
131
+ 0% {
132
+ .ai-gradient-overlay(rgba(255, 255, 255, @ai-overlay-opacity), @background);
133
+ }
134
+ 10% {
135
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.18), @background);
136
+ }
137
+ 20% {
138
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.16), @background);
139
+ }
140
+ 30% {
141
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.14), @background);
142
+ }
143
+ 40% {
144
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.12), @background);
145
+ }
146
+ 50% {
147
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.1), @background);
148
+ }
149
+ 60% {
150
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.08), @background);
151
+ }
152
+ 70% {
153
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.06), @background);
154
+ }
155
+ 80% {
156
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.04), @background);
157
+ }
158
+ 90% {
159
+ .ai-gradient-overlay(rgba(255, 255, 255, 0.02), @background);
160
+ }
161
+ 100% {
162
+ background: @background;
163
+ }
164
+ }
165
+ }
166
+
167
+ .generate-active-animation(@name; @background) {
168
+ @keyframes @name {
169
+ 0% {
170
+ background: @background;
171
+ }
172
+ 10% {
173
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.02), @background);
174
+ }
175
+ 20% {
176
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.04), @background);
177
+ }
178
+ 30% {
179
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.06), @background);
180
+ }
181
+ 40% {
182
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.08), @background);
183
+ }
184
+ 50% {
185
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.1), @background);
186
+ }
187
+ 60% {
188
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.12), @background);
189
+ }
190
+ 70% {
191
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.14), @background);
192
+ }
193
+ 80% {
194
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.16), @background);
195
+ }
196
+ 90% {
197
+ .ai-gradient-overlay(rgba(0, 0, 0, 0.18), @background);
198
+ }
199
+ 100% {
200
+ .ai-gradient-overlay(rgba(0, 0, 0, @ai-overlay-opacity), @background);
201
+ }
202
+ }
203
+ }
204
+
205
+ .button-variant-ai(@color; @hover-color; @background) {
206
+ color: @color;
207
+ background: @background;
208
+ border: none;
209
+ text-shadow: @btn-text-shadow;
210
+ box-shadow: @btn-primary-shadow;
211
+
212
+ animation: ai-hover-out @ai-animation-duration @ai-animation-easing;
213
+ animation-fill-mode: both;
214
+
215
+ &:hover,
216
+ &:focus {
217
+ color: @color;
218
+ .ai-gradient-overlay(rgba(255, 255, 255, @ai-overlay-opacity), @background);
219
+ animation: ai-hover-in @ai-animation-duration @ai-animation-easing;
220
+ animation-fill-mode: both;
221
+ }
222
+
223
+ &:active,
224
+ &.active {
225
+ color: @color;
226
+ .ai-gradient-overlay(rgba(0, 0, 0, @ai-overlay-opacity), @background);
227
+ animation: ai-active-in @ai-animation-duration @ai-animation-easing;
228
+ animation-fill-mode: both;
229
+ }
230
+
231
+ .button-disabled(@white; @disabled-color; transparent);
232
+
233
+ // AI 按钮禁用状态的额外样式
234
+ &[disabled],
235
+ &.@{btn-prefix-cls}-disabled {
236
+ background: @btn-disable-bg-ai !important;
237
+ animation: none !important;
238
+ cursor: not-allowed;
239
+
240
+ &:hover,
241
+ &:focus,
242
+ &:active {
243
+ background: @btn-disable-bg-ai !important;
244
+ animation: none !important;
245
+ }
246
+ }
247
+
248
+ // linear-gradient不支持 transition 动画,使用 animation模拟 transition 动画,目前10帧差不多可以很丝滑
249
+ .generate-hover-in-animation(ai-hover-in; @background);
250
+ .generate-hover-out-animation(ai-hover-out; @background);
251
+ .generate-active-animation(ai-active-in; @background);
252
+ }
@@ -48,6 +48,7 @@
48
48
  .@{btn-prefix-cls}-group &:first-child {
49
49
  &:not(:last-child) {
50
50
  border-right-color: @btn-group-border;
51
+
51
52
  &[disabled] {
52
53
  border-right-color: @btn-default-border;
53
54
  }
@@ -57,6 +58,7 @@
57
58
  .@{btn-prefix-cls}-group &:last-child:not(:first-child),
58
59
  .@{btn-prefix-cls}-group & + & {
59
60
  border-left-color: @btn-group-border;
61
+
60
62
  &[disabled] {
61
63
  border-left-color: @btn-default-border;
62
64
  }
@@ -89,6 +91,7 @@
89
91
 
90
92
  &-round {
91
93
  .btn-round(@btn-prefix-cls);
94
+
92
95
  &.@{btn-prefix-cls}-icon-only {
93
96
  width: auto;
94
97
  }
@@ -130,6 +133,7 @@
130
133
 
131
134
  &&-loading {
132
135
  position: relative;
136
+
133
137
  &:not([disabled]) {
134
138
  pointer-events: none;
135
139
  }
@@ -141,6 +145,7 @@
141
145
 
142
146
  &&-loading:not(&-circle):not(&-circle-outline):not(&-icon-only) {
143
147
  padding-left: 29px;
148
+
144
149
  .@{iconfont-css-prefix}:not(:last-child) {
145
150
  margin-left: -14px;
146
151
  }
@@ -148,6 +153,7 @@
148
153
 
149
154
  &-sm&-loading:not(&-circle):not(&-circle-outline):not(&-icon-only) {
150
155
  padding-left: 24px;
156
+
151
157
  .@{iconfont-css-prefix} {
152
158
  margin-left: -17px;
153
159
  }
@@ -218,6 +224,7 @@ a.@{btn-prefix-cls} {
218
224
  &-lg {
219
225
  line-height: calc(@btn-height-lg - 2px);
220
226
  }
227
+
221
228
  &-sm {
222
229
  line-height: calc(@btn-height-sm - 2px);
223
230
  }