@airpower/web 0.3.2 → 0.3.4
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/dist/components/table/Table.vue.d.ts +24 -12
- package/dist/main.js +163 -17
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ declare const _default: <E extends RootEntity, S extends AbstractCurdService<E>>
|
|
|
14
14
|
props: __VLS_PrettifyLocal<Pick<Partial<{
|
|
15
15
|
loading: boolean;
|
|
16
16
|
entity: ITransformerConstructor<E>;
|
|
17
|
+
onSearch: (request: QueryRequestPage<E>) => void;
|
|
17
18
|
autoHeight: boolean;
|
|
18
19
|
selectList: E[];
|
|
19
20
|
emptyText: string;
|
|
@@ -67,6 +68,16 @@ declare const _default: <E extends RootEntity, S extends AbstractCurdService<E>>
|
|
|
67
68
|
importUrl: string;
|
|
68
69
|
importTemplateUrl: string;
|
|
69
70
|
fileEntity: ITransformerConstructor<IFile & RootEntity>;
|
|
71
|
+
onAdd: () => void;
|
|
72
|
+
onDetail: (row: E) => void;
|
|
73
|
+
onDelete: (row: E) => void;
|
|
74
|
+
onEdit: (row: E) => void;
|
|
75
|
+
onSelected: (list: E[]) => void;
|
|
76
|
+
onAddRow: (row: E) => void;
|
|
77
|
+
onSortChange: (sort?: QuerySort) => void;
|
|
78
|
+
onDisable: (row: E) => void;
|
|
79
|
+
onEnable: (row: E) => void;
|
|
80
|
+
isTree: boolean;
|
|
70
81
|
}> & Omit<{
|
|
71
82
|
readonly loading: boolean;
|
|
72
83
|
readonly autoHeight: boolean;
|
|
@@ -96,7 +107,9 @@ declare const _default: <E extends RootEntity, S extends AbstractCurdService<E>>
|
|
|
96
107
|
readonly deleteContent: string;
|
|
97
108
|
readonly showImport: boolean;
|
|
98
109
|
readonly showExport: boolean;
|
|
110
|
+
readonly isTree: boolean;
|
|
99
111
|
readonly entity?: ITransformerConstructor<E> | undefined;
|
|
112
|
+
readonly onSearch?: ((request: QueryRequestPage<E>) => void) | undefined;
|
|
100
113
|
readonly emptyText?: string | undefined;
|
|
101
114
|
readonly service?: CurdServiceConstructor<E, S> | undefined;
|
|
102
115
|
readonly addPermission?: string | undefined;
|
|
@@ -124,17 +137,16 @@ declare const _default: <E extends RootEntity, S extends AbstractCurdService<E>>
|
|
|
124
137
|
readonly importUrl?: string | undefined;
|
|
125
138
|
readonly importTemplateUrl?: string | undefined;
|
|
126
139
|
readonly fileEntity?: ITransformerConstructor<IFile & RootEntity> | undefined;
|
|
127
|
-
readonly onAdd?: (() =>
|
|
128
|
-
readonly
|
|
129
|
-
readonly
|
|
130
|
-
readonly
|
|
131
|
-
readonly
|
|
132
|
-
readonly
|
|
133
|
-
readonly
|
|
134
|
-
readonly
|
|
135
|
-
readonly
|
|
136
|
-
|
|
137
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "loading" | "entity" | "autoHeight" | "selectList" | "emptyText" | "addPermission" | "searchParams" | "useHook" | "disablePage" | "hideAdd" | "editPermission" | "disablePermission" | "enablePermission" | "detailPermission" | "deletePermission" | "addRowPermission" | "exportPermission" | "importPermission" | "dataList" | "columnList" | "hideEdit" | "disableEdit" | "disableAddRow" | "disableChangeStatus" | "disableDetail" | "disableDelete" | "disableRow" | "hideDelete" | "selectable" | "showSelect" | "showEnableAndDisable" | "hideIndex" | "fieldCacheKey" | "hideColumnSelector" | "ctrlWidth" | "hideCtrl" | "showDetail" | "showAddRow" | "customDelete" | "deleteTitle" | "deleteContent" | "showImport" | "importTitle" | "exportParam" | "showExport" | "defaultFilter" | "importUrl" | "importTemplateUrl" | "fileEntity">, "onSearch" | "service" | "onAdd" | "onDelete" | "onDisable" | "onEnable" | "onDetail" | "onEdit" | "onSelectChanged" | "onAddRow" | "onSortChanged" | ("loading" | "entity" | "autoHeight" | "selectList" | "emptyText" | "addPermission" | "searchParams" | "useHook" | "disablePage" | "hideAdd" | "editPermission" | "disablePermission" | "enablePermission" | "detailPermission" | "deletePermission" | "addRowPermission" | "exportPermission" | "importPermission" | "dataList" | "columnList" | "hideEdit" | "disableEdit" | "disableAddRow" | "disableChangeStatus" | "disableDetail" | "disableDelete" | "disableRow" | "hideDelete" | "selectable" | "showSelect" | "showEnableAndDisable" | "hideIndex" | "fieldCacheKey" | "hideColumnSelector" | "ctrlWidth" | "hideCtrl" | "showDetail" | "showAddRow" | "customDelete" | "deleteTitle" | "deleteContent" | "showImport" | "importTitle" | "exportParam" | "showExport" | "defaultFilter" | "importUrl" | "importTemplateUrl" | "fileEntity")> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
140
|
+
readonly onAdd?: (() => void) | undefined;
|
|
141
|
+
readonly onDetail?: ((row: E) => void) | undefined;
|
|
142
|
+
readonly onDelete?: ((row: E) => void) | undefined;
|
|
143
|
+
readonly onEdit?: ((row: E) => void) | undefined;
|
|
144
|
+
readonly onSelected?: ((list: E[]) => void) | undefined;
|
|
145
|
+
readonly onAddRow?: ((row: E) => void) | undefined;
|
|
146
|
+
readonly onSortChange?: ((sort?: QuerySort) => void) | undefined;
|
|
147
|
+
readonly onDisable?: ((row: E) => void) | undefined;
|
|
148
|
+
readonly onEnable?: ((row: E) => void) | undefined;
|
|
149
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "loading" | "entity" | "onSearch" | "autoHeight" | "selectList" | "emptyText" | "addPermission" | "searchParams" | "useHook" | "disablePage" | "hideAdd" | "editPermission" | "disablePermission" | "enablePermission" | "detailPermission" | "deletePermission" | "addRowPermission" | "exportPermission" | "importPermission" | "dataList" | "columnList" | "hideEdit" | "disableEdit" | "disableAddRow" | "disableChangeStatus" | "disableDetail" | "disableDelete" | "disableRow" | "hideDelete" | "selectable" | "showSelect" | "showEnableAndDisable" | "hideIndex" | "fieldCacheKey" | "hideColumnSelector" | "ctrlWidth" | "hideCtrl" | "showDetail" | "showAddRow" | "customDelete" | "deleteTitle" | "deleteContent" | "showImport" | "importTitle" | "exportParam" | "showExport" | "defaultFilter" | "importUrl" | "importTemplateUrl" | "fileEntity" | "onAdd" | "onDetail" | "onDelete" | "onEdit" | "onSelected" | "onAddRow" | "onSortChange" | "onDisable" | "onEnable" | "isTree">, "service" | ("loading" | "entity" | "onSearch" | "autoHeight" | "selectList" | "emptyText" | "addPermission" | "searchParams" | "useHook" | "disablePage" | "hideAdd" | "editPermission" | "disablePermission" | "enablePermission" | "detailPermission" | "deletePermission" | "addRowPermission" | "exportPermission" | "importPermission" | "dataList" | "columnList" | "hideEdit" | "disableEdit" | "disableAddRow" | "disableChangeStatus" | "disableDetail" | "disableDelete" | "disableRow" | "hideDelete" | "selectable" | "showSelect" | "showEnableAndDisable" | "hideIndex" | "fieldCacheKey" | "hideColumnSelector" | "ctrlWidth" | "hideCtrl" | "showDetail" | "showAddRow" | "customDelete" | "deleteTitle" | "deleteContent" | "showImport" | "importTitle" | "exportParam" | "showExport" | "defaultFilter" | "importUrl" | "importTemplateUrl" | "fileEntity" | "onAdd" | "onDetail" | "onDelete" | "onEdit" | "onSelected" | "onAddRow" | "onSortChange" | "onDisable" | "onEnable" | "isTree")> & {} & Partial<{}>> & import('vue').PublicProps;
|
|
138
150
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
139
151
|
resetSearch: () => void;
|
|
140
152
|
search: () => void;
|
|
@@ -164,7 +176,7 @@ declare const _default: <E extends RootEntity, S extends AbstractCurdService<E>>
|
|
|
164
176
|
afterPage?(_: {}): any;
|
|
165
177
|
footerRight?(_: {}): any;
|
|
166
178
|
};
|
|
167
|
-
emit:
|
|
179
|
+
emit: {};
|
|
168
180
|
}>) => import('vue').VNode & {
|
|
169
181
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
170
182
|
};
|
package/dist/main.js
CHANGED
|
@@ -17827,12 +17827,87 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
17827
17827
|
fileEntity: {
|
|
17828
17828
|
type: Function,
|
|
17829
17829
|
default: void 0
|
|
17830
|
+
},
|
|
17831
|
+
/**
|
|
17832
|
+
* # 自定义添加事件
|
|
17833
|
+
*/
|
|
17834
|
+
onAdd: {
|
|
17835
|
+
type: Function,
|
|
17836
|
+
default: void 0
|
|
17837
|
+
},
|
|
17838
|
+
/**
|
|
17839
|
+
* # 自定义详情事件
|
|
17840
|
+
*/
|
|
17841
|
+
onDetail: {
|
|
17842
|
+
type: Function,
|
|
17843
|
+
default: void 0
|
|
17844
|
+
},
|
|
17845
|
+
/**
|
|
17846
|
+
* # 自定义删除事件
|
|
17847
|
+
*/
|
|
17848
|
+
onDelete: {
|
|
17849
|
+
type: Function,
|
|
17850
|
+
default: void 0
|
|
17851
|
+
},
|
|
17852
|
+
/**
|
|
17853
|
+
* # 自定义编辑事件
|
|
17854
|
+
*/
|
|
17855
|
+
onEdit: {
|
|
17856
|
+
type: Function,
|
|
17857
|
+
default: void 0
|
|
17858
|
+
},
|
|
17859
|
+
/**
|
|
17860
|
+
* # 选择变更事件
|
|
17861
|
+
*/
|
|
17862
|
+
onSelected: {
|
|
17863
|
+
type: Function,
|
|
17864
|
+
default: void 0
|
|
17865
|
+
},
|
|
17866
|
+
/**
|
|
17867
|
+
* # 行添加事件
|
|
17868
|
+
*/
|
|
17869
|
+
onAddRow: {
|
|
17870
|
+
type: Function,
|
|
17871
|
+
default: void 0
|
|
17872
|
+
},
|
|
17873
|
+
/**
|
|
17874
|
+
* # 排序变更事件
|
|
17875
|
+
*/
|
|
17876
|
+
onSortChange: {
|
|
17877
|
+
type: Function,
|
|
17878
|
+
default: void 0
|
|
17879
|
+
},
|
|
17880
|
+
/**
|
|
17881
|
+
* # 禁用事件
|
|
17882
|
+
*/
|
|
17883
|
+
onDisable: {
|
|
17884
|
+
type: Function,
|
|
17885
|
+
default: void 0
|
|
17886
|
+
},
|
|
17887
|
+
/**
|
|
17888
|
+
* # 启用事件
|
|
17889
|
+
*/
|
|
17890
|
+
onEnable: {
|
|
17891
|
+
type: Function,
|
|
17892
|
+
default: void 0
|
|
17893
|
+
},
|
|
17894
|
+
/**
|
|
17895
|
+
* # 搜索事件
|
|
17896
|
+
*/
|
|
17897
|
+
onSearch: {
|
|
17898
|
+
type: Function,
|
|
17899
|
+
default: void 0
|
|
17900
|
+
},
|
|
17901
|
+
/**
|
|
17902
|
+
* # 是否树形
|
|
17903
|
+
*/
|
|
17904
|
+
isTree: {
|
|
17905
|
+
type: Boolean,
|
|
17906
|
+
default: false
|
|
17830
17907
|
}
|
|
17831
17908
|
},
|
|
17832
|
-
|
|
17833
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
17909
|
+
setup(__props, { expose: __expose }) {
|
|
17834
17910
|
const props = __props;
|
|
17835
|
-
const emits = __emit;
|
|
17836
17911
|
__expose({
|
|
17837
17912
|
resetSearch: onReset,
|
|
17838
17913
|
search: onSearch
|
|
@@ -17853,7 +17928,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
17853
17928
|
const entityInstance = Transformer.newInstance(EntityClass);
|
|
17854
17929
|
const modelConfig = getModelConfig(EntityClass);
|
|
17855
17930
|
const dataListRef = computed(() => {
|
|
17856
|
-
|
|
17931
|
+
if (props.dataList) {
|
|
17932
|
+
return props.dataList;
|
|
17933
|
+
}
|
|
17934
|
+
if (hook) {
|
|
17935
|
+
if (props.isTree) {
|
|
17936
|
+
return hook.list.value;
|
|
17937
|
+
}
|
|
17938
|
+
return hook.response.value.list;
|
|
17939
|
+
}
|
|
17940
|
+
return [];
|
|
17857
17941
|
});
|
|
17858
17942
|
const selectListRef = computed(() => {
|
|
17859
17943
|
return hook ? hook.selectList.value : props.selectList;
|
|
@@ -17934,7 +18018,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
17934
18018
|
}
|
|
17935
18019
|
async function handleDelete(item) {
|
|
17936
18020
|
if (props.customDelete) {
|
|
17937
|
-
|
|
18021
|
+
if (props.onDelete) {
|
|
18022
|
+
props.onDelete(item);
|
|
18023
|
+
} else if (hook) {
|
|
18024
|
+
hook.onDelete(item);
|
|
18025
|
+
}
|
|
17938
18026
|
return;
|
|
17939
18027
|
}
|
|
17940
18028
|
try {
|
|
@@ -17954,7 +18042,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
17954
18042
|
cancelButtonText: WebI18n.get().Cancel,
|
|
17955
18043
|
type: "warning"
|
|
17956
18044
|
});
|
|
17957
|
-
|
|
18045
|
+
if (props.onDelete) {
|
|
18046
|
+
props.onDelete(item);
|
|
18047
|
+
} else if (hook) {
|
|
18048
|
+
hook.onDelete(item);
|
|
18049
|
+
}
|
|
17958
18050
|
} catch (e) {
|
|
17959
18051
|
console.error(e);
|
|
17960
18052
|
}
|
|
@@ -17983,16 +18075,24 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
17983
18075
|
selectAll.push(find);
|
|
17984
18076
|
}
|
|
17985
18077
|
});
|
|
17986
|
-
|
|
18078
|
+
if (props.onSelected) {
|
|
18079
|
+
props.onSelected(selectAll);
|
|
18080
|
+
} else if (hook) {
|
|
18081
|
+
hook.onSelected(selectAll);
|
|
18082
|
+
}
|
|
17987
18083
|
}
|
|
17988
18084
|
function handleSortChanged(data) {
|
|
18085
|
+
let callback;
|
|
17989
18086
|
if (data.prop && data.order) {
|
|
17990
18087
|
const sort = new QuerySort();
|
|
17991
18088
|
sort.field = data.prop;
|
|
17992
18089
|
sort.direction = data.order === "descending" ? "desc" : "asc";
|
|
17993
|
-
|
|
17994
|
-
}
|
|
17995
|
-
|
|
18090
|
+
callback = sort;
|
|
18091
|
+
}
|
|
18092
|
+
if (props.onSortChange) {
|
|
18093
|
+
props.onSortChange(callback);
|
|
18094
|
+
} else if (hook) {
|
|
18095
|
+
hook.onSortChanged(callback);
|
|
17996
18096
|
}
|
|
17997
18097
|
}
|
|
17998
18098
|
function getRowEntity(scope) {
|
|
@@ -18039,6 +18139,48 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18039
18139
|
}
|
|
18040
18140
|
return WebConfig.apiUrl + url;
|
|
18041
18141
|
}
|
|
18142
|
+
function handleAdd() {
|
|
18143
|
+
if (props.onAdd) {
|
|
18144
|
+
props.onAdd();
|
|
18145
|
+
} else if (hook) {
|
|
18146
|
+
hook.onAdd();
|
|
18147
|
+
}
|
|
18148
|
+
}
|
|
18149
|
+
function handleAddRow(row) {
|
|
18150
|
+
if (props.onAddRow) {
|
|
18151
|
+
props.onAddRow(row);
|
|
18152
|
+
} else if (props.isTree) {
|
|
18153
|
+
hook == null ? void 0 : hook.onAddRow(row);
|
|
18154
|
+
}
|
|
18155
|
+
}
|
|
18156
|
+
function handleEdit(row) {
|
|
18157
|
+
if (props.onEdit) {
|
|
18158
|
+
props.onEdit(row);
|
|
18159
|
+
} else if (hook) {
|
|
18160
|
+
hook.onEdit(row);
|
|
18161
|
+
}
|
|
18162
|
+
}
|
|
18163
|
+
function handleDetail(row) {
|
|
18164
|
+
if (props.onDetail) {
|
|
18165
|
+
props.onDetail(row);
|
|
18166
|
+
} else if (hook) {
|
|
18167
|
+
hook.onDetail(row);
|
|
18168
|
+
}
|
|
18169
|
+
}
|
|
18170
|
+
function handleDisable(row) {
|
|
18171
|
+
if (props.onDisable) {
|
|
18172
|
+
props.onDisable(row);
|
|
18173
|
+
} else if (hook) {
|
|
18174
|
+
hook.onDisable(row);
|
|
18175
|
+
}
|
|
18176
|
+
}
|
|
18177
|
+
function handleEnable(row) {
|
|
18178
|
+
if (props.onEnable) {
|
|
18179
|
+
props.onEnable(row);
|
|
18180
|
+
} else if (hook) {
|
|
18181
|
+
hook.onEnable(row);
|
|
18182
|
+
}
|
|
18183
|
+
}
|
|
18042
18184
|
async function onImport() {
|
|
18043
18185
|
let url = props.importUrl;
|
|
18044
18186
|
if (!url) {
|
|
@@ -18117,7 +18259,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18117
18259
|
if (request.value.page) {
|
|
18118
18260
|
request.value.page.pageNum = 1;
|
|
18119
18261
|
}
|
|
18120
|
-
|
|
18262
|
+
if (props.onSearch) {
|
|
18263
|
+
props.onSearch(request.value);
|
|
18264
|
+
} else if (hook) {
|
|
18265
|
+
hook.onSearch(request.value);
|
|
18266
|
+
}
|
|
18121
18267
|
}
|
|
18122
18268
|
return (_ctx, _cache) => {
|
|
18123
18269
|
const _directive_loading = resolveDirective("loading");
|
|
@@ -18136,7 +18282,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18136
18282
|
permission: __props.addPermission || unref(PermissionUtil).get(unref(EntityClass), unref(PermissionAction).ADD),
|
|
18137
18283
|
icon: "ADD",
|
|
18138
18284
|
primary: "",
|
|
18139
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
18285
|
+
onClick: _cache[0] || (_cache[0] = ($event) => handleAdd())
|
|
18140
18286
|
}, {
|
|
18141
18287
|
default: withCtx(() => [
|
|
18142
18288
|
createTextVNode(toDisplayString(unref(modelConfig).addTitle || unref(WebI18n).get().Add), 1)
|
|
@@ -18350,7 +18496,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18350
18496
|
key: 0,
|
|
18351
18497
|
disabled: unref(isAddRowDisabled)(getRowEntity(scope)),
|
|
18352
18498
|
underline: false,
|
|
18353
|
-
onClick: ($event) =>
|
|
18499
|
+
onClick: ($event) => handleAddRow(getRowEntity(scope))
|
|
18354
18500
|
}, {
|
|
18355
18501
|
default: withCtx(() => [
|
|
18356
18502
|
createTextVNode(toDisplayString(unref(WebI18n).get().Add), 1)
|
|
@@ -18361,7 +18507,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18361
18507
|
key: 1,
|
|
18362
18508
|
disabled: unref(isEditDisabled)(getRowEntity(scope)),
|
|
18363
18509
|
underline: false,
|
|
18364
|
-
onClick: ($event) =>
|
|
18510
|
+
onClick: ($event) => handleEdit(getRowEntity(scope))
|
|
18365
18511
|
}, {
|
|
18366
18512
|
default: withCtx(() => [
|
|
18367
18513
|
createTextVNode(toDisplayString(unref(WebI18n).get().Update), 1)
|
|
@@ -18372,7 +18518,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18372
18518
|
key: 2,
|
|
18373
18519
|
disabled: unref(isDetailDisabled)(getRowEntity(scope)),
|
|
18374
18520
|
underline: false,
|
|
18375
|
-
onClick: ($event) =>
|
|
18521
|
+
onClick: ($event) => handleDetail(getRowEntity(scope))
|
|
18376
18522
|
}, {
|
|
18377
18523
|
default: withCtx(() => [
|
|
18378
18524
|
createTextVNode(toDisplayString(unref(WebI18n).get().Detail), 1)
|
|
@@ -18384,7 +18530,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18384
18530
|
key: 0,
|
|
18385
18531
|
disabled: unref(isDisableChangeStatus)(getRowEntity(scope)),
|
|
18386
18532
|
underline: false,
|
|
18387
|
-
onClick: ($event) =>
|
|
18533
|
+
onClick: ($event) => handleEnable(getRowEntity(scope))
|
|
18388
18534
|
}, {
|
|
18389
18535
|
default: withCtx(() => [
|
|
18390
18536
|
createTextVNode(toDisplayString(unref(WebI18n).get().Enable), 1)
|
|
@@ -18395,7 +18541,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
18395
18541
|
disabled: unref(isDisableChangeStatus)(getRowEntity(scope)),
|
|
18396
18542
|
underline: false,
|
|
18397
18543
|
type: "warning",
|
|
18398
|
-
onClick: ($event) =>
|
|
18544
|
+
onClick: ($event) => handleDisable(getRowEntity(scope))
|
|
18399
18545
|
}, {
|
|
18400
18546
|
default: withCtx(() => [
|
|
18401
18547
|
createTextVNode(toDisplayString(unref(WebI18n).get().Disable), 1)
|