bhd-components 0.2.2 → 0.2.4

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 (46) hide show
  1. package/README.md +0 -10
  2. package/dist/table.esm.es5.development.css +113 -23
  3. package/dist/table.esm.es5.development.js +14 -9
  4. package/dist/table.esm.es5.production.css +1 -1
  5. package/dist/table.esm.es5.production.js +1 -1
  6. package/es2017/index.d.ts +72 -68
  7. package/es2017/index.js +9 -2
  8. package/es2017/message/index.d.ts +18 -0
  9. package/es2017/message/index.js +42 -0
  10. package/es2017/message/index.module.less +91 -0
  11. package/es2017/pagination/index.d.ts +4 -0
  12. package/es2017/pagination/index.js +13 -0
  13. package/es2017/pagination/index.module.less +49 -0
  14. package/es2017/table/index.js +12 -8
  15. package/es2017/table/index.module.less +128 -5
  16. package/es2017/tableSelect/index.d.ts +3 -0
  17. package/es2017/tableSelect/index.js +74 -0
  18. package/es2017/tableSelect/index.module.less +21 -0
  19. package/es2017/theme/variable.less +625 -0
  20. package/es2017/titleBar/index.d.ts +11 -0
  21. package/es2017/titleBar/index.js +51 -0
  22. package/es2017/titleBar/index.module.less +44 -0
  23. package/es2017/viewImage/index.d.ts +3 -0
  24. package/es2017/viewImage/index.js +180 -0
  25. package/es2017/viewImage/index.module.less +170 -0
  26. package/esm/index.d.ts +72 -68
  27. package/esm/index.js +9 -2
  28. package/esm/message/index.d.ts +18 -0
  29. package/esm/message/index.js +42 -0
  30. package/esm/message/index.module.less +91 -0
  31. package/esm/pagination/index.d.ts +4 -0
  32. package/esm/pagination/index.js +13 -0
  33. package/esm/pagination/index.module.less +49 -0
  34. package/esm/table/index.js +12 -8
  35. package/esm/table/index.module.less +128 -5
  36. package/esm/tableSelect/index.d.ts +3 -0
  37. package/esm/tableSelect/index.js +74 -0
  38. package/esm/tableSelect/index.module.less +21 -0
  39. package/esm/theme/variable.less +625 -0
  40. package/esm/titleBar/index.d.ts +11 -0
  41. package/esm/titleBar/index.js +51 -0
  42. package/esm/titleBar/index.module.less +44 -0
  43. package/esm/viewImage/index.d.ts +3 -0
  44. package/esm/viewImage/index.js +185 -0
  45. package/esm/viewImage/index.module.less +170 -0
  46. package/package.json +6 -5
@@ -0,0 +1,91 @@
1
+ // .bhd-message-notice {
2
+ // /* success */
3
+ // &.bhd-message-notice-success {
4
+ // .bhd-message-notice-content {
5
+ // background: #5991ef;
6
+ // color: #ffffff;
7
+ // font-weight: 500;
8
+ // // font-family: 'PingFang SC';
9
+ // font-size: 14px;
10
+ // .bhd-message-success {
11
+ // & > .anticon {
12
+ // color: #ffffff;
13
+ // font-size: 14px;
14
+ // }
15
+ // }
16
+ // }
17
+ // }
18
+ // /* warn */
19
+ // &.bhd-message-notice-warning {
20
+ // }
21
+ // /* error */
22
+ // &.bhd-message-notice-error {
23
+ // .bhd-message-notice-content {
24
+ // background-color: #f8700c;
25
+ // color: #ffffff;
26
+ // font-weight: 500;
27
+ // // font-family: 'PingFang SC';
28
+ // font-size: 14px;
29
+ // .bhd-message-error {
30
+ // & > .anticon {
31
+ // color: #ffffff;
32
+ // font-size: 14px;
33
+ // }
34
+ // }
35
+ // }
36
+ // }
37
+ // }
38
+
39
+ /* 成功 */
40
+ .customSuccess {
41
+ :global {
42
+ .bhd-message-notice-content {
43
+ background: #5991ef !important;
44
+ color: #ffffff;
45
+ font-weight: 500;
46
+ font-size: 14px;
47
+ .bhd-message-success {
48
+ & > .anticon {
49
+ color: #ffffff;
50
+ font-size: 14px;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ /* 警告 */
58
+ .customWarning {
59
+ :global {
60
+ .bhd-message-notice-content {
61
+ background-color: #fadb14 !important;
62
+ color: #ffffff;
63
+ font-weight: 500;
64
+ font-size: 14px;
65
+ .bhd-message-warning {
66
+ & > .anticon {
67
+ color: #ffffff;
68
+ font-size: 14px;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ /* 错误 */
76
+ .customError {
77
+ :global {
78
+ .bhd-message-notice-content {
79
+ background-color: #f8700c !important;
80
+ color: #ffffff;
81
+ font-weight: 500;
82
+ font-size: 14px;
83
+ .bhd-message-error {
84
+ & > .anticon {
85
+ color: #ffffff;
86
+ font-size: 14px;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { PaginationProps } from "antd/es/pagination";
3
+ declare const BhdPagination: (props: PaginationProps) => JSX.Element;
4
+ export default BhdPagination;
@@ -0,0 +1,13 @@
1
+ import _object_spread from "@swc/helpers/src/_object_spread.mjs";
2
+ import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
3
+ import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
4
+ import * as React from "react";
5
+ import styles from "./index.module.less";
6
+ import { Pagination } from "antd";
7
+ var BhdPagination = function(props) {
8
+ var className = "".concat(styles.pagination, " ").concat(props.className || "");
9
+ return /*#__PURE__*/ _jsx(Pagination, _object_spread_props(_object_spread({}, props), {
10
+ className: className
11
+ }));
12
+ };
13
+ export default BhdPagination;
@@ -0,0 +1,49 @@
1
+ .pagination{
2
+ :global{
3
+ .bhd-pagination-item{
4
+ border-color: transparent;
5
+ }
6
+ .bhd-pagination-item-link{
7
+ border: none!important;
8
+ background: none!important;
9
+ }
10
+ .bhd-pagination-item-active{
11
+ background-color: #f4523b;
12
+ &:hover{
13
+ background-color: #ff7d66;
14
+ &>a{
15
+ color: #FFFFFF;
16
+ }
17
+ }
18
+ &>a{
19
+ color: #FFFFFF;
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ :global{
26
+ .bhd-pagination-disabled{
27
+ .bhd-pagination-item{
28
+ border: none!important;
29
+ background: none!important;
30
+ color: rgba(0, 0, 0, 0.25)!important;
31
+ a{
32
+ color: rgba(0, 0, 0, 0.25)!important;
33
+ }
34
+ }
35
+ }
36
+
37
+ .bhd-pagination-mini{
38
+ .bhd-pagination-item{
39
+ margin-right: 8px !important;
40
+ }
41
+ .bhd-pagination-item:not(.bhd-pagination-item-active){
42
+ &:hover{
43
+ background-color:transparent!important;
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+
@@ -36,16 +36,20 @@ var Table = function(props) {
36
36
  180,
37
37
  240,
38
38
  320
39
- ] : _props_defaultWidthRang, _props_isFixedLeft = props.isFixedLeft, isFixedLeft = _props_isFixedLeft === void 0 ? true : _props_isFixedLeft, _props_isFixedRight = props.isFixedRight, isFixedRight = _props_isFixedRight === void 0 ? true : _props_isFixedRight;
39
+ ] : _props_defaultWidthRang, _props_isFixedLeft = props.isFixedLeft, isFixedLeft = _props_isFixedLeft === void 0 ? true : _props_isFixedLeft, _props_isFixedRight = props.isFixedRight, isFixedRight = _props_isFixedRight === void 0 ? true : _props_isFixedRight, _props_bordered = props.bordered, bordered = _props_bordered === void 0 ? false : _props_bordered, kind = props.kind;
40
40
  var _useState = _sliced_to_array(useState(props.columns || []), 2), columns = _useState[0], setColumns = _useState[1];
41
41
  var _useState1 = _sliced_to_array(useState(props.scroll || undefined), 2), scrollObject = _useState1[0], setScrollObject = _useState1[1];
42
42
  var columnTootipClassName = props.columnTootipClassName, columnTootipColor = props.columnTootipColor;
43
43
  var initColumns = function() {
44
- var _initColumnsWidth = initColumnsWidth(props.columns, tableRef.current.offsetWidth), selfColumns = _initColumnsWidth.columns;
44
+ var scrollBarDom = tableRef.current.getElementsByClassName("bhd-table-cell-scrollbar")[0];
45
+ var scrollBarWidth = scrollBarDom ? scrollBarDom.clientWidth : 0;
46
+ var tableWidth = bordered ? tableRef.current.offsetWidth - 2 - scrollBarWidth : tableRef.current.offsetWidth - scrollBarWidth;
47
+ console.log("gaodug", scrollBarWidth);
48
+ var _initColumnsWidth = initColumnsWidth(props.columns, tableWidth), selfColumns = _initColumnsWidth.columns;
45
49
  setColumns(selfColumns);
46
50
  var obj = scrollObject ? scrollObject : {};
47
51
  obj = _object_spread_props(_object_spread({}, obj), {
48
- x: tableRef.current.offsetWidth
52
+ x: tableWidth
49
53
  });
50
54
  setScrollObject(obj);
51
55
  };
@@ -57,7 +61,7 @@ var Table = function(props) {
57
61
  item.width = item.width || "auto";
58
62
  // item.width=parseFloat(item.width)
59
63
  if (widthPercentage.test(item.width)) //检测到宽度为百分比 则转换为具体px 如大于100% 则视为自适应
60
- item.width = parseFloat(item.width) >= 100 ? "auto" : tableWidth * item.width;
64
+ item.width = parseFloat(item.width) >= 100 ? "auto" : tableWidth * parseFloat(item.width) / 100;
61
65
  else if (typeof item.width === "number") //检测为number 则为具体的像素值
62
66
  item.width = item.width;
63
67
  else if (widthPx.test(item.width)) //检测为 "12px" 则为具体的值
@@ -114,7 +118,6 @@ var Table = function(props) {
114
118
  }
115
119
  return item;
116
120
  });
117
- // console.log("diffdiff",diff,tableWidth,minWidth,avgWidth,columns,autoNum)
118
121
  columns = columns.map(function(item, index) {
119
122
  //存在适应自适应列侯 多余宽度 则平均分配每一列(除最后一列)
120
123
  if (avgWidth > 0 && index !== columns.length - 1) item.width += avgWidth / columns.length - 1;
@@ -142,7 +145,9 @@ var Table = function(props) {
142
145
  }, obj.style)
143
146
  });
144
147
  };
145
- console.log("宽度宽度", item, item.width, item.widthRang);
148
+ // if(isNaN(item.width)){
149
+ // console.log("宽度宽度",item,item.width,item.widthRang)
150
+ // }
146
151
  return item;
147
152
  });
148
153
  return {
@@ -175,12 +180,11 @@ var Table = function(props) {
175
180
  }
176
181
  });
177
182
  return /*#__PURE__*/ _jsx("div", {
178
- className: styles.Table,
183
+ className: "".concat(styles.Table, " ").concat(kind === "simple" ? styles.SmallTable : ""),
179
184
  ref: tableRef,
180
185
  children: /*#__PURE__*/ _jsx(AntdTable, _object_spread({}, config))
181
186
  });
182
187
  };
183
- // let BhdTable=Provider(Table)
184
188
  Table.SELECTION_COLUMN = AntdTable.SELECTION_COLUMN;
185
189
  Table.EXPAND_COLUMN = AntdTable.EXPAND_COLUMN;
186
190
  Table.SELECTION_ALL = AntdTable.SELECTION_ALL;
@@ -1,5 +1,8 @@
1
+ // @import url("../theme/variable.less");
2
+
1
3
  .Table {
2
4
  width: 100%;
5
+ // color:@customColor;
3
6
  :global {
4
7
  table {
5
8
  th,
@@ -14,13 +17,13 @@
14
17
  font-size: 16px;
15
18
  color: rgba(0, 0, 0, 0.85);
16
19
  white-space: nowrap;
20
+ background: #fafafa;
17
21
  &:nth-child(1) {
18
22
  padding-left: 40px;
19
23
  }
20
24
  &:last-child {
21
25
  padding-right: 40px;
22
26
  }
23
- background: #fafafa;
24
27
  &::before {
25
28
  display: none;
26
29
  }
@@ -55,8 +58,8 @@
55
58
  padding-right: 40px;
56
59
  }
57
60
  /* 多选框 距右的距离 */
58
- &.bhd-table-selection-column{
59
- padding-inline-end:16px;
61
+ &.bhd-table-selection-column {
62
+ padding-inline-end: 16px;
60
63
  }
61
64
  }
62
65
  }
@@ -73,13 +76,133 @@
73
76
  }
74
77
 
75
78
  /* scroll 固定列 设置overflow:hidden 阴影消失问题 */
76
- .bhd-table-cell-fix-left-first::after,.bhd-table-cell-fix-left-last::after{
79
+ .bhd-table-cell-fix-left-first::after,
80
+ .bhd-table-cell-fix-left-last::after {
77
81
  right: 2px;
78
82
  }
79
- .bhd-table-cell-fix-right-first::after,.bhd-table-cell-fix-right-last::after{
83
+ .bhd-table-cell-fix-right-first::after,
84
+ .bhd-table-cell-fix-right-last::after {
80
85
  left: 2px;
81
86
  }
82
87
  }
88
+ /* 分页器 */
89
+ .bhd-pagination {
90
+ .bhd-pagination-item {
91
+ border-color: transparent;
92
+ }
93
+ .bhd-pagination-item-link {
94
+ border: none !important;
95
+ background: none !important;
96
+ }
97
+ .bhd-pagination-item-active {
98
+ background-color: #f4523b;
99
+ &:hover {
100
+ background-color: #ff7d66;
101
+ & > a {
102
+ color: #ffffff;
103
+ }
104
+ }
105
+ & > a {
106
+ color: #ffffff;
107
+ }
108
+ }
109
+ &.bhd-pagination-disabled {
110
+ .bhd-pagination-item {
111
+ border: none !important;
112
+ background: none !important;
113
+ color: rgba(0, 0, 0, 0.25) !important;
114
+ a {
115
+ color: rgba(0, 0, 0, 0.25) !important;
116
+ }
117
+ }
118
+ }
119
+
120
+ &.bhd-pagination-mini {
121
+ .bhd-pagination-item {
122
+ margin-right: 8px !important;
123
+ }
124
+ .bhd-pagination-item:not(.bhd-pagination-item-active) {
125
+ &:hover {
126
+ background-color: transparent !important;
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ &.SmallTable{
134
+ :global{
135
+ table {
136
+ th,
137
+ td {
138
+ border: none;
139
+ border-bottom: 1px solid #EBEBEB;
140
+ }
141
+ & > .bhd-table-thead {
142
+ & > tr {
143
+ & > .bhd-table-cell {
144
+ font-weight: 500;
145
+ font-size: 16px;
146
+ color: rgba(0, 0, 0, 0.85);
147
+ white-space: nowrap;
148
+ padding-top: 8px;
149
+ padding-bottom: 8px;
150
+ background-color: #fafafa;
151
+ &:nth-child(1) {
152
+ padding-left: 40px;
153
+ }
154
+ &:last-child {
155
+ padding-right: 40px;
156
+ }
157
+ // background: @color-background-fillquaternary-Tr;
158
+ &::before {
159
+ display: none;
160
+ }
161
+ &.bhd-table-selection-column {
162
+ padding-inline-end: 16px;
163
+ }
164
+ }
165
+ }
166
+ }
167
+ tbody {
168
+ tr.bhd-table-placeholder {
169
+ &:hover {
170
+ td {
171
+ background-color: #ffffff;
172
+ }
173
+ }
174
+ }
175
+ tr:not(.bhd-table-placeholder) {
176
+ background: transparent;
177
+ &:hover {
178
+ td {
179
+ background-color: #F5F5F5 !important;
180
+ }
181
+ }
182
+ td {
183
+ word-wrap: break-word;
184
+ word-break: break-all;
185
+ overflow: hidden;
186
+ white-space: nowrap;
187
+ text-overflow: ellipsis;
188
+ padding-top: 13.5px;
189
+ padding-bottom: 13.5px;
190
+ &:nth-child(1) {
191
+ padding-left: 40px;
192
+ }
193
+ &:last-child {
194
+ padding-right: 40px;
195
+ }
196
+ /* 多选框 距右的距离 */
197
+ &.bhd-table-selection-column {
198
+ padding-inline-end: 16px;
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+
83
206
  }
84
207
  }
85
208
 
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const BhdTableSelect: (props: any) => JSX.Element;
3
+ export default BhdTableSelect;
@@ -0,0 +1,74 @@
1
+ /*
2
+ * @Author: xiazhi
3
+ * @Date: 2023-06-06 14:37:48
4
+ */ import _object_spread from "@swc/helpers/src/_object_spread.mjs";
5
+ import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
6
+ import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
7
+ import * as React from "react";
8
+ import { useRef } from "react";
9
+ import { Select } from "antd";
10
+ //import type { SelectProps } from 'antd';
11
+ import styles from "./index.module.less";
12
+ var BhdTableSelect = function(props) {
13
+ var _props_className = props.// initOption=[],
14
+ // initOptionType='default',
15
+ className, className = _props_className === void 0 ? "" : _props_className, _props_popupClassName = props.popupClassName, popupClassName = _props_popupClassName === void 0 ? "" : _props_popupClassName, _props_dropdownStyle = props.dropdownStyle, dropdownStyle = _props_dropdownStyle === void 0 ? {} : _props_dropdownStyle, children = props.children;
16
+ var tableSelectRef = useRef(null);
17
+ // const handleTypeSwitchOption=()=>{
18
+ // switch(initOptionType){
19
+ // case 'imageText':
20
+ // return initOption.map(item=>{
21
+ // return <Option
22
+ // key={item.value}
23
+ // value={item.value}
24
+ // label={
25
+ // <div className={styles.BhdTableSelect_option_lable}>
26
+ // <img src={item.img} alt="" />
27
+ // <span>{item.label}</span>
28
+ // </div>
29
+ // }>
30
+ // <div className={styles.BhdTableSelect_option_value}>
31
+ // <div>
32
+ // <img src={item.headSculpture} alt="" />
33
+ // <div>
34
+ // <p>
35
+ // <span>{item.userName}</span>
36
+ // <div>
37
+ // {item.labels.map((ele:any)=><span>{ele}</span>)}
38
+ // </div>
39
+ // </p>
40
+ // <p>{item.ipone}</p>
41
+ // </div>
42
+ // </div>
43
+ // </div>
44
+ // </Option>
45
+ // })
46
+ // default:
47
+ // return initOption.map(item=><Option key={item.value} value={item.value}>{item.label}</Option>);
48
+ // }
49
+ // }
50
+ // useEffect(()=>{
51
+ // // if(initOption && initOption.length>0){
52
+ // // handleTypeSwitchOption();
53
+ // // }
54
+ // },[initOption]);
55
+ var config = _object_spread_props(_object_spread({}, props), {
56
+ dropdownStyle: _object_spread_props(_object_spread({}, dropdownStyle), {
57
+ padding: 0,
58
+ borderRadius: 4,
59
+ border: "1px solid rgba(0,0,0,0.15)"
60
+ }),
61
+ popupClassName: popupClassName ? "".concat(popupClassName, " ").concat(styles.BhdTableSelect_popup) : styles.BhdTableSelect_popup
62
+ });
63
+ return /*#__PURE__*/ _jsx("div", {
64
+ className: "".concat(styles.BhdTableSelect, " ").concat(className),
65
+ ref: tableSelectRef,
66
+ children: /*#__PURE__*/ _jsx(Select, _object_spread_props(_object_spread({}, config), {
67
+ children: children
68
+ }))
69
+ });
70
+ };
71
+ BhdTableSelect.Option = function() {
72
+ return Select.Option;
73
+ };
74
+ export default BhdTableSelect;
@@ -0,0 +1,21 @@
1
+ .BhdTableSelect{
2
+ :global{
3
+ .bhd-select-selector{
4
+ padding-left: 0 !important;
5
+ .bhd-select-selection-search{
6
+ inset-inline-start:0;
7
+ }
8
+ .bhd-select-selection-item{
9
+ font-size: 16px;
10
+ font-family: PingFang SC-Regular, PingFang SC;
11
+ font-weight: 400;
12
+ color: rgba(0,0,0,0.85);
13
+ line-height: 24px;
14
+ }
15
+ }
16
+ .bhd-select-arrow{
17
+ margin-top: -9px;
18
+ inset-inline-end: 6px;
19
+ }
20
+ }
21
+ }