ct-component-plus 0.0.39 → 0.0.40

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.40",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -57,4 +57,6 @@ export const tableProps = {
57
57
  default: "暂无数据",
58
58
  },
59
59
  mergeList: Array,
60
+ alignLeftKeys: Array,
61
+ alignRightKeys: Array,
60
62
  }
@@ -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 || {}">
@@ -137,6 +137,18 @@ const showData = computed(() => {
137
137
  const columnData = computed(() => {
138
138
  return props.tableProps.columnData || [];
139
139
  });
140
+ const getColumnAlign = (column) => {
141
+ if (column.align) {
142
+ return column.align;
143
+ }
144
+ if (props.alignLeftKeys && props.alignLeftKeys.includes(column.value)) {
145
+ return "left";
146
+ }
147
+ if (props.alignRightKeys && props.alignRightKeys.includes(column.value)) {
148
+ return "right";
149
+ }
150
+ return "center";
151
+ };
140
152
  const judgeWidth = (column, index) => {
141
153
  // 判断处理column的width
142
154
  const columnWidth = props.columnWidth;