@tachybase/client 1.3.17 → 1.3.18
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/application/CustomRouterContextProvider.mjs +2 -1
- package/es/application/components/AppComponent.mjs +3 -1
- package/es/application/schema-initializer/hooks/index.d.ts +1 -1
- package/es/application/schema-initializer/hooks/index.mjs +2 -2
- package/es/block-provider/hooks/index.mjs +1 -1
- package/es/built-in/acl/Configuration/schemas/scopes.mjs +5 -4
- package/es/built-in/dynamic-page/DynamicPage.context.d.ts +0 -0
- package/es/built-in/dynamic-page/DynamicPage.context.mjs +0 -0
- package/es/built-in/dynamic-page/DynamicPage.mjs +33 -16
- package/es/built-in/dynamic-page/DynamicPage.style.d.ts +3 -0
- package/es/built-in/dynamic-page/DynamicPage.style.mjs +26 -0
- package/es/built-in/dynamic-page/PageNavBar.d.ts +3 -0
- package/es/built-in/dynamic-page/PageNavBar.mjs +47 -0
- package/es/built-in/dynamic-page/PageNavBar.style.d.ts +3 -0
- package/es/built-in/dynamic-page/PageNavBar.style.mjs +25 -0
- package/es/built-in/dynamic-page/utils.d.ts +2 -1
- package/es/built-in/dynamic-page/utils.mjs +3 -0
- package/es/built-in/locale/LocalePlugin.mjs +1 -1
- package/es/built-in/page-style/CustomAdminHeader.mjs +2 -2
- package/es/built-in/page-style/PageStyle.provider.d.ts +7 -2
- package/es/built-in/page-style/PageStyle.provider.mjs +8 -3
- package/es/built-in/page-style/TabContent.mjs +7 -5
- package/es/built-in/page-style/usePageStyle.d.ts +1 -1
- package/es/built-in/page-style/usePageStyle.mjs +1 -1
- package/es/built-in/page-style/useTabSettings.d.ts +4 -3
- package/es/built-in/page-style/useTabSettings.mjs +8 -7
- package/es/built-in/quick-access/PopupActionSchemaInitializerItem.mjs +2 -2
- package/es/modules/actions/add-child/CreateChildInitializer.mjs +2 -2
- package/es/modules/actions/add-new/CreateActionInitializer.mjs +2 -2
- package/es/modules/actions/add-record/CustomizeAddRecordActionInitializer.mjs +2 -2
- package/es/modules/actions/associate/AssociateActionInitializer.mjs +2 -1
- package/es/modules/actions/submit/createSubmitActionSettings.mjs +6 -3
- package/es/modules/actions/view-edit-popup/PopupActionInitializer.mjs +2 -2
- package/es/modules/actions/view-edit-popup/UpdateActionInitializer.mjs +2 -2
- package/es/modules/actions/view-edit-popup/ViewActionInitializer.mjs +2 -2
- package/es/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.mjs +2 -2
- package/es/modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs +2 -2
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +2 -2
- package/es/schema-component/antd/action/Action.Container.mjs +26 -5
- package/es/schema-component/antd/action/Action.Designer.mjs +14 -3
- package/es/schema-component/antd/action/Action.Page.mjs +1 -1
- package/es/schema-component/antd/action/Action.mjs +56 -11
- package/es/schema-component/antd/action/context.d.ts +9 -1
- package/es/schema-component/antd/action/context.mjs +10 -1
- package/es/schema-component/antd/action/hooks.d.ts +2 -1
- package/es/schema-component/antd/action/hooks.mjs +2 -2
- package/es/schema-component/antd/association-field/FileManager.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalPicker.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalTag.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalViewer.mjs +2 -2
- package/es/schema-component/antd/association-field/SubTable.mjs +2 -2
- package/es/schema-component/antd/form-item/FormItem.Settings.mjs +3 -2
- package/es/schema-component/antd/page/Page.mjs +27 -22
- package/es/schema-component/antd/record-picker/InputRecordPicker.mjs +2 -2
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.mjs +2 -2
- package/es/schema-initializer/items/SelectActionInitializer.mjs +2 -2
- package/es/schema-items/OpenModeSchemaItems.mjs +37 -16
- package/es/schema-templates/schemas/uiSchemaTemplates.mjs +1 -1
- package/es/user/ChangePassword.mjs +19 -4
- package/lib/application/CustomRouterContextProvider.js +2 -1
- package/lib/application/components/AppComponent.js +3 -1
- package/lib/application/schema-initializer/hooks/index.js +152 -193
- package/lib/block-provider/hooks/index.js +3 -3
- package/lib/built-in/acl/Configuration/schemas/scopes.js +4 -3
- package/lib/built-in/dynamic-page/DynamicPage.context.js +5 -0
- package/lib/built-in/dynamic-page/DynamicPage.js +31 -14
- package/lib/built-in/dynamic-page/DynamicPage.style.js +60 -0
- package/lib/built-in/dynamic-page/PageNavBar.js +81 -0
- package/lib/built-in/dynamic-page/PageNavBar.style.js +59 -0
- package/lib/built-in/dynamic-page/utils.js +3 -0
- package/lib/built-in/locale/LocalePlugin.js +1 -1
- package/lib/built-in/page-style/CustomAdminHeader.js +2 -2
- package/lib/built-in/page-style/PageStyle.provider.js +10 -2
- package/lib/built-in/page-style/TabContent.js +6 -4
- package/lib/built-in/page-style/usePageStyle.js +1 -1
- package/lib/built-in/page-style/useTabSettings.js +8 -7
- package/lib/built-in/quick-access/PopupActionSchemaInitializerItem.js +1 -1
- package/lib/locale/en_US.js +1 -0
- package/lib/modules/actions/add-child/CreateChildInitializer.js +2 -2
- package/lib/modules/actions/add-new/CreateActionInitializer.js +2 -2
- package/lib/modules/actions/add-record/CustomizeAddRecordActionInitializer.js +2 -2
- package/lib/modules/actions/associate/AssociateActionInitializer.js +2 -1
- package/lib/modules/actions/submit/createSubmitActionSettings.js +5 -2
- package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +2 -2
- package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +2 -2
- package/lib/modules/actions/view-edit-popup/ViewActionInitializer.js +2 -2
- package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +1 -1
- package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +1 -1
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -1
- package/lib/schema-component/antd/action/Action.Container.js +25 -4
- package/lib/schema-component/antd/action/Action.Designer.js +13 -2
- package/lib/schema-component/antd/action/Action.Page.js +1 -1
- package/lib/schema-component/antd/action/Action.js +55 -10
- package/lib/schema-component/antd/action/context.js +13 -1
- package/lib/schema-component/antd/action/hooks.js +1 -1
- package/lib/schema-component/antd/association-field/FileManager.js +1 -1
- package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
- package/lib/schema-component/antd/association-field/InternalPicker.js +1 -1
- package/lib/schema-component/antd/association-field/InternalTag.js +1 -1
- package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
- package/lib/schema-component/antd/association-field/SubTable.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.Settings.js +3 -2
- package/lib/schema-component/antd/page/Page.js +26 -21
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
- package/lib/schema-initializer/items/SelectActionInitializer.js +2 -2
- package/lib/schema-items/OpenModeSchemaItems.js +36 -15
- package/lib/schema-templates/schemas/uiSchemaTemplates.js +1 -1
- package/lib/user/ChangePassword.js +18 -3
- package/package.json +10 -11
|
@@ -50,8 +50,11 @@ const external_react_router_dom_namespaceObject = require("react-router-dom");
|
|
|
50
50
|
const external_index_js_namespaceObject = require("../../index.js");
|
|
51
51
|
const index_js_namespaceObject = require("../../../application/index.js");
|
|
52
52
|
const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
|
|
53
|
+
const external_block_provider_index_js_namespaceObject = require("../../../block-provider/index.js");
|
|
53
54
|
const acl_index_js_namespaceObject = require("../../../built-in/acl/index.js");
|
|
54
55
|
const utils_js_namespaceObject = require("../../../built-in/dynamic-page/utils.js");
|
|
56
|
+
const PageStyle_provider_js_namespaceObject = require("../../../built-in/page-style/PageStyle.provider.js");
|
|
57
|
+
const usePageStyle_js_namespaceObject = require("../../../built-in/page-style/usePageStyle.js");
|
|
55
58
|
const external_data_source_index_js_namespaceObject = require("../../../data-source/index.js");
|
|
56
59
|
const external_icon_index_js_namespaceObject = require("../../../icon/index.js");
|
|
57
60
|
const external_record_provider_index_js_namespaceObject = require("../../../record-provider/index.js");
|
|
@@ -96,7 +99,9 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
96
99
|
const openMode = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode'];
|
|
97
100
|
const openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize'];
|
|
98
101
|
const disabled = form.disabled || field.disabled || (null == (_field_data = field.data) ? void 0 : _field_data.disabled) || propsDisabled;
|
|
99
|
-
const linkageRules = (null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || []
|
|
102
|
+
const linkageRules = (0, external_react_namespaceObject.useMemo)(()=>(null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [], [
|
|
103
|
+
fieldSchema
|
|
104
|
+
]);
|
|
100
105
|
const { designable } = (0, external_index_js_namespaceObject.useDesignable)();
|
|
101
106
|
const tarComponent = (0, external_hooks_index_js_namespaceObject.useComponent)(component) || component;
|
|
102
107
|
const { modal } = external_antd_namespaceObject.App.useApp();
|
|
@@ -109,6 +114,23 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
109
114
|
const { getAriaLabel } = (0, useGetAriaLabelOfAction_js_namespaceObject.useGetAriaLabelOfAction)(title);
|
|
110
115
|
let actionTitle = title || compile(fieldSchema.title);
|
|
111
116
|
actionTitle = external_lodash_default().isString(actionTitle) ? t(actionTitle) : actionTitle;
|
|
117
|
+
const collectionKey = null == collection ? void 0 : collection.getPrimaryKey();
|
|
118
|
+
const pageStyle = (0, usePageStyle_js_namespaceObject.usePageStyle)();
|
|
119
|
+
const isMobile = (0, external_block_provider_index_js_namespaceObject.useIsMobile)();
|
|
120
|
+
const isPageMode = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
121
|
+
if (null == pageMode ? void 0 : pageMode.enable) return true;
|
|
122
|
+
if (openMode === external_context_js_namespaceObject.OpenMode.PAGE) return true;
|
|
123
|
+
if (!openMode || [
|
|
124
|
+
external_context_js_namespaceObject.OpenMode.DEFAULT,
|
|
125
|
+
external_context_js_namespaceObject.OpenMode.DRAWER
|
|
126
|
+
].includes(openMode)) return isMobile || pageStyle === PageStyle_provider_js_namespaceObject.PageStyle.TAB_STYLE;
|
|
127
|
+
return false;
|
|
128
|
+
}, [
|
|
129
|
+
null == pageMode ? void 0 : pageMode.enable,
|
|
130
|
+
openMode,
|
|
131
|
+
isMobile,
|
|
132
|
+
pageStyle
|
|
133
|
+
]);
|
|
112
134
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
113
135
|
field.stateOfLinkageRules = {};
|
|
114
136
|
linkageRules.filter((k)=>!k.disabled).forEach((v)=>{
|
|
@@ -130,6 +152,30 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
130
152
|
record,
|
|
131
153
|
variables
|
|
132
154
|
]);
|
|
155
|
+
const openModal = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
156
|
+
setVisible(true);
|
|
157
|
+
}, []);
|
|
158
|
+
const openPage = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
159
|
+
const containerSchema = fieldSchema.reduceProperties((buf, s)=>'Action.Container' === s['x-component'] ? s : buf);
|
|
160
|
+
const target = utils_js_namespaceObject.PathHandler.getInstance().toWildcardPath({
|
|
161
|
+
collection: collection.name,
|
|
162
|
+
filterByTk: record[collectionKey]
|
|
163
|
+
});
|
|
164
|
+
const findMPageSchema = (schema)=>{
|
|
165
|
+
if (!schema) return;
|
|
166
|
+
if ('MPage' === schema['x-component']) return schema['x-uid'];
|
|
167
|
+
return findMPageSchema(null == schema ? void 0 : schema.parent);
|
|
168
|
+
};
|
|
169
|
+
const MPageUID = findMPageSchema(fieldSchema);
|
|
170
|
+
const finalPath = isMobile ? "./".concat(MPageUID, "/sub/").concat(containerSchema['x-uid'], "/").concat(target) : "./sub/".concat(containerSchema['x-uid'], "/").concat(target);
|
|
171
|
+
navigate(finalPath);
|
|
172
|
+
}, [
|
|
173
|
+
fieldSchema,
|
|
174
|
+
record,
|
|
175
|
+
collectionKey,
|
|
176
|
+
null == collection ? void 0 : collection.name,
|
|
177
|
+
navigate
|
|
178
|
+
]);
|
|
133
179
|
const handleButtonClick = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
134
180
|
if ((0, client_namespaceObject.isPortalInBody)(e.target)) return;
|
|
135
181
|
e.preventDefault();
|
|
@@ -137,14 +183,8 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
137
183
|
if (!disabled && aclCtx) {
|
|
138
184
|
const onOk = ()=>{
|
|
139
185
|
null == onClick || onClick(e);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const target = utils_js_namespaceObject.PathHandler.getInstance().toWildcardPath({
|
|
143
|
-
collection: collection.name,
|
|
144
|
-
filterByTk: record[collection.getPrimaryKey()]
|
|
145
|
-
});
|
|
146
|
-
navigate('../' + containerSchema['x-uid'] + '/' + target);
|
|
147
|
-
} else setVisible(true);
|
|
186
|
+
if (isPageMode) openPage();
|
|
187
|
+
else openModal();
|
|
148
188
|
run();
|
|
149
189
|
};
|
|
150
190
|
if (null == confirm ? void 0 : confirm.content) modal.confirm({
|
|
@@ -163,7 +203,12 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
163
203
|
disabled,
|
|
164
204
|
modal,
|
|
165
205
|
onClick,
|
|
166
|
-
run
|
|
206
|
+
run,
|
|
207
|
+
isPageMode,
|
|
208
|
+
openPage,
|
|
209
|
+
openModal,
|
|
210
|
+
actionTitle,
|
|
211
|
+
t
|
|
167
212
|
]);
|
|
168
213
|
const buttonStyle = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
169
214
|
var _field_data;
|
|
@@ -25,6 +25,7 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
ActionContextProvider: ()=>ActionContextProvider,
|
|
28
|
+
OpenMode: ()=>context_OpenMode,
|
|
28
29
|
ActionContext: ()=>ActionContext
|
|
29
30
|
});
|
|
30
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
@@ -43,11 +44,22 @@ const ActionContextProvider = (props)=>{
|
|
|
43
44
|
children: props.children
|
|
44
45
|
});
|
|
45
46
|
};
|
|
47
|
+
var context_OpenMode = /*#__PURE__*/ function(OpenMode) {
|
|
48
|
+
OpenMode["DEFAULT"] = "default";
|
|
49
|
+
OpenMode["DRAWER"] = "drawer";
|
|
50
|
+
OpenMode["MODAL"] = "modal";
|
|
51
|
+
OpenMode["PAGE"] = "page";
|
|
52
|
+
OpenMode["SHEET"] = "sheet";
|
|
53
|
+
OpenMode["DRAWER_MODE"] = "drawer-mode";
|
|
54
|
+
return OpenMode;
|
|
55
|
+
}({});
|
|
46
56
|
exports.ActionContext = __webpack_exports__.ActionContext;
|
|
47
57
|
exports.ActionContextProvider = __webpack_exports__.ActionContextProvider;
|
|
58
|
+
exports.OpenMode = __webpack_exports__.OpenMode;
|
|
48
59
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
49
60
|
"ActionContext",
|
|
50
|
-
"ActionContextProvider"
|
|
61
|
+
"ActionContextProvider",
|
|
62
|
+
"OpenMode"
|
|
51
63
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
52
64
|
Object.defineProperty(exports, '__esModule', {
|
|
53
65
|
value: true
|
|
@@ -46,7 +46,7 @@ const useActionContext = ()=>{
|
|
|
46
46
|
...ctx,
|
|
47
47
|
setVisible (visible) {
|
|
48
48
|
let confirm = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false;
|
|
49
|
-
if ((null == ctx ? void 0 : ctx.openMode) !==
|
|
49
|
+
if ((null == ctx ? void 0 : ctx.openMode) !== external_context_js_namespaceObject.OpenMode.PAGE) if (visible) {
|
|
50
50
|
var _ctx_setVisible1;
|
|
51
51
|
null == ctx || null == (_ctx_setVisible1 = ctx.setVisible) || _ctx_setVisible1.call(ctx, visible);
|
|
52
52
|
} else if (confirm && ctx.formValueChanged) modal.confirm({
|
|
@@ -188,7 +188,7 @@ const InternalFileManager = (props)=>{
|
|
|
188
188
|
}),
|
|
189
189
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_action_index_js_namespaceObject.ActionContextProvider, {
|
|
190
190
|
value: {
|
|
191
|
-
openMode:
|
|
191
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
192
192
|
visible: visibleSelector,
|
|
193
193
|
setVisible: setVisibleSelector,
|
|
194
194
|
modalProps: {
|
|
@@ -87,7 +87,7 @@ const InternaDrawerSubTable = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
87
87
|
...ctx,
|
|
88
88
|
visible,
|
|
89
89
|
setVisible,
|
|
90
|
-
openMode:
|
|
90
|
+
openMode: context_js_namespaceObject.OpenMode.DEFAULT
|
|
91
91
|
},
|
|
92
92
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Drawer, {
|
|
93
93
|
title: t(null == options ? void 0 : null == (_options_uiSchema = options.uiSchema) ? void 0 : _options_uiSchema.rawTitle),
|
|
@@ -229,7 +229,7 @@ const InternalPicker = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
229
229
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_action_index_js_namespaceObject.ActionContextProvider, {
|
|
230
230
|
value: {
|
|
231
231
|
openSize: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) || openSize,
|
|
232
|
-
openMode:
|
|
232
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
233
233
|
visible: visibleSelector,
|
|
234
234
|
setVisible: setVisibleSelector
|
|
235
235
|
},
|
|
@@ -145,7 +145,7 @@ const ReadPrettyInternalTag = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
145
145
|
value: {
|
|
146
146
|
visible,
|
|
147
147
|
setVisible,
|
|
148
|
-
openMode:
|
|
148
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
149
149
|
snapshot: (null == collectionField ? void 0 : collectionField.interface) === 'snapshot'
|
|
150
150
|
},
|
|
151
151
|
children: renderRecordProvider()
|
|
@@ -160,7 +160,7 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
160
160
|
value: {
|
|
161
161
|
visible,
|
|
162
162
|
setVisible,
|
|
163
|
-
openMode:
|
|
163
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
164
164
|
snapshot: (null == collectionField ? void 0 : collectionField.interface) === 'snapshot',
|
|
165
165
|
fieldSchema: fieldSchema
|
|
166
166
|
},
|
|
@@ -267,7 +267,7 @@ const SubTable = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
267
267
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_action_index_js_namespaceObject.ActionContextProvider, {
|
|
268
268
|
value: {
|
|
269
269
|
openSize,
|
|
270
|
-
openMode:
|
|
270
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
271
271
|
visible: visibleSelector,
|
|
272
272
|
setVisible: setVisibleSelector
|
|
273
273
|
},
|
|
@@ -72,6 +72,7 @@ const SchemaSettingsSortingRule_js_namespaceObject = require("../../../schema-se
|
|
|
72
72
|
const VariableInput_js_namespaceObject = require("../../../schema-settings/VariableInput/VariableInput.js");
|
|
73
73
|
const external_variables_index_js_namespaceObject = require("../../../variables/index.js");
|
|
74
74
|
const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
|
|
75
|
+
const external_action_index_js_namespaceObject = require("../action/index.js");
|
|
75
76
|
const util_js_namespaceObject = require("../association-field/util.js");
|
|
76
77
|
const external_filter_index_js_namespaceObject = require("../filter/index.js");
|
|
77
78
|
const utils_js_namespaceObject = require("../form-v2/utils.js");
|
|
@@ -781,7 +782,7 @@ const formItemSettings = new index_js_namespaceObject.SchemaSettings({
|
|
|
781
782
|
'x-component': 'Action',
|
|
782
783
|
'x-decorator': 'ACLActionProvider',
|
|
783
784
|
'x-component-props': {
|
|
784
|
-
openMode:
|
|
785
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DRAWER_MODE,
|
|
785
786
|
type: 'default',
|
|
786
787
|
component: 'CreateRecordAction'
|
|
787
788
|
}
|
|
@@ -852,7 +853,7 @@ const formItemSettings = new index_js_namespaceObject.SchemaSettings({
|
|
|
852
853
|
'x-component': 'Action',
|
|
853
854
|
'x-decorator': 'ACLActionProvider',
|
|
854
855
|
'x-component-props': {
|
|
855
|
-
openMode:
|
|
856
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DRAWER_MODE,
|
|
856
857
|
type: 'default',
|
|
857
858
|
component: 'CreateRecordAction'
|
|
858
859
|
}
|
|
@@ -72,7 +72,7 @@ const external_PageDesigner_js_namespaceObject = require("./PageDesigner.js");
|
|
|
72
72
|
const external_PageTabDesigner_js_namespaceObject = require("./PageTabDesigner.js");
|
|
73
73
|
const external_style_js_namespaceObject = require("./style.js");
|
|
74
74
|
const Page = (props)=>{
|
|
75
|
-
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
|
|
75
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2, _match_params;
|
|
76
76
|
const { children, ...others } = props;
|
|
77
77
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
78
78
|
const { title, setTitle } = (0, document_title_index_js_namespaceObject.useDocumentTitle)();
|
|
@@ -80,12 +80,26 @@ const Page = (props)=>{
|
|
|
80
80
|
const disablePageHeader = null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
|
|
81
81
|
const enablePageTabs = null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
|
|
82
82
|
const enableSharePage = null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2.enableSharePage;
|
|
83
|
-
const [searchParams, setSearchParams] = (0, external_react_router_dom_namespaceObject.useSearchParams)();
|
|
84
83
|
const [loading, setLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
const navigate = (0, external_react_router_dom_namespaceObject.useNavigate)();
|
|
85
|
+
const location = (0, external_react_router_dom_namespaceObject.useLocation)();
|
|
86
|
+
const match = (0, external_react_router_dom_namespaceObject.useMatch)('/:entry/:entryId/page-tab/:pageTabId/*');
|
|
87
|
+
const pageTabActiveKey = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
88
|
+
var _match_params;
|
|
89
|
+
return (null == match ? void 0 : null == (_match_params = match.params) ? void 0 : _match_params.pageTabId) || Object.keys(fieldSchema.properties || {}).shift();
|
|
90
|
+
}, [
|
|
91
|
+
null == match ? void 0 : null == (_match_params = match.params) ? void 0 : _match_params.pageTabId,
|
|
92
|
+
fieldSchema.properties
|
|
88
93
|
]);
|
|
94
|
+
const setPageTabUrl = (pageTabId)=>{
|
|
95
|
+
const currentPath = location.pathname;
|
|
96
|
+
const newPath = currentPath.replace(/\/page-tab\/[^/]*/, "/page-tab/".concat(pageTabId));
|
|
97
|
+
newPath.includes('/page-tab/') ? navigate(newPath, {
|
|
98
|
+
replace: true
|
|
99
|
+
}) : navigate("".concat(currentPath, "/page-tab/").concat(pageTabId), {
|
|
100
|
+
replace: true
|
|
101
|
+
});
|
|
102
|
+
};
|
|
89
103
|
const [height, setHeight] = (0, external_react_namespaceObject.useState)(0);
|
|
90
104
|
const aclStyles = (0, style_js_namespaceObject.useStyles)();
|
|
91
105
|
const { wrapSSR, hashId, componentCls } = (0, external_style_js_namespaceObject.getStyles)();
|
|
@@ -105,21 +119,21 @@ const Page = (props)=>{
|
|
|
105
119
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageHeader, {
|
|
106
120
|
disablePageHeader: disablePageHeader,
|
|
107
121
|
enablePageTabs: enablePageTabs,
|
|
108
|
-
activeKey:
|
|
122
|
+
activeKey: pageTabActiveKey,
|
|
109
123
|
title: title,
|
|
110
124
|
fieldSchema: fieldSchema,
|
|
111
125
|
parentProps: others,
|
|
112
126
|
setHeight: setHeight,
|
|
113
127
|
setLoading: setLoading,
|
|
114
128
|
enableSharePage: enableSharePage,
|
|
115
|
-
|
|
129
|
+
setPageTabUrl: setPageTabUrl
|
|
116
130
|
}),
|
|
117
131
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageContentComponent, {
|
|
118
132
|
loading: loading,
|
|
119
133
|
disablePageHeader: disablePageHeader,
|
|
120
134
|
enablePageTabs: enablePageTabs,
|
|
121
135
|
fieldSchema: fieldSchema,
|
|
122
|
-
activeKey:
|
|
136
|
+
activeKey: pageTabActiveKey,
|
|
123
137
|
height: height,
|
|
124
138
|
children: children
|
|
125
139
|
})
|
|
@@ -129,7 +143,7 @@ const Page = (props)=>{
|
|
|
129
143
|
};
|
|
130
144
|
const PageHeader = (props)=>{
|
|
131
145
|
var _fieldSchema_xcomponentprops;
|
|
132
|
-
const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading,
|
|
146
|
+
const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setPageTabUrl, fieldSchema, title, parentProps, enableSharePage } = props;
|
|
133
147
|
const { theme } = (0, theme_index_js_namespaceObject.useGlobalTheme)();
|
|
134
148
|
const options = (0, external_react_namespaceObject.useContext)(schema_namespaceObject.SchemaOptionsContext);
|
|
135
149
|
const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
|
|
@@ -172,7 +186,7 @@ const PageHeader = (props)=>{
|
|
|
172
186
|
footer: enablePageTabs && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabComponent, {
|
|
173
187
|
activeKey: activeKey,
|
|
174
188
|
setLoading: setLoading,
|
|
175
|
-
|
|
189
|
+
setPageTabUrl: setPageTabUrl,
|
|
176
190
|
showScrollArea: showScrollArea,
|
|
177
191
|
options: options,
|
|
178
192
|
theme: theme,
|
|
@@ -258,7 +272,7 @@ const HeaderExtra = (param)=>{
|
|
|
258
272
|
});
|
|
259
273
|
};
|
|
260
274
|
const TabComponent = (props)=>{
|
|
261
|
-
const { activeKey, setLoading,
|
|
275
|
+
const { activeKey, setLoading, setPageTabUrl, showScrollArea, options, theme, items } = props;
|
|
262
276
|
const { styles } = (0, external_Page_style_js_namespaceObject.useStyles)();
|
|
263
277
|
const [hasMounted, setHasMounted] = (0, external_react_namespaceObject.useState)(false);
|
|
264
278
|
const sensors = (0, core_namespaceObject.useSensors)((0, core_namespaceObject.useSensor)(core_namespaceObject.PointerSensor, {
|
|
@@ -267,16 +281,7 @@ const TabComponent = (props)=>{
|
|
|
267
281
|
}
|
|
268
282
|
}));
|
|
269
283
|
const handleTabClick = (activeKey)=>{
|
|
270
|
-
|
|
271
|
-
setSearchParams([
|
|
272
|
-
[
|
|
273
|
-
'tab',
|
|
274
|
-
activeKey
|
|
275
|
-
]
|
|
276
|
-
]);
|
|
277
|
-
setTimeout(()=>{
|
|
278
|
-
setLoading(false);
|
|
279
|
-
}, 50);
|
|
284
|
+
setPageTabUrl(activeKey);
|
|
280
285
|
};
|
|
281
286
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
282
287
|
setTimeout(()=>{
|
|
@@ -252,7 +252,7 @@ const Drawer = (param)=>{
|
|
|
252
252
|
allowNull: true,
|
|
253
253
|
name: null == collectionField ? void 0 : collectionField.target,
|
|
254
254
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_action_index_js_namespaceObject.ActionContextProvider, {
|
|
255
|
-
openMode:
|
|
255
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
256
256
|
visible: visible,
|
|
257
257
|
setVisible: setVisible,
|
|
258
258
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.FormProvider, {
|
|
@@ -133,7 +133,7 @@ const ReadPrettyRecordPicker = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
133
133
|
value: {
|
|
134
134
|
visible,
|
|
135
135
|
setVisible,
|
|
136
|
-
openMode:
|
|
136
|
+
openMode: external_action_index_js_namespaceObject.OpenMode.DEFAULT,
|
|
137
137
|
snapshot: 'snapshot' === collectionField.interface
|
|
138
138
|
},
|
|
139
139
|
children: renderRecordProvider()
|
|
@@ -27,7 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
SelectActionInitializer: ()=>SelectActionInitializer
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
require("
|
|
30
|
+
const index_js_namespaceObject = require("../../schema-component/index.js");
|
|
31
31
|
const external_ActionInitializer_js_namespaceObject = require("./ActionInitializer.js");
|
|
32
32
|
const SelectActionInitializer = (props)=>{
|
|
33
33
|
const schema = {
|
|
@@ -37,7 +37,7 @@ const SelectActionInitializer = (props)=>{
|
|
|
37
37
|
'x-designer': 'Action.Designer',
|
|
38
38
|
'x-component': 'Action',
|
|
39
39
|
'x-component-props': {
|
|
40
|
-
openMode:
|
|
40
|
+
openMode: index_js_namespaceObject.OpenMode.DRAWER_MODE
|
|
41
41
|
},
|
|
42
42
|
properties: {
|
|
43
43
|
drawer: {
|
|
@@ -28,11 +28,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
SchemaSettingOpenModeSchemaItems: ()=>SchemaSettingOpenModeSchemaItems
|
|
29
29
|
});
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
-
require("react");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
32
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
33
33
|
const external_antd_namespaceObject = require("antd");
|
|
34
34
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
35
35
|
const index_js_namespaceObject = require("../application/index.js");
|
|
36
|
+
const external_block_provider_index_js_namespaceObject = require("../block-provider/index.js");
|
|
37
|
+
const PageStyle_provider_js_namespaceObject = require("../built-in/page-style/PageStyle.provider.js");
|
|
38
|
+
const usePageStyle_js_namespaceObject = require("../built-in/page-style/usePageStyle.js");
|
|
36
39
|
const external_schema_component_index_js_namespaceObject = require("../schema-component/index.js");
|
|
37
40
|
const external_schema_settings_index_js_namespaceObject = require("../schema-settings/index.js");
|
|
38
41
|
const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
@@ -42,7 +45,16 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
42
45
|
const field = (0, schema_namespaceObject.useField)();
|
|
43
46
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
44
47
|
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
45
|
-
const
|
|
48
|
+
const isMobile = (0, external_block_provider_index_js_namespaceObject.useIsMobile)();
|
|
49
|
+
const pageStyle = (0, usePageStyle_js_namespaceObject.usePageStyle)();
|
|
50
|
+
const defaultOpenMode = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
51
|
+
if (isMobile || pageStyle === PageStyle_provider_js_namespaceObject.PageStyle.TAB_STYLE) return external_schema_component_index_js_namespaceObject.OpenMode.PAGE;
|
|
52
|
+
return external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE;
|
|
53
|
+
}, [
|
|
54
|
+
isMobile,
|
|
55
|
+
pageStyle
|
|
56
|
+
]);
|
|
57
|
+
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || defaultOpenMode;
|
|
46
58
|
var _fieldSchema_xcomponentprops_openSize;
|
|
47
59
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
48
60
|
children: [
|
|
@@ -51,11 +63,11 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
51
63
|
options: [
|
|
52
64
|
{
|
|
53
65
|
label: t('Drawer'),
|
|
54
|
-
value:
|
|
66
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE
|
|
55
67
|
},
|
|
56
68
|
{
|
|
57
69
|
label: t('Dialog'),
|
|
58
|
-
value:
|
|
70
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.MODAL
|
|
59
71
|
}
|
|
60
72
|
],
|
|
61
73
|
value: openModeValue,
|
|
@@ -75,8 +87,8 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
75
87
|
}
|
|
76
88
|
}) : null,
|
|
77
89
|
openSize && [
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
external_schema_component_index_js_namespaceObject.OpenMode.MODAL,
|
|
91
|
+
external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE
|
|
80
92
|
].includes(openModeValue) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaInitializerItem, {
|
|
81
93
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
82
94
|
style: {
|
|
@@ -103,7 +115,7 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
103
115
|
value: 'large'
|
|
104
116
|
}
|
|
105
117
|
],
|
|
106
|
-
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode'])
|
|
118
|
+
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode']) === external_schema_component_index_js_namespaceObject.OpenMode.MODAL ? 'large' : 'middle',
|
|
107
119
|
onChange: (value)=>{
|
|
108
120
|
field.componentProps.openSize = value;
|
|
109
121
|
const schema = {
|
|
@@ -135,7 +147,16 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
135
147
|
const field = (0, schema_namespaceObject.useField)();
|
|
136
148
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
137
149
|
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
138
|
-
const
|
|
150
|
+
const pageStyle = (0, usePageStyle_js_namespaceObject.usePageStyle)();
|
|
151
|
+
const isMobile = (0, external_block_provider_index_js_namespaceObject.useIsMobile)();
|
|
152
|
+
const defaultOpenMode = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
153
|
+
if (isMobile || pageStyle === PageStyle_provider_js_namespaceObject.PageStyle.TAB_STYLE) return external_schema_component_index_js_namespaceObject.OpenMode.PAGE;
|
|
154
|
+
return external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE;
|
|
155
|
+
}, [
|
|
156
|
+
isMobile,
|
|
157
|
+
pageStyle
|
|
158
|
+
]);
|
|
159
|
+
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || defaultOpenMode;
|
|
139
160
|
var _fieldSchema_xcomponentprops_openSize;
|
|
140
161
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
141
162
|
children: [
|
|
@@ -144,19 +165,19 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
144
165
|
options: [
|
|
145
166
|
{
|
|
146
167
|
label: t('Drawer'),
|
|
147
|
-
value:
|
|
168
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE
|
|
148
169
|
},
|
|
149
170
|
{
|
|
150
171
|
label: t('Dialog'),
|
|
151
|
-
value:
|
|
172
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.MODAL
|
|
152
173
|
},
|
|
153
174
|
{
|
|
154
175
|
label: t('Sheet'),
|
|
155
|
-
value:
|
|
176
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.SHEET
|
|
156
177
|
},
|
|
157
178
|
{
|
|
158
179
|
label: t('Page'),
|
|
159
|
-
value:
|
|
180
|
+
value: external_schema_component_index_js_namespaceObject.OpenMode.PAGE
|
|
160
181
|
}
|
|
161
182
|
],
|
|
162
183
|
value: openModeValue,
|
|
@@ -176,8 +197,8 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
176
197
|
}
|
|
177
198
|
}) : null,
|
|
178
199
|
openSize && [
|
|
179
|
-
|
|
180
|
-
|
|
200
|
+
external_schema_component_index_js_namespaceObject.OpenMode.MODAL,
|
|
201
|
+
external_schema_component_index_js_namespaceObject.OpenMode.DRAWER_MODE
|
|
181
202
|
].includes(openModeValue) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_schema_settings_index_js_namespaceObject.SchemaSettingsSelectItem, {
|
|
182
203
|
title: t('Popup size'),
|
|
183
204
|
options: [
|
|
@@ -194,7 +215,7 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
194
215
|
value: 'large'
|
|
195
216
|
}
|
|
196
217
|
],
|
|
197
|
-
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode'])
|
|
218
|
+
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode']) === external_schema_component_index_js_namespaceObject.OpenMode.MODAL ? 'large' : 'middle',
|
|
198
219
|
onChange: (value)=>{
|
|
199
220
|
field.componentProps.openSize = value;
|
|
200
221
|
const schema = {
|
|
@@ -45,15 +45,24 @@ const useCloseAction = ()=>{
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
const useSaveCurrentUserValues = ()=>{
|
|
48
|
+
var _currentUser_data_data, _currentUser_data;
|
|
48
49
|
const { setVisible } = (0, external_index_js_namespaceObject.useActionContext)();
|
|
49
50
|
const form = (0, schema_namespaceObject.useForm)();
|
|
50
51
|
const api = (0, index_js_namespaceObject.useAPIClient)();
|
|
52
|
+
const currentUser = (0, external_index_js_namespaceObject.useCurrentUserContext)();
|
|
53
|
+
const hideOldPassword = (null == currentUser ? void 0 : null == (_currentUser_data = currentUser.data) ? void 0 : null == (_currentUser_data_data = _currentUser_data.data) ? void 0 : _currentUser_data_data.password) === null;
|
|
51
54
|
return {
|
|
52
55
|
async run () {
|
|
53
56
|
await form.submit();
|
|
54
57
|
await api.resource('auth').changePassword({
|
|
55
58
|
values: form.values
|
|
56
59
|
});
|
|
60
|
+
if (hideOldPassword) currentUser.mutate({
|
|
61
|
+
data: {
|
|
62
|
+
...currentUser.data.data,
|
|
63
|
+
password: ''
|
|
64
|
+
}
|
|
65
|
+
});
|
|
57
66
|
await form.reset();
|
|
58
67
|
setVisible(false);
|
|
59
68
|
}
|
|
@@ -73,7 +82,8 @@ const schema = {
|
|
|
73
82
|
title: '{{t("Old password")}}',
|
|
74
83
|
required: true,
|
|
75
84
|
'x-component': 'Password',
|
|
76
|
-
'x-decorator': 'FormItem'
|
|
85
|
+
'x-decorator': 'FormItem',
|
|
86
|
+
'x-hidden': '{{ hideOldPassword }}'
|
|
77
87
|
},
|
|
78
88
|
newPassword: {
|
|
79
89
|
type: 'string',
|
|
@@ -147,9 +157,12 @@ const schema = {
|
|
|
147
157
|
}
|
|
148
158
|
};
|
|
149
159
|
const useChangePassword = ()=>{
|
|
160
|
+
var _currentUser_data_data, _currentUser_data;
|
|
150
161
|
const ctx = (0, external_react_namespaceObject.useContext)(external_index_js_namespaceObject.DropdownVisibleContext);
|
|
151
162
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
152
163
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
164
|
+
const currentUser = (0, external_index_js_namespaceObject.useCurrentUserContext)();
|
|
165
|
+
const hideOldPassword = (null == currentUser ? void 0 : null == (_currentUser_data = currentUser.data) ? void 0 : null == (_currentUser_data_data = _currentUser_data.data) ? void 0 : _currentUser_data_data.password) === null;
|
|
153
166
|
return (0, external_react_namespaceObject.useMemo)(()=>({
|
|
154
167
|
key: 'password',
|
|
155
168
|
eventKey: 'ChangePassword',
|
|
@@ -170,7 +183,8 @@ const useChangePassword = ()=>{
|
|
|
170
183
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.SchemaComponent, {
|
|
171
184
|
scope: {
|
|
172
185
|
useCloseAction,
|
|
173
|
-
useSaveCurrentUserValues
|
|
186
|
+
useSaveCurrentUserValues,
|
|
187
|
+
hideOldPassword
|
|
174
188
|
},
|
|
175
189
|
schema: schema
|
|
176
190
|
})
|
|
@@ -179,7 +193,8 @@ const useChangePassword = ()=>{
|
|
|
179
193
|
]
|
|
180
194
|
})
|
|
181
195
|
}), [
|
|
182
|
-
visible
|
|
196
|
+
visible,
|
|
197
|
+
hideOldPassword
|
|
183
198
|
]);
|
|
184
199
|
};
|
|
185
200
|
exports.useChangePassword = __webpack_exports__.useChangePassword;
|