@airpower/web 0.0.36 → 0.0.38
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 +2 -2
- package/dist/airpower.web.js +217 -194
- package/dist/controller/DetailController.d.ts +28 -0
- package/dist/controller/EditorController.d.ts +11 -0
- package/dist/controller/index.d.ts +4 -0
- package/dist/{hooks/interface/IUseDetailOption.d.ts → controller/interface/IDetailControllerOption.d.ts} +3 -2
- package/dist/{hooks/interface/ITableHookOption.d.ts → controller/interface/ITableControllerOption.d.ts} +3 -2
- package/dist/{hooks/interface/IUseTableTreeOption.d.ts → controller/interface/ITableTreeControllerOption.d.ts} +4 -3
- package/dist/{hooks → controller}/interface/IUseEditorOption.d.ts +4 -3
- package/dist/controller/interface/index.d.ts +4 -0
- package/dist/controller/table/BaseTableController.d.ts +72 -0
- package/dist/controller/table/TableController.d.ts +31 -0
- package/dist/controller/table/TableTreeController.d.ts +16 -0
- package/dist/controller/table/index.d.ts +3 -0
- package/dist/decorator/@table/IElementTableColumn.d.ts +1 -0
- package/dist/decorator/@table/ITableFieldConfig.d.ts +1 -0
- package/dist/helper/WebAccessToken.d.ts +1 -0
- package/dist/helper/WebI18n.d.ts +15 -11
- 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,8 +10,8 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://github.com/AirPowerTeam/AirPower-Web">Github</a> /
|
|
14
|
-
<a href="https://gitee.com/air-power/AirPower-Web">Gitee</a> /
|
|
13
|
+
<a href="https://github.com/AirPowerTeam/AirPower-Web">Github</a> /
|
|
14
|
+
<a href="https://gitee.com/air-power/AirPower-Web">Gitee</a> /
|
|
15
15
|
<a href="https://www.npmjs.com/package/@airpower/web">NPM</a>
|
|
16
16
|
</p>
|
|
17
17
|
|
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, HttpConfig, AirI18n,
|
|
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";
|
|
@@ -111,194 +111,220 @@ class WebAccessToken {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
class WebI18n extends AirI18n {
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
__publicField(this, "Detail", "详情");
|
|
117
|
+
__publicField(this, "Edit", "编辑");
|
|
118
|
+
__publicField(this, "Add", "添加");
|
|
119
|
+
__publicField(this, "EditSuccess", "编辑成功");
|
|
120
|
+
__publicField(this, "AddSuccess", "添加成功");
|
|
121
|
+
__publicField(this, "DeleteSuccess", "删除成功");
|
|
122
|
+
__publicField(this, "SelectPlease", "请选择");
|
|
123
|
+
__publicField(this, "DisableSuccess", "禁用成功");
|
|
124
|
+
__publicField(this, "EnableSuccess", "启用成功");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
class DetailController {
|
|
128
|
+
constructor() {
|
|
129
|
+
__publicField(this, "isLoading", ref(false));
|
|
130
|
+
__publicField(this, "formData");
|
|
131
|
+
__publicField(this, "title", ref(WebI18n.get().Detail));
|
|
132
|
+
__publicField(this, "service");
|
|
133
|
+
__publicField(this, "option", {});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* ### 创建详情控制器
|
|
137
|
+
* @param props `defineProps` 的返回值
|
|
138
|
+
* @param entityClass 详情使用的实体类
|
|
139
|
+
* @param serviceClass 详情使用的 `Service`
|
|
140
|
+
* @param option `可选` 更多的配置
|
|
141
|
+
*/
|
|
142
|
+
static create(props, entityClass, serviceClass, option = {}) {
|
|
143
|
+
const instance = new this();
|
|
144
|
+
instance.service = AirClassTransformer.newInstance(serviceClass);
|
|
145
|
+
instance.option = option;
|
|
146
|
+
instance.service.setLoading(instance.isLoading);
|
|
147
|
+
instance.formData = ref(props.param ? props.param.copy() : AirClassTransformer.newInstance(entityClass));
|
|
148
|
+
instance.getDetail();
|
|
149
|
+
return instance;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* ### 查询详情方法
|
|
153
|
+
*/
|
|
154
|
+
async getDetail() {
|
|
155
|
+
if (this.formData.value.id) {
|
|
156
|
+
this.formData.value = await this.service.getDetail(this.formData.value.id, this.option.apiUrl);
|
|
157
|
+
if (this.option.afterGetDetail) {
|
|
158
|
+
const result = this.option.afterGetDetail(this.formData.value);
|
|
159
|
+
if (result !== void 0) {
|
|
160
|
+
this.formData.value = result;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
116
164
|
}
|
|
117
165
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
166
|
+
class EditorController extends DetailController {
|
|
167
|
+
async getDetail() {
|
|
168
|
+
this.title.value = this.formData.value.id ? WebI18n.get().Edit : WebI18n.get().Add;
|
|
169
|
+
return super.getDetail();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class BaseTableController {
|
|
173
|
+
/**
|
|
174
|
+
* ### 创建表格控制器
|
|
175
|
+
* @param ServiceClass 服务类
|
|
176
|
+
*/
|
|
177
|
+
constructor(ServiceClass) {
|
|
178
|
+
__publicField(this, "request");
|
|
179
|
+
__publicField(this, "response", ref(new QueryPageResponse()));
|
|
180
|
+
__publicField(this, "list", ref([]));
|
|
181
|
+
__publicField(this, "selectList", ref([]));
|
|
182
|
+
__publicField(this, "isLoading", ref(false));
|
|
183
|
+
__publicField(this, "service");
|
|
184
|
+
__publicField(this, "option", {});
|
|
185
|
+
this.service = AirClassTransformer.newInstance(ServiceClass);
|
|
186
|
+
this.request = ref(new QueryPageRequest(this.service.entityClass));
|
|
187
|
+
this.init();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* ### 设置配置
|
|
191
|
+
* @param option 更多配置
|
|
192
|
+
*/
|
|
193
|
+
setOption(option) {
|
|
194
|
+
this.option = option;
|
|
195
|
+
if (option.defaultFilter) {
|
|
196
|
+
this.request.value.filter = option.defaultFilter;
|
|
197
|
+
}
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* ### 查询列表事件
|
|
202
|
+
*/
|
|
203
|
+
async getList() {
|
|
204
|
+
let req = this.request.value;
|
|
205
|
+
if (this.option.beforeSearch) {
|
|
206
|
+
const result = this.option.beforeSearch(req);
|
|
207
|
+
if (result) {
|
|
135
208
|
req = result;
|
|
136
209
|
}
|
|
137
210
|
}
|
|
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;
|
|
211
|
+
if (this.option.treeList) {
|
|
212
|
+
this.list.value = await this.service.getTreeList(req, this.option.apiUrl);
|
|
213
|
+
} else if (!this.option.unPaginate) {
|
|
214
|
+
this.response.value = await this.service.getPage(req, this.option.apiUrl);
|
|
215
|
+
this.list.value = this.response.value.list;
|
|
143
216
|
} else {
|
|
144
|
-
list.value = await service.getList(req, option.apiUrl);
|
|
217
|
+
this.list.value = await this.service.getList(req, this.option.apiUrl);
|
|
145
218
|
}
|
|
146
219
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
220
|
+
/**
|
|
221
|
+
* ### 搜索
|
|
222
|
+
* @param req 请求对象
|
|
223
|
+
*/
|
|
224
|
+
async search(req) {
|
|
225
|
+
this.request.value = req;
|
|
226
|
+
this.getList();
|
|
150
227
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
228
|
+
/**
|
|
229
|
+
* ### 重新加载数据
|
|
230
|
+
* 会自动返回第一页
|
|
231
|
+
*/
|
|
232
|
+
async reload() {
|
|
233
|
+
if (!this.request.value.page) {
|
|
234
|
+
this.request.value.page = new Page();
|
|
154
235
|
}
|
|
155
|
-
request.value.page.pageNum = 1;
|
|
156
|
-
|
|
236
|
+
this.request.value.page.pageNum = 1;
|
|
237
|
+
this.search(this.request.value);
|
|
157
238
|
}
|
|
158
|
-
|
|
159
|
-
|
|
239
|
+
/**
|
|
240
|
+
* ### 添加事件
|
|
241
|
+
*/
|
|
242
|
+
async add() {
|
|
243
|
+
if (!this.option.editView) {
|
|
160
244
|
console.error("请为 useAirTableList 的 option 传入 editView");
|
|
161
245
|
return;
|
|
162
246
|
}
|
|
163
247
|
try {
|
|
164
|
-
console.warn("需要弹出并携带数据", entity, option.editView);
|
|
165
248
|
} finally {
|
|
166
|
-
|
|
249
|
+
this.getList();
|
|
167
250
|
}
|
|
168
251
|
}
|
|
169
|
-
|
|
170
|
-
|
|
252
|
+
/**
|
|
253
|
+
* ### 点击表格行详情事件
|
|
254
|
+
* @param row 行数据
|
|
255
|
+
*/
|
|
256
|
+
async detail(row) {
|
|
257
|
+
if (!this.option.detailView) {
|
|
171
258
|
console.error("请为 useAirTableList 的 option 传入 detailView");
|
|
172
259
|
return;
|
|
173
260
|
}
|
|
174
261
|
try {
|
|
175
|
-
console.warn("需要弹出并携带数据", row, option.detailView);
|
|
262
|
+
console.warn("需要弹出并携带数据", row, this.option.detailView);
|
|
176
263
|
} finally {
|
|
177
|
-
|
|
264
|
+
this.reload();
|
|
178
265
|
}
|
|
179
266
|
}
|
|
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
|
-
}
|
|
267
|
+
/**
|
|
268
|
+
* ### 排序变更事件
|
|
269
|
+
* @param sort 排序对象
|
|
270
|
+
*/
|
|
271
|
+
async sortChanged(sort) {
|
|
272
|
+
this.request.value.sort = sort;
|
|
273
|
+
this.request.value.page = new Page();
|
|
274
|
+
this.getList();
|
|
227
275
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
}
|
|
276
|
+
/**
|
|
277
|
+
* ### 选择变更事件
|
|
278
|
+
* @param list 选择列表
|
|
279
|
+
*/
|
|
280
|
+
async selectChanged(list) {
|
|
281
|
+
this.selectList.value = list;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* ### 分页变更事件
|
|
285
|
+
* @param page 分页对象
|
|
286
|
+
*/
|
|
287
|
+
async pageChanged(page) {
|
|
288
|
+
this.request.value.page = page;
|
|
289
|
+
this.getList();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* ### 初始化
|
|
293
|
+
*/
|
|
294
|
+
init() {
|
|
295
|
+
this.service.setLoading(this.isLoading);
|
|
296
|
+
this.getList();
|
|
268
297
|
}
|
|
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
298
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
class TableController extends BaseTableController {
|
|
300
|
+
/**
|
|
301
|
+
* ### 表格行编辑事件
|
|
302
|
+
* @param row 行数据
|
|
303
|
+
*/
|
|
304
|
+
async edit(row) {
|
|
305
|
+
if (!this.option.editView) {
|
|
288
306
|
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
289
307
|
return;
|
|
290
308
|
}
|
|
291
309
|
try {
|
|
292
|
-
console.warn("需要弹出并携带数据", row, option.editView);
|
|
310
|
+
console.warn("需要弹出并携带数据", row, this.option.editView);
|
|
293
311
|
} finally {
|
|
294
|
-
|
|
312
|
+
this.getList();
|
|
295
313
|
}
|
|
296
314
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
/**
|
|
316
|
+
* ### 表格行删除事件
|
|
317
|
+
* @param row 行数据
|
|
318
|
+
*/
|
|
319
|
+
async delete(row) {
|
|
320
|
+
await this.service.delete(row.id, WebI18n.get().DeleteSuccess);
|
|
321
|
+
this.getList();
|
|
300
322
|
}
|
|
301
|
-
|
|
323
|
+
/**
|
|
324
|
+
* ### 表格行禁用事件
|
|
325
|
+
* @param row 行数据
|
|
326
|
+
*/
|
|
327
|
+
async disable(row) {
|
|
302
328
|
await ElMessageBox.confirm(
|
|
303
329
|
"是否确认禁用当前选择的数据?",
|
|
304
330
|
"禁用提醒",
|
|
@@ -308,10 +334,14 @@ function useTable(entityClass, serviceClass, option = {}) {
|
|
|
308
334
|
type: "warning"
|
|
309
335
|
}
|
|
310
336
|
);
|
|
311
|
-
await
|
|
312
|
-
|
|
337
|
+
await this.service.disable(row.id, WebI18n.get().DisableSuccess);
|
|
338
|
+
this.getList();
|
|
313
339
|
}
|
|
314
|
-
|
|
340
|
+
/**
|
|
341
|
+
* ### 表格行启用事件
|
|
342
|
+
* @param row 行数据
|
|
343
|
+
*/
|
|
344
|
+
async enable(row) {
|
|
315
345
|
await ElMessageBox.confirm(
|
|
316
346
|
"是否确认启用当前选择的数据?",
|
|
317
347
|
"启用提醒",
|
|
@@ -321,43 +351,34 @@ function useTable(entityClass, serviceClass, option = {}) {
|
|
|
321
351
|
type: "warning"
|
|
322
352
|
}
|
|
323
353
|
);
|
|
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;
|
|
354
|
+
await this.service.enable(row.id, WebI18n.get().EnableSuccess);
|
|
355
|
+
this.getList();
|
|
337
356
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
357
|
+
}
|
|
358
|
+
class TableTreeController extends TableController {
|
|
359
|
+
/**
|
|
360
|
+
* ### 树表格添加子项事件
|
|
361
|
+
* @param row 行数据
|
|
362
|
+
*/
|
|
363
|
+
async onAddRow(row) {
|
|
364
|
+
if (!this.option.editView) {
|
|
341
365
|
console.error("请为 useAirTableList 的 option 传入 editor");
|
|
342
366
|
return;
|
|
343
367
|
}
|
|
344
368
|
try {
|
|
345
|
-
let param = AirClassTransformer.newInstance(entityClass);
|
|
369
|
+
let param = AirClassTransformer.newInstance(this.service.entityClass);
|
|
346
370
|
param.parentId = row.id;
|
|
347
|
-
if (option.beforeAddRow) {
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
param =
|
|
371
|
+
if (this.option.beforeAddRow) {
|
|
372
|
+
const result = this.option.beforeAddRow(param, row);
|
|
373
|
+
if (result !== void 0) {
|
|
374
|
+
param = result;
|
|
351
375
|
}
|
|
352
376
|
}
|
|
353
|
-
console.warn("需要弹出并携带数据", param, option.editView);
|
|
377
|
+
console.warn("需要弹出并携带数据", param, this.option.editView);
|
|
354
378
|
} finally {
|
|
355
|
-
|
|
379
|
+
this.reload();
|
|
356
380
|
}
|
|
357
381
|
}
|
|
358
|
-
return Object.assign(result, {
|
|
359
|
-
onAddRow
|
|
360
|
-
});
|
|
361
382
|
}
|
|
362
383
|
class WebHttp extends AbstractHttp {
|
|
363
384
|
constructor() {
|
|
@@ -416,14 +437,17 @@ class AbstractWebService extends AbstractEntityService {
|
|
|
416
437
|
__publicField(this, "loading", ref(false));
|
|
417
438
|
}
|
|
418
439
|
/**
|
|
419
|
-
* ###
|
|
440
|
+
* ### 设置加载状态
|
|
420
441
|
* @param loading 加载状态
|
|
421
442
|
*/
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
return service;
|
|
443
|
+
setLoading(loading) {
|
|
444
|
+
this.loading = loading;
|
|
445
|
+
return this;
|
|
426
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* ### 创建一个 `Http` 对象
|
|
449
|
+
* @param url 请求的 `URL`
|
|
450
|
+
*/
|
|
427
451
|
createHttp(url) {
|
|
428
452
|
const http = WebHttp.create(url, (error) => {
|
|
429
453
|
ElMessage.error(error.message);
|
|
@@ -440,18 +464,17 @@ class AbstractWebService extends AbstractEntityService {
|
|
|
440
464
|
}
|
|
441
465
|
export {
|
|
442
466
|
AbstractWebService,
|
|
467
|
+
BaseTableController,
|
|
468
|
+
DetailController,
|
|
469
|
+
EditorController,
|
|
443
470
|
Table,
|
|
471
|
+
TableController,
|
|
472
|
+
TableTreeController,
|
|
444
473
|
WebAccessToken,
|
|
445
474
|
WebHttp,
|
|
446
475
|
WebI18n,
|
|
447
476
|
_sfc_main as WebTable,
|
|
448
477
|
getTableConfig,
|
|
449
478
|
getTableConfigList,
|
|
450
|
-
getTableFieldList
|
|
451
|
-
useBaseTable,
|
|
452
|
-
useDetail,
|
|
453
|
-
useEditor,
|
|
454
|
-
useSelector,
|
|
455
|
-
useTable,
|
|
456
|
-
useTableTree
|
|
479
|
+
getTableFieldList
|
|
457
480
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
*
|
|
8
|
+
* @author Hamm.cn
|
|
9
|
+
*/
|
|
10
|
+
export declare class DetailController<E extends AirEntity, S extends AbstractWebService<E>, O extends IDetailControllerOption<E> = IDetailControllerOption<E>> {
|
|
11
|
+
isLoading: Ref<boolean, boolean>;
|
|
12
|
+
formData: Ref<E>;
|
|
13
|
+
title: Ref<string, string>;
|
|
14
|
+
protected service: S;
|
|
15
|
+
protected option: O;
|
|
16
|
+
/**
|
|
17
|
+
* ### 创建详情控制器
|
|
18
|
+
* @param props `defineProps` 的返回值
|
|
19
|
+
* @param entityClass 详情使用的实体类
|
|
20
|
+
* @param serviceClass 详情使用的 `Service`
|
|
21
|
+
* @param option `可选` 更多的配置
|
|
22
|
+
*/
|
|
23
|
+
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;
|
|
24
|
+
/**
|
|
25
|
+
* ### 查询详情方法
|
|
26
|
+
*/
|
|
27
|
+
getDetail(): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AirEntity } from '@airpower/core';
|
|
2
|
+
import { AbstractWebService } from '../service';
|
|
3
|
+
import { DetailController } from './DetailController';
|
|
4
|
+
/**
|
|
5
|
+
* # 编辑器控制器
|
|
6
|
+
*
|
|
7
|
+
* @author Hamm.cn
|
|
8
|
+
*/
|
|
9
|
+
export declare class EditorController<E extends AirEntity, S extends AbstractWebService<E>> extends DetailController<E, S> {
|
|
10
|
+
getDetail(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AirEntity } from '@airpower/core';
|
|
2
2
|
/**
|
|
3
|
-
* #
|
|
3
|
+
* # 详情控制器配置项
|
|
4
|
+
*
|
|
4
5
|
* @author Hamm.cn
|
|
5
6
|
*/
|
|
6
|
-
export interface
|
|
7
|
+
export interface IDetailControllerOption<E extends AirEntity> {
|
|
7
8
|
/**
|
|
8
9
|
* ### 查到详情后的事件
|
|
9
10
|
* 参数为响应的数据,请处理后返回
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AirEntity, QueryPageRequest } from '@airpower/core';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
/**
|
|
4
|
-
* #
|
|
4
|
+
* # 表格控制器配置项
|
|
5
|
+
*
|
|
5
6
|
* @author Hamm.cn
|
|
6
7
|
*/
|
|
7
|
-
export interface
|
|
8
|
+
export interface ITableControllerOption<E extends AirEntity> {
|
|
8
9
|
/**
|
|
9
10
|
* ### 不分页
|
|
10
11
|
* 默认请求分页接口 如配置了 `treeList` 则此项自动失效
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AirEntity, ITree } from '@airpower/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ITableControllerOption } from './ITableControllerOption';
|
|
3
3
|
/**
|
|
4
|
-
* #
|
|
4
|
+
* # 表格树控制器配置项
|
|
5
|
+
*
|
|
5
6
|
* @author Hamm.cn
|
|
6
7
|
*/
|
|
7
|
-
export interface
|
|
8
|
+
export interface ITableTreeControllerOption<T extends ITree & AirEntity> extends ITableControllerOption<T> {
|
|
8
9
|
/**
|
|
9
10
|
* ### 添加行的子项的前置拦截方法
|
|
10
11
|
* 参数为发起请求的数据,请处理后返回 `param`
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AirEntity } from '@airpower/core';
|
|
2
|
-
import {
|
|
2
|
+
import { IDetailControllerOption } from './IDetailControllerOption';
|
|
3
3
|
/**
|
|
4
|
-
* #
|
|
4
|
+
* # 编辑控制器的可选配置
|
|
5
|
+
*
|
|
5
6
|
* @author Hamm.cn
|
|
6
7
|
*/
|
|
7
|
-
export interface IUseEditorOption<E extends AirEntity> extends
|
|
8
|
+
export interface IUseEditorOption<E extends AirEntity> extends IDetailControllerOption<E> {
|
|
8
9
|
/**
|
|
9
10
|
* ### 编辑成功的提示消息
|
|
10
11
|
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
*
|
|
8
|
+
* @author Hamm.cn
|
|
9
|
+
*/
|
|
10
|
+
export declare class BaseTableController<E extends AirEntity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> {
|
|
11
|
+
request: Ref<QueryPageRequest<E>>;
|
|
12
|
+
response: Ref<QueryPageResponse<E>>;
|
|
13
|
+
list: Ref<E[]>;
|
|
14
|
+
selectList: Ref<E[]>;
|
|
15
|
+
isLoading: Ref<boolean, boolean>;
|
|
16
|
+
protected service: S;
|
|
17
|
+
protected option: O;
|
|
18
|
+
/**
|
|
19
|
+
* ### 创建表格控制器
|
|
20
|
+
* @param ServiceClass 服务类
|
|
21
|
+
*/
|
|
22
|
+
constructor(ServiceClass: new () => S & {
|
|
23
|
+
entityClass: new () => E;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* ### 设置配置
|
|
27
|
+
* @param option 更多配置
|
|
28
|
+
*/
|
|
29
|
+
setOption(option: O): this;
|
|
30
|
+
/**
|
|
31
|
+
* ### 查询列表事件
|
|
32
|
+
*/
|
|
33
|
+
getList(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* ### 搜索
|
|
36
|
+
* @param req 请求对象
|
|
37
|
+
*/
|
|
38
|
+
search(req: QueryPageRequest<E>): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* ### 重新加载数据
|
|
41
|
+
* 会自动返回第一页
|
|
42
|
+
*/
|
|
43
|
+
reload(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* ### 添加事件
|
|
46
|
+
*/
|
|
47
|
+
add(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* ### 点击表格行详情事件
|
|
50
|
+
* @param row 行数据
|
|
51
|
+
*/
|
|
52
|
+
detail(row: E): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* ### 排序变更事件
|
|
55
|
+
* @param sort 排序对象
|
|
56
|
+
*/
|
|
57
|
+
sortChanged(sort?: QuerySort): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* ### 选择变更事件
|
|
60
|
+
* @param list 选择列表
|
|
61
|
+
*/
|
|
62
|
+
selectChanged(list: E[]): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* ### 分页变更事件
|
|
65
|
+
* @param page 分页对象
|
|
66
|
+
*/
|
|
67
|
+
pageChanged(page: Page): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* ### 初始化
|
|
70
|
+
*/
|
|
71
|
+
private init;
|
|
72
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AirEntity } from '@airpower/core';
|
|
2
|
+
import { AbstractWebService } from '../../service';
|
|
3
|
+
import { ITableControllerOption } from '../interface';
|
|
4
|
+
import { BaseTableController } from './BaseTableController';
|
|
5
|
+
/**
|
|
6
|
+
* # 表格控制器
|
|
7
|
+
*
|
|
8
|
+
* @author Hamm.cn
|
|
9
|
+
*/
|
|
10
|
+
export declare class TableController<E extends AirEntity, S extends AbstractWebService<E>, O extends ITableControllerOption<E> = ITableControllerOption<E>> extends BaseTableController<E, S, O> {
|
|
11
|
+
/**
|
|
12
|
+
* ### 表格行编辑事件
|
|
13
|
+
* @param row 行数据
|
|
14
|
+
*/
|
|
15
|
+
edit(row: E): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* ### 表格行删除事件
|
|
18
|
+
* @param row 行数据
|
|
19
|
+
*/
|
|
20
|
+
delete(row: E): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* ### 表格行禁用事件
|
|
23
|
+
* @param row 行数据
|
|
24
|
+
*/
|
|
25
|
+
disable(row: E): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* ### 表格行启用事件
|
|
28
|
+
* @param row 行数据
|
|
29
|
+
*/
|
|
30
|
+
enable(row: E): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
*
|
|
8
|
+
* @author Hamm.cn
|
|
9
|
+
*/
|
|
10
|
+
export declare class TableTreeController<E extends ITree & AirEntity, S extends AbstractWebService<E>> extends TableController<E, S, ITableTreeControllerOption<E>> {
|
|
11
|
+
/**
|
|
12
|
+
* ### 树表格添加子项事件
|
|
13
|
+
* @param row 行数据
|
|
14
|
+
*/
|
|
15
|
+
onAddRow(row: E): Promise<void>;
|
|
16
|
+
}
|
package/dist/helper/WebI18n.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { AirI18n } from '@airpower/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
/**
|
|
3
|
+
* # Web端默认语言包
|
|
4
|
+
*
|
|
5
|
+
* @author Hamm.cn
|
|
6
|
+
*/
|
|
7
|
+
export declare class WebI18n extends AirI18n {
|
|
8
|
+
Detail: string;
|
|
9
|
+
Edit: string;
|
|
10
|
+
Add: string;
|
|
11
|
+
EditSuccess: string;
|
|
12
|
+
AddSuccess: string;
|
|
13
|
+
DeleteSuccess: string;
|
|
14
|
+
SelectPlease: string;
|
|
15
|
+
DisableSuccess: string;
|
|
16
|
+
EnableSuccess: string;
|
|
13
17
|
}
|
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.38",
|
|
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.13",
|
|
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.15",
|
|
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 { AirEntity, 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 & AirEntity, S extends AbstractWebService<E>>(entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<S>, option?: IUseTableTreeOption<E>): IUseTableTreeResult<E, S>;
|