@nocobase/plugin-departments 1.6.20

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.
Files changed (84) hide show
  1. package/LICENSE.txt +161 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/ResourcesProvider.d.ts +20 -0
  6. package/dist/client/collections/departments.d.ts +144 -0
  7. package/dist/client/collections/users.d.ts +205 -0
  8. package/dist/client/components/DepartmentOwnersField.d.ts +18 -0
  9. package/dist/client/components/ReadOnlyAssociationField.d.ts +18 -0
  10. package/dist/client/components/UserDepartmentsField.d.ts +18 -0
  11. package/dist/client/components/UserMainDepartmentField.d.ts +18 -0
  12. package/dist/client/components/fieldSettings.d.ts +22 -0
  13. package/dist/client/components/index.d.ts +20 -0
  14. package/dist/client/departments/AggregateSearch.d.ts +18 -0
  15. package/dist/client/departments/Department.d.ts +45 -0
  16. package/dist/client/departments/DepartmentBlock.d.ts +18 -0
  17. package/dist/client/departments/DepartmentField.d.ts +18 -0
  18. package/dist/client/departments/DepartmentManagement.d.ts +18 -0
  19. package/dist/client/departments/DepartmentOwnersField.d.ts +10 -0
  20. package/dist/client/departments/DepartmentTable.d.ts +18 -0
  21. package/dist/client/departments/DepartmentTree.d.ts +30 -0
  22. package/dist/client/departments/DepartmentTreeSelect.d.ts +24 -0
  23. package/dist/client/departments/IsOwnerField.d.ts +18 -0
  24. package/dist/client/departments/Member.d.ts +19 -0
  25. package/dist/client/departments/NewDepartment.d.ts +10 -0
  26. package/dist/client/departments/UserDepartmentsField.d.ts +10 -0
  27. package/dist/client/departments/schemas/departments.d.ts +257 -0
  28. package/dist/client/departments/schemas/users.d.ts +443 -0
  29. package/dist/client/hooks/departments-manager.d.ts +37 -0
  30. package/dist/client/hooks/index.d.ts +18 -0
  31. package/dist/client/hooks/tree-manager.d.ts +38 -0
  32. package/dist/client/hooks/useTableBlockProps.d.ts +28 -0
  33. package/dist/client/index.d.ts +23 -0
  34. package/dist/client/index.js +10 -0
  35. package/dist/client/locale.d.ts +9 -0
  36. package/dist/client/roles/RoleDepartmentsManager.d.ts +18 -0
  37. package/dist/client/roles/schemas/departments.d.ts +235 -0
  38. package/dist/client/utils.d.ts +17 -0
  39. package/dist/externalVersion.js +29 -0
  40. package/dist/index.d.ts +18 -0
  41. package/dist/index.js +48 -0
  42. package/dist/locale/en-US.json +35 -0
  43. package/dist/locale/zh-CN.json +35 -0
  44. package/dist/server/actions/departments.d.ts +21 -0
  45. package/dist/server/actions/departments.js +114 -0
  46. package/dist/server/actions/users.d.ts +20 -0
  47. package/dist/server/actions/users.js +151 -0
  48. package/dist/server/collections/departmentRoles.d.ts +10 -0
  49. package/dist/server/collections/departmentRoles.js +37 -0
  50. package/dist/server/collections/departments.d.ts +37 -0
  51. package/dist/server/collections/departments.js +172 -0
  52. package/dist/server/collections/departmentsUsers.d.ts +10 -0
  53. package/dist/server/collections/departmentsUsers.js +53 -0
  54. package/dist/server/collections/roles.d.ts +14 -0
  55. package/dist/server/collections/roles.js +48 -0
  56. package/dist/server/collections/users.d.ts +67 -0
  57. package/dist/server/collections/users.js +96 -0
  58. package/dist/server/department-data-sync-resource.d.ts +27 -0
  59. package/dist/server/department-data-sync-resource.js +339 -0
  60. package/dist/server/index.d.ts +17 -0
  61. package/dist/server/index.js +42 -0
  62. package/dist/server/middlewares/destroy-department-check.d.ts +18 -0
  63. package/dist/server/middlewares/destroy-department-check.js +62 -0
  64. package/dist/server/middlewares/index.d.ts +22 -0
  65. package/dist/server/middlewares/index.js +40 -0
  66. package/dist/server/middlewares/reset-user-departments-cache.d.ts +18 -0
  67. package/dist/server/middlewares/reset-user-departments-cache.js +48 -0
  68. package/dist/server/middlewares/set-department-owners.d.ts +18 -0
  69. package/dist/server/middlewares/set-department-owners.js +83 -0
  70. package/dist/server/middlewares/set-departments-roles.d.ts +18 -0
  71. package/dist/server/middlewares/set-departments-roles.js +71 -0
  72. package/dist/server/middlewares/set-main-department.d.ts +18 -0
  73. package/dist/server/middlewares/set-main-department.js +114 -0
  74. package/dist/server/middlewares/update-department-isleaf.d.ts +18 -0
  75. package/dist/server/middlewares/update-department-isleaf.js +93 -0
  76. package/dist/server/migrations/update-field-uischemas-20240307124823.d.ts +20 -0
  77. package/dist/server/migrations/update-field-uischemas-20240307124823.js +106 -0
  78. package/dist/server/models/department.d.ts +20 -0
  79. package/dist/server/models/department.js +47 -0
  80. package/dist/server/plugin.d.ts +19 -0
  81. package/dist/server/plugin.js +154 -0
  82. package/package.json +22 -0
  83. package/server.d.ts +2 -0
  84. package/server.js +1 -0
@@ -0,0 +1,443 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const membersActionSchema: {
10
+ type: string;
11
+ 'x-component': string;
12
+ properties: {
13
+ remove: {
14
+ type: string;
15
+ title: string;
16
+ 'x-component': string;
17
+ 'x-component-props': {
18
+ icon: string;
19
+ confirm: {
20
+ title: string;
21
+ content: string;
22
+ };
23
+ style: {
24
+ marginRight: number;
25
+ };
26
+ useAction: string;
27
+ };
28
+ };
29
+ create: {
30
+ type: string;
31
+ title: string;
32
+ 'x-component': string;
33
+ 'x-component-props': {
34
+ type: string;
35
+ icon: string;
36
+ };
37
+ properties: {
38
+ drawer: {
39
+ type: string;
40
+ 'x-component': string;
41
+ };
42
+ };
43
+ };
44
+ };
45
+ };
46
+ export declare const rowRemoveActionSchema: {
47
+ type: string;
48
+ properties: {
49
+ remove: {
50
+ title: string;
51
+ 'x-component': string;
52
+ 'x-component-props': {
53
+ confirm: {
54
+ title: string;
55
+ content: string;
56
+ };
57
+ useAction: string;
58
+ };
59
+ };
60
+ };
61
+ };
62
+ export declare const getMembersSchema: (department: any, user: any) => {
63
+ type: string;
64
+ 'x-component': string;
65
+ 'x-component-props': {
66
+ heightMode: string;
67
+ };
68
+ properties: {
69
+ table: {
70
+ type: string;
71
+ 'x-component': string;
72
+ 'x-use-component-props': string;
73
+ 'x-component-props': {
74
+ rowKey: string;
75
+ rowSelection: {
76
+ type: string;
77
+ };
78
+ pagination: {
79
+ showTotal: string;
80
+ };
81
+ };
82
+ properties: {
83
+ phone: {
84
+ type: string;
85
+ 'x-decorator': string;
86
+ 'x-component': string;
87
+ properties: {
88
+ phone: {
89
+ type: string;
90
+ 'x-component': string;
91
+ 'x-read-pretty': boolean;
92
+ };
93
+ };
94
+ };
95
+ email: {
96
+ type: string;
97
+ 'x-decorator': string;
98
+ 'x-component': string;
99
+ properties: {
100
+ email: {
101
+ type: string;
102
+ 'x-component': string;
103
+ 'x-read-pretty': boolean;
104
+ };
105
+ };
106
+ };
107
+ actions: {
108
+ type: string;
109
+ title: string;
110
+ 'x-component': string;
111
+ 'x-component-props': {
112
+ fixed: string;
113
+ };
114
+ properties: {
115
+ actions: {
116
+ type: string;
117
+ 'x-component': string;
118
+ 'x-component-props': {
119
+ split: string;
120
+ };
121
+ properties: {
122
+ remove?: {
123
+ type: string;
124
+ 'x-component': string;
125
+ };
126
+ update: {
127
+ type: string;
128
+ title: string;
129
+ 'x-component': string;
130
+ 'x-component-props': {
131
+ type: string;
132
+ };
133
+ properties: {
134
+ drawer: {
135
+ type: string;
136
+ 'x-component': string;
137
+ 'x-decorator': string;
138
+ title: string;
139
+ properties: {
140
+ departments: {
141
+ title: string;
142
+ 'x-decorator': string;
143
+ 'x-component': string;
144
+ };
145
+ };
146
+ };
147
+ };
148
+ };
149
+ };
150
+ };
151
+ };
152
+ };
153
+ isOwner?: {
154
+ type: string;
155
+ 'x-decorator': string;
156
+ 'x-component': string;
157
+ 'x-component-props': {
158
+ style: {
159
+ minWidth: number;
160
+ };
161
+ };
162
+ title: string;
163
+ properties: {
164
+ isOwner: {
165
+ type: string;
166
+ 'x-component': string;
167
+ };
168
+ };
169
+ };
170
+ nickname: {
171
+ type: string;
172
+ 'x-decorator': string;
173
+ 'x-component': string;
174
+ properties: {
175
+ nickname: {
176
+ type: string;
177
+ 'x-component': string;
178
+ 'x-read-pretty': boolean;
179
+ };
180
+ };
181
+ };
182
+ username: {
183
+ type: string;
184
+ 'x-decorator': string;
185
+ 'x-component': string;
186
+ properties: {
187
+ username: {
188
+ type: string;
189
+ 'x-component': string;
190
+ 'x-read-pretty': boolean;
191
+ };
192
+ };
193
+ };
194
+ departments: {
195
+ type: string;
196
+ 'x-decorator': string;
197
+ 'x-component': string;
198
+ properties: {
199
+ departments: {
200
+ type: string;
201
+ 'x-component': string;
202
+ 'x-read-pretty': boolean;
203
+ };
204
+ };
205
+ };
206
+ };
207
+ };
208
+ actions?: {
209
+ type: string;
210
+ 'x-component': string;
211
+ 'x-component-props': {
212
+ style: {
213
+ marginBottom: number;
214
+ };
215
+ };
216
+ properties: {
217
+ [x: string]: {
218
+ type: string;
219
+ title: string;
220
+ 'x-action': string;
221
+ 'x-component': string;
222
+ 'x-use-component-props': string;
223
+ 'x-component-props': {
224
+ icon: string;
225
+ };
226
+ 'x-align': string;
227
+ } | {
228
+ type: string;
229
+ title: string;
230
+ 'x-action': string;
231
+ 'x-component': string;
232
+ 'x-use-component-props': string;
233
+ 'x-component-props': {
234
+ icon: string;
235
+ };
236
+ 'x-align'?: undefined;
237
+ } | {
238
+ type: string;
239
+ 'x-component': string;
240
+ title?: undefined;
241
+ 'x-action'?: undefined;
242
+ 'x-use-component-props'?: undefined;
243
+ 'x-component-props'?: undefined;
244
+ 'x-align'?: undefined;
245
+ };
246
+ refresh: {
247
+ type: string;
248
+ title: string;
249
+ 'x-action': string;
250
+ 'x-component': string;
251
+ 'x-use-component-props': string;
252
+ 'x-component-props': {
253
+ icon: string;
254
+ };
255
+ };
256
+ actions: {
257
+ type: string;
258
+ 'x-component': string;
259
+ };
260
+ };
261
+ };
262
+ };
263
+ };
264
+ export declare const addMembersSchema: {
265
+ type: string;
266
+ properties: {
267
+ drawer: {
268
+ type: string;
269
+ 'x-component': string;
270
+ 'x-decorator': string;
271
+ title: string;
272
+ properties: {
273
+ resource: {
274
+ type: string;
275
+ 'x-decorator': string;
276
+ 'x-component': string;
277
+ properties: {
278
+ actions: {
279
+ type: string;
280
+ 'x-component': string;
281
+ 'x-component-props': {
282
+ style: {
283
+ marginBottom: number;
284
+ };
285
+ };
286
+ properties: {
287
+ filter: {
288
+ type: string;
289
+ title: string;
290
+ default: {
291
+ $and: ({
292
+ username: {
293
+ $includes: string;
294
+ };
295
+ nickname?: undefined;
296
+ } | {
297
+ nickname: {
298
+ $includes: string;
299
+ };
300
+ username?: undefined;
301
+ })[];
302
+ };
303
+ 'x-action': string;
304
+ 'x-component': string;
305
+ 'x-use-component-props': string;
306
+ 'x-component-props': {
307
+ icon: string;
308
+ };
309
+ 'x-align': string;
310
+ };
311
+ };
312
+ };
313
+ table: {
314
+ type: string;
315
+ 'x-component': string;
316
+ 'x-component-props': {
317
+ rowKey: string;
318
+ rowSelection: {
319
+ type: string;
320
+ onChange: string;
321
+ };
322
+ useDataSource: string;
323
+ };
324
+ properties: {
325
+ username: {
326
+ type: string;
327
+ 'x-decorator': string;
328
+ 'x-component': string;
329
+ properties: {
330
+ username: {
331
+ type: string;
332
+ 'x-component': string;
333
+ 'x-read-pretty': boolean;
334
+ };
335
+ };
336
+ };
337
+ nickname: {
338
+ type: string;
339
+ 'x-decorator': string;
340
+ 'x-component': string;
341
+ properties: {
342
+ nickname: {
343
+ type: string;
344
+ 'x-component': string;
345
+ 'x-read-pretty': boolean;
346
+ };
347
+ };
348
+ };
349
+ phone: {
350
+ type: string;
351
+ 'x-decorator': string;
352
+ 'x-component': string;
353
+ properties: {
354
+ phone: {
355
+ type: string;
356
+ 'x-component': string;
357
+ 'x-read-pretty': boolean;
358
+ };
359
+ };
360
+ };
361
+ email: {
362
+ type: string;
363
+ 'x-decorator': string;
364
+ 'x-component': string;
365
+ properties: {
366
+ email: {
367
+ type: string;
368
+ 'x-component': string;
369
+ 'x-read-pretty': boolean;
370
+ };
371
+ };
372
+ };
373
+ };
374
+ };
375
+ };
376
+ };
377
+ footer: {
378
+ type: string;
379
+ 'x-component': string;
380
+ properties: {
381
+ cancel: {
382
+ title: string;
383
+ 'x-component': string;
384
+ 'x-component-props': {
385
+ useAction: string;
386
+ };
387
+ };
388
+ submit: {
389
+ title: string;
390
+ 'x-component': string;
391
+ 'x-component-props': {
392
+ type: string;
393
+ };
394
+ 'x-use-component-props': string;
395
+ };
396
+ };
397
+ };
398
+ };
399
+ };
400
+ };
401
+ };
402
+ export declare const userDepartmentsSchema: {
403
+ type: string;
404
+ properties: {
405
+ drawer: {
406
+ title: string;
407
+ 'x-decorator': string;
408
+ 'x-component': string;
409
+ properties: {
410
+ table: {
411
+ type: string;
412
+ 'x-decorator': string;
413
+ 'x-component': string;
414
+ 'x-component-props': {
415
+ useDataSource: string;
416
+ useDisabled: string;
417
+ };
418
+ };
419
+ footer: {
420
+ type: string;
421
+ 'x-component': string;
422
+ properties: {
423
+ cancel: {
424
+ title: string;
425
+ 'x-component': string;
426
+ 'x-component-props': {
427
+ useAction: string;
428
+ };
429
+ };
430
+ confirm: {
431
+ title: string;
432
+ 'x-component': string;
433
+ 'x-component-props': {
434
+ type: string;
435
+ useAction: string;
436
+ };
437
+ };
438
+ };
439
+ };
440
+ };
441
+ };
442
+ };
443
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /// <reference types="react" />
10
+ import { TreeManagerOptions } from './tree-manager';
11
+ type DepartmentManagerOptions = {
12
+ resource?: string;
13
+ resourceOf?: string;
14
+ params?: any;
15
+ } & TreeManagerOptions;
16
+ export declare const useDepartmentManager: (options?: DepartmentManagerOptions) => {
17
+ loadData: ({ key, children }: {
18
+ key: any;
19
+ children: any;
20
+ }) => Promise<void>;
21
+ getByKeyword: (keyword: string) => Promise<void>;
22
+ initData: (data: any[]) => void;
23
+ treeData: any[];
24
+ setTreeData: import("react").Dispatch<import("react").SetStateAction<any[]>>;
25
+ nodeMap: {};
26
+ updateTreeData: (key: any, children: any[]) => any;
27
+ constructTreeData: (nodeMap: {
28
+ [parentId: string]: any;
29
+ [parentId: number]: any;
30
+ }) => any;
31
+ getChildrenIds: (id: any) => any[];
32
+ loadedKeys: any[];
33
+ setLoadedKeys: import("react").Dispatch<import("react").SetStateAction<any[]>>;
34
+ expandedKeys: any[];
35
+ setExpandedKeys: import("react").Dispatch<import("react").SetStateAction<any[]>>;
36
+ };
37
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const useCreateAction: () => {
10
+ run(): Promise<void>;
11
+ };
12
+ export declare const useFilterActionProps: () => {
13
+ options: any[];
14
+ onSubmit: (values: any) => any;
15
+ onReset: () => any;
16
+ };
17
+ export * from './tree-manager';
18
+ export * from './departments-manager';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * This file is part of the NocoBase (R) project.
11
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
+ * Authors: NocoBase Team.
13
+ *
14
+ * This program is offered under a commercial license.
15
+ * For more information, see <https://www.nocobase.com/agreement>
16
+ */
17
+ import React from 'react';
18
+ export type TreeManagerOptions = {
19
+ label?: React.FC<{
20
+ node: any;
21
+ }>;
22
+ };
23
+ export declare const useTreeManager: (options?: TreeManagerOptions) => {
24
+ initData: (data: any[]) => void;
25
+ treeData: any[];
26
+ setTreeData: React.Dispatch<React.SetStateAction<any[]>>;
27
+ nodeMap: {};
28
+ updateTreeData: (key: any, children: any[]) => any;
29
+ constructTreeData: (nodeMap: {
30
+ [parentId: string]: any;
31
+ [parentId: number]: any;
32
+ }) => any;
33
+ getChildrenIds: (id: any) => any[];
34
+ loadedKeys: any[];
35
+ setLoadedKeys: React.Dispatch<React.SetStateAction<any[]>>;
36
+ expandedKeys: any[];
37
+ setExpandedKeys: React.Dispatch<React.SetStateAction<any[]>>;
38
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const useTableBlockProps: () => {
10
+ bordered: any;
11
+ childrenColumnName: any;
12
+ loading: any;
13
+ showIndex: any;
14
+ dragSort: any;
15
+ rowKey: any;
16
+ pagination: any;
17
+ onRowSelectionChange: (selectedRowKeys: any, selectedRowData: any) => void;
18
+ onRowDragEnd: ({ from, to }: {
19
+ from: any;
20
+ to: any;
21
+ }) => Promise<void>;
22
+ onChange: ({ current, pageSize }: {
23
+ current: any;
24
+ pageSize: any;
25
+ }, filters: any, sorter: any) => void;
26
+ onClickRow: (record: any, setSelectedRow: any, selectedRow: any) => void;
27
+ onExpand: (expanded: any, record: any) => void;
28
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ /**
10
+ * This file is part of the NocoBase (R) project.
11
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
12
+ * Authors: NocoBase Team.
13
+ *
14
+ * This program is offered under a commercial license.
15
+ * For more information, see <https://www.nocobase.com/agreement>
16
+ */
17
+ import { Plugin } from '@nocobase/client';
18
+ export declare class PluginDepartmentsClient extends Plugin {
19
+ afterAdd(): Promise<void>;
20
+ beforeLoad(): Promise<void>;
21
+ load(): Promise<void>;
22
+ }
23
+ export default PluginDepartmentsClient;