ct-component-plus 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ct-component-plus",
3
3
  "private": false,
4
- "version": "0.0.39",
4
+ "version": "0.0.41",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -15,7 +15,7 @@
15
15
  "docs:build": "vuepress build docs"
16
16
  },
17
17
  "dependencies": {
18
- "cingta-icon": "^2.0.2",
18
+ "cingta-icon": "^2.1.3",
19
19
  "element-plus": "~2.3.4",
20
20
  "vue": "^3.2.47"
21
21
  },
@@ -57,4 +57,7 @@ export const tableProps = {
57
57
  default: "暂无数据",
58
58
  },
59
59
  mergeList: Array,
60
+ alignLeftKeys: Array,
61
+ alignRightKeys: Array,
62
+ rowKey: String,
60
63
  }
@@ -7,7 +7,7 @@
7
7
  :data="showData"
8
8
  :span-method="spanMethod"
9
9
  @selection-change="handleSelectChange"
10
- row-key="rowKey"
10
+ :row-key="rowKey || 'rowKey'"
11
11
  v-bind="$attrs">
12
12
  <el-table-column
13
13
  v-if="isMultiSelect"
@@ -25,7 +25,7 @@
25
25
  :min-width="judgeMinWidth(column, index)"
26
26
  :sort-orders="['ascending', 'descending']"
27
27
  :sortable="column.sortable ? 'custom' : false"
28
- :align="column.align || 'center'"
28
+ :align="getColumnAlign(column)"
29
29
  :fixed="column.fixed || false"
30
30
  show-overflow-tooltip
31
31
  v-bind="column.rawAttr || {}">
@@ -55,7 +55,7 @@
55
55
  :min-width="judgeMinWidth(column1, index)"
56
56
  :sort-orders="['ascending', 'descending']"
57
57
  :sortable="column1.sortable ? 'custom' : false"
58
- :align="column1.align || 'center'"
58
+ :align="getColumnAlign(column1)"
59
59
  :fixed="column1.fixed || false"
60
60
  show-overflow-tooltip
61
61
  v-bind="column1.rawAttr || {}">
@@ -119,12 +119,13 @@ const handleCurrentChange = (val) => {
119
119
  pageNo.value = val;
120
120
  };
121
121
  const showData = computed(() => {
122
- const table = props.tableProps.tableData.map((item, index) => {
123
- return {
124
- ...item,
125
- rowKey: `ct-row-${index}`,
126
- };
127
- });
122
+ // const table = props.tableProps.tableData.map((item, index) => {
123
+ // return {
124
+ // ...item,
125
+ // rowKey: `ct-row-${index}`,
126
+ // };
127
+ // });
128
+ const table = props.tableProps.tableData;
128
129
  if (props.pagination) {
129
130
  return table.slice(
130
131
  (pageNo.value - 1) * pageSize.value,
@@ -137,6 +138,18 @@ const showData = computed(() => {
137
138
  const columnData = computed(() => {
138
139
  return props.tableProps.columnData || [];
139
140
  });
141
+ const getColumnAlign = (column) => {
142
+ if (column.align) {
143
+ return column.align;
144
+ }
145
+ if (props.alignLeftKeys && props.alignLeftKeys.includes(column.value)) {
146
+ return "left";
147
+ }
148
+ if (props.alignRightKeys && props.alignRightKeys.includes(column.value)) {
149
+ return "right";
150
+ }
151
+ return "center";
152
+ };
140
153
  const judgeWidth = (column, index) => {
141
154
  // 判断处理column的width
142
155
  const columnWidth = props.columnWidth;