ct-component-plus 0.0.27 → 0.0.29

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.27",
4
+ "version": "0.0.29",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -77,5 +77,5 @@ const install = function (app, options) {
77
77
  export default {
78
78
  install
79
79
  }
80
-
80
+ export { CtMessage }
81
81
  export * from 'element-plus'
@@ -117,6 +117,14 @@ export default {
117
117
  state.pageNo = 1;
118
118
  getPageData();
119
119
  };
120
+ const setTableProps = (data) => {
121
+ const { total, tableData, columnData, list } = data;
122
+ state.total = total || 0;
123
+ if (columnData) {
124
+ tableProps.columnData = columnData;
125
+ }
126
+ tableProps.tableData = tableData || list || [];
127
+ };
120
128
  const getPageData = async (download = false) => {
121
129
  let dataP = {
122
130
  ...state.searchParams,
@@ -128,7 +136,14 @@ export default {
128
136
  state.pageError = false;
129
137
  state.pageLoading = true;
130
138
  if (isFunction(props.cbs.doSearch)) {
131
- await props.cbs.doSearch(dataP);
139
+ const res = await props.cbs.doSearch(dataP);
140
+ if (res) {
141
+ if (Array.isArray(res)) {
142
+ tableProps.tableData = res;
143
+ } else if (typeof res === "object") {
144
+ setTableProps(res);
145
+ }
146
+ }
132
147
  state.pageLoading = false;
133
148
  return;
134
149
  }
@@ -152,12 +167,7 @@ export default {
152
167
  const dataHandle = await props.cbs.afterSearch(data);
153
168
  if (dataHandle) data = dataHandle;
154
169
  }
155
- const { total, tableData, columnData, list } = data;
156
- state.total = total || 0;
157
- if (columnData) {
158
- tableProps.columnData = columnData;
159
- }
160
- tableProps.tableData = tableData || list || [];
170
+ setTableProps(data);
161
171
  })
162
172
  .catch(() => {
163
173
  state.pageError = true;
@@ -10,33 +10,28 @@
10
10
  ns.is('outer-border', outerBorder),
11
11
  ]"
12
12
  :key="item.param || index"
13
- :style="{ ...getComponentStyle(item) }"
14
- >
13
+ :style="{ ...getComponentStyle(item) }">
15
14
  <slot v-bind="getComponentSlotScope(item)">
16
15
  <slot
17
16
  name="item-before"
18
- v-bind="getComponentSlotScope(item)"
19
- ></slot>
17
+ v-bind="getComponentSlotScope(item)"></slot>
20
18
  <span
21
19
  :class="[
22
20
  ns.e('item-label'),
23
21
  ns.is('required', item.required),
24
22
  ns.is('outer-border', outerBorder),
25
- ]"
26
- >
23
+ ]">
27
24
  <span>{{ item.label }}</span>
28
25
  <span :class="[ns.is('required')]" v-if="!outerBorder">:</span>
29
26
  </span>
30
27
  <div :class="[ns.e('item-component')]">
31
28
  <slot
32
29
  :name="item.componentName || item.param"
33
- v-bind="getComponentSlotScope(item)"
34
- >
30
+ v-bind="getComponentSlotScope(item)">
35
31
  <component
36
32
  :is="getComponent(item.type)"
37
33
  v-model="searchParamsCurrent[item.param]"
38
- v-bind="getComponentProps(item)"
39
- >
34
+ v-bind="getComponentProps(item)">
40
35
  </component>
41
36
  </slot>
42
37
  </div>
@@ -173,7 +168,7 @@ defineExpose({
173
168
  });
174
169
  onMounted(() => {});
175
170
  </script>
176
- <style lang='less'>
171
+ <style lang="less">
177
172
  .ct-search-box {
178
173
  --ct-search-box-item-margin-right: 16px;
179
174
  --ct-search-box-item-margin-top: 14px;
@@ -201,6 +196,7 @@ onMounted(() => {});
201
196
  --ct-search-box-item-component-width: 100%;
202
197
  &.is-outer-border {
203
198
  --ct-font-size: 13px;
199
+ --el-font-size-base: var(--ct-font-size, 13px);
204
200
  --ct-search-box-border-color: var(--ct-border-color);
205
201
  --ct-search-box-inner-border-color: transparent;
206
202
  font-size: var(--ct-font-size);
@@ -246,4 +242,4 @@ onMounted(() => {});
246
242
  }
247
243
  }
248
244
  }
249
- </style>
245
+ </style>