@nocobase/client 0.7.0-alpha.80 → 0.7.0-alpha.83

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 (95) hide show
  1. package/es/acl/ACLProvider.js +10 -15
  2. package/es/antd-config-provider/index.js +7 -4
  3. package/es/api-client/APIClient.d.ts +2 -30
  4. package/es/api-client/APIClient.js +30 -158
  5. package/es/api-client/hooks/useResource.d.ts +1 -1
  6. package/es/block-provider/hooks/index.d.ts +3 -0
  7. package/es/block-provider/hooks/index.js +233 -168
  8. package/es/collection-manager/Configuration/AddFieldAction.js +27 -9
  9. package/es/collection-manager/Configuration/EditFieldAction.js +25 -8
  10. package/es/collection-manager/hooks/useCollection.d.ts +1 -1
  11. package/es/i18n/i18n.js +3 -3
  12. package/es/locale/en_US.d.ts +10 -0
  13. package/es/locale/en_US.js +11 -1
  14. package/es/locale/index.d.ts +44 -0
  15. package/es/locale/zh_CN.d.ts +34 -0
  16. package/es/locale/zh_CN.js +35 -1
  17. package/es/schema-component/antd/action/Action.Designer.js +33 -13
  18. package/es/schema-component/antd/action/utils.d.ts +2 -0
  19. package/es/schema-component/antd/action/utils.js +60 -0
  20. package/es/schema-component/antd/date-picker/util.d.ts +2 -1
  21. package/es/schema-component/antd/date-picker/util.js +4 -2
  22. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  23. package/es/schema-initializer/buttons/FormActionInitializers.js +63 -0
  24. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  25. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  26. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  27. package/es/schema-settings/SchemaSettings.js +48 -16
  28. package/es/user/CurrentUser.js +1 -1
  29. package/es/user/LanguageSettings.js +4 -3
  30. package/es/user/SigninPage.js +3 -14
  31. package/es/user/SwitchRole.js +2 -26
  32. package/es/workflow/triggers/collection.js +1 -0
  33. package/es/workflow/triggers/index.js +2 -0
  34. package/es/workflow/triggers/schedule.d.ts +25 -0
  35. package/es/workflow/triggers/schedule.js +531 -0
  36. package/lib/acl/ACLProvider.js +9 -15
  37. package/lib/antd-config-provider/index.js +6 -3
  38. package/lib/api-client/APIClient.d.ts +2 -30
  39. package/lib/api-client/APIClient.js +26 -160
  40. package/lib/api-client/hooks/useResource.d.ts +1 -1
  41. package/lib/block-provider/hooks/index.d.ts +3 -0
  42. package/lib/block-provider/hooks/index.js +238 -169
  43. package/lib/collection-manager/Configuration/AddFieldAction.js +27 -9
  44. package/lib/collection-manager/Configuration/EditFieldAction.js +25 -8
  45. package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
  46. package/lib/i18n/i18n.js +3 -3
  47. package/lib/locale/en_US.d.ts +10 -0
  48. package/lib/locale/en_US.js +11 -1
  49. package/lib/locale/index.d.ts +44 -0
  50. package/lib/locale/zh_CN.d.ts +34 -0
  51. package/lib/locale/zh_CN.js +35 -1
  52. package/lib/schema-component/antd/action/Action.Designer.js +34 -13
  53. package/lib/schema-component/antd/action/utils.d.ts +2 -0
  54. package/lib/schema-component/antd/action/utils.js +67 -0
  55. package/lib/schema-component/antd/date-picker/util.d.ts +2 -1
  56. package/lib/schema-component/antd/date-picker/util.js +6 -1
  57. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  58. package/lib/schema-initializer/buttons/FormActionInitializers.js +63 -0
  59. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  60. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  61. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  62. package/lib/schema-settings/SchemaSettings.js +49 -16
  63. package/lib/user/CurrentUser.js +1 -1
  64. package/lib/user/LanguageSettings.js +4 -3
  65. package/lib/user/SigninPage.js +3 -14
  66. package/lib/user/SwitchRole.js +2 -27
  67. package/lib/workflow/triggers/collection.js +1 -0
  68. package/lib/workflow/triggers/index.js +3 -0
  69. package/lib/workflow/triggers/schedule.d.ts +25 -0
  70. package/lib/workflow/triggers/schedule.js +554 -0
  71. package/package.json +4 -3
  72. package/src/acl/ACLProvider.tsx +4 -5
  73. package/src/antd-config-provider/index.tsx +4 -2
  74. package/src/api-client/APIClient.ts +2 -120
  75. package/src/block-provider/hooks/index.ts +106 -69
  76. package/src/collection-manager/Configuration/AddFieldAction.tsx +18 -0
  77. package/src/collection-manager/Configuration/EditFieldAction.tsx +19 -0
  78. package/src/i18n/i18n.ts +3 -3
  79. package/src/locale/en_US.ts +11 -1
  80. package/src/locale/zh_CN.ts +39 -1
  81. package/src/schema-component/antd/action/Action.Designer.tsx +33 -1
  82. package/src/schema-component/antd/action/utils.ts +68 -0
  83. package/src/schema-component/antd/date-picker/util.ts +4 -3
  84. package/src/schema-initializer/SchemaInitializer.tsx +2 -2
  85. package/src/schema-initializer/buttons/FormActionInitializers.tsx +66 -0
  86. package/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +22 -0
  87. package/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +22 -0
  88. package/src/schema-settings/SchemaSettings.tsx +40 -29
  89. package/src/user/CurrentUser.tsx +1 -1
  90. package/src/user/LanguageSettings.tsx +1 -0
  91. package/src/user/SigninPage.tsx +2 -7
  92. package/src/user/SwitchRole.tsx +2 -6
  93. package/src/workflow/triggers/collection.tsx +1 -1
  94. package/src/workflow/triggers/index.tsx +2 -0
  95. package/src/workflow/triggers/schedule.tsx +422 -0
@@ -1,188 +1,54 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.APIClient = void 0;
7
9
 
8
- var _reactive = require("@formily/reactive");
10
+ var _sdk = require("@nocobase/sdk");
9
11
 
10
- var _axios = _interopRequireDefault(require("axios"));
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
13
 
12
- var _jsCookie = _interopRequireDefault(require("js-cookie"));
14
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
15
 
14
- var _qs = _interopRequireDefault(require("qs"));
16
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
17
 
16
- var _excluded = ["values", "filter"];
18
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
19
 
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
19
21
 
20
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
22
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
21
23
 
22
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
23
25
 
24
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
26
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
27
 
26
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
28
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
29
 
28
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
31
 
30
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
32
+ var APIClient = /*#__PURE__*/function (_APIClientSDK) {
33
+ _inherits(APIClient, _APIClientSDK);
31
34
 
32
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
35
+ var _super = _createSuper(APIClient);
33
36
 
34
- var APIClient = /*#__PURE__*/function () {
35
- function APIClient(instance) {
36
- _classCallCheck(this, APIClient);
37
+ function APIClient() {
38
+ var _this;
37
39
 
38
- this.axios = void 0;
39
- this.services = void 0;
40
- this.tokenKey = 'NOCOBASE_TOKEN';
41
- this.services = (0, _reactive.observable)({});
40
+ _classCallCheck(this, APIClient);
42
41
 
43
- if (typeof instance === 'function') {
44
- this.axios = instance;
45
- } else {
46
- this.axios = _axios.default.create(instance);
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
47
44
  }
48
45
 
49
- this.qsMiddleware();
50
- this.authMiddleware();
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+ _this.services = void 0;
48
+ return _this;
51
49
  }
52
50
 
53
- _createClass(APIClient, [{
54
- key: "qsMiddleware",
55
- value: function qsMiddleware() {
56
- this.axios.interceptors.request.use(function (config) {
57
- config.paramsSerializer = function (params) {
58
- return _qs.default.stringify(params, {
59
- strictNullHandling: true,
60
- arrayFormat: 'brackets'
61
- });
62
- };
63
-
64
- return config;
65
- });
66
- } // TODO
67
-
68
- }, {
69
- key: "authMiddleware",
70
- value: function authMiddleware() {
71
- var _this = this;
72
-
73
- this.axios.interceptors.request.use(function (config) {
74
- var token = localStorage.getItem(_this.tokenKey);
75
- config.headers['X-Locale'] = localStorage.getItem('NOCOBASE_LANG');
76
- config.headers['X-Hostname'] = window.location.hostname;
77
-
78
- if (token) {
79
- config.headers['Authorization'] = "Bearer ".concat(token);
80
- }
81
-
82
- var currentRoleName = _jsCookie.default.get('currentRoleName');
83
-
84
- if (currentRoleName) {
85
- config.headers['X-Role'] = currentRoleName;
86
- }
87
-
88
- return config;
89
- });
90
- } // TODO
91
-
92
- }, {
93
- key: "setBearerToken",
94
- value: function setBearerToken(token) {
95
- localStorage.setItem(this.tokenKey, token || '');
96
-
97
- _jsCookie.default.remove('currentRoleName');
98
- }
99
- }, {
100
- key: "service",
101
- value: function service(uid) {
102
- return this.services[uid];
103
- }
104
- }, {
105
- key: "request",
106
- value: function request(config) {
107
- var resource = config.resource,
108
- resourceOf = config.resourceOf,
109
- action = config.action,
110
- params = config.params;
111
-
112
- if (resource) {
113
- return this.resource(resource, resourceOf)[action](params);
114
- }
115
-
116
- return this.axios.request(config);
117
- }
118
- }, {
119
- key: "resource",
120
- value: function resource(name, of) {
121
- var _this2 = this;
122
-
123
- var target = {};
124
- var handler = {
125
- get: function get(_, actionName) {
126
- var url = name.split('.').join("/".concat(of || '_', "/"));
127
- url += ":".concat(actionName);
128
- var config = {
129
- url: url
130
- };
131
-
132
- if (['get', 'list'].includes(actionName)) {
133
- config['method'] = 'get';
134
- } else {
135
- config['method'] = 'post';
136
- }
137
-
138
- return /*#__PURE__*/function () {
139
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(params) {
140
- var _ref2, values, filter, others;
141
-
142
- return regeneratorRuntime.wrap(function _callee$(_context) {
143
- while (1) {
144
- switch (_context.prev = _context.next) {
145
- case 0:
146
- _ref2 = params || {}, values = _ref2.values, filter = _ref2.filter, others = _objectWithoutProperties(_ref2, _excluded);
147
- config['params'] = others;
148
-
149
- if (filter) {
150
- if (typeof filter === 'string') {
151
- config['params']['filter'] = filter;
152
- } else {
153
- config['params']['filter'] = JSON.stringify(filter);
154
- }
155
- }
156
-
157
- if (config.method !== 'get') {
158
- config['data'] = values || {};
159
- }
160
-
161
- _context.next = 6;
162
- return _this2.request(config);
163
-
164
- case 6:
165
- return _context.abrupt("return", _context.sent);
166
-
167
- case 7:
168
- case "end":
169
- return _context.stop();
170
- }
171
- }
172
- }, _callee);
173
- }));
174
-
175
- return function (_x) {
176
- return _ref.apply(this, arguments);
177
- };
178
- }();
179
- }
180
- };
181
- return new Proxy(target, handler);
182
- }
183
- }]);
184
-
185
- return APIClient;
186
- }();
51
+ return _createClass(APIClient);
52
+ }(_sdk.APIClient);
187
53
 
188
54
  exports.APIClient = APIClient;
@@ -1 +1 @@
1
- export declare function useResource(name: string, of?: string | number): import("..").IResource;
1
+ export declare function useResource(name: string, of?: string | number): import("@nocobase/sdk").IResource;
@@ -7,6 +7,9 @@ export declare const useCreateActionProps: () => {
7
7
  export declare const useCustomizeUpdateActionProps: () => {
8
8
  onClick(): Promise<void>;
9
9
  };
10
+ export declare const useCustomizeRequestActionProps: () => {
11
+ onClick(): Promise<void>;
12
+ };
10
13
  export declare const useUpdateActionProps: () => {
11
14
  onClick(): Promise<void>;
12
15
  };