@tachybase/module-hera 1.9.22 → 1.9.40
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/client/index.js +15 -26
- package/dist/externalVersion.js +8 -10
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/server/actions/index.d.ts +0 -2
- package/dist/server/actions/index.js +1 -5
- package/dist/server/migrations/20250102010713-add-plugin-department.d.ts +6 -0
- package/dist/server/{middlewares/set-department-owners.js → migrations/20250102010713-add-plugin-department.js} +22 -41
- package/dist/server/plugin.js +0 -2
- package/package.json +14 -14
- package/dist/client/features/departments/common/DepartmentTable.schema.d.ts +0 -50
- package/dist/client/features/departments/common/DepartmentTable.view.d.ts +0 -4
- package/dist/client/features/departments/common/FilterKeys.context.d.ts +0 -10
- package/dist/client/features/departments/common/InternalDepartmentTable.d.ts +0 -5
- package/dist/client/features/departments/common/Request.povider.d.ts +0 -1
- package/dist/client/features/departments/common/UserDepartmentsFieldNotSupport.d.ts +0 -2
- package/dist/client/features/departments/common/scopes/useDepartmentFilterActionProps.d.ts +0 -5
- package/dist/client/features/departments/common/scopes/useFilterActionProps.d.ts +0 -5
- package/dist/client/features/departments/index.d.ts +0 -5
- package/dist/client/features/departments/main-tab/DepartmentIndex.d.ts +0 -5
- package/dist/client/features/departments/main-tab/DepartmentIndex.provider.d.ts +0 -3
- package/dist/client/features/departments/main-tab/DepartmentManagement.component.d.ts +0 -1
- package/dist/client/features/departments/main-tab/DepartmentManagement.schema.d.ts +0 -10
- package/dist/client/features/departments/main-tab/DepartmentManagement.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/collections/departments.collection.d.ts +0 -128
- package/dist/client/features/departments/main-tab/collections/users.collection.d.ts +0 -189
- package/dist/client/features/departments/main-tab/components/DepartmentSelect.d.ts +0 -1
- package/dist/client/features/departments/main-tab/components/InternalSuperiorDepartmentSelect.d.ts +0 -1
- package/dist/client/features/departments/main-tab/components/SuperiorDepartmentSelect.d.ts +0 -1
- package/dist/client/features/departments/main-tab/context/Department.context.d.ts +0 -23
- package/dist/client/features/departments/main-tab/context/DepartmentsExpanded.context.d.ts +0 -17
- package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.schema.d.ts +0 -67
- package/dist/client/features/departments/main-tab/departments-block/AddNewDepartment.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-block/DepartmentOwnersField.component.d.ts +0 -5
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsBlock.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsSearch.component.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-block/DepartmentsTree.component.d.ts +0 -8
- package/dist/client/features/departments/main-tab/departments-block/Request.provider.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.schema.d.ts +0 -136
- package/dist/client/features/departments/main-tab/departments-block/UnknownOwerns.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentEdit.d.ts +0 -62
- package/dist/client/features/departments/main-tab/departments-block/schemas/schemaDepartmentNewSub.d.ts +0 -57
- package/dist/client/features/departments/main-tab/departments-block/scopes/useCreateDepartment.d.ts +0 -3
- package/dist/client/features/departments/main-tab/departments-block/scopes/useUpdateDepartment.d.ts +0 -3
- package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.schema.d.ts +0 -148
- package/dist/client/features/departments/main-tab/departments-users-block/AddMembers.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentField.component.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/DepartmentsUsersBlock.schema.d.ts +0 -676
- package/dist/client/features/departments/main-tab/departments-users-block/IsOwnerField.component.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.schema.d.ts +0 -49
- package/dist/client/features/departments/main-tab/departments-users-block/MemberActions.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.schema.d.ts +0 -16
- package/dist/client/features/departments/main-tab/departments-users-block/RowRemoveAction.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/UserDepartmentsField.component.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.schema.d.ts +0 -42
- package/dist/client/features/departments/main-tab/departments-users-block/UserSelectDepartment.view.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useBulkRemoveMembersAction.d.ts +0 -3
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useDataSource.d.ts +0 -40
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useMembersDataSource.d.ts +0 -6
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/usePropsAddMember.d.ts +0 -1
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRefreshActionProps.d.ts +0 -3
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useRemoveMemberAction.d.ts +0 -3
- package/dist/client/features/departments/main-tab/departments-users-block/scopes/useShowTotal.d.ts +0 -1
- package/dist/client/features/departments/main-tab/hooks/useDeepTree.d.ts +0 -14
- package/dist/client/features/departments/main-tab/hooks/useGetDepTree.d.ts +0 -18
- package/dist/client/features/departments/main-tab/kit.d.ts +0 -4
- package/dist/client/features/departments/main-tab/providers/DepartmentsResource.provider.d.ts +0 -3
- package/dist/client/features/departments/main-tab/providers/UserResource.provider.d.ts +0 -3
- package/dist/client/features/departments/role-auth/DepartmentTitle.component.d.ts +0 -1
- package/dist/client/features/departments/role-auth/Departments.d.ts +0 -1
- package/dist/client/features/departments/role-auth/Departments.schema.d.ts +0 -227
- package/dist/client/features/departments/role-auth/kit.d.ts +0 -4
- package/dist/client/features/departments/role-auth/scopes/useAddDepartments.d.ts +0 -3
- package/dist/client/features/departments/role-auth/scopes/useBulkRemoveDepartments.d.ts +0 -3
- package/dist/client/features/departments/role-auth/scopes/useDataSource.d.ts +0 -40
- package/dist/client/features/departments/role-auth/scopes/useDisabled.d.ts +0 -3
- package/dist/client/features/departments/role-auth/scopes/useRemoveDepartment.d.ts +0 -3
- package/dist/client/features/departments/settings/DepartmentOwnersFieldSetting.d.ts +0 -2
- package/dist/client/features/departments/settings/UserDepartmentsFieldSetting.d.ts +0 -2
- package/dist/client/features/departments/settings/UserMainDepartmentFieldSetting.d.ts +0 -2
- package/dist/client/features/departments/settings/items/enableLinkItem.d.ts +0 -2
- package/dist/client/features/departments/settings/items/modeSelectItem.d.ts +0 -2
- package/dist/client/features/departments/settings/items/titleFieldItem.d.ts +0 -2
- package/dist/client/features/departments/utils/getDepartmentStr.d.ts +0 -1
- package/dist/client/features/departments/utils/getUserListByDepartment.d.ts +0 -1
- package/dist/server/actions/departments.d.ts +0 -5
- package/dist/server/actions/departments.js +0 -105
- package/dist/server/actions/users.d.ts +0 -4
- package/dist/server/actions/users.js +0 -142
- package/dist/server/collections/departmentRoles.d.ts +0 -2
- package/dist/server/collections/departmentRoles.js +0 -27
- package/dist/server/collections/departments.d.ts +0 -29
- package/dist/server/collections/departments.js +0 -162
- package/dist/server/collections/departmentsUsers.d.ts +0 -2
- package/dist/server/collections/departmentsUsers.js +0 -43
- package/dist/server/collections/roles.d.ts +0 -2
- package/dist/server/collections/roles.js +0 -39
- package/dist/server/collections/users.d.ts +0 -55
- package/dist/server/collections/users.js +0 -87
- package/dist/server/features/departments.d.ts +0 -7
- package/dist/server/features/departments.js +0 -132
- package/dist/server/middlewares/destroy-department-check.d.ts +0 -2
- package/dist/server/middlewares/destroy-department-check.js +0 -53
- package/dist/server/middlewares/index.d.ts +0 -6
- package/dist/server/middlewares/index.js +0 -31
- package/dist/server/middlewares/list-users-include-child-department.d.ts +0 -2
- package/dist/server/middlewares/list-users-include-child-department.js +0 -77
- package/dist/server/middlewares/reset-user-departments-cache.d.ts +0 -2
- package/dist/server/middlewares/reset-user-departments-cache.js +0 -39
- package/dist/server/middlewares/set-department-owners.d.ts +0 -2
- package/dist/server/middlewares/set-departments-roles.d.ts +0 -2
- package/dist/server/middlewares/set-departments-roles.js +0 -64
- package/dist/server/middlewares/set-main-department.d.ts +0 -2
- package/dist/server/middlewares/set-main-department.js +0 -105
- package/dist/server/middlewares/update-department-isleaf.d.ts +0 -2
- package/dist/server/middlewares/update-department-isleaf.js +0 -84
- package/dist/server/models/department.d.ts +0 -4
- package/dist/server/models/department.js +0 -38
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var update_department_isleaf_exports = {};
|
|
19
|
-
__export(update_department_isleaf_exports, {
|
|
20
|
-
updateDepartmentIsLeaf: () => updateDepartmentIsLeaf
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(update_department_isleaf_exports);
|
|
23
|
-
const updateIsLeafWhenAddChild = async (repo, parent) => {
|
|
24
|
-
if (parent && parent.isLeaf !== false) {
|
|
25
|
-
await repo.update({
|
|
26
|
-
filter: {
|
|
27
|
-
id: parent.id
|
|
28
|
-
},
|
|
29
|
-
values: {
|
|
30
|
-
isLeaf: false
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const updateIsLeafWhenChangeChild = async (repo, oldParentId, newParentId) => {
|
|
36
|
-
if (oldParentId && oldParentId !== newParentId) {
|
|
37
|
-
const hasChild = await repo.count({
|
|
38
|
-
filter: {
|
|
39
|
-
parentId: oldParentId
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
if (!hasChild) {
|
|
43
|
-
await repo.update({
|
|
44
|
-
filter: {
|
|
45
|
-
id: oldParentId
|
|
46
|
-
},
|
|
47
|
-
values: {
|
|
48
|
-
isLeaf: true
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const updateDepartmentIsLeaf = async (ctx, next) => {
|
|
55
|
-
const { filterByTk, values = {}, resourceName, actionName } = ctx.action.params;
|
|
56
|
-
const repo = ctx.db.getRepository("departments");
|
|
57
|
-
const { parent } = values;
|
|
58
|
-
if (resourceName === "departments" && actionName === "create") {
|
|
59
|
-
ctx.action.params.values = { ...values, isLeaf: true };
|
|
60
|
-
await next();
|
|
61
|
-
await updateIsLeafWhenAddChild(repo, parent);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (resourceName === "departments" && actionName === "update") {
|
|
65
|
-
const department = await repo.findOne({ filterByTk });
|
|
66
|
-
await next();
|
|
67
|
-
await Promise.all([
|
|
68
|
-
updateIsLeafWhenChangeChild(repo, department.parentId, parent == null ? void 0 : parent.id),
|
|
69
|
-
updateIsLeafWhenAddChild(repo, parent)
|
|
70
|
-
]);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (resourceName === "departments" && actionName === "destroy") {
|
|
74
|
-
const department = await repo.findOne({ filterByTk });
|
|
75
|
-
await next();
|
|
76
|
-
await updateIsLeafWhenChangeChild(repo, department.parentId, null);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
return next();
|
|
80
|
-
};
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
updateDepartmentIsLeaf
|
|
84
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var department_exports = {};
|
|
19
|
-
__export(department_exports, {
|
|
20
|
-
DepartmentModel: () => DepartmentModel
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(department_exports);
|
|
23
|
-
var import_database = require("@tachybase/database");
|
|
24
|
-
class DepartmentModel extends import_database.Model {
|
|
25
|
-
getOwners() {
|
|
26
|
-
return this.getMembers({
|
|
27
|
-
through: {
|
|
28
|
-
where: {
|
|
29
|
-
isOwner: true
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
DepartmentModel
|
|
38
|
-
});
|