@nocobase/client 0.10.0-alpha.2 → 0.10.0-alpha.4
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.
- package/es/acl/Configuration/MenuItemsProvider.js +3 -3
- package/es/application/Application.js +2 -2
- package/es/auth/SigninPage.js +12 -9
- package/es/block-provider/GanttBlockProvider.js +5 -4
- package/es/block-provider/TableBlockProvider.d.ts +1 -0
- package/es/block-provider/TableBlockProvider.js +51 -17
- package/es/collection-manager/Configuration/AddCollectionAction.js +31 -25
- package/es/collection-manager/Configuration/AddFieldAction.js +45 -32
- package/es/collection-manager/Configuration/AddSubFieldAction.js +24 -19
- package/es/collection-manager/Configuration/ConfigurationTabs.js +57 -50
- package/es/collection-manager/hooks/useOptions.js +39 -36
- package/es/collection-manager/interfaces/integer.js +1 -1
- package/es/collection-manager/interfaces/number.js +3 -3
- package/es/collection-manager/interfaces/percent.js +3 -3
- package/es/formula/Expression.js +66 -46
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useAdminSchemaUid.d.ts +1 -0
- package/es/hooks/useAdminSchemaUid.js +6 -0
- package/es/hooks/useMenuItem.d.ts +37 -0
- package/es/hooks/useMenuItem.js +93 -0
- package/es/index.d.ts +2 -3
- package/es/index.js +3 -4
- package/es/locale/en_US.d.ts +3 -1
- package/es/locale/en_US.js +4 -2
- package/es/locale/es_ES.d.ts +1 -1
- package/es/locale/es_ES.js +1 -1
- package/es/locale/ja_JP.d.ts +3 -1
- package/es/locale/ja_JP.js +4 -2
- package/es/locale/pt_BR.d.ts +1 -1
- package/es/locale/pt_BR.js +1 -1
- package/es/locale/ru_RU.d.ts +1 -1
- package/es/locale/ru_RU.js +1 -1
- package/es/locale/zh_CN.d.ts +3 -1
- package/es/locale/zh_CN.js +3 -1
- package/es/pm/Card.js +5 -5
- package/es/pm/PluginManagerLink.js +16 -12
- package/es/pm/index.d.ts +2 -1
- package/es/pm/index.js +36 -22
- package/es/route-switch/antd/admin-layout/index.js +5 -5
- package/es/schema-component/antd/action/Action.Designer.js +3 -5
- package/es/schema-component/antd/action/Action.Drawer.js +1 -1
- package/es/schema-component/antd/action/ActionBar.js +1 -1
- package/es/schema-component/antd/association-field/Editable.js +1 -2
- package/es/schema-component/antd/association-field/Nester.js +7 -1
- package/es/schema-component/antd/association-field/SubTable.js +1 -1
- package/es/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/es/schema-component/antd/cascader/Cascader.js +1 -1
- package/es/schema-component/antd/form-item/FormItem.js +10 -3
- package/es/schema-component/antd/form-v2/Form.js +2 -2
- package/es/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/es/schema-component/antd/gantt/components/grid/grid-body.js +3 -3
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/es/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/es/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/es/schema-component/antd/grid/Grid.js +2 -2
- package/es/schema-component/antd/grid-card/GridCard.Designer.js +3 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.js +3 -3
- package/es/schema-component/antd/index.less +1 -3
- package/es/schema-component/antd/list/List.Decorator.js +3 -3
- package/es/schema-component/antd/list/List.Item.js +2 -2
- package/es/schema-component/antd/list/List.d.ts +2 -2
- package/es/schema-component/antd/list/List.js +6 -6
- package/es/schema-component/antd/menu/Menu.js +306 -156
- package/es/schema-component/antd/page/Page.js +29 -23
- package/es/schema-component/antd/remote-select/RemoteSelect.js +60 -10
- package/es/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/es/schema-component/antd/remote-select/utils.js +31 -0
- package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +51 -12
- package/es/schema-component/antd/table-v2/Table.js +28 -47
- package/es/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/es/schema-component/antd/table-v2/utils.js +0 -28
- package/es/schema-component/antd/tabs/Tabs.js +35 -22
- package/es/schema-component/antd/tabs/context.d.ts +1 -1
- package/es/schema-component/antd/upload/ReadPretty.js +7 -3
- package/es/schema-component/antd/variable/VariableSelect.js +1 -1
- package/es/schema-component/common/utils/uitls.d.ts +1 -0
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/es/schema-initializer/SchemaInitializer.js +158 -103
- package/es/schema-initializer/SelectCollection.d.ts +1 -2
- package/es/schema-initializer/SelectCollection.js +19 -16
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/es/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/es/schema-initializer/buttons/TableColumnInitializers.js +3 -2
- package/es/schema-initializer/components/CreateRecordAction.js +37 -27
- package/es/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/es/schema-initializer/items/CalendarBlockInitializer.js +2 -2
- package/es/schema-initializer/utils.d.ts +0 -1
- package/es/schema-initializer/utils.js +40 -25
- package/es/schema-settings/SchemaSettings.js +110 -29
- package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/es/schema-settings/VariableInput/hooks/useFormVariable.js +89 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.js +77 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/es/schema-templates/BlockTemplateDetails.js +5 -1
- package/es/schema-templates/BlockTemplatePage.js +4 -1
- package/es/user/ChangePassword.d.ts +1 -2
- package/es/user/ChangePassword.js +30 -26
- package/es/user/CurrentUser.js +172 -141
- package/es/user/EditProfile.d.ts +1 -2
- package/es/user/EditProfile.js +30 -24
- package/es/user/LanguageSettings.d.ts +1 -2
- package/es/user/LanguageSettings.js +67 -64
- package/es/user/SigninPage.js +25 -22
- package/es/user/SwitchRole.d.ts +1 -2
- package/es/user/SwitchRole.js +54 -49
- package/es/user/ThemeSettings.d.ts +1 -2
- package/es/user/ThemeSettings.js +56 -52
- package/lib/acl/Configuration/MenuItemsProvider.js +3 -3
- package/lib/application/Application.js +2 -2
- package/lib/auth/SigninPage.js +25 -22
- package/lib/block-provider/GanttBlockProvider.js +5 -4
- package/lib/block-provider/TableBlockProvider.d.ts +1 -0
- package/lib/block-provider/TableBlockProvider.js +53 -17
- package/lib/collection-manager/Configuration/AddCollectionAction.js +29 -23
- package/lib/collection-manager/Configuration/AddFieldAction.js +43 -30
- package/lib/collection-manager/Configuration/AddSubFieldAction.js +22 -17
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +57 -49
- package/lib/collection-manager/hooks/useOptions.js +39 -36
- package/lib/collection-manager/interfaces/integer.js +1 -1
- package/lib/collection-manager/interfaces/number.js +3 -3
- package/lib/collection-manager/interfaces/percent.js +3 -3
- package/lib/formula/Expression.js +64 -44
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/useAdminSchemaUid.d.ts +1 -0
- package/lib/hooks/useAdminSchemaUid.js +13 -0
- package/lib/hooks/useMenuItem.d.ts +37 -0
- package/lib/hooks/useMenuItem.js +108 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +22 -33
- package/lib/locale/en_US.d.ts +3 -1
- package/lib/locale/en_US.js +4 -2
- package/lib/locale/es_ES.d.ts +1 -1
- package/lib/locale/es_ES.js +1 -1
- package/lib/locale/ja_JP.d.ts +3 -1
- package/lib/locale/ja_JP.js +4 -2
- package/lib/locale/pt_BR.d.ts +1 -1
- package/lib/locale/pt_BR.js +1 -1
- package/lib/locale/ru_RU.d.ts +1 -1
- package/lib/locale/ru_RU.js +1 -1
- package/lib/locale/zh_CN.d.ts +3 -1
- package/lib/locale/zh_CN.js +3 -1
- package/lib/pm/Card.js +6 -6
- package/lib/pm/PluginManagerLink.js +15 -10
- package/lib/pm/index.d.ts +2 -1
- package/lib/pm/index.js +37 -23
- package/lib/route-switch/antd/admin-layout/index.js +4 -4
- package/lib/schema-component/antd/action/Action.Designer.js +2 -4
- package/lib/schema-component/antd/action/Action.Drawer.js +1 -1
- package/lib/schema-component/antd/association-field/Editable.js +0 -1
- package/lib/schema-component/antd/association-field/Nester.js +6 -0
- package/lib/schema-component/antd/association-field/SubTable.js +1 -1
- package/lib/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/lib/schema-component/antd/cascader/Cascader.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.js +10 -3
- package/lib/schema-component/antd/form-v2/Form.js +2 -2
- package/lib/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/lib/schema-component/antd/gantt/components/grid/grid-body.js +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/lib/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/lib/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/lib/schema-component/antd/grid/Grid.js +1 -1
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +4 -5
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +8 -8
- package/lib/schema-component/antd/index.less +1 -3
- package/lib/schema-component/antd/list/List.Decorator.js +3 -3
- package/lib/schema-component/antd/list/List.Item.js +6 -6
- package/lib/schema-component/antd/list/List.d.ts +2 -2
- package/lib/schema-component/antd/list/List.js +24 -24
- package/lib/schema-component/antd/menu/Menu.js +304 -154
- package/lib/schema-component/antd/page/Page.js +29 -23
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +57 -7
- package/lib/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/lib/schema-component/antd/remote-select/utils.js +41 -0
- package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +50 -11
- package/lib/schema-component/antd/table-v2/Table.js +26 -45
- package/lib/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/lib/schema-component/antd/table-v2/utils.js +0 -29
- package/lib/schema-component/antd/tabs/Tabs.js +34 -21
- package/lib/schema-component/antd/tabs/context.d.ts +1 -1
- package/lib/schema-component/antd/upload/ReadPretty.js +7 -3
- package/lib/schema-component/antd/variable/VariableSelect.js +1 -1
- package/lib/schema-component/common/utils/uitls.d.ts +1 -0
- package/lib/schema-component/common/utils/uitls.js +3 -1
- package/lib/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/lib/schema-initializer/SchemaInitializer.js +155 -101
- package/lib/schema-initializer/SelectCollection.d.ts +1 -2
- package/lib/schema-initializer/SelectCollection.js +22 -17
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/lib/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/lib/schema-initializer/buttons/TableColumnInitializers.js +2 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +35 -25
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +9 -9
- package/lib/schema-initializer/utils.d.ts +0 -1
- package/lib/schema-initializer/utils.js +41 -25
- package/lib/schema-settings/SchemaSettings.js +106 -27
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +96 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.js +84 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/lib/schema-templates/BlockTemplateDetails.js +5 -1
- package/lib/schema-templates/BlockTemplatePage.js +5 -2
- package/lib/user/ChangePassword.d.ts +1 -2
- package/lib/user/ChangePassword.js +30 -26
- package/lib/user/CurrentUser.js +166 -135
- package/lib/user/EditProfile.d.ts +1 -2
- package/lib/user/EditProfile.js +31 -25
- package/lib/user/LanguageSettings.d.ts +1 -2
- package/lib/user/LanguageSettings.js +66 -63
- package/lib/user/SigninPage.js +25 -22
- package/lib/user/SwitchRole.d.ts +1 -2
- package/lib/user/SwitchRole.js +57 -51
- package/lib/user/ThemeSettings.d.ts +1 -2
- package/lib/user/ThemeSettings.js +59 -54
- package/package.json +9 -8
- package/es/settings-form/SettingsForm.d.ts +0 -13
- package/es/settings-form/SettingsForm.js +0 -309
- package/es/settings-form/index.d.ts +0 -1
- package/es/settings-form/index.js +0 -1
- package/lib/settings-form/SettingsForm.d.ts +0 -13
- package/lib/settings-form/SettingsForm.js +0 -320
- package/lib/settings-form/index.d.ts +0 -1
- package/lib/settings-form/index.js +0 -16
|
@@ -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.
|
|
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
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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.
|
|
195
|
+
exports.useChangePassword = useChangePassword;
|
package/lib/user/CurrentUser.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.SettingsMenu = exports.DropdownVisibleContext = exports.CurrentUser = void 0;
|
|
8
8
|
var _css = require("@emotion/css");
|
|
9
|
+
var _client = require("@nocobase/utils/client");
|
|
9
10
|
var _antd = require("antd");
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _reactI18next = require("react-i18next");
|
|
@@ -23,20 +24,28 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
24
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
24
25
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
26
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
28
27
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
29
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
30
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
35
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
31
36
|
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); } }
|
|
32
37
|
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); }); }; }
|
|
33
|
-
var
|
|
34
|
-
var _data$
|
|
38
|
+
var useApplicationVersion = function useApplicationVersion() {
|
|
39
|
+
var _data$data2;
|
|
35
40
|
var data = (0, _CurrentAppInfoProvider.useCurrentAppInfo)();
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
return (0, _react.useMemo)(function () {
|
|
42
|
+
var _data$data;
|
|
43
|
+
return {
|
|
44
|
+
key: 'version',
|
|
45
|
+
disabled: true,
|
|
46
|
+
label: "Version ".concat(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.version)
|
|
47
|
+
};
|
|
48
|
+
}, [data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.version]);
|
|
40
49
|
};
|
|
41
50
|
/**
|
|
42
51
|
* @note If you want to change here, Note the Setting block on the mobile side
|
|
@@ -53,138 +62,158 @@ var SettingsMenu = function SettingsMenu(props) {
|
|
|
53
62
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
54
63
|
t = _useTranslation.t;
|
|
55
64
|
var silenceApi = (0, _.useAPIClient)();
|
|
56
|
-
var check = /*#__PURE__*/function () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// ignore
|
|
73
|
-
});
|
|
74
|
-
}, 3000);
|
|
75
|
-
});
|
|
76
|
-
case 2:
|
|
77
|
-
return _context.abrupt("return", _context.sent);
|
|
78
|
-
case 3:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context.stop();
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}));
|
|
84
|
-
return function check() {
|
|
85
|
-
return _ref.apply(this, arguments);
|
|
86
|
-
};
|
|
87
|
-
}();
|
|
88
|
-
return /*#__PURE__*/_react.default.createElement(_antd.Menu, null, /*#__PURE__*/_react.default.createElement(ApplicationVersion, null), /*#__PURE__*/_react.default.createElement(_antd.Menu.Divider, null), /*#__PURE__*/_react.default.createElement(_EditProfile.EditProfile, null), /*#__PURE__*/_react.default.createElement(_ChangePassword.ChangePassword, null), /*#__PURE__*/_react.default.createElement(_antd.Menu.Divider, null), /*#__PURE__*/_react.default.createElement(_SwitchRole.SwitchRole, null), /*#__PURE__*/_react.default.createElement(_LanguageSettings.LanguageSettings, null), /*#__PURE__*/_react.default.createElement(_ThemeSettings.ThemeSettings, null), /*#__PURE__*/_react.default.createElement(_antd.Menu.Divider, null), appAllowed && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Menu.Item, {
|
|
89
|
-
key: "cache",
|
|
90
|
-
onClick: function () {
|
|
91
|
-
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
92
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
93
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
94
|
-
case 0:
|
|
95
|
-
_context2.next = 2;
|
|
96
|
-
return api.resource('app').clearCache();
|
|
97
|
-
case 2:
|
|
98
|
-
window.location.reload();
|
|
99
|
-
case 3:
|
|
100
|
-
case "end":
|
|
101
|
-
return _context2.stop();
|
|
102
|
-
}
|
|
103
|
-
}, _callee2);
|
|
104
|
-
}));
|
|
105
|
-
function onClick() {
|
|
106
|
-
return _onClick.apply(this, arguments);
|
|
107
|
-
}
|
|
108
|
-
return onClick;
|
|
109
|
-
}()
|
|
110
|
-
}, t('Clear cache')), /*#__PURE__*/_react.default.createElement(_antd.Menu.Item, {
|
|
111
|
-
key: "reboot",
|
|
112
|
-
onClick: function () {
|
|
113
|
-
var _onClick2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
114
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
115
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
116
|
-
case 0:
|
|
117
|
-
_antd.Modal.confirm({
|
|
118
|
-
title: t('Reboot application'),
|
|
119
|
-
content: t('The will interrupt service, it may take a few seconds to restart. Are you sure to continue?'),
|
|
120
|
-
okText: t('Reboot'),
|
|
121
|
-
okButtonProps: {
|
|
122
|
-
danger: true
|
|
123
|
-
},
|
|
124
|
-
onOk: function () {
|
|
125
|
-
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
126
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
127
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
128
|
-
case 0:
|
|
129
|
-
_context3.next = 2;
|
|
130
|
-
return api.resource('app').reboot();
|
|
131
|
-
case 2:
|
|
132
|
-
_context3.next = 4;
|
|
133
|
-
return check();
|
|
134
|
-
case 4:
|
|
135
|
-
window.location.reload();
|
|
136
|
-
case 5:
|
|
137
|
-
case "end":
|
|
138
|
-
return _context3.stop();
|
|
139
|
-
}
|
|
140
|
-
}, _callee3);
|
|
141
|
-
}));
|
|
142
|
-
function onOk() {
|
|
143
|
-
return _onOk.apply(this, arguments);
|
|
144
|
-
}
|
|
145
|
-
return onOk;
|
|
146
|
-
}()
|
|
65
|
+
var check = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
66
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
|
+
while (1) switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
_context.next = 2;
|
|
70
|
+
return new Promise(function (resolve) {
|
|
71
|
+
var heartbeat = setInterval(function () {
|
|
72
|
+
silenceApi.silent().resource('app').getInfo().then(function (res) {
|
|
73
|
+
console.log(res);
|
|
74
|
+
if ((res === null || res === void 0 ? void 0 : res.status) === 200) {
|
|
75
|
+
resolve('ok');
|
|
76
|
+
clearInterval(heartbeat);
|
|
77
|
+
}
|
|
78
|
+
return res;
|
|
79
|
+
}).catch(function (err) {
|
|
80
|
+
(0, _client.error)(err);
|
|
147
81
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return _onClick2.apply(this, arguments);
|
|
82
|
+
}, 3000);
|
|
83
|
+
});
|
|
84
|
+
case 2:
|
|
85
|
+
return _context.abrupt("return", _context.sent);
|
|
86
|
+
case 3:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
156
89
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
90
|
+
}, _callee);
|
|
91
|
+
})), [silenceApi]);
|
|
92
|
+
var divider = (0, _react.useMemo)(function () {
|
|
93
|
+
return {
|
|
94
|
+
type: 'divider'
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
var appVersion = useApplicationVersion();
|
|
98
|
+
var editProfile = (0, _EditProfile.useEditProfile)();
|
|
99
|
+
var changePassword = (0, _ChangePassword.useChangePassword)();
|
|
100
|
+
var switchRole = (0, _SwitchRole.useSwitchRole)();
|
|
101
|
+
var languageSettings = (0, _LanguageSettings.useLanguageSettings)();
|
|
102
|
+
var themeSettings = (0, _ThemeSettings.useThemeSettings)();
|
|
103
|
+
var controlApp = (0, _react.useMemo)(function () {
|
|
104
|
+
if (!appAllowed) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return [{
|
|
108
|
+
key: 'cache',
|
|
109
|
+
label: t('Clear cache'),
|
|
110
|
+
onClick: function () {
|
|
111
|
+
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
112
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
113
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
114
|
+
case 0:
|
|
115
|
+
_context2.next = 2;
|
|
116
|
+
return api.resource('app').clearCache();
|
|
117
|
+
case 2:
|
|
118
|
+
window.location.reload();
|
|
119
|
+
case 3:
|
|
120
|
+
case "end":
|
|
121
|
+
return _context2.stop();
|
|
122
|
+
}
|
|
123
|
+
}, _callee2);
|
|
124
|
+
}));
|
|
125
|
+
function onClick() {
|
|
126
|
+
return _onClick.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
return onClick;
|
|
129
|
+
}()
|
|
130
|
+
}, {
|
|
131
|
+
key: 'reboot',
|
|
132
|
+
label: t('Reboot application'),
|
|
133
|
+
onClick: function () {
|
|
134
|
+
var _onClick2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
135
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
136
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
_antd.Modal.confirm({
|
|
139
|
+
title: t('Reboot application'),
|
|
140
|
+
content: t('The will interrupt service, it may take a few seconds to restart. Are you sure to continue?'),
|
|
141
|
+
okText: t('Reboot'),
|
|
142
|
+
okButtonProps: {
|
|
143
|
+
danger: true
|
|
144
|
+
},
|
|
145
|
+
onOk: function () {
|
|
146
|
+
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
_context3.next = 2;
|
|
151
|
+
return api.resource('app').reboot();
|
|
152
|
+
case 2:
|
|
153
|
+
_context3.next = 4;
|
|
154
|
+
return check();
|
|
155
|
+
case 4:
|
|
156
|
+
window.location.reload();
|
|
157
|
+
case 5:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context3.stop();
|
|
160
|
+
}
|
|
161
|
+
}, _callee3);
|
|
162
|
+
}));
|
|
163
|
+
function onOk() {
|
|
164
|
+
return _onOk.apply(this, arguments);
|
|
165
|
+
}
|
|
166
|
+
return onOk;
|
|
167
|
+
}()
|
|
168
|
+
});
|
|
169
|
+
case 1:
|
|
170
|
+
case "end":
|
|
171
|
+
return _context4.stop();
|
|
172
|
+
}
|
|
173
|
+
}, _callee4);
|
|
174
|
+
}));
|
|
175
|
+
function onClick() {
|
|
176
|
+
return _onClick2.apply(this, arguments);
|
|
177
|
+
}
|
|
178
|
+
return onClick;
|
|
179
|
+
}()
|
|
180
|
+
}, divider];
|
|
181
|
+
}, [appAllowed, check]);
|
|
182
|
+
var items = (0, _react.useMemo)(function () {
|
|
183
|
+
return [appVersion, divider, editProfile, changePassword, divider, switchRole, languageSettings, themeSettings, divider].concat(_toConsumableArray(controlApp), [{
|
|
184
|
+
key: 'signout',
|
|
185
|
+
label: t('Sign out'),
|
|
186
|
+
onClick: function () {
|
|
187
|
+
var _onClick3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
188
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
189
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
190
|
+
case 0:
|
|
191
|
+
_context5.next = 2;
|
|
192
|
+
return api.auth.signOut();
|
|
193
|
+
case 2:
|
|
194
|
+
navigate("/signin?redirect=".concat(encodeURIComponent(redirectUrl)));
|
|
195
|
+
case 3:
|
|
196
|
+
case "end":
|
|
197
|
+
return _context5.stop();
|
|
198
|
+
}
|
|
199
|
+
}, _callee5);
|
|
200
|
+
}));
|
|
201
|
+
function onClick() {
|
|
202
|
+
return _onClick3.apply(this, arguments);
|
|
203
|
+
}
|
|
204
|
+
return onClick;
|
|
205
|
+
}()
|
|
206
|
+
}]);
|
|
207
|
+
}, [appVersion, changePassword, controlApp, divider, editProfile, history, languageSettings, switchRole, themeSettings]);
|
|
208
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Menu, {
|
|
209
|
+
items: items
|
|
210
|
+
});
|
|
182
211
|
};
|
|
183
212
|
exports.SettingsMenu = SettingsMenu;
|
|
184
213
|
var DropdownVisibleContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
185
214
|
exports.DropdownVisibleContext = DropdownVisibleContext;
|
|
186
215
|
var CurrentUser = function CurrentUser() {
|
|
187
|
-
var _data$
|
|
216
|
+
var _data$data3, _data$data4;
|
|
188
217
|
var _useState = (0, _react.useState)(false),
|
|
189
218
|
_useState2 = _slicedToArray(_useState, 2),
|
|
190
219
|
visible = _useState2[0],
|
|
@@ -206,7 +235,9 @@ var CurrentUser = function CurrentUser() {
|
|
|
206
235
|
onOpenChange: function onOpenChange(visible) {
|
|
207
236
|
setVisible(visible);
|
|
208
237
|
},
|
|
209
|
-
|
|
238
|
+
dropdownRender: function dropdownRender() {
|
|
239
|
+
return /*#__PURE__*/_react.default.createElement(SettingsMenu, null);
|
|
240
|
+
}
|
|
210
241
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
211
242
|
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-width: 160px;\n overflow: hidden;\n display: inline-block;\n line-height: 12px;\n white-space: nowrap;\n text-overflow: ellipsis;\n "]))),
|
|
212
243
|
style: {
|
|
@@ -215,6 +246,6 @@ var CurrentUser = function CurrentUser() {
|
|
|
215
246
|
padding: '16px',
|
|
216
247
|
color: 'rgba(255, 255, 255, 0.65)'
|
|
217
248
|
}
|
|
218
|
-
}, (data === null || data === void 0 ? void 0 : (_data$
|
|
249
|
+
}, (data === null || data === void 0 ? void 0 : (_data$data3 = data.data) === null || _data$data3 === void 0 ? void 0 : _data$data3.nickname) || (data === null || data === void 0 ? void 0 : (_data$data4 = data.data) === null || _data$data4 === void 0 ? void 0 : _data$data4.email)))));
|
|
219
250
|
};
|
|
220
251
|
exports.CurrentUser = CurrentUser;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const EditProfile: () => React.JSX.Element;
|
|
1
|
+
export declare const useEditProfile: () => import("antd/lib/menu/hooks/useItems").ItemType;
|
package/lib/user/EditProfile.js
CHANGED
|
@@ -4,10 +4,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.useEditProfile = 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("../");
|
|
@@ -151,33 +150,40 @@ var schema = {
|
|
|
151
150
|
}
|
|
152
151
|
})
|
|
153
152
|
};
|
|
154
|
-
var
|
|
153
|
+
var useEditProfile = function useEditProfile() {
|
|
154
|
+
var ctx = (0, _react2.useContext)(_.DropdownVisibleContext);
|
|
155
155
|
var _useState = (0, _react2.useState)(false),
|
|
156
156
|
_useState2 = _slicedToArray(_useState, 2),
|
|
157
157
|
visible = _useState2[0],
|
|
158
158
|
setVisible = _useState2[1];
|
|
159
159
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
160
160
|
t = _useTranslation.t;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
161
|
+
return (0, _react2.useMemo)(function () {
|
|
162
|
+
return {
|
|
163
|
+
key: 'profile',
|
|
164
|
+
eventKey: 'EditProfile',
|
|
165
|
+
onClick: function onClick() {
|
|
166
|
+
setVisible(true);
|
|
167
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.setVisible(false);
|
|
168
|
+
},
|
|
169
|
+
label: /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, t('Edit profile'), /*#__PURE__*/_react2.default.createElement(_.ActionContextProvider, {
|
|
170
|
+
value: {
|
|
171
|
+
visible: visible,
|
|
172
|
+
setVisible: setVisible
|
|
173
|
+
}
|
|
174
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
175
|
+
onClick: function onClick(e) {
|
|
176
|
+
return e.stopPropagation();
|
|
177
|
+
}
|
|
178
|
+
}, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
|
|
179
|
+
scope: {
|
|
180
|
+
useCurrentUserValues: useCurrentUserValues,
|
|
181
|
+
useCloseAction: useCloseAction,
|
|
182
|
+
useSaveCurrentUserValues: useSaveCurrentUserValues
|
|
183
|
+
},
|
|
184
|
+
schema: schema
|
|
185
|
+
}))))
|
|
186
|
+
};
|
|
187
|
+
}, [visible]);
|
|
182
188
|
};
|
|
183
|
-
exports.
|
|
189
|
+
exports.useEditProfile = useEditProfile;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const LanguageSettings: () => React.JSX.Element;
|
|
1
|
+
export declare const useLanguageSettings: () => import("antd/lib/menu/hooks/useItems").ItemType;
|