@nocobase/client 0.11.1-alpha.4 → 0.11.1-alpha.5
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.
|
@@ -12,20 +12,20 @@ import { useTableBlockContext } from '../../../block-provider';
|
|
|
12
12
|
import { useCurrentUserContext } from '../../../user';
|
|
13
13
|
import jsonLogic from '../../common/utils/logic';
|
|
14
14
|
export var useVariablesCtx = function useVariablesCtx() {
|
|
15
|
-
var _service$data, _service$data$data;
|
|
16
|
-
var
|
|
17
|
-
data = _ref.data;
|
|
15
|
+
var _service$data, _service$data$data, _currentUser$data2;
|
|
16
|
+
var currentUser = useCurrentUserContext();
|
|
18
17
|
var _useTableBlockContext = useTableBlockContext(),
|
|
19
18
|
field = _useTableBlockContext.field,
|
|
20
19
|
service = _useTableBlockContext.service,
|
|
21
20
|
rowKey = _useTableBlockContext.rowKey;
|
|
22
21
|
var contextData = service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : (_service$data$data = _service$data.data) === null || _service$data$data === void 0 ? void 0 : _service$data$data.filter(function (v) {
|
|
23
|
-
var
|
|
24
|
-
return (
|
|
22
|
+
var _ref, _field$data;
|
|
23
|
+
return (_ref = (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.selectedRowKeys) || []) === null || _ref === void 0 ? void 0 : _ref.includes(v[rowKey]);
|
|
25
24
|
});
|
|
26
25
|
return useMemo(function () {
|
|
26
|
+
var _currentUser$data;
|
|
27
27
|
return {
|
|
28
|
-
$user: (data === null || data === void 0 ? void 0 : data.data) || {},
|
|
28
|
+
$user: (currentUser === null || currentUser === void 0 ? void 0 : (_currentUser$data = currentUser.data) === null || _currentUser$data === void 0 ? void 0 : _currentUser$data.data) || {},
|
|
29
29
|
$date: {
|
|
30
30
|
now: function now() {
|
|
31
31
|
return dayjs().toISOString();
|
|
@@ -33,7 +33,7 @@ export var useVariablesCtx = function useVariablesCtx() {
|
|
|
33
33
|
},
|
|
34
34
|
$context: contextData
|
|
35
35
|
};
|
|
36
|
-
}, [data]);
|
|
36
|
+
}, [contextData, currentUser === null || currentUser === void 0 ? void 0 : (_currentUser$data2 = currentUser.data) === null || _currentUser$data2 === void 0 ? void 0 : _currentUser$data2.data]);
|
|
37
37
|
};
|
|
38
38
|
export var isVariable = function isVariable(str) {
|
|
39
39
|
var _str$match;
|
|
@@ -23,20 +23,20 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
23
23
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
24
|
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); }
|
|
25
25
|
var useVariablesCtx = function useVariablesCtx() {
|
|
26
|
-
var _service$data, _service$data$data;
|
|
27
|
-
var
|
|
28
|
-
data = _ref.data;
|
|
26
|
+
var _service$data, _service$data$data, _currentUser$data2;
|
|
27
|
+
var currentUser = (0, _user.useCurrentUserContext)();
|
|
29
28
|
var _useTableBlockContext = (0, _blockProvider.useTableBlockContext)(),
|
|
30
29
|
field = _useTableBlockContext.field,
|
|
31
30
|
service = _useTableBlockContext.service,
|
|
32
31
|
rowKey = _useTableBlockContext.rowKey;
|
|
33
32
|
var contextData = service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : (_service$data$data = _service$data.data) === null || _service$data$data === void 0 ? void 0 : _service$data$data.filter(function (v) {
|
|
34
|
-
var
|
|
35
|
-
return (
|
|
33
|
+
var _ref, _field$data;
|
|
34
|
+
return (_ref = (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.selectedRowKeys) || []) === null || _ref === void 0 ? void 0 : _ref.includes(v[rowKey]);
|
|
36
35
|
});
|
|
37
36
|
return (0, _react.useMemo)(function () {
|
|
37
|
+
var _currentUser$data;
|
|
38
38
|
return {
|
|
39
|
-
$user: (data === null || data === void 0 ? void 0 : data.data) || {},
|
|
39
|
+
$user: (currentUser === null || currentUser === void 0 ? void 0 : (_currentUser$data = currentUser.data) === null || _currentUser$data === void 0 ? void 0 : _currentUser$data.data) || {},
|
|
40
40
|
$date: {
|
|
41
41
|
now: function now() {
|
|
42
42
|
return (0, _client.dayjs)().toISOString();
|
|
@@ -44,7 +44,7 @@ var useVariablesCtx = function useVariablesCtx() {
|
|
|
44
44
|
},
|
|
45
45
|
$context: contextData
|
|
46
46
|
};
|
|
47
|
-
}, [data]);
|
|
47
|
+
}, [contextData, currentUser === null || currentUser === void 0 ? void 0 : (_currentUser$data2 = currentUser.data) === null || _currentUser$data2 === void 0 ? void 0 : _currentUser$data2.data]);
|
|
48
48
|
};
|
|
49
49
|
exports.useVariablesCtx = useVariablesCtx;
|
|
50
50
|
var isVariable = function isVariable(str) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client",
|
|
3
|
-
"version": "0.11.1-alpha.
|
|
3
|
+
"version": "0.11.1-alpha.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
"@dnd-kit/core": "^5.0.1",
|
|
13
13
|
"@dnd-kit/sortable": "^6.0.0",
|
|
14
14
|
"@emotion/css": "^11.7.1",
|
|
15
|
-
"@formily/antd-v5": "^1.1.0
|
|
16
|
-
"@formily/core": "2.2.
|
|
17
|
-
"@formily/grid": "2.2.
|
|
18
|
-
"@formily/json-schema": "2.2.
|
|
19
|
-
"@formily/path": "2.2.
|
|
20
|
-
"@formily/react": "2.2.
|
|
21
|
-
"@formily/reactive": "2.2.
|
|
22
|
-
"@formily/reactive-react": "2.2.
|
|
23
|
-
"@formily/shared": "2.2.
|
|
24
|
-
"@formily/validator": "2.2.
|
|
25
|
-
"@nocobase/evaluators": "0.11.1-alpha.
|
|
26
|
-
"@nocobase/sdk": "0.11.1-alpha.
|
|
27
|
-
"@nocobase/utils": "0.11.1-alpha.
|
|
15
|
+
"@formily/antd-v5": "^1.1.0",
|
|
16
|
+
"@formily/core": "^2.2.27",
|
|
17
|
+
"@formily/grid": "^2.2.27",
|
|
18
|
+
"@formily/json-schema": "^2.2.27",
|
|
19
|
+
"@formily/path": "^2.2.27",
|
|
20
|
+
"@formily/react": "^2.2.27",
|
|
21
|
+
"@formily/reactive": "^2.2.27",
|
|
22
|
+
"@formily/reactive-react": "^2.2.27",
|
|
23
|
+
"@formily/shared": "^2.2.27",
|
|
24
|
+
"@formily/validator": "^2.2.27",
|
|
25
|
+
"@nocobase/evaluators": "0.11.1-alpha.5",
|
|
26
|
+
"@nocobase/sdk": "0.11.1-alpha.5",
|
|
27
|
+
"@nocobase/utils": "0.11.1-alpha.5",
|
|
28
28
|
"ahooks": "^3.7.2",
|
|
29
29
|
"antd": "^5.6.4",
|
|
30
30
|
"antd-style": "^3.3.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"dumi": "^2.2.0",
|
|
71
71
|
"dumi-theme-nocobase": "^0.2.14"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "1dcfd15a7d95a40b0a2f60e1de19ec574066fb20"
|
|
74
74
|
}
|