ct-component-plus 0.0.38 → 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.38",
4
+ "version": "0.0.40",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -5,9 +5,13 @@
5
5
  v-for="item in optionList"
6
6
  :key="item.value"
7
7
  :label="item.value"
8
- :disabled="item.disabled"
9
- >{{ item.label }}</el-checkbox
10
- >
8
+ :disabled="item.disabled">
9
+ <template #default>
10
+ <slot v-bind="item">
11
+ {{ item.label }}
12
+ </slot>
13
+ </template>
14
+ </el-checkbox>
11
15
  </el-checkbox-group>
12
16
  </template>
13
17
 
@@ -44,5 +48,4 @@ defineExpose({
44
48
  });
45
49
  onMounted(() => {});
46
50
  </script>
47
- <style lang='less'>
48
- </style>
51
+ <style lang="less"></style>
@@ -61,12 +61,13 @@ const install = function (app, options) {
61
61
  app.use(cingtaIcon)
62
62
  let serviceOptions = {}
63
63
  if (isObject(options)) {
64
- const { tableEmptyDom } = options;
64
+ const { tableEmptyDom, selectTooltip = false } = options;
65
65
  if (!options.baseDao) {
66
66
  console.warn('当前使用的组件库没有配置baseDao')
67
67
  } else {
68
68
  app.provide('$ctBaseDao', options.baseDao)
69
69
  }
70
+ app.provide('$selectTooltip', selectTooltip)
70
71
  if (isObject(options.serviceOptions)) serviceOptions = options.serviceOptions;
71
72
  if (isObject(options.searchBoxComponent)) app.provide('$userDefinedSearchComponent', options.searchBoxComponent)
72
73
  if (isObject(tableEmptyDom)) app.provide('$tableEmptyDom', tableEmptyDom)
@@ -5,8 +5,7 @@
5
5
  <slot name="table-title">
6
6
  <ct-icon
7
7
  :class="[ns.e('total-icon')]"
8
- name="content-search_line"
9
- ></ct-icon>
8
+ name="content-search_line"></ct-icon>
10
9
  <span>查询结果:</span>
11
10
  <span>共{{ total }}条记录</span>
12
11
  <span>,每页显示{{ pageSize }}条</span>
@@ -21,15 +20,13 @@
21
20
  :class="[ns.e('handle-item'), ns.is(item, true)]"
22
21
  v-for="(item, index) in handleList"
23
22
  :key="index"
24
- v-show="handleItemShow(item)"
25
- >
23
+ v-show="handleItemShow(item)">
26
24
  <component
27
25
  v-if="handleItemShow(item)"
28
26
  :is="getHandleComponent(item)"
29
27
  v-bind="handleOptionsBind(item)"
30
28
  v-model:sortObj="modelSort"
31
- @download="download"
32
- />
29
+ @download="download" />
33
30
  </div>
34
31
  </div>
35
32
  <slot name="table-handle-after"></slot>
@@ -103,7 +100,7 @@ const handleItemShow = (item) => {
103
100
  };
104
101
  onMounted(() => {});
105
102
  </script>
106
- <style lang='less' scoped>
103
+ <style lang="less" scoped>
107
104
  .ct-page-table-title {
108
105
  &__container {
109
106
  display: flex;
@@ -120,6 +117,11 @@ onMounted(() => {});
120
117
  &__total-icon {
121
118
  margin-right: 8px;
122
119
  }
120
+ &__right {
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: flex-end;
124
+ }
123
125
  &__handle {
124
126
  display: flex;
125
127
  align-items: center;
@@ -146,4 +148,4 @@ onMounted(() => {});
146
148
  }
147
149
  }
148
150
  }
149
- </style>
151
+ </style>
@@ -346,6 +346,7 @@ export default {
346
346
  ),
347
347
  ]),
348
348
  ]),
349
+ slots.default ? slots.default() : null,
349
350
  ]),
350
351
  ]);
351
352
  },
@@ -53,7 +53,9 @@
53
53
  :value="item.value"
54
54
  :disabled="item.disabled">
55
55
  <slot name="option" :item="item" :index="index">
56
- <span>{{ item.label }}</span>
56
+ <span :title="selectTooltip ? item.label : undefined">{{
57
+ item.label
58
+ }}</span>
57
59
  </slot>
58
60
  </el-option>
59
61
  </slot>
@@ -75,6 +77,7 @@ import { isFunction, isArray } from "../../../utils";
75
77
  import Empty from "./empty.vue";
76
78
  const baseDao = inject("$ctBaseDao");
77
79
  const serviceConfig = inject("$ctServiceConfig");
80
+ const selectTooltip = inject("$selectTooltip");
78
81
 
79
82
  const props = defineProps(selectProps);
80
83
  const emit = defineEmits(selectEmits);
@@ -186,7 +189,6 @@ const watchServiceHandle = async () => {
186
189
  if (paramsHandle === false) return;
187
190
  params = paramsHandle || params;
188
191
  }
189
- console.log("method", method, props.api);
190
192
  baseDao[method](props.api, params).then((res) => {
191
193
  const mapObj = props.mapObj || {};
192
194
  const { list, label = "label", value = "value", self } = mapObj;
@@ -41,7 +41,7 @@ export const tableProps = {
41
41
  }
42
42
  },
43
43
  teleportDom: {
44
- type: [String, Node],
44
+ type: [String, Object],
45
45
  },
46
46
  defaultSort: {
47
47
  type: Object,
@@ -57,4 +57,6 @@ export const tableProps = {
57
57
  default: "暂无数据",
58
58
  },
59
59
  mergeList: Array,
60
+ alignLeftKeys: Array,
61
+ alignRightKeys: Array,
60
62
  }
@@ -14,7 +14,8 @@
14
14
  type="selection"
15
15
  width="88"
16
16
  v-bind="multiSelectAttr"
17
- :reserve-selection="true"></el-table-column>
17
+ :reserve-selection="true">
18
+ </el-table-column>
18
19
  <el-table-column
19
20
  v-for="(column, index) in columnData"
20
21
  :key="column.value + '-' + column.label"
@@ -24,7 +25,7 @@
24
25
  :min-width="judgeMinWidth(column, index)"
25
26
  :sort-orders="['ascending', 'descending']"
26
27
  :sortable="column.sortable ? 'custom' : false"
27
- :align="column.align || 'center'"
28
+ :align="getColumnAlign(column)"
28
29
  :fixed="column.fixed || false"
29
30
  show-overflow-tooltip
30
31
  v-bind="column.rawAttr || {}">
@@ -54,7 +55,7 @@
54
55
  :min-width="judgeMinWidth(column1, index)"
55
56
  :sort-orders="['ascending', 'descending']"
56
57
  :sortable="column1.sortable ? 'custom' : false"
57
- :align="column1.align || 'center'"
58
+ :align="getColumnAlign(column1)"
58
59
  :fixed="column1.fixed || false"
59
60
  show-overflow-tooltip
60
61
  v-bind="column1.rawAttr || {}">
@@ -136,6 +137,18 @@ const showData = computed(() => {
136
137
  const columnData = computed(() => {
137
138
  return props.tableProps.columnData || [];
138
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
+ };
139
152
  const judgeWidth = (column, index) => {
140
153
  // 判断处理column的width
141
154
  const columnWidth = props.columnWidth;