@airpower/web 0.0.35 → 0.0.37
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/README.md +3 -1
- package/dist/airpower.web.js +197 -197
- package/dist/controller/DetailController.d.ts +24 -0
- package/dist/controller/EditorController.d.ts +14 -0
- package/dist/controller/index.d.ts +4 -0
- package/dist/{hooks/interface/IUseDetailOption.d.ts → controller/interface/IDetailControllerOption.d.ts} +2 -2
- package/dist/{hooks/interface/ITableHookOption.d.ts → controller/interface/ITableControllerOption.d.ts} +2 -2
- package/dist/{hooks/interface/IUseTableTreeOption.d.ts → controller/interface/ITableTreeControllerOption.d.ts} +4 -4
- package/dist/{hooks → controller}/interface/IUseEditorOption.d.ts +2 -2
- package/dist/controller/interface/index.d.ts +4 -0
- package/dist/controller/table/BaseTableController.d.ts +64 -0
- package/dist/controller/table/TableController.d.ts +30 -0
- package/dist/controller/table/TableTreeController.d.ts +18 -0
- package/dist/controller/table/index.d.ts +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/service/AbstractWebService.d.ts +7 -4
- package/package.json +4 -4
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/interface/ITableHookResult.d.ts +0 -80
- package/dist/hooks/interface/IUseDetailResult.d.ts +0 -30
- package/dist/hooks/interface/IUseEditorResult.d.ts +0 -14
- package/dist/hooks/interface/IUseSelectorOption.d.ts +0 -8
- package/dist/hooks/interface/IUseSelectorResult.d.ts +0 -19
- package/dist/hooks/interface/IUseTableOption.d.ts +0 -8
- package/dist/hooks/interface/IUseTableResult.d.ts +0 -33
- package/dist/hooks/interface/IUseTableTreeResult.d.ts +0 -13
- package/dist/hooks/interface/index.d.ts +0 -12
- package/dist/hooks/useBaseTable.d.ts +0 -11
- package/dist/hooks/useDetail.d.ts +0 -12
- package/dist/hooks/useEditor.d.ts +0 -12
- package/dist/hooks/useSelector.d.ts +0 -12
- package/dist/hooks/useTable.d.ts +0 -11
- package/dist/hooks/useTableTree.d.ts +0 -11
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://
|
|
13
|
+
<a href="https://github.com/AirPowerTeam/AirPower-Web">Github</a> /
|
|
14
|
+
<a href="https://gitee.com/air-power/AirPower-Web">Gitee</a> /
|
|
15
|
+
<a href="https://www.npmjs.com/package/@airpower/web">NPM</a>
|
|
14
16
|
</p>
|
|
15
17
|
|
|
16
18
|
## 🎉 项目介绍
|
package/dist/airpower.web.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, toHandlers, withCtx, createElementBlock, Fragment, renderList, ref } from "vue";
|
|
5
|
-
import { AirDecorator, getFieldConfig, AirClassTransformer,
|
|
5
|
+
import { AirDecorator, getFieldConfig, AirClassTransformer, HttpConfig, AirI18n, QueryPageResponse, QueryPageRequest, Page, AbstractHttp, HttpResponse, HttpStatus, AbstractEntityService } from "@airpower/core";
|
|
6
6
|
export * from "@airpower/core";
|
|
7
7
|
import { ElTable, ElTableColumn, ElMessageBox, ElMessage } from "element-plus";
|
|
8
8
|
import axios from "axios";
|
|
@@ -94,20 +94,20 @@ class WebAccessToken {
|
|
|
94
94
|
*/
|
|
95
95
|
static getAccessToken() {
|
|
96
96
|
var _a;
|
|
97
|
-
return ((_a = localStorage.getItem(
|
|
97
|
+
return ((_a = localStorage.getItem(HttpConfig.authorizationHeaderKey)) == null ? void 0 : _a.toString()) || "";
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* ### 设置AccessToken
|
|
101
101
|
* @param accessToken AccessToken
|
|
102
102
|
*/
|
|
103
103
|
static setAccessToken(accessToken) {
|
|
104
|
-
localStorage.setItem(
|
|
104
|
+
localStorage.setItem(HttpConfig.authorizationHeaderKey, accessToken);
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* ### 移除AccessToken
|
|
108
108
|
*/
|
|
109
109
|
static removeAccessToken() {
|
|
110
|
-
localStorage.removeItem(
|
|
110
|
+
localStorage.removeItem(HttpConfig.authorizationHeaderKey);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
class WebI18n extends AirI18n {
|
|
@@ -115,190 +115,193 @@ class WebI18n extends AirI18n {
|
|
|
115
115
|
return AirI18n.get();
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
class DetailController {
|
|
119
|
+
constructor() {
|
|
120
|
+
__publicField(this, "isLoading", ref(false));
|
|
121
|
+
__publicField(this, "formData");
|
|
122
|
+
__publicField(this, "title", ref(WebI18n.get().Detail || "详情"));
|
|
123
|
+
__publicField(this, "service");
|
|
124
|
+
__publicField(this, "option", {});
|
|
125
|
+
}
|
|
126
|
+
static create(props, entityClass, serviceClass, option = {}) {
|
|
127
|
+
const instance = new this();
|
|
128
|
+
instance.service = AirClassTransformer.newInstance(serviceClass);
|
|
129
|
+
instance.option = option;
|
|
130
|
+
instance.service.setLoading(instance.isLoading);
|
|
131
|
+
instance.formData = ref(props.param ? props.param.copy() : AirClassTransformer.newInstance(entityClass));
|
|
132
|
+
instance.getDetail();
|
|
133
|
+
return instance;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* ### 查询详情方法
|
|
137
|
+
*/
|
|
138
|
+
async getDetail() {
|
|
139
|
+
if (this.formData.value.id) {
|
|
140
|
+
this.formData.value = await this.service.getDetail(this.formData.value.id, this.option.apiUrl);
|
|
141
|
+
if (this.option.afterGetDetail) {
|
|
142
|
+
const result = this.option.afterGetDetail(this.formData.value);
|
|
143
|
+
if (result !== void 0) {
|
|
144
|
+
this.formData.value = result;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
class EditorController extends DetailController {
|
|
151
|
+
async getDetail() {
|
|
152
|
+
this.title.value = this.formData.value.id ? WebI18n.get().Edit || "编辑" : WebI18n.get().Add || "添加";
|
|
153
|
+
return super.getDetail();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
class BaseTableController {
|
|
157
|
+
constructor(ServiceClass) {
|
|
158
|
+
__publicField(this, "request");
|
|
159
|
+
__publicField(this, "response", ref(new QueryPageResponse()));
|
|
160
|
+
__publicField(this, "list", ref([]));
|
|
161
|
+
__publicField(this, "selectList", ref([]));
|
|
162
|
+
__publicField(this, "isLoading", ref(false));
|
|
163
|
+
__publicField(this, "service");
|
|
164
|
+
__publicField(this, "option", {});
|
|
165
|
+
this.service = AirClassTransformer.newInstance(ServiceClass);
|
|
166
|
+
this.request = ref(new QueryPageRequest(this.service.entityClass));
|
|
167
|
+
this.init();
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* ### 设置配置
|
|
171
|
+
* @param option 更多配置
|
|
172
|
+
*/
|
|
173
|
+
setOption(option) {
|
|
174
|
+
this.option = option;
|
|
175
|
+
if (option.defaultFilter) {
|
|
176
|
+
this.request.value.filter = option.defaultFilter;
|
|
177
|
+
}
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* ### 查询列表事件
|
|
182
|
+
*/
|
|
183
|
+
async getList() {
|
|
184
|
+
let req = this.request.value;
|
|
185
|
+
if (this.option.beforeSearch) {
|
|
186
|
+
const result = this.option.beforeSearch(req);
|
|
187
|
+
if (result) {
|
|
135
188
|
req = result;
|
|
136
189
|
}
|
|
137
190
|
}
|
|
138
|
-
if (option.treeList) {
|
|
139
|
-
list.value = await service.getTreeList(req, option.apiUrl);
|
|
140
|
-
} else if (!option.unPaginate) {
|
|
141
|
-
response.value = await service.getPage(req, option.apiUrl);
|
|
142
|
-
list.value = response.value.list;
|
|
191
|
+
if (this.option.treeList) {
|
|
192
|
+
this.list.value = await this.service.getTreeList(req, this.option.apiUrl);
|
|
193
|
+
} else if (!this.option.unPaginate) {
|
|
194
|
+
this.response.value = await this.service.getPage(req, this.option.apiUrl);
|
|
195
|
+
this.list.value = this.response.value.list;
|
|
143
196
|
} else {
|
|
144
|
-
list.value = await service.getList(req, option.apiUrl);
|
|
197
|
+
this.list.value = await this.service.getList(req, this.option.apiUrl);
|
|
145
198
|
}
|
|
146
199
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
200
|
+
/**
|
|
201
|
+
* ### 搜索
|
|
202
|
+
* @param req 请求对象
|
|
203
|
+
*/
|
|
204
|
+
async search(req) {
|
|
205
|
+
this.request.value = req;
|
|
206
|
+
this.getList();
|
|
150
207
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
208
|
+
/**
|
|
209
|
+
* ### 重新加载数据
|
|
210
|
+
* 会自动返回第一页
|
|
211
|
+
*/
|
|
212
|
+
async reload() {
|
|
213
|
+
if (!this.request.value.page) {
|
|
214
|
+
this.request.value.page = new Page();
|
|
154
215
|
}
|
|
155
|
-
request.value.page.pageNum = 1;
|
|
156
|
-
|
|
216
|
+
this.request.value.page.pageNum = 1;
|
|
217
|
+
this.search(this.request.value);
|
|
157
218
|
}
|
|
158
|
-
|
|
159
|
-
|
|
219
|
+
/**
|
|
220
|
+
* ### 添加事件
|
|
221
|
+
*/
|
|
222
|
+
async add() {
|
|
223
|
+
if (!this.option.editView) {
|
|
160
224
|
console.error("请为 useAirTableList 的 option 传入 editView");
|
|
161
225
|
return;
|
|
162
226
|
}
|
|
163
227
|
try {
|
|
164
|
-
console.warn("需要弹出并携带数据", entity, option.editView);
|
|
165
228
|
} finally {
|
|
166
|
-
|
|
229
|
+
this.getList();
|
|
167
230
|
}
|
|
168
231
|
}
|
|
169
|
-
|
|
170
|
-
|
|
232
|
+
/**
|
|
233
|
+
* ### 点击表格行详情事件
|
|
234
|
+
* @param row 行数据
|
|
235
|
+
*/
|
|
236
|
+
async detail(row) {
|
|
237
|
+
if (!this.option.detailView) {
|
|
171
238
|
console.error("请为 useAirTableList 的 option 传入 detailView");
|
|
172
239
|
return;
|
|
173
240
|
}
|
|
174
241
|
try {
|
|
175
|
-
console.warn("需要弹出并携带数据", row, option.detailView);
|
|
242
|
+
console.warn("需要弹出并携带数据", row, this.option.detailView);
|
|
176
243
|
} finally {
|
|
177
|
-
|
|
244
|
+
this.reload();
|
|
178
245
|
}
|
|
179
246
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
async function onPageChanged(page) {
|
|
189
|
-
request.value.page = page;
|
|
190
|
-
onGetList();
|
|
191
|
-
}
|
|
192
|
-
onGetList();
|
|
193
|
-
return {
|
|
194
|
-
entity,
|
|
195
|
-
service,
|
|
196
|
-
isLoading,
|
|
197
|
-
response,
|
|
198
|
-
request,
|
|
199
|
-
list,
|
|
200
|
-
selectList,
|
|
201
|
-
onSearch,
|
|
202
|
-
onPageChanged,
|
|
203
|
-
onAdd,
|
|
204
|
-
onSortChanged,
|
|
205
|
-
onSelected,
|
|
206
|
-
onGetList,
|
|
207
|
-
onDetail,
|
|
208
|
-
onReloadData
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function useDetail(props, entityClass, serviceClass, option = {}) {
|
|
212
|
-
const isLoading = ref(false);
|
|
213
|
-
const service = AirClassTransformer.newInstance(serviceClass);
|
|
214
|
-
service.loading = isLoading;
|
|
215
|
-
const formData = ref(props.param ? props.param.copy() : AirClassTransformer.newInstance(entityClass));
|
|
216
|
-
const title = ref(WebI18n.get().Detail || "详情");
|
|
217
|
-
async function getDetail() {
|
|
218
|
-
if (formData.value.id) {
|
|
219
|
-
formData.value = await service.getDetail(formData.value.id, option.apiUrl);
|
|
220
|
-
if (option.afterGetDetail) {
|
|
221
|
-
const result = option.afterGetDetail(formData.value);
|
|
222
|
-
if (result !== void 0) {
|
|
223
|
-
formData.value = result;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
247
|
+
/**
|
|
248
|
+
* ### 排序变更事件
|
|
249
|
+
* @param sort 排序对象
|
|
250
|
+
*/
|
|
251
|
+
async sortChanged(sort) {
|
|
252
|
+
this.request.value.sort = sort;
|
|
253
|
+
this.request.value.page = new Page();
|
|
254
|
+
this.getList();
|
|
227
255
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
postData = result2;
|
|
248
|
-
}
|
|
249
|
-
try {
|
|
250
|
-
if (postData.id) {
|
|
251
|
-
const id2 = await result.service.update(
|
|
252
|
-
postData,
|
|
253
|
-
option.successMessage || WebI18n.get().EditSuccess || "编辑成功",
|
|
254
|
-
option.apiUrlUpdate
|
|
255
|
-
);
|
|
256
|
-
props.onConfirm(id2);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const id = await result.service.add(
|
|
260
|
-
postData,
|
|
261
|
-
option.successMessage || WebI18n.get().AddSuccess || "添加成功",
|
|
262
|
-
option.apiUrlAdd
|
|
263
|
-
);
|
|
264
|
-
props.onConfirm(id);
|
|
265
|
-
} catch (e) {
|
|
266
|
-
console.warn(e);
|
|
267
|
-
}
|
|
256
|
+
/**
|
|
257
|
+
* ### 选择变更事件
|
|
258
|
+
* @param list 选择列表
|
|
259
|
+
*/
|
|
260
|
+
async selectChanged(list) {
|
|
261
|
+
this.selectList.value = list;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* ### 分页变更事件
|
|
265
|
+
* @param page 分页对象
|
|
266
|
+
*/
|
|
267
|
+
async pageChanged(page) {
|
|
268
|
+
this.request.value.page = page;
|
|
269
|
+
this.getList();
|
|
270
|
+
}
|
|
271
|
+
init() {
|
|
272
|
+
this.service.setLoading(this.isLoading);
|
|
273
|
+
this.getList();
|
|
268
274
|
}
|
|
269
|
-
return Object.assign(result, {
|
|
270
|
-
title,
|
|
271
|
-
onSubmit
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function useSelector(props, entityClass, serviceClass, option = {}) {
|
|
275
|
-
const result = useBaseTable(entityClass, serviceClass, option);
|
|
276
|
-
const title = ref(WebI18n.get().SelectPlease || "请选择");
|
|
277
|
-
result.selectList.value = props.selectList;
|
|
278
|
-
const disableConfirm = computed(() => props.isMultiple && result.selectList.value.length === 0);
|
|
279
|
-
return Object.assign(result, {
|
|
280
|
-
title,
|
|
281
|
-
disableConfirm
|
|
282
|
-
});
|
|
283
275
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
276
|
+
class TableController extends BaseTableController {
|
|
277
|
+
/**
|
|
278
|
+
* ### 表格行编辑事件
|
|
279
|
+
* @param row 行数据
|
|
280
|
+
*/
|
|
281
|
+
async edit(row) {
|
|
282
|
+
if (!this.option.editView) {
|
|
288
283
|
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
289
284
|
return;
|
|
290
285
|
}
|
|
291
286
|
try {
|
|
292
|
-
console.warn("需要弹出并携带数据", row, option.editView);
|
|
287
|
+
console.warn("需要弹出并携带数据", row, this.option.editView);
|
|
293
288
|
} finally {
|
|
294
|
-
|
|
289
|
+
this.getList();
|
|
295
290
|
}
|
|
296
291
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
292
|
+
/**
|
|
293
|
+
* ### 表格行删除事件
|
|
294
|
+
* @param row 行数据
|
|
295
|
+
*/
|
|
296
|
+
async delete(row) {
|
|
297
|
+
await this.service.delete(row.id, WebI18n.get().DeleteSuccess || "删除成功");
|
|
298
|
+
this.getList();
|
|
300
299
|
}
|
|
301
|
-
|
|
300
|
+
/**
|
|
301
|
+
* ### 表格行禁用事件
|
|
302
|
+
* @param row 行数据
|
|
303
|
+
*/
|
|
304
|
+
async disable(row) {
|
|
302
305
|
await ElMessageBox.confirm(
|
|
303
306
|
"是否确认禁用当前选择的数据?",
|
|
304
307
|
"禁用提醒",
|
|
@@ -308,10 +311,14 @@ function useTable(entityClass, serviceClass, option = {}) {
|
|
|
308
311
|
type: "warning"
|
|
309
312
|
}
|
|
310
313
|
);
|
|
311
|
-
await
|
|
312
|
-
|
|
314
|
+
await this.service.disable(row.id, WebI18n.get().DisableSuccess || "禁用成功");
|
|
315
|
+
this.getList();
|
|
313
316
|
}
|
|
314
|
-
|
|
317
|
+
/**
|
|
318
|
+
* ### 表格行启用事件
|
|
319
|
+
* @param row 行数据
|
|
320
|
+
*/
|
|
321
|
+
async enable(row) {
|
|
315
322
|
await ElMessageBox.confirm(
|
|
316
323
|
"是否确认启用当前选择的数据?",
|
|
317
324
|
"启用提醒",
|
|
@@ -321,43 +328,34 @@ function useTable(entityClass, serviceClass, option = {}) {
|
|
|
321
328
|
type: "warning"
|
|
322
329
|
}
|
|
323
330
|
);
|
|
324
|
-
await
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
return Object.assign(result, {
|
|
328
|
-
onEdit,
|
|
329
|
-
onDelete,
|
|
330
|
-
onDisable,
|
|
331
|
-
onEnable
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
function useTableTree(entityClass, serviceClass, option = {}) {
|
|
335
|
-
if (option.unPaginate === void 0) {
|
|
336
|
-
option.unPaginate = true;
|
|
331
|
+
await this.service.enable(row.id, WebI18n.get().EnableSuccess || "启用成功");
|
|
332
|
+
this.getList();
|
|
337
333
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
334
|
+
}
|
|
335
|
+
class TableTreeController extends TableController {
|
|
336
|
+
/**
|
|
337
|
+
* ### 树表格添加子项事件
|
|
338
|
+
* @param row 行数据
|
|
339
|
+
*/
|
|
340
|
+
async onAddRow(row) {
|
|
341
|
+
if (!this.option.editView) {
|
|
341
342
|
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
344
345
|
try {
|
|
345
|
-
let param = AirClassTransformer.newInstance(entityClass);
|
|
346
|
+
let param = AirClassTransformer.newInstance(this.service.entityClass);
|
|
346
347
|
param.parentId = row.id;
|
|
347
|
-
if (option.beforeAddRow) {
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
param =
|
|
348
|
+
if (this.option.beforeAddRow) {
|
|
349
|
+
const result = this.option.beforeAddRow(param, row);
|
|
350
|
+
if (result !== void 0) {
|
|
351
|
+
param = result;
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
|
-
console.warn("需要弹出并携带数据", param, option.editView);
|
|
354
|
+
console.warn("需要弹出并携带数据", param, this.option.editView);
|
|
354
355
|
} finally {
|
|
355
|
-
|
|
356
|
+
this.reload();
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
|
-
return Object.assign(result, {
|
|
359
|
-
onAddRow
|
|
360
|
-
});
|
|
361
359
|
}
|
|
362
360
|
class WebHttp extends AbstractHttp {
|
|
363
361
|
constructor() {
|
|
@@ -377,7 +375,7 @@ class WebHttp extends AbstractHttp {
|
|
|
377
375
|
const response = new HttpResponse();
|
|
378
376
|
try {
|
|
379
377
|
const res = await axios.request(axiosConfig);
|
|
380
|
-
if (res.status !==
|
|
378
|
+
if (res.status !== HttpStatus.OK) {
|
|
381
379
|
response.code = res.status;
|
|
382
380
|
response.message = res.statusText;
|
|
383
381
|
response.data = res;
|
|
@@ -388,7 +386,7 @@ class WebHttp extends AbstractHttp {
|
|
|
388
386
|
response.data = res.data.data;
|
|
389
387
|
return response;
|
|
390
388
|
} catch (e) {
|
|
391
|
-
response.code =
|
|
389
|
+
response.code = HttpStatus.INTERNAL_SERVER_ERROR;
|
|
392
390
|
response.message = e.message;
|
|
393
391
|
response.data = e;
|
|
394
392
|
return response;
|
|
@@ -416,14 +414,17 @@ class AbstractWebService extends AbstractEntityService {
|
|
|
416
414
|
__publicField(this, "loading", ref(false));
|
|
417
415
|
}
|
|
418
416
|
/**
|
|
419
|
-
* ###
|
|
417
|
+
* ### 设置加载状态
|
|
420
418
|
* @param loading 加载状态
|
|
421
419
|
*/
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
return service;
|
|
420
|
+
setLoading(loading) {
|
|
421
|
+
this.loading = loading;
|
|
422
|
+
return this;
|
|
426
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* ### 创建一个 `Http` 对象
|
|
426
|
+
* @param url 请求的 `URL`
|
|
427
|
+
*/
|
|
427
428
|
createHttp(url) {
|
|
428
429
|
const http = WebHttp.create(url, (error) => {
|
|
429
430
|
ElMessage.error(error.message);
|
|
@@ -440,18 +441,17 @@ class AbstractWebService extends AbstractEntityService {
|
|
|
440
441
|
}
|
|
441
442
|
export {
|
|
442
443
|
AbstractWebService,
|
|
444
|
+
BaseTableController,
|
|
445
|
+
DetailController,
|
|
446
|
+
EditorController,
|
|
443
447
|
Table,
|
|
448
|
+
TableController,
|
|
449
|
+
TableTreeController,
|
|
444
450
|
WebAccessToken,
|
|
445
451
|
WebHttp,
|
|
446
452
|
WebI18n,
|
|
447
453
|
_sfc_main as WebTable,
|
|
448
454
|
getTableConfig,
|
|
449
455
|
getTableConfigList,
|
|
450
|
-
getTableFieldList
|
|
451
|
-
useBaseTable,
|
|
452
|
-
useDetail,
|
|
453
|
-
useEditor,
|
|
454
|
-
useSelector,
|
|
455
|
-
useTable,
|
|
456
|
-
useTableTree
|
|
456
|
+
getTableFieldList
|
|
457
457
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AirEntity, ClassConstructor, IJson } from '@airpower/core';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { AbstractWebService } from '../service';
|
|
4
|
+
import { IDetailControllerOption } from './interface';
|
|
5
|
+
/**
|
|
6
|
+
* # 详情控制器
|
|
7
|
+
* @param props `defineProps` 的返回值
|
|
8
|
+
* @param entityClass 详情使用的实体类
|
|
9
|
+
* @param serviceClass 详情使用的 `Service`
|
|
10
|
+
* @param option `可选` 更多的配置
|
|
11
|
+
* @author Hamm.cn
|
|
12
|
+
*/
|
|
13
|
+
export declare class DetailController<E extends AirEntity, S extends AbstractWebService<E>, O extends IDetailControllerOption<E> = IDetailControllerOption<E>> {
|
|
14
|
+
isLoading: Ref<boolean, boolean>;
|
|
15
|
+
formData: Ref<E>;
|
|
16
|
+
title: Ref<string, string>;
|
|
17
|
+
protected service: S;
|
|
18
|
+
protected option: O;
|
|
19
|
+
static create<T extends DetailController<E, S>, E extends AirEntity, S extends AbstractWebService<E>>(this: ClassConstructor<T>, props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IDetailControllerOption<E>): T;
|
|
20
|
+
/**
|
|
21
|
+
* ### 查询详情方法
|
|
22
|
+
*/
|
|
23
|
+
getDetail(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AirEntity } from '@airpower/core';
|
|
2
|
+
import { AbstractWebService } from '../service';
|
|
3
|
+
import { DetailController } from './DetailController';
|
|
4
|
+
/**
|
|
5
|
+
* # 编辑器控制器
|
|
6
|
+
* @param props `defineProps` 的返回值
|
|
7
|
+
* @param entityClass `Editor`使用的实体类
|
|
8
|
+
* @param serviceClass `Editor`使用的`Service`
|
|
9
|
+
* @param option `可选` 更多的配置
|
|
10
|
+
* @author Hamm.cn
|
|
11
|
+
*/
|
|
12
|
+
export declare class EditorController<E extends AirEntity, S extends AbstractWebService<E>> extends DetailController<E, S> {
|
|
13
|
+
getDetail(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AirEntity } from '@airpower/core';
|
|
2
2
|
/**
|
|
3
|
-
* #
|
|
3
|
+
* # 详情控制器配置项
|
|
4
4
|
* @author Hamm.cn
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface IDetailControllerOption<E extends AirEntity> {
|
|
7
7
|
/**
|
|
8
8
|
* ### 查到详情后的事件
|
|
9
9
|
* 参数为响应的数据,请处理后返回
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AirEntity, QueryPageRequest } from '@airpower/core';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
/**
|
|
4
|
-
* #
|
|
4
|
+
* # 表格控制器配置项
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ITableControllerOption<E extends AirEntity> {
|
|
8
8
|
/**
|
|
9
9
|
* ### 不分页
|
|
10
10
|
* 默认请求分页接口 如配置了 `treeList` 则此项自动失效
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ITree } from '@airpower/core';
|
|
2
|
-
import {
|
|
1
|
+
import { AirEntity, ITree } from '@airpower/core';
|
|
2
|
+
import { ITableControllerOption } from './ITableControllerOption';
|
|
3
3
|
/**
|
|
4
|
-
* #
|
|
4
|
+
* # 表格树控制器配置项
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ITableTreeControllerOption<T extends ITree & AirEntity> extends ITableControllerOption<T> {
|
|
8
8
|
/**
|
|
9
9
|
* ### 添加行的子项的前置拦截方法
|
|
10
10
|
* 参数为发起请求的数据,请处理后返回 `param`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import {
|
|
2
|
+
import { IDetailControllerOption } from './IDetailControllerOption';
|
|
3
3
|
/**
|
|
4
4
|
* # `Editor` 的 `Hook` 可选配置
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export interface IUseEditorOption<E extends AirEntity> extends
|
|
7
|
+
export interface IUseEditorOption<E extends AirEntity> extends IDetailControllerOption<E> {
|
|
8
8
|
/**
|
|
9
9
|
* ### 编辑成功的提示消息
|
|
10
10
|
*/
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AirEntity, QuerySort, Page, QueryPageRequest, QueryPageResponse } from '@airpower/core';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { AbstractWebService } from '../../service';
|
|
4
|
+
import { ITableControllerOption } from '../interface';
|
|
5
|
+
/**
|
|
6
|
+
* # 表格控制器基类
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export declare class BaseTableController<E extends AirEntity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> {
|
|
10
|
+
request: Ref<QueryPageRequest<E>>;
|
|
11
|
+
response: Ref<QueryPageResponse<E>>;
|
|
12
|
+
list: Ref<E[]>;
|
|
13
|
+
selectList: Ref<E[]>;
|
|
14
|
+
isLoading: Ref<boolean, boolean>;
|
|
15
|
+
protected service: S;
|
|
16
|
+
protected option: O;
|
|
17
|
+
constructor(ServiceClass: new () => S & {
|
|
18
|
+
entityClass: new () => E;
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* ### 设置配置
|
|
22
|
+
* @param option 更多配置
|
|
23
|
+
*/
|
|
24
|
+
setOption(option: O): this;
|
|
25
|
+
/**
|
|
26
|
+
* ### 查询列表事件
|
|
27
|
+
*/
|
|
28
|
+
getList(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* ### 搜索
|
|
31
|
+
* @param req 请求对象
|
|
32
|
+
*/
|
|
33
|
+
search(req: QueryPageRequest<E>): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* ### 重新加载数据
|
|
36
|
+
* 会自动返回第一页
|
|
37
|
+
*/
|
|
38
|
+
reload(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* ### 添加事件
|
|
41
|
+
*/
|
|
42
|
+
add(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* ### 点击表格行详情事件
|
|
45
|
+
* @param row 行数据
|
|
46
|
+
*/
|
|
47
|
+
detail(row: E): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* ### 排序变更事件
|
|
50
|
+
* @param sort 排序对象
|
|
51
|
+
*/
|
|
52
|
+
sortChanged(sort?: QuerySort): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* ### 选择变更事件
|
|
55
|
+
* @param list 选择列表
|
|
56
|
+
*/
|
|
57
|
+
selectChanged(list: E[]): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* ### 分页变更事件
|
|
60
|
+
* @param page 分页对象
|
|
61
|
+
*/
|
|
62
|
+
pageChanged(page: Page): Promise<void>;
|
|
63
|
+
private init;
|
|
64
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AirEntity } from '@airpower/core';
|
|
2
|
+
import { AbstractWebService } from '../../service';
|
|
3
|
+
import { ITableControllerOption } from '../interface';
|
|
4
|
+
import { BaseTableController } from './BaseTableController';
|
|
5
|
+
/**
|
|
6
|
+
* # 表格控制器
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export declare class TableController<E extends AirEntity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> extends BaseTableController<E, S, O> {
|
|
10
|
+
/**
|
|
11
|
+
* ### 表格行编辑事件
|
|
12
|
+
* @param row 行数据
|
|
13
|
+
*/
|
|
14
|
+
edit(row: E): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* ### 表格行删除事件
|
|
17
|
+
* @param row 行数据
|
|
18
|
+
*/
|
|
19
|
+
delete(row: E): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* ### 表格行禁用事件
|
|
22
|
+
* @param row 行数据
|
|
23
|
+
*/
|
|
24
|
+
disable(row: E): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* ### 表格行启用事件
|
|
27
|
+
* @param row 行数据
|
|
28
|
+
*/
|
|
29
|
+
enable(row: E): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AirEntity, ITree } from '@airpower/core';
|
|
2
|
+
import { AbstractWebService } from '../../service';
|
|
3
|
+
import { ITableTreeControllerOption } from '../interface';
|
|
4
|
+
import { TableController } from './TableController';
|
|
5
|
+
/**
|
|
6
|
+
* # 表格控制器
|
|
7
|
+
* @param entityClass 实体类
|
|
8
|
+
* @param serviceClass 表格使用的`Service`类
|
|
9
|
+
* @param option `可选` 更多配置
|
|
10
|
+
* @author Hamm.cn
|
|
11
|
+
*/
|
|
12
|
+
export declare class TableTreeController<E extends ITree & AirEntity, S extends AbstractWebService<E>> extends TableController<E, S, ITableTreeControllerOption<E>> {
|
|
13
|
+
/**
|
|
14
|
+
* ### 树表格添加子项事件
|
|
15
|
+
* @param row 行数据
|
|
16
|
+
*/
|
|
17
|
+
onAddRow(row: E): Promise<void>;
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AbstractHttp, AirEntity, AbstractEntityService } from '@airpower/core';
|
|
2
|
-
import { ClassConstructor } from 'airpower';
|
|
3
2
|
import { Ref } from 'vue';
|
|
4
3
|
/**
|
|
5
4
|
* # 实体 `API` 服务超类
|
|
@@ -12,12 +11,16 @@ export declare abstract class AbstractWebService<E extends AirEntity> extends Ab
|
|
|
12
11
|
/**
|
|
13
12
|
* ### 是否正在加载中
|
|
14
13
|
*/
|
|
15
|
-
loading
|
|
14
|
+
private loading;
|
|
16
15
|
/**
|
|
17
|
-
* ###
|
|
16
|
+
* ### 设置加载状态
|
|
18
17
|
* @param loading 加载状态
|
|
19
18
|
*/
|
|
20
|
-
|
|
19
|
+
setLoading(loading: Ref<boolean>): this;
|
|
20
|
+
/**
|
|
21
|
+
* ### 创建一个 `Http` 对象
|
|
22
|
+
* @param url 请求的 `URL`
|
|
23
|
+
*/
|
|
21
24
|
protected createHttp(url: string): AbstractHttp;
|
|
22
25
|
protected showSuccess(successMessage: string): void;
|
|
23
26
|
protected showError(errorMessage: string): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airpower/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.37",
|
|
5
5
|
"description": "AirPower-Web",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hamm",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"lint": "eslint src --ext .ts",
|
|
39
39
|
"preview": "vite preview"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"@airpower/core": "^0.1.10",
|
|
41
|
+
"peerDependencies": {
|
|
43
42
|
"axios": "^1.8.4",
|
|
44
43
|
"element-plus": "^2.9.7",
|
|
45
44
|
"vue": "^3.5.13"
|
|
46
45
|
},
|
|
47
|
-
"
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@airpower/core": "^0.1.13",
|
|
48
48
|
"axios": "^1.8.4",
|
|
49
49
|
"element-plus": "^2.9.7",
|
|
50
50
|
"vue": "^3.5.13"
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { AirEntity, Page, QueryPageRequest, QueryPageResponse, QuerySort } from '@airpower/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { AbstractWebService } from '../../service';
|
|
4
|
-
/**
|
|
5
|
-
* # `TableHook` 的基础返回结构
|
|
6
|
-
* @author Hamm.cn
|
|
7
|
-
*/
|
|
8
|
-
export interface ITableHookResult<E extends AirEntity, S extends AbstractWebService<E>> {
|
|
9
|
-
/**
|
|
10
|
-
* ### 当前绑定的 `Loading` 状态
|
|
11
|
-
* 请随意 `v-loading` 到你需要的地方
|
|
12
|
-
*/
|
|
13
|
-
isLoading: Ref<boolean>;
|
|
14
|
-
/**
|
|
15
|
-
* ### 响应数据
|
|
16
|
-
*/
|
|
17
|
-
response: Ref<QueryPageResponse<E>>;
|
|
18
|
-
/**
|
|
19
|
-
* ### 请求数据
|
|
20
|
-
*/
|
|
21
|
-
request: Ref<QueryPageRequest<E>>;
|
|
22
|
-
/**
|
|
23
|
-
* ### 返回的单页数据列表
|
|
24
|
-
*/
|
|
25
|
-
list: Ref<E[]>;
|
|
26
|
-
/**
|
|
27
|
-
* ### 选中的数据列表
|
|
28
|
-
*/
|
|
29
|
-
selectList: Ref<E[]>;
|
|
30
|
-
/**
|
|
31
|
-
* ### 实体的实例
|
|
32
|
-
*/
|
|
33
|
-
entity: E;
|
|
34
|
-
/**
|
|
35
|
-
* ### `Service`的实例
|
|
36
|
-
*/
|
|
37
|
-
service: S;
|
|
38
|
-
/**
|
|
39
|
-
* ### 刷新数据 返回第一页
|
|
40
|
-
*/
|
|
41
|
-
onReloadData: () => void;
|
|
42
|
-
/**
|
|
43
|
-
* ### 搜索事件
|
|
44
|
-
*
|
|
45
|
-
* @param request 请求对象
|
|
46
|
-
*/
|
|
47
|
-
onSearch: (request: QueryPageRequest<E>) => void;
|
|
48
|
-
/**
|
|
49
|
-
* ### 分页变更事件
|
|
50
|
-
*
|
|
51
|
-
* @param page 分页对象
|
|
52
|
-
*/
|
|
53
|
-
onPageChanged: (page: Page) => void;
|
|
54
|
-
/**
|
|
55
|
-
* ### 详情事件
|
|
56
|
-
*
|
|
57
|
-
* @param row 选择的行
|
|
58
|
-
*/
|
|
59
|
-
onDetail: (row: E) => void;
|
|
60
|
-
/**
|
|
61
|
-
* ### 添加事件
|
|
62
|
-
*/
|
|
63
|
-
onAdd: () => void;
|
|
64
|
-
/**
|
|
65
|
-
* ### 排序变更事件
|
|
66
|
-
*
|
|
67
|
-
* @param sort 排序对象
|
|
68
|
-
*/
|
|
69
|
-
onSortChanged: (sort?: QuerySort) => void | Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* ### 多选事件
|
|
72
|
-
*
|
|
73
|
-
* @param list 选择的行列表
|
|
74
|
-
*/
|
|
75
|
-
onSelected: (list: E[]) => void;
|
|
76
|
-
/**
|
|
77
|
-
* ### 刷新数据 保持留在当页
|
|
78
|
-
*/
|
|
79
|
-
onGetList: () => void;
|
|
80
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { AbstractWebService } from '../../service';
|
|
4
|
-
/**
|
|
5
|
-
* # 详情的 `Hook` 标准返回
|
|
6
|
-
* @author Hamm.cn
|
|
7
|
-
*/
|
|
8
|
-
export interface IUseDetailResult<E extends AirEntity, S extends AbstractWebService<E>> {
|
|
9
|
-
/**
|
|
10
|
-
* ### 对话框显示的标题
|
|
11
|
-
*/
|
|
12
|
-
title: Ref<string>;
|
|
13
|
-
/**
|
|
14
|
-
* ### 表单或详情数据
|
|
15
|
-
*/
|
|
16
|
-
formData: Ref<E>;
|
|
17
|
-
/**
|
|
18
|
-
* ### 当前绑定的 `Loading` 状态
|
|
19
|
-
* 请随意 `v-loading` 到你需要的地方
|
|
20
|
-
*/
|
|
21
|
-
isLoading: Ref<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* ### 当前 `Hook` 使用的 `Service` 实例
|
|
24
|
-
*/
|
|
25
|
-
service: S;
|
|
26
|
-
/**
|
|
27
|
-
* ### 查询详情
|
|
28
|
-
*/
|
|
29
|
-
getDetail: () => void;
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../../service';
|
|
3
|
-
import { IUseDetailResult } from './IUseDetailResult';
|
|
4
|
-
/**
|
|
5
|
-
* # `Editor` 的 `Hook` 标准返回
|
|
6
|
-
* @author Hamm.cn
|
|
7
|
-
*/
|
|
8
|
-
export interface IUseEditorResult<E extends AirEntity, S extends AbstractWebService<E>> extends IUseDetailResult<E, S> {
|
|
9
|
-
/**
|
|
10
|
-
* ### 表单提交的方法
|
|
11
|
-
* 你可以使用 `beforeSubmit` 方法来拦截请求的数据
|
|
12
|
-
*/
|
|
13
|
-
onSubmit: () => void;
|
|
14
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { AbstractWebService } from '../../service';
|
|
4
|
-
import { ITableHookResult } from './ITableHookResult';
|
|
5
|
-
/**
|
|
6
|
-
* # 选择器 `Hook` 的标准返回
|
|
7
|
-
* @author Hamm.cn
|
|
8
|
-
*/
|
|
9
|
-
export interface IUseSelectorResult<E extends AirEntity, S extends AbstractWebService<E>> extends ITableHookResult<E, S> {
|
|
10
|
-
/**
|
|
11
|
-
* ### `Selector` 的标题
|
|
12
|
-
*/
|
|
13
|
-
title: Ref<string>;
|
|
14
|
-
/**
|
|
15
|
-
* ### 是否禁用确认按钮
|
|
16
|
-
* 多选时当没有选择任何数据时将禁用确认按钮
|
|
17
|
-
*/
|
|
18
|
-
disableConfirm: Ref<boolean>;
|
|
19
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../../service';
|
|
3
|
-
import { ITableHookResult } from './ITableHookResult';
|
|
4
|
-
/**
|
|
5
|
-
* # 表格的 `Hook` 标准返回
|
|
6
|
-
* @author Hamm.cn
|
|
7
|
-
*/
|
|
8
|
-
export interface IUseTableResult<E extends AirEntity, S extends AbstractWebService<E>> extends ITableHookResult<E, S> {
|
|
9
|
-
/**
|
|
10
|
-
* ### 编辑事件
|
|
11
|
-
*
|
|
12
|
-
* @param row 选择的行
|
|
13
|
-
*/
|
|
14
|
-
onEdit: (row: E) => void;
|
|
15
|
-
/**
|
|
16
|
-
* ### 删除事件
|
|
17
|
-
*
|
|
18
|
-
* @param row 选择的行
|
|
19
|
-
*/
|
|
20
|
-
onDelete: (row: E) => void;
|
|
21
|
-
/**
|
|
22
|
-
* ### 禁用事件
|
|
23
|
-
*
|
|
24
|
-
* @param row 选择的行
|
|
25
|
-
*/
|
|
26
|
-
onDisable: (row: E) => void;
|
|
27
|
-
/**
|
|
28
|
-
* ### 启用事件
|
|
29
|
-
*
|
|
30
|
-
* @param row 选择的行
|
|
31
|
-
*/
|
|
32
|
-
onEnable: (row: E) => void;
|
|
33
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../../service';
|
|
3
|
-
import { IUseTableResult } from './IUseTableResult';
|
|
4
|
-
/**
|
|
5
|
-
* # 树表格的 `Hook` 标准返回
|
|
6
|
-
* @author Hamm.cn
|
|
7
|
-
*/
|
|
8
|
-
export interface IUseTableTreeResult<E extends AirEntity, S extends AbstractWebService<E>> extends IUseTableResult<E, S> {
|
|
9
|
-
/**
|
|
10
|
-
* ### 表格行的添加按钮点击事件
|
|
11
|
-
*/
|
|
12
|
-
onAddRow: (row: E) => void;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './ITableHookOption';
|
|
2
|
-
export * from './ITableHookResult';
|
|
3
|
-
export * from './IUseDetailOption';
|
|
4
|
-
export * from './IUseDetailResult';
|
|
5
|
-
export * from './IUseEditorOption';
|
|
6
|
-
export * from './IUseEditorResult';
|
|
7
|
-
export * from './IUseSelectorOption';
|
|
8
|
-
export * from './IUseSelectorResult';
|
|
9
|
-
export * from './IUseTableOption';
|
|
10
|
-
export * from './IUseTableResult';
|
|
11
|
-
export * from './IUseTableTreeOption';
|
|
12
|
-
export * from './IUseTableTreeResult';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AirEntity, ClassConstructor } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { ITableHookOption, ITableHookResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 表格基础`Hook`
|
|
6
|
-
* @param entityClass 实体类
|
|
7
|
-
* @param serviceClass 表格使用的 `Service` 类
|
|
8
|
-
* @param option `可选` 更多配置
|
|
9
|
-
* @author Hamm.cn
|
|
10
|
-
*/
|
|
11
|
-
export declare function useBaseTable<E extends AirEntity, S extends AbstractWebService<E>>(entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: ITableHookOption<E>): ITableHookResult<E, S>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AirEntity, ClassConstructor, IJson } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { IUseDetailOption, IUseDetailResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 引入详情的`Hook`
|
|
6
|
-
* @param props `defineProps` 的返回值
|
|
7
|
-
* @param entityClass 详情使用的实体类
|
|
8
|
-
* @param serviceClass 详情使用的 `Service`
|
|
9
|
-
* @param option `可选` 更多的配置
|
|
10
|
-
* @author Hamm.cn
|
|
11
|
-
*/
|
|
12
|
-
export declare function useDetail<E extends AirEntity, S extends AbstractWebService<E>>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseDetailOption<E>): IUseDetailResult<E, S>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AirEntity, ClassConstructor, IJson } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { IUseEditorOption, IUseEditorResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 引入`Editor`的`Hook`
|
|
6
|
-
* @param props `defineProps`的返回值
|
|
7
|
-
* @param entityClass `Editor`使用的实体类
|
|
8
|
-
* @param serviceClass `Editor`使用的`Service`
|
|
9
|
-
* @param option `可选` 更多的配置
|
|
10
|
-
* @author Hamm.cn
|
|
11
|
-
*/
|
|
12
|
-
export declare function useEditor<E extends AirEntity, S extends AbstractWebService<E>>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseEditorOption<E>): IUseEditorResult<E, S>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AirEntity, ClassConstructor, IJson } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { IUseSelectorOption, IUseSelectorResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 引入`Selector`使用的`Hook`
|
|
6
|
-
* @param props `defineProps`的返回值
|
|
7
|
-
* @param entityClass 实体类
|
|
8
|
-
* @param serviceClass `Selector`使用的`Service`类
|
|
9
|
-
* @param option `可选` 更多配置
|
|
10
|
-
* @author Hamm.cn
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSelector<E extends AirEntity, S extends AbstractWebService<E>>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseSelectorOption<E>): IUseSelectorResult<E, S>;
|
package/dist/hooks/useTable.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AirEntity, ClassConstructor } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { IUseTableOption, IUseTableResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 引入表格使用的`Hook`
|
|
6
|
-
* @param entityClass 实体类
|
|
7
|
-
* @param serviceClass 表格使用的`Service`类
|
|
8
|
-
* @param option `可选` 更多配置
|
|
9
|
-
* @author Hamm.cn
|
|
10
|
-
*/
|
|
11
|
-
export declare function useTable<E extends AirEntity, S extends AbstractWebService<E>>(entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseTableOption<E>): IUseTableResult<E, S>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ClassConstructor, ITree } from '@airpower/core';
|
|
2
|
-
import { AbstractWebService } from '../service';
|
|
3
|
-
import { IUseTableTreeOption, IUseTableTreeResult } from './interface';
|
|
4
|
-
/**
|
|
5
|
-
* # 引入表格树使用的`Hook`
|
|
6
|
-
* @param entityClass 实体类
|
|
7
|
-
* @param serviceClass 表格使用的`Service`类
|
|
8
|
-
* @param option `可选` 更多配置
|
|
9
|
-
* @author Hamm.cn
|
|
10
|
-
*/
|
|
11
|
-
export declare function useTableTree<E extends ITree, S extends AbstractWebService<E>>(entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseTableTreeOption<E>): IUseTableTreeResult<E, S>;
|