tntd 3.0.0-beta.16 → 3.0.0-beta.19

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 (121) hide show
  1. package/es/descriptions/descriptions.js +20 -16
  2. package/es/descriptions/descriptions.js.map +1 -1
  3. package/es/descriptions/descriptions.less +6 -2
  4. package/es/descriptions/style/index.less +1 -0
  5. package/es/drawer/drawer.js +9 -3
  6. package/es/drawer/drawer.js.map +1 -1
  7. package/es/handle-icon/index.js +11 -5
  8. package/es/handle-icon/index.js.map +1 -1
  9. package/es/handle-icon/index.less +7 -2
  10. package/es/page-container/index.js +1 -1
  11. package/es/page-container/index.js.map +1 -1
  12. package/es/page-loading/index.js +1 -1
  13. package/es/page-loading/index.js.map +1 -1
  14. package/es/query-form/Field/Checkbox.js +1 -1
  15. package/es/query-form/Field/Checkbox.js.map +1 -1
  16. package/es/query-form/Field/SelectInput.js +4 -22
  17. package/es/query-form/Field/SelectInput.js.map +1 -1
  18. package/es/query-form/Field/fieldsMap.js +2 -2
  19. package/es/query-form/Field/fieldsMap.js.map +1 -1
  20. package/es/query-form/Field/index.js +0 -1
  21. package/es/query-form/Field/index.js.map +1 -1
  22. package/es/query-form/index.js +332 -149
  23. package/es/query-form/index.js.map +1 -1
  24. package/es/query-form/index.less +60 -17
  25. package/es/query-form-backup/Field/Composition/FieldPopover.less +35 -0
  26. package/es/query-form-backup/Field/Composition/index.less +114 -0
  27. package/es/query-form-backup/index.less +90 -0
  28. package/es/table/expand.less +51 -0
  29. package/es/table/hooks/index.js +2 -1
  30. package/es/table/hooks/index.js.map +1 -1
  31. package/es/table/hooks/use-expand-fixed.js +76 -0
  32. package/es/table/hooks/use-expand-fixed.js.map +1 -0
  33. package/es/table/index.js +1 -0
  34. package/es/table/index.js.map +1 -1
  35. package/es/table/style/index.less +17 -31
  36. package/es/table/table.js +115 -14
  37. package/es/table/table.js.map +1 -1
  38. package/es/table/table.less +8 -19
  39. package/es/table/utils.js +11 -0
  40. package/es/table/utils.js.map +1 -1
  41. package/es/table-container/index.js +1 -1
  42. package/es/table-container/index.js.map +1 -1
  43. package/es/tabs-container/index.js +1 -1
  44. package/es/tabs-container/index.js.map +1 -1
  45. package/es/title/index.js +4 -3
  46. package/es/title/index.js.map +1 -1
  47. package/es/tntd-action/Action.js +57 -11
  48. package/es/tntd-action/Action.js.map +1 -1
  49. package/es/tntd-action/index.less +5 -3
  50. package/lib/descriptions/descriptions.d.ts.map +1 -1
  51. package/lib/descriptions/descriptions.js +23 -18
  52. package/lib/descriptions/descriptions.js.map +1 -1
  53. package/lib/descriptions/descriptions.less +6 -2
  54. package/lib/descriptions/style/index.less +1 -0
  55. package/lib/drawer/drawer.d.ts +2 -0
  56. package/lib/drawer/drawer.d.ts.map +1 -1
  57. package/lib/drawer/drawer.js +8 -2
  58. package/lib/drawer/drawer.js.map +1 -1
  59. package/lib/handle-icon/index.d.ts.map +1 -1
  60. package/lib/handle-icon/index.js +11 -4
  61. package/lib/handle-icon/index.js.map +1 -1
  62. package/lib/handle-icon/index.less +7 -2
  63. package/lib/page-container/index.js +1 -1
  64. package/lib/page-container/index.js.map +1 -1
  65. package/lib/page-loading/index.js +1 -1
  66. package/lib/page-loading/index.js.map +1 -1
  67. package/lib/query-form/Field/Checkbox.js +1 -1
  68. package/lib/query-form/Field/Checkbox.js.map +1 -1
  69. package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
  70. package/lib/query-form/Field/SelectInput.js +3 -15
  71. package/lib/query-form/Field/SelectInput.js.map +1 -1
  72. package/lib/query-form/Field/fieldsMap.d.ts +3 -6
  73. package/lib/query-form/Field/fieldsMap.js +2 -2
  74. package/lib/query-form/Field/fieldsMap.js.map +1 -1
  75. package/lib/query-form/Field/index.d.ts.map +1 -1
  76. package/lib/query-form/Field/index.js +0 -1
  77. package/lib/query-form/Field/index.js.map +1 -1
  78. package/lib/query-form/index.d.ts +27 -15
  79. package/lib/query-form/index.d.ts.map +1 -1
  80. package/lib/query-form/index.js +356 -171
  81. package/lib/query-form/index.js.map +1 -1
  82. package/lib/query-form/index.less +60 -17
  83. package/lib/query-form-backup/Field/Composition/FieldPopover.less +35 -0
  84. package/lib/query-form-backup/Field/Composition/index.less +114 -0
  85. package/lib/query-form-backup/index.less +90 -0
  86. package/lib/table/expand.less +51 -0
  87. package/lib/table/hooks/index.d.ts +1 -0
  88. package/lib/table/hooks/index.d.ts.map +1 -1
  89. package/lib/table/hooks/index.js +11 -0
  90. package/lib/table/hooks/index.js.map +1 -1
  91. package/lib/table/hooks/use-expand-fixed.d.ts +4 -0
  92. package/lib/table/hooks/use-expand-fixed.d.ts.map +1 -0
  93. package/lib/table/hooks/use-expand-fixed.js +106 -0
  94. package/lib/table/hooks/use-expand-fixed.js.map +1 -0
  95. package/lib/table/index.d.ts +1 -0
  96. package/lib/table/index.d.ts.map +1 -1
  97. package/lib/table/index.js +1 -0
  98. package/lib/table/index.js.map +1 -1
  99. package/lib/table/style/index.less +17 -31
  100. package/lib/table/table.d.ts +4 -1
  101. package/lib/table/table.d.ts.map +1 -1
  102. package/lib/table/table.js +112 -11
  103. package/lib/table/table.js.map +1 -1
  104. package/lib/table/table.less +8 -19
  105. package/lib/table/utils.d.ts +1 -0
  106. package/lib/table/utils.d.ts.map +1 -1
  107. package/lib/table/utils.js +13 -0
  108. package/lib/table/utils.js.map +1 -1
  109. package/lib/table-container/index.d.ts.map +1 -1
  110. package/lib/table-container/index.js +1 -1
  111. package/lib/table-container/index.js.map +1 -1
  112. package/lib/tabs-container/index.js +1 -1
  113. package/lib/tabs-container/index.js.map +1 -1
  114. package/lib/title/index.d.ts +1 -0
  115. package/lib/title/index.d.ts.map +1 -1
  116. package/lib/title/index.js +3 -2
  117. package/lib/title/index.js.map +1 -1
  118. package/lib/tntd-action/Action.js +62 -12
  119. package/lib/tntd-action/Action.js.map +1 -1
  120. package/lib/tntd-action/index.less +5 -3
  121. package/package.json +3 -2
@@ -1,30 +1,73 @@
1
1
  .tnt-queryform {
2
- &-top {
3
- display: flex;
4
- &-body {
5
- flex: 1;
6
- .ant-btn {
7
- margin-right: 10px;
8
- }
9
- }
10
- }
2
+ display: flex;
11
3
 
12
4
  &-extra {
5
+ line-height: 32px;
6
+ margin-left: 12px;
13
7
  & > * {
14
- margin-left: 10px;
8
+ margin-left: 8px;
9
+ }
10
+ }
11
+
12
+ &-actions {
13
+ align-items: center;
14
+ display: inline-block;
15
+ height: 32px;
16
+ line-height: 32px;
17
+
18
+ & > *:not(.expand-link) {
19
+ margin-right: 10px;
20
+ }
21
+ & > .expand-link {
22
+ padding: 0;
23
+ margin-right: 0;
24
+ }
25
+ & > .ant-badge {
26
+ .tnt-icon {
27
+ margin-right: 8px;
28
+ }
15
29
  }
16
30
  }
17
31
 
18
32
  .ant-form {
19
- // margin-bottom: @margin-sm;
33
+ display: inline-block;
34
+ margin-bottom: 12px;
35
+ display: flex;
36
+ flex: 1;
20
37
  &.ant-form-inline {
21
38
  flex-wrap: unset;
22
- position: relative;
39
+ }
40
+
41
+ & > div:nth-child(1) {
42
+ height: 32px;
43
+ overflow: hidden;
44
+ .ant-form-item-label {
45
+ label {
46
+ // bottom: 4px;
47
+ }
48
+ }
49
+ }
50
+
51
+ &.expanded {
52
+ & > div:nth-child(1) {
53
+ height: auto !important;
54
+ }
55
+ }
56
+
57
+ &.showMore {
58
+ & > div:nth-child(1) {
59
+ .ant-form-item {
60
+ margin-bottom: 12px;
61
+ }
62
+ }
63
+ }
64
+
65
+ & > div:nth-child(2) {
66
+ display: flex;
23
67
  }
24
68
 
25
69
  &.ant-form-inline .ant-form-item {
26
70
  margin-right: 10px;
27
- margin-bottom: @margin-sm;
28
71
  display: inline-block;
29
72
  }
30
73
 
@@ -32,7 +75,7 @@
32
75
  // min-width: 160px;
33
76
  line-height: unset;
34
77
  .ant-calendar-picker-input {
35
- padding: 0 @padding-sm;
78
+ padding: 0 11px;
36
79
  }
37
80
  .ant-form-item-children {
38
81
  & > .ant-input,
@@ -45,7 +88,7 @@
45
88
  }
46
89
 
47
90
  &-drawer {
48
- margin-top: @margin-xxl;
91
+ margin-top: 50px;
49
92
  &.large-size {
50
93
  margin-top: 60px;
51
94
  }
@@ -60,7 +103,7 @@
60
103
  .ant-form-item {
61
104
  display: block;
62
105
  margin-right: 0;
63
- margin-bottom: @margin-md;
106
+ margin-bottom: 20px;
64
107
  width: 100%;
65
108
  }
66
109
  .ant-form-item-label {
@@ -82,7 +125,7 @@
82
125
  width: 100%;
83
126
  margin-bottom: 10px;
84
127
  &.ant-btn-primary {
85
- margin-top: @margin-md;
128
+ margin-top: 20px;
86
129
  }
87
130
  }
88
131
  }
@@ -0,0 +1,35 @@
1
+ .tnt-queryform-field-popover {
2
+ min-width: 280px;
3
+ .ant-popover-inner-content {
4
+ padding: @padding-sm 0;
5
+ }
6
+ .ant-calendar-picker {
7
+ margin: @margin-xxs 0;
8
+ }
9
+ label {
10
+ color: tint(@text-color, 50%);
11
+ margin-bottom: @margin-xs;
12
+ display: block;
13
+ padding: 0 @padding-sm;
14
+ }
15
+ .ant-select-dropdown-menu {
16
+ &-item {
17
+ padding: @padding-xxs @padding-sm;
18
+ &:hover {
19
+ background-color: @bg-color-quaternary;
20
+ }
21
+ }
22
+ }
23
+ &-content {
24
+ padding: @padding-xxs @padding-sm;
25
+ }
26
+ .ant-select-selected-icon {
27
+ position: absolute;
28
+ right: @margin-base;
29
+ top: @margin-xs;
30
+ color: @blue-6;
31
+ }
32
+ .tnt-highlight {
33
+ color: @blue-6;
34
+ }
35
+ }
@@ -0,0 +1,114 @@
1
+ @import '../../../style/themes/index';
2
+ @import '../../../style/mixins/index';
3
+ @import '../../../input/style/mixin';
4
+
5
+ .tnt-queryform-composition-input {
6
+ // width: 100%;
7
+ max-height: 162px;
8
+ overflow-x: hidden;
9
+ cursor: text;
10
+ padding: 2px @padding-xl;
11
+ position: relative;
12
+ box-sizing: border-box;
13
+ background-color: @select-background;
14
+ border: @border-width-base @border-style-base @select-border-color;
15
+ border-top-width: calc(@border-width-base + 0.02px);
16
+ border-radius: @border-radius-base;
17
+ outline: none;
18
+ transition: all 0.3s @ease-in-out;
19
+ user-select: none;
20
+ margin-bottom: @margin-sm;
21
+
22
+ &-prefix {
23
+ position: absolute;
24
+ left: @padding-sm;
25
+ top: 50%;
26
+ transform: translateY(-50%);
27
+ i.anticon {
28
+ color: tint(@bg-color-spotilight, 50%);
29
+ }
30
+ }
31
+
32
+ &-width {
33
+ height: 0;
34
+ opacity: 0;
35
+ width: auto;
36
+ position: absolute;
37
+ max-width: 100%;
38
+ }
39
+
40
+ &-items {
41
+ float: left;
42
+ padding: 0;
43
+ list-style: none;
44
+ margin: 0;
45
+ width: 100%;
46
+ &-item {
47
+ padding: 3px 0;
48
+ }
49
+ li {
50
+ float: left;
51
+ line-height: 1;
52
+ }
53
+ &-input {
54
+ .inputClass {
55
+ background: none;
56
+ border: none !important;
57
+ outline: none;
58
+ box-shadow: none !important;
59
+ width: 150px !important;
60
+ height: 26px;
61
+ line-height: 26px;
62
+ padding: 0;
63
+ input {
64
+ border: none !important;
65
+ outline: none !important;
66
+ box-shadow: none !important;
67
+ height: 26px;
68
+ line-height: 26px;
69
+ padding: 0;
70
+ }
71
+ textarea {
72
+ padding: 0;
73
+ }
74
+ }
75
+ .inputClass-with-placeholder {
76
+ min-width: 398px !important;
77
+ }
78
+ }
79
+ }
80
+ &-clear {
81
+ position: absolute;
82
+ right: @margin-sm;
83
+ top: 50%;
84
+ transform: translateY(-50%);
85
+ display: none;
86
+ i.anticon {
87
+ color: tint(@bg-color-spotilight, 50%);
88
+ }
89
+ &:hover {
90
+ .anticon {
91
+ color: @text-color-secondary !important;
92
+ }
93
+ }
94
+ }
95
+ &:hover {
96
+ border-color: @blue-6;
97
+ outline: 0;
98
+ .tnt-queryform-composition-input-clear {
99
+ display: block;
100
+ }
101
+ // box-shadow: 0 0 0 2px rgb(18 107 251 / 20%);
102
+ }
103
+ &:focus,
104
+ &:active {
105
+ border-color: @blue-5;
106
+ outline: 0;
107
+ // box-shadow: 0 0 0 2px rgb(18 107 251 / 20%);
108
+ }
109
+ .ant-tag {
110
+ padding: 0 @padding-xs;
111
+ border: none;
112
+ background: @fill-color-tertiary;
113
+ }
114
+ }
@@ -0,0 +1,90 @@
1
+ .tnt-queryform {
2
+ &-top {
3
+ display: flex;
4
+ &-body {
5
+ flex: 1;
6
+ .ant-btn {
7
+ margin-right: 10px;
8
+ }
9
+ }
10
+ }
11
+
12
+ &-extra {
13
+ & > * {
14
+ margin-left: 10px;
15
+ }
16
+ }
17
+
18
+ .ant-form {
19
+ // margin-bottom: @margin-sm;
20
+ &.ant-form-inline {
21
+ flex-wrap: unset;
22
+ position: relative;
23
+ }
24
+
25
+ &.ant-form-inline .ant-form-item {
26
+ margin-right: 10px;
27
+ margin-bottom: @margin-sm;
28
+ display: inline-block;
29
+ }
30
+
31
+ .ant-form-item-control {
32
+ // min-width: 160px;
33
+ line-height: unset;
34
+ .ant-calendar-picker-input {
35
+ padding: 0 @padding-sm;
36
+ }
37
+ .ant-form-item-children {
38
+ & > .ant-input,
39
+ & > .ant-input-affix-wrapper {
40
+ width: 160px;
41
+ // width: 200px;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ &-drawer {
48
+ margin-top: @margin-xxl;
49
+ &.large-size {
50
+ margin-top: 60px;
51
+ }
52
+
53
+ &.ant-drawer.ant-drawer-open {
54
+ .ant-drawer-mask {
55
+ opacity: 0;
56
+ background: unset;
57
+ }
58
+ }
59
+ .ant-drawer-body {
60
+ .ant-form-item {
61
+ display: block;
62
+ margin-right: 0;
63
+ margin-bottom: @margin-md;
64
+ width: 100%;
65
+ }
66
+ .ant-form-item-label {
67
+ display: block;
68
+ text-align: left;
69
+ line-height: 22px;
70
+ margin-bottom: 10px;
71
+ }
72
+ .ant-form-item-control-wrapper,
73
+ .ant-form-item-control,
74
+ .ant-calendar-picker,
75
+ .ant-input {
76
+ min-width: 100%;
77
+ width: 100%;
78
+ }
79
+
80
+ & > .ant-btn {
81
+ display: block;
82
+ width: 100%;
83
+ margin-bottom: 10px;
84
+ &.ant-btn-primary {
85
+ margin-top: @margin-md;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,51 @@
1
+ @table-prefix-cls: ~'@{ant-prefix}-table';
2
+ @pagination-prefix-cls: ~'@{ant-prefix}-pagination';
3
+ @spin-prefix-cls: ~'@{ant-prefix}-spin';
4
+ @table-borderless-shadow: 0 0 14px rgba(0, 0, 0, 0.08);
5
+
6
+ // .@{table-prefix-cls} {
7
+ .tnt-table-wrapper {
8
+ // customize the fixed of table
9
+ &.@{table-prefix-cls}-sticky {
10
+ .@{table-prefix-cls}-scroll,
11
+ .@{table-prefix-cls}-default {
12
+ .@{table-prefix-cls}-body table {
13
+ table-layout: fixed;
14
+
15
+ tr.@{table-prefix-cls}-expanded-row.@{table-prefix-cls}-expanded-row-level-1 {
16
+ position: relative;
17
+ z-index: 10;
18
+ background: #f3f4f6;
19
+
20
+ > td:not([colspan]) {
21
+ display: none;
22
+ }
23
+
24
+ // 兼容低版本浏览器
25
+ > td[colspan] {
26
+ background: #fff;
27
+ z-index: 100;
28
+ padding: 0;
29
+ border: none;
30
+
31
+ > .@{table-prefix-cls}-expanded-row-fixed {
32
+ position: sticky;
33
+ left: 0px;
34
+ overflow: hidden;
35
+ padding: 16px;
36
+ background: inherit;
37
+ border-top: 1px solid #e1e6ee;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ .@{table-prefix-cls}-fixed-left table {
45
+ width: fit-content;
46
+ }
47
+ .@{table-prefix-cls}-fixed-right table {
48
+ width: fit-content;
49
+ }
50
+ }
51
+ }
@@ -1 +1,2 @@
1
- export * from './use-column-setting';
1
+ export * from './use-column-setting';
2
+ export * from './use-expand-fixed';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA","sourcesContent":["export * from './use-column-setting'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA","sourcesContent":["export * from './use-column-setting'\nexport * from './use-expand-fixed'\n"]}
@@ -0,0 +1,76 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { makeRandomCode } from '../utils';
3
+ export const useExpandFixed = () => {
4
+ const curTableKey = useRef(makeRandomCode());
5
+ const activeKeyRef = useRef(null);
6
+ const oldActiveKeyRef = useRef({
7
+ main: null,
8
+ right: null,
9
+ left: null
10
+ });
11
+ const container = useRef(null);
12
+ const observer = useRef(null);
13
+ const getDom = key => {
14
+ const main = document.querySelector(`.${curTableKey.current} .ant-table-scroll [data-row-key="${key}-extra-row"]`) || document.querySelector(`.${curTableKey.current} .ant-table-default [data-row-key="${key}-extra-row"]`);
15
+ const right = document.querySelector(`.${curTableKey.current} .ant-table-fixed-right [data-row-key="${key}-extra-row"]`);
16
+ const left = document.querySelector(`.${curTableKey.current} .ant-table-fixed-left [data-row-key="${key}-extra-row"]`);
17
+ return [main, right, left];
18
+ };
19
+ const expand = async () => {
20
+ const [main, right, left] = getDom(String(activeKeyRef.current) || '');
21
+ if (right) {
22
+ right.setAttribute('style', `display: inline-block; height: ${(main === null || main === void 0 ? void 0 : main.offsetHeight) || 0}px; overflow: hidden;`);
23
+ }
24
+ if (left) {
25
+ left.setAttribute('style', `display: inline-block; height: ${(main === null || main === void 0 ? void 0 : main.offsetHeight) || 0}px; overflow: hidden;`);
26
+ }
27
+ if (main) {
28
+ // 解决 expandIconAsCell为true 且 iconCell的td元素为display: none;时, 展开内容滚动到最右边,会多出一部分iconCell所占据的空间 的问题
29
+ const td = main.childNodes[1];
30
+ const colspan = td.getAttribute('colspan') || 0;
31
+ const Oldcolspan = td.getAttribute('oldcolspan') || 0;
32
+ const newColspan = Oldcolspan ? Oldcolspan : Number(colspan) + 1 + '';
33
+ if (!Oldcolspan) td.setAttribute('oldcolspan', newColspan);
34
+ td.setAttribute('colspan', newColspan);
35
+ //
36
+ }
37
+ oldActiveKeyRef.current = {
38
+ main,
39
+ right,
40
+ left
41
+ };
42
+ };
43
+ const ob = () => {
44
+ const classname = curTableKey.current;
45
+ if (!classname) return;
46
+ container.current = document.querySelector(`.${classname}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`);
47
+ observer.current = new MutationObserver(expand);
48
+ observer.current.observe(container.current, {
49
+ childList: true,
50
+ attributes: true
51
+ });
52
+ };
53
+ const setChangedKey = key => {
54
+ activeKeyRef.current = key;
55
+ };
56
+ const trigger = key => {
57
+ setChangedKey(key);
58
+ const className = curTableKey.current;
59
+ if (!className) return;
60
+ const dom = document === null || document === void 0 ? void 0 : document.querySelector(`.${className}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`);
61
+ dom === null || dom === void 0 ? void 0 : dom.setAttribute('c-data', 'Mutation');
62
+ };
63
+ useEffect(() => {
64
+ ob();
65
+ }, [curTableKey.current]);
66
+ return [curTableKey.current, trigger];
67
+ };
68
+ export const findRowKey = (record, rowKey) => {
69
+ let res = '';
70
+ if (typeof rowKey === 'function') {
71
+ res = [record].map(rowKey)[0];
72
+ } else if (typeof rowKey === 'string') {
73
+ res = record[rowKey];
74
+ }
75
+ return res;
76
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-expand-fixed.js","sourceRoot":"","sources":["../../../src/table/hooks/use-expand-fixed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAUzC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,MAAM,CAAU,cAAc,EAAE,CAAC,CAAA;IACrD,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAA;IAChD,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,GAAW,EAAE,EAAE;QAC9B,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAA;QACrC,IAAI,CAAC,SAAS;YAAE,OAAM;QACtB,MAAM,GAAG,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,CACjC,IAAI,SAAS,iGAAiG,CAC/G,CAAA;QACD,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IACzC,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,EAAE,CAAA;IACN,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzB,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,OAAgC,CAAU,CAAA;AACzE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,MAAW,EACX,MAAyD,EACzD,EAAE;IACF,IAAI,GAAG,GAAoB,EAAE,CAAA;IAC7B,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;QAChC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;KAC9B;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACrC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;KACrB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import { useEffect, useRef } from 'react'\nimport { makeRandomCode } from '../utils'\n\nexport type keyType = string | number | null\n\ninterface OldDom {\n main: HTMLDivElement | null\n right: HTMLDivElement | null\n left: HTMLDivElement | null\n}\n\nexport const useExpandFixed = () => {\n const curTableKey = useRef<keyType>(makeRandomCode())\n const activeKeyRef = useRef<string | null>(null)\n const oldActiveKeyRef = useRef<OldDom>({\n main: null,\n right: null,\n left: null,\n })\n const container = useRef<HTMLDivElement | null>(null)\n const observer = useRef<MutationObserver | null>(null)\n\n const getDom = (key: string | number | undefined) => {\n const main =\n (document.querySelector(\n `.${curTableKey.current} .ant-table-scroll [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement) ||\n (document.querySelector(\n `.${curTableKey.current} .ant-table-default [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement)\n const right = document.querySelector(\n `.${curTableKey.current} .ant-table-fixed-right [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement\n const left = document.querySelector(\n `.${curTableKey.current} .ant-table-fixed-left [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement\n return [main, right, left]\n }\n\n const expand = async () => {\n const [main, right, left] = getDom(String(activeKeyRef.current) || '')\n\n if (right) {\n right.setAttribute(\n 'style',\n `display: inline-block; height: ${main?.offsetHeight || 0}px; overflow: hidden;`\n )\n }\n\n if (left) {\n left.setAttribute(\n 'style',\n `display: inline-block; height: ${main?.offsetHeight || 0}px; overflow: hidden;`\n )\n }\n\n if (main) {\n // 解决 expandIconAsCell为true 且 iconCell的td元素为display: none;时, 展开内容滚动到最右边,会多出一部分iconCell所占据的空间 的问题\n const td = main.childNodes[1] as HTMLDivElement\n\n const colspan = td.getAttribute('colspan') || 0\n const Oldcolspan = td.getAttribute('oldcolspan') || 0\n const newColspan = Oldcolspan ? Oldcolspan : Number(colspan) + 1 + ''\n if (!Oldcolspan) td.setAttribute('oldcolspan', newColspan)\n\n td.setAttribute('colspan', newColspan)\n //\n }\n\n oldActiveKeyRef.current = {\n main,\n right,\n left,\n }\n }\n\n const ob = () => {\n const classname = curTableKey.current\n if (!classname) return\n\n container.current = document.querySelector(\n `.${classname}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`\n ) as HTMLDivElement\n\n observer.current = new MutationObserver(expand)\n observer.current.observe(container.current, {\n childList: true, // 子节点的变动\n attributes: true,\n })\n }\n\n const setChangedKey = (key: string) => {\n activeKeyRef.current = key\n }\n\n const trigger = (key: string) => {\n setChangedKey(key)\n const className = curTableKey.current\n if (!className) return\n const dom = document?.querySelector(\n `.${className}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`\n )\n dom?.setAttribute('c-data', 'Mutation')\n }\n\n useEffect(() => {\n ob()\n }, [curTableKey.current])\n\n return [curTableKey.current, trigger as (key: string) => void] as const\n}\n\nexport const findRowKey = (\n record: any,\n rowKey: string | ((record: any, index: number) => string)\n) => {\n let res: string | number = ''\n if (typeof rowKey === 'function') {\n res = [record].map(rowKey)[0]\n } else if (typeof rowKey === 'string') {\n res = record[rowKey]\n }\n\n return res\n}\n"]}
package/es/table/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import './style';
2
2
  import { Table } from './table';
3
3
  import './table.less';
4
+ import './expand.less';
4
5
  export * from './table';
5
6
  export default Table;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,cAAc,CAAA;AAErB,cAAc,SAAS,CAAA;AAEvB,eAAe,KAAK,CAAA","sourcesContent":["import './style'\nimport { Table } from './table'\nimport './table.less'\n\nexport * from './table'\n\nexport default Table\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,cAAc,CAAA;AACrB,OAAO,eAAe,CAAA;AAEtB,cAAc,SAAS,CAAA;AAEvB,eAAe,KAAK,CAAA","sourcesContent":["import './style'\nimport { Table } from './table'\nimport './table.less'\nimport './expand.less'\n\nexport * from './table'\n\nexport default Table\n"]}
@@ -233,7 +233,7 @@
233
233
  transition: all 0.3s, height 0s;
234
234
  &.@{table-prefix-cls}-row-hover,
235
235
  &:hover {
236
- &:not(.@{table-prefix-cls}-expanded-row):not(.@{table-prefix-cls}-row-selected) {
236
+ &:not(.@{table-prefix-cls}-expanded-row) {
237
237
  box-shadow: 0px 0px 5px -5px rgba(0, 0, 0, 0.05), 0px 0px 25px 0px rgba(0, 0, 0, 0.1);
238
238
  position: relative;
239
239
  > td {
@@ -243,34 +243,6 @@
243
243
  }
244
244
  }
245
245
 
246
- &-thead > tr,
247
- &-tbody > tr {
248
- transition: all 0.3s, height 0s;
249
- // &.@{table-prefix-cls}-row-hover,
250
- // &:hover {
251
- // &:not(.@{table-prefix-cls}-expanded-row):not(.@{table-prefix-cls}-row-selected) {
252
- // box-shadow: 0px 0px 5px -5px rgba(0, 0, 0, 0.05), 0px 0px 25px 0px rgba(0, 0, 0, 0.1);
253
- // position: relative;
254
- // > td {
255
- // background: @table-row-hover-bg;
256
- // }
257
- // }
258
- // }
259
- &.@{table-prefix-cls}-row-selected > td {
260
- &.@{table-prefix-cls}-column-sort {
261
- background: @table-body-selected-sort-bg;
262
- }
263
- }
264
- &:hover {
265
- &.@{table-prefix-cls}-row-selected > td {
266
- background: @table-selected-row-hover-bg;
267
- &.@{table-prefix-cls}-column-sort {
268
- background: @table-body-selected-sort-bg;
269
- }
270
- }
271
- }
272
- }
273
-
274
246
  &-thead > tr:hover {
275
247
  background: none;
276
248
  }
@@ -334,8 +306,22 @@
334
306
  }
335
307
 
336
308
  &-tbody > tr.@{table-prefix-cls}-row-selected td {
337
- color: @table-selected-row-color;
338
- background: @table-selected-row-bg;
309
+ // color: @table-selected-row-color;
310
+ // background: @table-selected-row-bg;
311
+ &.@{table-prefix-cls}-selection-column {
312
+ position: relative;
313
+ &::after {
314
+ content: ' ';
315
+ width: 4px;
316
+ height: calc(100% - 10px);
317
+ background: @blue-5;
318
+ display: block;
319
+ position: absolute;
320
+ top: 5px;
321
+ left: 0;
322
+ border-radius: 0 4px 4px 0;
323
+ }
324
+ }
339
325
  }
340
326
 
341
327
  &-thead > tr > th.@{table-prefix-cls}-column-sort {