@nocobase/plugin-users 0.21.0-alpha.10 → 0.21.0-alpha.12

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.
@@ -1,15 +1,15 @@
1
1
  module.exports = {
2
2
  "react": "18.2.0",
3
3
  "antd": "5.12.8",
4
- "@nocobase/client": "0.21.0-alpha.10",
4
+ "@nocobase/client": "0.21.0-alpha.12",
5
5
  "@formily/react": "2.3.0",
6
6
  "@formily/core": "2.3.0",
7
- "@nocobase/plugin-acl": "0.21.0-alpha.10",
7
+ "@nocobase/plugin-acl": "0.21.0-alpha.12",
8
8
  "react-i18next": "11.18.6",
9
- "@nocobase/database": "0.21.0-alpha.10",
10
- "@nocobase/server": "0.21.0-alpha.10",
11
- "@nocobase/utils": "0.21.0-alpha.10",
12
- "@nocobase/cache": "0.21.0-alpha.10",
9
+ "@nocobase/database": "0.21.0-alpha.12",
10
+ "@nocobase/server": "0.21.0-alpha.12",
11
+ "@nocobase/utils": "0.21.0-alpha.12",
12
+ "@nocobase/cache": "0.21.0-alpha.12",
13
13
  "@formily/shared": "2.3.0",
14
- "@nocobase/actions": "0.21.0-alpha.10"
14
+ "@nocobase/actions": "0.21.0-alpha.12"
15
15
  };
@@ -117,6 +117,36 @@ var users_default = (0, import_database.defineCollection)({
117
117
  type: "json",
118
118
  name: "systemSettings",
119
119
  defaultValue: {}
120
+ },
121
+ {
122
+ uiSchema: {
123
+ "x-component-props": {
124
+ dateFormat: "YYYY-MM-DD"
125
+ },
126
+ type: "datetime",
127
+ title: '{{t("Created at")}}',
128
+ "x-component": "DatePicker",
129
+ "x-read-pretty": true
130
+ },
131
+ name: "createdAt",
132
+ type: "date",
133
+ field: "createdAt",
134
+ interface: "createdAt"
135
+ },
136
+ {
137
+ uiSchema: {
138
+ "x-component-props": {
139
+ dateFormat: "YYYY-MM-DD"
140
+ },
141
+ type: "datetime",
142
+ title: '{{t("Last updated at")}}',
143
+ "x-component": "DatePicker",
144
+ "x-read-pretty": true
145
+ },
146
+ name: "updatedAt",
147
+ type: "date",
148
+ field: "updatedAt",
149
+ interface: "updatedAt"
120
150
  }
121
151
  ]
122
152
  });
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ }
@@ -0,0 +1,137 @@
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_system_fields_exports = {};
19
+ __export(update_system_fields_exports, {
20
+ default: () => update_system_fields_default
21
+ });
22
+ module.exports = __toCommonJS(update_system_fields_exports);
23
+ var import_server = require("@nocobase/server");
24
+ class update_system_fields_default extends import_server.Migration {
25
+ on = "afterLoad";
26
+ // 'beforeLoad' or 'afterLoad'
27
+ appVersion = "<0.21.0-alpha.11";
28
+ async up() {
29
+ const Field = this.context.db.getRepository("fields");
30
+ const createdByField = await Field.findOne({
31
+ filter: {
32
+ name: "createdBy",
33
+ collectionName: "users",
34
+ interface: null
35
+ }
36
+ });
37
+ if (createdByField) {
38
+ await createdByField.update({
39
+ interface: "createdBy",
40
+ options: {
41
+ ...createdByField.options,
42
+ uiSchema: {
43
+ type: "object",
44
+ title: '{{t("Created by")}}',
45
+ "x-component": "AssociationField",
46
+ "x-component-props": {
47
+ fieldNames: {
48
+ value: "id",
49
+ label: "nickname"
50
+ }
51
+ },
52
+ "x-read-pretty": true
53
+ }
54
+ }
55
+ });
56
+ }
57
+ const updatedByField = await Field.findOne({
58
+ filter: {
59
+ name: "updatedBy",
60
+ collectionName: "users",
61
+ interface: null
62
+ }
63
+ });
64
+ if (updatedByField) {
65
+ await updatedByField.update({
66
+ interface: "updatedBy",
67
+ options: {
68
+ ...updatedByField.options,
69
+ uiSchema: {
70
+ type: "object",
71
+ title: '{{t("Last updated by")}}',
72
+ "x-component": "AssociationField",
73
+ "x-component-props": {
74
+ fieldNames: {
75
+ value: "id",
76
+ label: "nickname"
77
+ }
78
+ },
79
+ "x-read-pretty": true
80
+ }
81
+ }
82
+ });
83
+ }
84
+ const createdAtField = await Field.count({
85
+ filter: {
86
+ name: "createdAt",
87
+ collectionName: "users"
88
+ }
89
+ });
90
+ if (!createdAtField) {
91
+ await Field.create({
92
+ values: {
93
+ collectionName: "users",
94
+ uiSchema: {
95
+ "x-component-props": {
96
+ dateFormat: "YYYY-MM-DD"
97
+ },
98
+ type: "datetime",
99
+ title: '{{t("Created at")}}',
100
+ "x-component": "DatePicker",
101
+ "x-read-pretty": true
102
+ },
103
+ name: "createdAt",
104
+ field: "createdAt",
105
+ type: "date",
106
+ interface: "createdAt"
107
+ }
108
+ });
109
+ }
110
+ const updatedAtField = await Field.count({
111
+ filter: {
112
+ name: "updatedAt",
113
+ collectionName: "users"
114
+ }
115
+ });
116
+ if (!updatedAtField) {
117
+ await Field.create({
118
+ values: {
119
+ collectionName: "users",
120
+ uiSchema: {
121
+ "x-component-props": {
122
+ dateFormat: "YYYY-MM-DD"
123
+ },
124
+ type: "datetime",
125
+ title: '{{t("Last updated at")}}',
126
+ "x-component": "DatePicker",
127
+ "x-read-pretty": true
128
+ },
129
+ name: "updatedAt",
130
+ field: "updatedAt",
131
+ type: "date",
132
+ interface: "updatedAt"
133
+ }
134
+ });
135
+ }
136
+ }
137
+ }
@@ -98,7 +98,20 @@ class PluginUsersServer extends import_server.Plugin {
98
98
  type: "belongsTo",
99
99
  target: "users",
100
100
  foreignKey: "createdById",
101
- targetKey: "id"
101
+ targetKey: "id",
102
+ uiSchema: {
103
+ type: "object",
104
+ title: '{{t("Created by")}}',
105
+ "x-component": "AssociationField",
106
+ "x-component-props": {
107
+ fieldNames: {
108
+ value: "id",
109
+ label: "nickname"
110
+ }
111
+ },
112
+ "x-read-pretty": true
113
+ },
114
+ interface: "createdBy"
102
115
  });
103
116
  }
104
117
  if (updatedBy === true) {
@@ -113,7 +126,20 @@ class PluginUsersServer extends import_server.Plugin {
113
126
  type: "belongsTo",
114
127
  target: "users",
115
128
  foreignKey: "updatedById",
116
- targetKey: "id"
129
+ targetKey: "id",
130
+ uiSchema: {
131
+ type: "object",
132
+ title: '{{t("Last updated by")}}',
133
+ "x-component": "AssociationField",
134
+ "x-component-props": {
135
+ fieldNames: {
136
+ value: "id",
137
+ label: "nickname"
138
+ }
139
+ },
140
+ "x-read-pretty": true
141
+ },
142
+ interface: "updatedBy"
117
143
  });
118
144
  }
119
145
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "用户",
5
5
  "description": "Provides basic user model, as well as created by and updated by fields.",
6
6
  "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
7
- "version": "0.21.0-alpha.10",
7
+ "version": "0.21.0-alpha.12",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/users",
@@ -24,7 +24,7 @@
24
24
  "@nocobase/test": "0.x",
25
25
  "@nocobase/utils": "0.x"
26
26
  },
27
- "gitHead": "98adf5ec996a4f359c6ca1c4a6ac837c43b6e268",
27
+ "gitHead": "dd6229634ae442894b0f0666a00ba4a3888b8985",
28
28
  "keywords": [
29
29
  "Users & permissions"
30
30
  ]