@juzhenfe/page-model 3.17.6 → 3.17.8
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/page-model/constructor.d.ts +4 -0
- package/dist/components/table/constructor.d.ts +0 -8
- package/dist/components/table/type.d.ts +3 -0
- package/dist/components/table/utils/use-static-summary.d.ts +1 -7
- package/dist/index.es.js +55 -62
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
|
@@ -65,6 +65,10 @@ export default class PageModelManager extends Reflections {
|
|
|
65
65
|
updatedChildrenConfig(): void;
|
|
66
66
|
registerChildManager(managerName: any, manager: TableManager | SearchFormManager | TopTabsManager | FormManager): void;
|
|
67
67
|
handleSubmit(): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* 上次请求数据
|
|
70
|
+
*/
|
|
71
|
+
lastReqData: any;
|
|
68
72
|
doGetDataRequest(): Promise<boolean>;
|
|
69
73
|
/**
|
|
70
74
|
* 处理表格数据
|
|
@@ -302,14 +302,6 @@ export default class TableManager extends IManager {
|
|
|
302
302
|
* 更新当前渲染的列元素
|
|
303
303
|
*/
|
|
304
304
|
updateCurrentRenderTableEls(els: PageModel.TableBaseItem[]): void;
|
|
305
|
-
/**
|
|
306
|
-
* 当前elTable渲染的column
|
|
307
|
-
*/
|
|
308
|
-
currentTableColumns: any[];
|
|
309
|
-
/**
|
|
310
|
-
* 更新当前elTable渲染的column
|
|
311
|
-
*/
|
|
312
|
-
updateCurrentTableColumns(columns: any[]): void;
|
|
313
305
|
/**
|
|
314
306
|
* 当前列元素更新
|
|
315
307
|
*/
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
* 使用用户配置的汇总
|
|
3
3
|
*/
|
|
4
4
|
import TableManager from '../constructor';
|
|
5
|
-
import EventEmitter from '../../../utils/event-emitter';
|
|
6
|
-
/**
|
|
7
|
-
* 用户汇总配置修改事件
|
|
8
|
-
*/
|
|
9
|
-
declare const userSummaryConfigEmiter: EventEmitter<"change">;
|
|
10
|
-
export { userSummaryConfigEmiter };
|
|
11
5
|
export declare enum SummaryTypeEnum {
|
|
12
6
|
不展示 = 0,
|
|
13
7
|
求和 = 1,
|
|
@@ -18,4 +12,4 @@ export declare enum SummaryTypeEnum {
|
|
|
18
12
|
* @param tableManager
|
|
19
13
|
* @returns
|
|
20
14
|
*/
|
|
21
|
-
export declare function useUserSummary(tableManager: TableManager): boolean;
|
|
15
|
+
export declare function useUserSummary(tableManager: TableManager): () => boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -3746,6 +3746,7 @@ const _PageModelManager = class extends Reflections {
|
|
|
3746
3746
|
__publicField(this, "staticData");
|
|
3747
3747
|
__publicField(this, "id", 0);
|
|
3748
3748
|
__publicField(this, "isTableFullscreen", false);
|
|
3749
|
+
__publicField(this, "lastReqData");
|
|
3749
3750
|
__publicField(this, "isTableSelecting", false);
|
|
3750
3751
|
__publicField(this, "loadingInstance");
|
|
3751
3752
|
__publicField(this, "authButtons", []);
|
|
@@ -3893,6 +3894,7 @@ const _PageModelManager = class extends Reflections {
|
|
|
3893
3894
|
if (typeof config.beforeGetRequest === "function") {
|
|
3894
3895
|
config.beforeGetRequest.call(this, reqData);
|
|
3895
3896
|
}
|
|
3897
|
+
this.lastReqData = reqData;
|
|
3896
3898
|
let reqResult = await _PageModelManager.request[method](
|
|
3897
3899
|
config.getUrl,
|
|
3898
3900
|
reqData
|
|
@@ -4698,7 +4700,6 @@ class TableManager extends IManager {
|
|
|
4698
4700
|
__publicField(this, "radioData", null);
|
|
4699
4701
|
__publicField(this, "currentFilterTableEls", []);
|
|
4700
4702
|
__publicField(this, "currentRenderTableEls");
|
|
4701
|
-
__publicField(this, "currentTableColumns", []);
|
|
4702
4703
|
__publicField(this, "innerFilters", null);
|
|
4703
4704
|
__publicField(this, "saveContentScope");
|
|
4704
4705
|
__publicField(this, "saveContent");
|
|
@@ -5444,9 +5445,6 @@ class TableManager extends IManager {
|
|
|
5444
5445
|
this.currentRenderTableEls = els;
|
|
5445
5446
|
this.onCurrentRenderTableElsChange();
|
|
5446
5447
|
}
|
|
5447
|
-
updateCurrentTableColumns(columns) {
|
|
5448
|
-
this.currentTableColumns = columns;
|
|
5449
|
-
}
|
|
5450
5448
|
onCurrentRenderTableElsChange() {
|
|
5451
5449
|
const propList = this.currentRenderTableEls.map((a) => a.prop).filter((a) => a);
|
|
5452
5450
|
this.columnParamsList = this.columnParamsList.filter((a) => {
|
|
@@ -9038,62 +9036,68 @@ function useTableEls(originTableEls, tableManager) {
|
|
|
9038
9036
|
renderEls
|
|
9039
9037
|
};
|
|
9040
9038
|
}
|
|
9041
|
-
const userSummaryConfigEmiter = new EventEmitter();
|
|
9042
9039
|
var SummaryTypeEnum = /* @__PURE__ */ ((SummaryTypeEnum2) => {
|
|
9043
9040
|
SummaryTypeEnum2[SummaryTypeEnum2["\u4E0D\u5C55\u793A"] = 0] = "\u4E0D\u5C55\u793A";
|
|
9044
9041
|
SummaryTypeEnum2[SummaryTypeEnum2["\u6C42\u548C"] = 1] = "\u6C42\u548C";
|
|
9045
9042
|
SummaryTypeEnum2[SummaryTypeEnum2["\u603B\u6570"] = 2] = "\u603B\u6570";
|
|
9046
9043
|
return SummaryTypeEnum2;
|
|
9047
9044
|
})(SummaryTypeEnum || {});
|
|
9048
|
-
let isHijacked = false;
|
|
9049
|
-
let summaryResult = reactive([]);
|
|
9050
9045
|
function useUserSummary(tableManager) {
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
const
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9046
|
+
let isHijacked = false;
|
|
9047
|
+
let summaryResult = reactive([]);
|
|
9048
|
+
let currentTableColumns = [];
|
|
9049
|
+
let isFirstQuery = true;
|
|
9050
|
+
let lastSummaryColumns = [];
|
|
9051
|
+
const getSummaryEls = () => {
|
|
9052
|
+
return tableManager.currentRenderTableEls.filter((a) => a.showSummary != null && a.showSummary !== "").filter((a) => a.prop).map((a) => {
|
|
9053
|
+
return {
|
|
9054
|
+
prop: a.prop,
|
|
9055
|
+
showSummary: a.showSummary
|
|
9056
|
+
};
|
|
9057
|
+
});
|
|
9058
|
+
};
|
|
9059
|
+
const getSummaryData = debounce(async () => {
|
|
9060
|
+
const summaryColumns = lastSummaryColumns = getSummaryEls();
|
|
9061
|
+
const reqResult = tableManager.table.serverSummaryFn.call(
|
|
9062
|
+
tableManager,
|
|
9063
|
+
summaryColumns,
|
|
9064
|
+
cloneDeep(tableManager.manager.lastReqData),
|
|
9065
|
+
currentTableColumns
|
|
9066
|
+
);
|
|
9067
|
+
const _result = await reqResult;
|
|
9068
|
+
_result.forEach((item, index2) => {
|
|
9069
|
+
summaryResult[index2] = item;
|
|
9070
|
+
});
|
|
9071
|
+
}, 300);
|
|
9072
|
+
return function initSummary() {
|
|
9073
|
+
if (tableManager.tableProps.summaryMethod && !tableManager.tableProps._customSummary) {
|
|
9074
|
+
return false;
|
|
9075
|
+
}
|
|
9076
|
+
const currentRenderTableEls = tableManager.currentRenderTableEls;
|
|
9077
|
+
const isUsingSummary = tableManager.table.showSummary || currentRenderTableEls.filter((a) => a.prop).some((a) => a.showSummary != null);
|
|
9078
|
+
if (!isUsingSummary) {
|
|
9079
|
+
tableManager.tableProps.showSummary = false;
|
|
9080
|
+
tableManager.tableProps.summaryMethod = null;
|
|
9081
|
+
return false;
|
|
9082
|
+
}
|
|
9061
9083
|
tableManager.tableProps.showSummary = true;
|
|
9062
9084
|
tableManager.tableProps._customSummary = true;
|
|
9063
|
-
|
|
9064
|
-
const
|
|
9065
|
-
let lastSummaryColumns = {};
|
|
9066
|
-
const getSummaryData = debounce(async () => {
|
|
9067
|
-
const summaryColumns = tableManager.currentRenderTableEls.filter((a) => a.showSummary != null && a.showSummary !== "").filter((a) => a.prop).map((a) => {
|
|
9068
|
-
return {
|
|
9069
|
-
prop: a.prop,
|
|
9070
|
-
showSummary: a.showSummary
|
|
9071
|
-
};
|
|
9072
|
-
});
|
|
9073
|
-
const reqResult = tableManager.table.serverSummaryFn.call(
|
|
9074
|
-
tableManager,
|
|
9075
|
-
summaryColumns,
|
|
9076
|
-
cloneDeep(lastSummaryColumns),
|
|
9077
|
-
currentTableColumns
|
|
9078
|
-
);
|
|
9079
|
-
const _result = await reqResult;
|
|
9080
|
-
_result.forEach((item, index2) => {
|
|
9081
|
-
summaryResult[index2] = item;
|
|
9082
|
-
});
|
|
9083
|
-
}, 300);
|
|
9085
|
+
const summaryEls = getSummaryEls();
|
|
9086
|
+
const isServerSummary = tableManager.table.useServerSummary && typeof tableManager.table.serverSummaryFn === "function";
|
|
9084
9087
|
if (isServerSummary) {
|
|
9085
9088
|
if (!isHijacked) {
|
|
9089
|
+
const config = tableManager.manager.config;
|
|
9086
9090
|
let _beforeGetRequest = config.beforeGetRequest;
|
|
9087
9091
|
config.beforeGetRequest = async function(reqParams) {
|
|
9088
9092
|
if (typeof _beforeGetRequest === "function") {
|
|
9089
9093
|
_beforeGetRequest.call(tableManager.manager, reqParams);
|
|
9090
9094
|
}
|
|
9091
|
-
|
|
9092
|
-
|
|
9095
|
+
if (isFirstQuery) {
|
|
9096
|
+
isFirstQuery = false;
|
|
9097
|
+
} else {
|
|
9098
|
+
getSummaryData();
|
|
9099
|
+
}
|
|
9093
9100
|
};
|
|
9094
|
-
userSummaryConfigEmiter.on("change", () => {
|
|
9095
|
-
getSummaryData();
|
|
9096
|
-
});
|
|
9097
9101
|
isHijacked = true;
|
|
9098
9102
|
}
|
|
9099
9103
|
}
|
|
@@ -9102,11 +9106,10 @@ function useUserSummary(tableManager) {
|
|
|
9102
9106
|
data
|
|
9103
9107
|
}) {
|
|
9104
9108
|
if (!columns.length) {
|
|
9105
|
-
return
|
|
9109
|
+
return [];
|
|
9106
9110
|
}
|
|
9107
|
-
tableManager.updateCurrentTableColumns(columns);
|
|
9108
9111
|
if (isServerSummary) {
|
|
9109
|
-
if (
|
|
9112
|
+
if (currentTableColumns.length !== columns.length || currentTableColumns.map((a) => a.property).join(",") !== columns.map((a) => a.property).join(",") || getSummaryEls().map((a) => a.showSummary).join(",") !== lastSummaryColumns.map((a) => a.showSummary).join(",")) {
|
|
9110
9113
|
getSummaryData();
|
|
9111
9114
|
}
|
|
9112
9115
|
currentTableColumns = columns;
|
|
@@ -9179,13 +9182,7 @@ function useUserSummary(tableManager) {
|
|
|
9179
9182
|
);
|
|
9180
9183
|
});
|
|
9181
9184
|
};
|
|
9182
|
-
|
|
9183
|
-
tableManager.context.$refs.tableRef.doLayout();
|
|
9184
|
-
}, 20);
|
|
9185
|
-
} else {
|
|
9186
|
-
tableManager.tableProps.showSummary = false;
|
|
9187
|
-
tableManager.tableProps.summaryMethod = null;
|
|
9188
|
-
}
|
|
9185
|
+
};
|
|
9189
9186
|
}
|
|
9190
9187
|
const useExportForm = () => {
|
|
9191
9188
|
const exportFormRef = ref();
|
|
@@ -9487,13 +9484,14 @@ const _sfc_main$n = defineComponent({
|
|
|
9487
9484
|
});
|
|
9488
9485
|
const filteredUserEls = ref([]);
|
|
9489
9486
|
const renderedTableEls = ref();
|
|
9487
|
+
const initSummary = useUserSummary(tableManager);
|
|
9490
9488
|
function setTableEls() {
|
|
9491
9489
|
const result = useTableEls(table.value.els, tableManager);
|
|
9492
9490
|
filteredUserEls.value = result.filteredUserEls;
|
|
9493
9491
|
renderedTableEls.value = result.renderEls;
|
|
9494
9492
|
tableManager.updateCurrentFilterTableEls(cloneDeep(result.filteredUserEls));
|
|
9495
9493
|
tableManager.updateCurrentRenderTableEls(cloneDeep(result.renderEls));
|
|
9496
|
-
|
|
9494
|
+
initSummary();
|
|
9497
9495
|
}
|
|
9498
9496
|
tableUserConfigChangeEmiter.on("change", () => {
|
|
9499
9497
|
setTableEls();
|
|
@@ -9524,7 +9522,6 @@ const _sfc_main$n = defineComponent({
|
|
|
9524
9522
|
};
|
|
9525
9523
|
const onSaveColumns = async (columns) => {
|
|
9526
9524
|
const originColumns = table.value.els;
|
|
9527
|
-
let isSummaryChange = false;
|
|
9528
9525
|
const contents = columns.map((column) => {
|
|
9529
9526
|
const originColumnIndex = originColumns.findIndex((a) => a.label === column.label);
|
|
9530
9527
|
const item = {
|
|
@@ -9539,9 +9536,8 @@ const _sfc_main$n = defineComponent({
|
|
|
9539
9536
|
item.sum = Number(column.showSummary);
|
|
9540
9537
|
}
|
|
9541
9538
|
const renderColumn = filteredUserEls.value.find((a) => a.prop === column.prop);
|
|
9542
|
-
if (column.showSummary !== (renderColumn == null ? void 0 : renderColumn.showSummary))
|
|
9543
|
-
|
|
9544
|
-
}
|
|
9539
|
+
if (column.showSummary !== (renderColumn == null ? void 0 : renderColumn.showSummary))
|
|
9540
|
+
;
|
|
9545
9541
|
return item;
|
|
9546
9542
|
});
|
|
9547
9543
|
const userSetting = PageModelManager.userSetting;
|
|
@@ -9557,9 +9553,6 @@ const _sfc_main$n = defineComponent({
|
|
|
9557
9553
|
} catch (error) {
|
|
9558
9554
|
}
|
|
9559
9555
|
setTableEls();
|
|
9560
|
-
if (isSummaryChange) {
|
|
9561
|
-
userSummaryConfigEmiter.emit("change");
|
|
9562
|
-
}
|
|
9563
9556
|
};
|
|
9564
9557
|
const clearSelection = () => {
|
|
9565
9558
|
tableManager.clearSelection();
|
|
@@ -14903,7 +14896,7 @@ const defineEditableTable = function(config) {
|
|
|
14903
14896
|
};
|
|
14904
14897
|
var iconfont = "";
|
|
14905
14898
|
const name = "@juzhenfe/page-model";
|
|
14906
|
-
const version = "3.17.
|
|
14899
|
+
const version = "3.17.8";
|
|
14907
14900
|
const types = "dist/main.d.ts";
|
|
14908
14901
|
const main = "dist/index.umd.js";
|
|
14909
14902
|
const keywords = [
|