@jeecg/online 1.0.1
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/AuthButtonConfig.js +140 -0
- package/AuthButtonTree.js +183 -0
- package/AuthDataConfig.js +243 -0
- package/AuthDataTree.js +160 -0
- package/AuthFieldConfig.js +167 -0
- package/AuthFieldTree.js +273 -0
- package/AuthManagerDrawer.js +125 -0
- package/AuthSetterModal.js +317 -0
- package/CgformCopyList.js +253 -0
- package/CgformModal.js +748 -0
- package/CgreportModal.js +673 -0
- package/ChartAutoRender.js +69 -0
- package/ChartDoubleRender.js +154 -0
- package/ChartSingleRender.js +132 -0
- package/ChartTabsRender.js +218 -0
- package/CheckDictTable.js +121 -0
- package/CodeGeneratorModal.js +293 -0
- package/CustomButtonList.js +413 -0
- package/DBAttributeTable.js +278 -0
- package/DbToOnlineModal.js +190 -0
- package/EnhanceJavaModal.js +304 -0
- package/EnhanceJsHistory.js +231 -0
- package/EnhanceJsModal.js +293 -0
- package/EnhanceSqlModal.js +305 -0
- package/ErrorTip.js +21 -0
- package/ExtendConfigModal.js +142 -0
- package/FieldTable.js +185 -0
- package/FileSelectModal.js +102 -0
- package/ForeignKeyTable.js +78 -0
- package/FormSchemaFactory.js +938 -0
- package/GraphreportAutoChart.js +352 -0
- package/GraphreportList.js +239 -0
- package/GraphreportModal.js +559 -0
- package/IndexTable.js +96 -0
- package/JOnlineSearchSelect.js +107 -0
- package/LICENSE +7 -0
- package/LeftDepart.js +96 -0
- package/LeftRole.js +95 -0
- package/LeftUser.js +114 -0
- package/ModalFormDemo.js +84 -0
- package/OnlineAutoList.js +410 -0
- package/OnlineAutoModal.js +265 -0
- package/OnlineAutoTreeList.js +513 -0
- package/OnlineCustomModal.js +269 -0
- package/OnlineForm.js +809 -0
- package/OnlineQueryForm.js +442 -0
- package/OnlineSearchFormItem.js +428 -0
- package/OnlineSelectCascade.js +217 -0
- package/OnlineSubForm.js +200 -0
- package/OnlineSuperQuery.js +912 -0
- package/OnlineSuperQueryValComponent.js +8 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +172 -0
- package/PageAttributeTable.js +242 -0
- package/ParamsTable.js +71 -0
- package/ProcessOnlineForm.js +183 -0
- package/QueryTable.js +128 -0
- package/README.md +23 -0
- package/_arrayPush.js +276 -0
- package/auth.api.js +43 -0
- package/auth.data.js +144 -0
- package/cgform.data.js +235 -0
- package/cloneDeep.js +475 -0
- package/enhance.api.js +120 -0
- package/enhance.data.js +196 -0
- package/graphreport.api.js +23 -0
- package/index.js +64 -0
- package/index2.js +336 -0
- package/index3.js +799 -0
- package/isArray.js +47 -0
- package/main.index.js +6 -0
- package/package.json +6 -0
- package/pick.js +238 -0
- package/style.css +1 -0
- package/toString.js +31 -0
- package/useAutoForm.js +4274 -0
- package/useCgformList.js +353 -0
- package/useChartRender.js +405 -0
- package/useMessageOnline.js +71 -0
- package/useOnlineTest.js +26866 -0
- package/useSchemas.js +505 -0
- package/useTableColumns.js +1154 -0
- package/useTableSync.js +105 -0
package/useTableSync.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { inject, ref, computed, nextTick } from "vue";
|
|
22
|
+
import { V as VALIDATE_FAILED } from "./cgform.data.js";
|
|
23
|
+
import { p as pick } from "./pick.js";
|
|
24
|
+
function useTableSync(columns) {
|
|
25
|
+
const tables = inject("tables");
|
|
26
|
+
const fullScreenRef = inject("fullScreenRef");
|
|
27
|
+
const tableRef = ref();
|
|
28
|
+
const loading = ref(false);
|
|
29
|
+
const dataSource = ref([]);
|
|
30
|
+
const tableHeight = computed(() => ({
|
|
31
|
+
normal: (fullScreenRef == null ? void 0 : fullScreenRef.value) ? 430 : 260,
|
|
32
|
+
noToolbar: (fullScreenRef == null ? void 0 : fullScreenRef.value) ? 480 : 320
|
|
33
|
+
}));
|
|
34
|
+
const columnKeys = computed(() => ["id"].concat(columns.value.map((col) => col.key)));
|
|
35
|
+
function validateData(activeKey) {
|
|
36
|
+
return __async(this, null, function* () {
|
|
37
|
+
let instance = tableRef.value;
|
|
38
|
+
let errMap = yield instance.fullValidateTable();
|
|
39
|
+
if (errMap) {
|
|
40
|
+
throw { code: VALIDATE_FAILED, activeKey };
|
|
41
|
+
}
|
|
42
|
+
let tableData = instance.getTableData().map((data) => pick(data, columnKeys.value));
|
|
43
|
+
let deleteIds = instance.getDeleteData().map((d) => d.id);
|
|
44
|
+
return { tableData, deleteIds };
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function setDataSource(data, insert = false) {
|
|
48
|
+
return __async(this, null, function* () {
|
|
49
|
+
if (insert) {
|
|
50
|
+
dataSource.value = [];
|
|
51
|
+
yield nextTick();
|
|
52
|
+
yield tableRef.value.addOrInsert(data, 0, null, { setActive: false });
|
|
53
|
+
yield nextTick();
|
|
54
|
+
tableRef.value.recalcDisableRows();
|
|
55
|
+
} else {
|
|
56
|
+
dataSource.value = data;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function syncTable(dbTable) {
|
|
61
|
+
let targetTable = tableRef.value;
|
|
62
|
+
let sourceTable = dbTable.value.tableRef;
|
|
63
|
+
let removeIds = dbTable.value.getRemoveIds();
|
|
64
|
+
let sourceData = sourceTable.getXTable().internalData.tableFullData;
|
|
65
|
+
let targetData = targetTable.getXTable().internalData.tableFullData;
|
|
66
|
+
sourceData.forEach((sourceValue) => {
|
|
67
|
+
let flag = false;
|
|
68
|
+
targetData.forEach((targetValue) => {
|
|
69
|
+
if (sourceValue.id === targetValue.id) {
|
|
70
|
+
let dbFieldName = targetValue["dbFieldName"];
|
|
71
|
+
let dbFieldTxt = targetValue["dbFieldTxt"];
|
|
72
|
+
if (sourceValue.dbFieldName !== dbFieldName || sourceValue.dbFieldTxt !== dbFieldTxt) {
|
|
73
|
+
targetTable.setValues([{
|
|
74
|
+
rowKey: targetValue.id,
|
|
75
|
+
values: {
|
|
76
|
+
dbFieldName: sourceValue.dbFieldName,
|
|
77
|
+
dbFieldTxt: sourceValue.dbFieldTxt
|
|
78
|
+
}
|
|
79
|
+
}]);
|
|
80
|
+
}
|
|
81
|
+
flag = true;
|
|
82
|
+
} else {
|
|
83
|
+
removeIds.forEach((deletedId) => {
|
|
84
|
+
if (deletedId === targetValue.id) {
|
|
85
|
+
targetTable.removeRowsById(deletedId);
|
|
86
|
+
flag = true;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (!flag) {
|
|
92
|
+
let record = Object.assign({}, sourceValue);
|
|
93
|
+
columns.value.forEach((column) => {
|
|
94
|
+
if (column.key !== "dbFieldName" && column.key !== "dbFieldTxt") {
|
|
95
|
+
record[column.key] = column.defaultValue;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
targetTable.addRows(record);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return nextTick();
|
|
102
|
+
}
|
|
103
|
+
return { tables, tableRef, loading, dataSource, columnKeys, tableHeight, syncTable, validateData, setDataSource };
|
|
104
|
+
}
|
|
105
|
+
export { useTableSync as u };
|