@nocobase/client 0.10.0-alpha.2 → 0.10.0-alpha.3

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 (194) hide show
  1. package/es/acl/Configuration/MenuItemsProvider.js +3 -3
  2. package/es/application/Application.js +2 -2
  3. package/es/auth/SigninPage.js +12 -9
  4. package/es/collection-manager/Configuration/AddCollectionAction.js +31 -25
  5. package/es/collection-manager/Configuration/AddFieldAction.js +45 -32
  6. package/es/collection-manager/Configuration/AddSubFieldAction.js +24 -19
  7. package/es/collection-manager/Configuration/ConfigurationTabs.js +57 -50
  8. package/es/collection-manager/hooks/useOptions.js +39 -36
  9. package/es/collection-manager/interfaces/integer.js +1 -1
  10. package/es/collection-manager/interfaces/number.js +3 -3
  11. package/es/collection-manager/interfaces/percent.js +3 -3
  12. package/es/formula/Expression.js +66 -46
  13. package/es/hooks/index.d.ts +1 -0
  14. package/es/hooks/index.js +1 -0
  15. package/es/hooks/useAdminSchemaUid.d.ts +1 -0
  16. package/es/hooks/useAdminSchemaUid.js +6 -0
  17. package/es/hooks/useMenuItem.d.ts +37 -0
  18. package/es/hooks/useMenuItem.js +90 -0
  19. package/es/index.d.ts +2 -3
  20. package/es/index.js +3 -4
  21. package/es/locale/en_US.d.ts +3 -1
  22. package/es/locale/en_US.js +4 -2
  23. package/es/locale/es_ES.d.ts +1 -1
  24. package/es/locale/es_ES.js +1 -1
  25. package/es/locale/ja_JP.d.ts +3 -1
  26. package/es/locale/ja_JP.js +4 -2
  27. package/es/locale/pt_BR.d.ts +1 -1
  28. package/es/locale/pt_BR.js +1 -1
  29. package/es/locale/ru_RU.d.ts +1 -1
  30. package/es/locale/ru_RU.js +1 -1
  31. package/es/locale/zh_CN.d.ts +3 -1
  32. package/es/locale/zh_CN.js +3 -1
  33. package/es/pm/Card.js +5 -5
  34. package/es/pm/PluginManagerLink.js +16 -12
  35. package/es/pm/index.d.ts +2 -1
  36. package/es/pm/index.js +36 -22
  37. package/es/route-switch/antd/admin-layout/index.js +4 -4
  38. package/es/schema-component/antd/action/Action.Designer.js +3 -5
  39. package/es/schema-component/antd/action/Action.Drawer.js +1 -1
  40. package/es/schema-component/antd/action/ActionBar.js +1 -1
  41. package/es/schema-component/antd/association-field/SubTable.js +1 -1
  42. package/es/schema-component/antd/calendar/DeleteEvent.js +1 -1
  43. package/es/schema-component/antd/cascader/Cascader.js +1 -1
  44. package/es/schema-component/antd/form-item/FormItem.js +10 -3
  45. package/es/schema-component/antd/grid-card/GridCard.Designer.js +3 -4
  46. package/es/schema-component/antd/index.less +1 -3
  47. package/es/schema-component/antd/menu/Menu.js +306 -156
  48. package/es/schema-component/antd/page/Page.js +29 -23
  49. package/es/schema-component/antd/remote-select/RemoteSelect.js +58 -10
  50. package/es/schema-component/antd/remote-select/utils.d.ts +4 -0
  51. package/es/schema-component/antd/remote-select/utils.js +31 -0
  52. package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
  53. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +51 -12
  54. package/es/schema-component/antd/table-v2/Table.js +9 -7
  55. package/es/schema-component/antd/tabs/Tabs.js +35 -22
  56. package/es/schema-component/antd/tabs/context.d.ts +1 -1
  57. package/es/schema-component/antd/upload/ReadPretty.js +7 -3
  58. package/es/schema-component/antd/variable/VariableSelect.js +1 -1
  59. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  60. package/es/schema-component/common/utils/uitls.js +1 -1
  61. package/es/schema-initializer/SchemaInitializer.d.ts +7 -2
  62. package/es/schema-initializer/SchemaInitializer.js +155 -102
  63. package/es/schema-initializer/SelectCollection.d.ts +1 -2
  64. package/es/schema-initializer/SelectCollection.js +19 -16
  65. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  66. package/es/schema-initializer/buttons/TableActionInitializers.js +5 -5
  67. package/es/schema-initializer/buttons/TableColumnInitializers.js +3 -2
  68. package/es/schema-initializer/components/CreateRecordAction.js +37 -27
  69. package/es/schema-initializer/components/assigned-field/AssignedField.js +2 -1
  70. package/es/schema-initializer/items/CalendarBlockInitializer.js +2 -2
  71. package/es/schema-initializer/utils.d.ts +0 -1
  72. package/es/schema-initializer/utils.js +40 -25
  73. package/es/schema-settings/SchemaSettings.js +123 -46
  74. package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
  75. package/es/schema-settings/VariableInput/hooks/useFormVariable.js +89 -0
  76. package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
  77. package/es/schema-settings/VariableInput/hooks/useIterationVariable.js +77 -0
  78. package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
  79. package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
  80. package/es/schema-templates/BlockTemplateDetails.js +5 -1
  81. package/es/schema-templates/BlockTemplatePage.js +4 -1
  82. package/es/user/ChangePassword.d.ts +1 -2
  83. package/es/user/ChangePassword.js +30 -26
  84. package/es/user/CurrentUser.js +172 -141
  85. package/es/user/EditProfile.d.ts +1 -2
  86. package/es/user/EditProfile.js +30 -24
  87. package/es/user/LanguageSettings.d.ts +1 -2
  88. package/es/user/LanguageSettings.js +67 -64
  89. package/es/user/SigninPage.js +25 -22
  90. package/es/user/SwitchRole.d.ts +1 -2
  91. package/es/user/SwitchRole.js +54 -49
  92. package/es/user/ThemeSettings.d.ts +1 -2
  93. package/es/user/ThemeSettings.js +56 -52
  94. package/lib/acl/Configuration/MenuItemsProvider.js +3 -3
  95. package/lib/application/Application.js +2 -2
  96. package/lib/auth/SigninPage.js +25 -22
  97. package/lib/collection-manager/Configuration/AddCollectionAction.js +29 -23
  98. package/lib/collection-manager/Configuration/AddFieldAction.js +43 -30
  99. package/lib/collection-manager/Configuration/AddSubFieldAction.js +22 -17
  100. package/lib/collection-manager/Configuration/ConfigurationTabs.js +57 -49
  101. package/lib/collection-manager/hooks/useOptions.js +39 -36
  102. package/lib/collection-manager/interfaces/integer.js +1 -1
  103. package/lib/collection-manager/interfaces/number.js +3 -3
  104. package/lib/collection-manager/interfaces/percent.js +3 -3
  105. package/lib/formula/Expression.js +64 -44
  106. package/lib/hooks/index.d.ts +1 -0
  107. package/lib/hooks/index.js +11 -0
  108. package/lib/hooks/useAdminSchemaUid.d.ts +1 -0
  109. package/lib/hooks/useAdminSchemaUid.js +13 -0
  110. package/lib/hooks/useMenuItem.d.ts +37 -0
  111. package/lib/hooks/useMenuItem.js +104 -0
  112. package/lib/index.d.ts +2 -3
  113. package/lib/index.js +22 -33
  114. package/lib/locale/en_US.d.ts +3 -1
  115. package/lib/locale/en_US.js +4 -2
  116. package/lib/locale/es_ES.d.ts +1 -1
  117. package/lib/locale/es_ES.js +1 -1
  118. package/lib/locale/ja_JP.d.ts +3 -1
  119. package/lib/locale/ja_JP.js +4 -2
  120. package/lib/locale/pt_BR.d.ts +1 -1
  121. package/lib/locale/pt_BR.js +1 -1
  122. package/lib/locale/ru_RU.d.ts +1 -1
  123. package/lib/locale/ru_RU.js +1 -1
  124. package/lib/locale/zh_CN.d.ts +3 -1
  125. package/lib/locale/zh_CN.js +3 -1
  126. package/lib/pm/Card.js +6 -6
  127. package/lib/pm/PluginManagerLink.js +15 -10
  128. package/lib/pm/index.d.ts +2 -1
  129. package/lib/pm/index.js +37 -23
  130. package/lib/route-switch/antd/admin-layout/index.js +3 -3
  131. package/lib/schema-component/antd/action/Action.Designer.js +2 -4
  132. package/lib/schema-component/antd/action/Action.Drawer.js +1 -1
  133. package/lib/schema-component/antd/association-field/SubTable.js +1 -1
  134. package/lib/schema-component/antd/calendar/DeleteEvent.js +1 -1
  135. package/lib/schema-component/antd/cascader/Cascader.js +1 -1
  136. package/lib/schema-component/antd/form-item/FormItem.js +10 -3
  137. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +4 -5
  138. package/lib/schema-component/antd/index.less +1 -3
  139. package/lib/schema-component/antd/menu/Menu.js +304 -154
  140. package/lib/schema-component/antd/page/Page.js +29 -23
  141. package/lib/schema-component/antd/remote-select/RemoteSelect.js +55 -7
  142. package/lib/schema-component/antd/remote-select/utils.d.ts +4 -0
  143. package/lib/schema-component/antd/remote-select/utils.js +41 -0
  144. package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
  145. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +50 -11
  146. package/lib/schema-component/antd/table-v2/Table.js +9 -7
  147. package/lib/schema-component/antd/tabs/Tabs.js +34 -21
  148. package/lib/schema-component/antd/tabs/context.d.ts +1 -1
  149. package/lib/schema-component/antd/upload/ReadPretty.js +7 -3
  150. package/lib/schema-component/antd/variable/VariableSelect.js +1 -1
  151. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  152. package/lib/schema-component/common/utils/uitls.js +3 -1
  153. package/lib/schema-initializer/SchemaInitializer.d.ts +7 -2
  154. package/lib/schema-initializer/SchemaInitializer.js +154 -101
  155. package/lib/schema-initializer/SelectCollection.d.ts +1 -2
  156. package/lib/schema-initializer/SelectCollection.js +22 -17
  157. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  158. package/lib/schema-initializer/buttons/TableActionInitializers.js +5 -5
  159. package/lib/schema-initializer/buttons/TableColumnInitializers.js +2 -1
  160. package/lib/schema-initializer/components/CreateRecordAction.js +35 -25
  161. package/lib/schema-initializer/components/assigned-field/AssignedField.js +2 -1
  162. package/lib/schema-initializer/items/CalendarBlockInitializer.js +9 -9
  163. package/lib/schema-initializer/utils.d.ts +0 -1
  164. package/lib/schema-initializer/utils.js +41 -25
  165. package/lib/schema-settings/SchemaSettings.js +122 -45
  166. package/lib/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
  167. package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +96 -0
  168. package/lib/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
  169. package/lib/schema-settings/VariableInput/hooks/useIterationVariable.js +84 -0
  170. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
  171. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
  172. package/lib/schema-templates/BlockTemplateDetails.js +5 -1
  173. package/lib/schema-templates/BlockTemplatePage.js +5 -2
  174. package/lib/user/ChangePassword.d.ts +1 -2
  175. package/lib/user/ChangePassword.js +30 -26
  176. package/lib/user/CurrentUser.js +166 -135
  177. package/lib/user/EditProfile.d.ts +1 -2
  178. package/lib/user/EditProfile.js +31 -25
  179. package/lib/user/LanguageSettings.d.ts +1 -2
  180. package/lib/user/LanguageSettings.js +66 -63
  181. package/lib/user/SigninPage.js +25 -22
  182. package/lib/user/SwitchRole.d.ts +1 -2
  183. package/lib/user/SwitchRole.js +57 -51
  184. package/lib/user/ThemeSettings.d.ts +1 -2
  185. package/lib/user/ThemeSettings.js +59 -54
  186. package/package.json +9 -8
  187. package/es/settings-form/SettingsForm.d.ts +0 -13
  188. package/es/settings-form/SettingsForm.js +0 -309
  189. package/es/settings-form/index.d.ts +0 -1
  190. package/es/settings-form/index.js +0 -1
  191. package/lib/settings-form/SettingsForm.d.ts +0 -13
  192. package/lib/settings-form/SettingsForm.js +0 -320
  193. package/lib/settings-form/index.d.ts +0 -1
  194. package/lib/settings-form/index.js +0 -16
@@ -0,0 +1,19 @@
1
+ import { Schema } from '@formily/react';
2
+ export declare const useFormVariable: ({ blockForm, rootCollection, operator, schema, level, }: {
3
+ blockForm?: any;
4
+ rootCollection: string;
5
+ operator?: any;
6
+ schema: Schema;
7
+ level?: number;
8
+ }) => {
9
+ label: string;
10
+ value: string;
11
+ key: string;
12
+ children: any[];
13
+ isLeaf: boolean;
14
+ field: {
15
+ target: string;
16
+ };
17
+ depth: number;
18
+ loadChildren: (option: any) => Promise<void>;
19
+ };
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useFormVariable = void 0;
7
+ var _react = require("react");
8
+ var _schemaComponent = require("../../../schema-component");
9
+ var getChildren = function getChildren(options, _ref) {
10
+ var depth = _ref.depth,
11
+ maxDepth = _ref.maxDepth,
12
+ loadChildren = _ref.loadChildren,
13
+ compile = _ref.compile;
14
+ var result = options.map(function (option) {
15
+ if (!option.target) {
16
+ return {
17
+ key: option.name,
18
+ value: option.name,
19
+ label: compile(option.title),
20
+ depth: depth
21
+ };
22
+ }
23
+ if (depth >= maxDepth) {
24
+ return null;
25
+ }
26
+ return {
27
+ key: option.name,
28
+ value: option.name,
29
+ label: compile(option.title),
30
+ children: [],
31
+ isLeaf: false,
32
+ field: option,
33
+ depth: depth,
34
+ loadChildren: loadChildren
35
+ };
36
+ }).filter(Boolean);
37
+ return result;
38
+ };
39
+ var useFormVariable = function useFormVariable(_ref2) {
40
+ var blockForm = _ref2.blockForm,
41
+ rootCollection = _ref2.rootCollection,
42
+ operator = _ref2.operator,
43
+ schema = _ref2.schema,
44
+ level = _ref2.level;
45
+ var compile = (0, _schemaComponent.useCompile)();
46
+ var getFilterOptions = (0, _schemaComponent.useGetFilterOptions)();
47
+ var loadChildren = function loadChildren(option) {
48
+ var _option$field;
49
+ if (!((_option$field = option.field) === null || _option$field === void 0 ? void 0 : _option$field.target)) {
50
+ return new Promise(function (resolve) {
51
+ resolve(void 0);
52
+ });
53
+ }
54
+ var collectionName = option.field.target;
55
+ var fields = getFilterOptions(collectionName);
56
+ var allowFields = option.depth === 0 ? fields.filter(function (field) {
57
+ return Object.keys(blockForm.fields).some(function (name) {
58
+ return name.includes(".".concat(field.name));
59
+ });
60
+ }) : fields;
61
+ return new Promise(function (resolve) {
62
+ setTimeout(function () {
63
+ var children = getChildren(allowFields, {
64
+ depth: option.depth + 1,
65
+ maxDepth: 4,
66
+ loadChildren: loadChildren,
67
+ compile: compile
68
+ }) || [];
69
+ if (children.length === 0) {
70
+ option.disabled = true;
71
+ resolve();
72
+ return;
73
+ }
74
+ option.children = children;
75
+ resolve();
76
+ // 延迟 5 毫秒,防止阻塞主线程,导致 UI 卡顿
77
+ }, 5);
78
+ });
79
+ };
80
+ var result = (0, _react.useMemo)(function () {
81
+ return blockForm && {
82
+ label: "{{t(\"Current form\")}}",
83
+ value: '$form',
84
+ key: '$form',
85
+ children: [],
86
+ isLeaf: false,
87
+ field: {
88
+ target: rootCollection
89
+ },
90
+ depth: 0,
91
+ loadChildren: loadChildren
92
+ };
93
+ }, [rootCollection]);
94
+ return result;
95
+ };
96
+ exports.useFormVariable = useFormVariable;
@@ -0,0 +1,8 @@
1
+ export declare const useIterationVariable: ({ blockForm, collectionField, operator, schema, level, rootCollection, }: {
2
+ blockForm?: any;
3
+ collectionField: any;
4
+ operator?: any;
5
+ schema: any;
6
+ level?: number;
7
+ rootCollection?: string;
8
+ }) => any;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useIterationVariable = void 0;
7
+ var _react = require("react");
8
+ var _schemaComponent = require("../../../schema-component");
9
+ var getChildren = function getChildren(options, _ref) {
10
+ var schema = _ref.schema,
11
+ operator = _ref.operator,
12
+ maxDepth = _ref.maxDepth,
13
+ _ref$count = _ref.count,
14
+ count = _ref$count === void 0 ? 1 : _ref$count,
15
+ getFilterOptions = _ref.getFilterOptions;
16
+ if (count > maxDepth) {
17
+ return [];
18
+ }
19
+ var result = options.map(function (option) {
20
+ if (option.type !== 'belongsTo' && option.type !== 'hasOne' || !option.target) {
21
+ return {
22
+ key: option.name,
23
+ value: option.name,
24
+ label: option.title,
25
+ // TODO: 现在是通过组件的名称来过滤能够被选择的选项,这样的坏处是不够精确,后续可以优化
26
+ // disabled: schema?.['x-component'] !== option.schema?.['x-component'],
27
+ disabled: false
28
+ };
29
+ }
30
+ var children = getChildren(getFilterOptions(option.target), {
31
+ schema: schema,
32
+ operator: operator,
33
+ maxDepth: maxDepth,
34
+ count: count + 1,
35
+ getFilterOptions: getFilterOptions
36
+ }) || [];
37
+ return {
38
+ key: option.name,
39
+ value: option.name,
40
+ label: option.title,
41
+ children: children,
42
+ disabled: children.every(function (child) {
43
+ return child.disabled;
44
+ })
45
+ };
46
+ });
47
+ return result;
48
+ };
49
+ var useIterationVariable = function useIterationVariable(_ref2) {
50
+ var blockForm = _ref2.blockForm,
51
+ collectionField = _ref2.collectionField,
52
+ operator = _ref2.operator,
53
+ schema = _ref2.schema,
54
+ level = _ref2.level,
55
+ rootCollection = _ref2.rootCollection;
56
+ var compile = (0, _schemaComponent.useCompile)();
57
+ var getFilterOptions = (0, _schemaComponent.useGetFilterOptions)();
58
+ var fields = getFilterOptions(collectionField === null || collectionField === void 0 ? void 0 : collectionField.collectionName);
59
+ var children = (0, _react.useMemo)(function () {
60
+ var allowFields = fields.filter(function (field) {
61
+ return Object.keys(blockForm.fields).some(function (name) {
62
+ return name.includes(field.name);
63
+ });
64
+ });
65
+ return getChildren(allowFields, {
66
+ schema: schema,
67
+ operator: operator,
68
+ maxDepth: level || 3,
69
+ getFilterOptions: getFilterOptions
70
+ }) || [];
71
+ }, [operator, schema, blockForm]);
72
+ return (0, _react.useMemo)(function () {
73
+ return rootCollection !== (collectionField === null || collectionField === void 0 ? void 0 : collectionField.collectionName) && children.length > 0 ? compile({
74
+ label: "{{t(\"Current object\")}}",
75
+ value: '$iteration',
76
+ key: '$iteration',
77
+ disabled: children.every(function (option) {
78
+ return option.disabled;
79
+ }),
80
+ children: children
81
+ }) : null;
82
+ }, [children]);
83
+ };
84
+ exports.useIterationVariable = useIterationVariable;
@@ -1,12 +1,5 @@
1
- export declare const useVariableOptions: () => ({
2
- label: string;
3
- value: string;
4
- key: string;
5
- disabled: boolean;
6
- children: {
7
- key: string;
8
- value: string;
9
- label: string;
10
- disabled: boolean;
11
- }[];
12
- } | import("../type").Option)[];
1
+ export declare const useVariableOptions: ({ form, collectionField, rootCollection }: {
2
+ form: any;
3
+ collectionField: any;
4
+ rootCollection: any;
5
+ }) => any[];
@@ -8,7 +8,12 @@ var _react = require("react");
8
8
  var _useValues2 = require("../../../schema-component/antd/filter/useValues");
9
9
  var _useDateVariable = require("./useDateVariable");
10
10
  var _useUserVariable = require("./useUserVariable");
11
- var useVariableOptions = function useVariableOptions() {
11
+ var _useFormVariable = require("./useFormVariable");
12
+ var _useIterationVariable = require("./useIterationVariable");
13
+ var useVariableOptions = function useVariableOptions(_ref) {
14
+ var form = _ref.form,
15
+ collectionField = _ref.collectionField,
16
+ rootCollection = _ref.rootCollection;
12
17
  var _useValues = (0, _useValues2.useValues)(),
13
18
  operator = _useValues.operator,
14
19
  schema = _useValues.schema;
@@ -20,9 +25,20 @@ var useVariableOptions = function useVariableOptions() {
20
25
  operator: operator,
21
26
  schema: schema
22
27
  });
28
+ var formVariabele = (0, _useFormVariable.useFormVariable)({
29
+ blockForm: form,
30
+ rootCollection: rootCollection,
31
+ schema: schema
32
+ });
33
+ var iterationVariabele = (0, _useIterationVariable.useIterationVariable)({
34
+ blockForm: form,
35
+ collectionField: collectionField,
36
+ schema: schema,
37
+ rootCollection: rootCollection
38
+ });
23
39
  var result = (0, _react.useMemo)(function () {
24
- return [userVariable, dateVariable];
25
- }, [dateVariable, userVariable]);
40
+ return [userVariable, dateVariable, formVariabele, iterationVariabele].filter(Boolean);
41
+ }, [dateVariable, userVariable, formVariabele, iterationVariabele]);
26
42
  if (!operator || !schema) return [];
27
43
  return result;
28
44
  };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.BlockTemplateDetails = void 0;
8
+ var _proLayout = require("@ant-design/pro-layout");
8
9
  var _antd = require("antd");
9
10
  var _react = _interopRequireWildcard(require("react"));
10
11
  var _reactRouterDom = require("react-router-dom");
@@ -92,7 +93,10 @@ var BlockTemplateDetails = function BlockTemplateDetails() {
92
93
  if (loading) {
93
94
  return /*#__PURE__*/_react.default.createElement(_antd.Spin, null);
94
95
  }
95
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.PageHeader, {
96
+ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_proLayout.PageHeader, {
97
+ style: {
98
+ backgroundColor: 'white'
99
+ },
96
100
  onBack: function onBack() {
97
101
  navigate('/admin/plugins/block-templates');
98
102
  },
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BlockTemplatesPane = exports.BlockTemplatePage = void 0;
7
- var _antd = require("antd");
7
+ var _proLayout = require("@ant-design/pro-layout");
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactI18next = require("react-i18next");
10
10
  var _collectionManager = require("../collection-manager");
@@ -15,7 +15,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
  var BlockTemplatePage = function BlockTemplatePage() {
16
16
  var _useTranslation = (0, _reactI18next.useTranslation)(),
17
17
  t = _useTranslation.t;
18
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_antd.PageHeader, {
18
+ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_proLayout.PageHeader, {
19
+ style: {
20
+ backgroundColor: 'white'
21
+ },
19
22
  ghost: false,
20
23
  title: t('Block templates')
21
24
  }), /*#__PURE__*/_react.default.createElement("div", {
@@ -1,2 +1 @@
1
- import React from 'react';
2
- export declare const ChangePassword: () => React.JSX.Element;
1
+ export declare const useChangePassword: () => import("antd/lib/menu/hooks/useItems").ItemType;
@@ -4,15 +4,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.ChangePassword = void 0;
7
+ exports.useChangePassword = void 0;
8
8
  var _react = require("@formily/react");
9
9
  var _shared = require("@formily/shared");
10
- var _antd = require("antd");
11
10
  var _react2 = _interopRequireWildcard(require("react"));
12
11
  var _reactI18next = require("react-i18next");
13
12
  var _ = require("../");
14
13
  var _apiClient = require("../api-client");
15
- var _CurrentUser = require("./CurrentUser");
16
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -159,33 +157,39 @@ var schema = {
159
157
  }
160
158
  })
161
159
  };
162
- var ChangePassword = function ChangePassword() {
160
+ var useChangePassword = function useChangePassword() {
161
+ var ctx = (0, _react2.useContext)(_.DropdownVisibleContext);
163
162
  var _useState = (0, _react2.useState)(false),
164
163
  _useState2 = _slicedToArray(_useState, 2),
165
164
  visible = _useState2[0],
166
165
  setVisible = _useState2[1];
167
166
  var _useTranslation = (0, _reactI18next.useTranslation)(),
168
167
  t = _useTranslation.t;
169
- var ctx = (0, _react2.useContext)(_CurrentUser.DropdownVisibleContext);
170
- return /*#__PURE__*/_react2.default.createElement(_.ActionContextProvider, {
171
- value: {
172
- visible: visible,
173
- setVisible: setVisible
174
- }
175
- }, /*#__PURE__*/_react2.default.createElement(_antd.Menu.Item, {
176
- key: "password",
177
- eventKey: 'ChangePassword',
178
- onClick: function onClick() {
179
- var _ctx$setVisible;
180
- ctx === null || ctx === void 0 ? void 0 : (_ctx$setVisible = ctx.setVisible) === null || _ctx$setVisible === void 0 ? void 0 : _ctx$setVisible.call(ctx, false);
181
- setVisible(true);
182
- }
183
- }, t('Change password')), /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
184
- scope: {
185
- useCloseAction: useCloseAction,
186
- useSaveCurrentUserValues: useSaveCurrentUserValues
187
- },
188
- schema: schema
189
- }));
168
+ return (0, _react2.useMemo)(function () {
169
+ return {
170
+ key: 'password',
171
+ eventKey: 'ChangePassword',
172
+ onClick: function onClick() {
173
+ setVisible(true);
174
+ ctx === null || ctx === void 0 ? void 0 : ctx.setVisible(false);
175
+ },
176
+ label: /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, t('Change password'), /*#__PURE__*/_react2.default.createElement(_.ActionContextProvider, {
177
+ value: {
178
+ visible: visible,
179
+ setVisible: setVisible
180
+ }
181
+ }, /*#__PURE__*/_react2.default.createElement("div", {
182
+ onClick: function onClick(e) {
183
+ return e.stopPropagation();
184
+ }
185
+ }, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
186
+ scope: {
187
+ useCloseAction: useCloseAction,
188
+ useSaveCurrentUserValues: useSaveCurrentUserValues
189
+ },
190
+ schema: schema
191
+ }))))
192
+ };
193
+ }, [visible]);
190
194
  };
191
- exports.ChangePassword = ChangePassword;
195
+ exports.useChangePassword = useChangePassword;