@oinone/kunlun-vue-admin-base 6.2.2 → 6.2.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/dist/oinone-kunlun-vue-admin-base.css +1 -1
- package/dist/oinone-kunlun-vue-admin-base.esm.js +267 -79
- package/dist/oinone-kunlun-vue-admin-base.scss +1 -1
- package/dist/types/src/action/server-actions/ServerActionWidget.d.ts +1 -0
- package/dist/types/src/field/form/m2o/address/FormM2OAddressFieldWidget.d.ts +11 -1
- package/dist/types/src/typing/model.d.ts +27 -12
- package/dist/types/src/view/login/LoginWidget.d.ts +5 -1
- package/dist/types/src/view/reset-password/ForgetPasswordWidget.d.ts +1 -1
- package/package.json +8 -8
- package/src/action/server-actions/ServerActionWidget.ts +17 -1
- package/src/basic/BaseI18nRouterWidget.ts +1 -1
- package/src/field/detail/common/DetailCommonField.vue +11 -5
- package/src/field/form/html/richtext/FormHtmlRichTextFieldWidget.ts +1 -1
- package/src/field/form/m2o/address/FormM2OAddressFieldWidget.ts +187 -12
- package/src/field/table/text/TableTextFieldWidget.ts +7 -4
- package/src/main-view/shared/SharedMainViewWidget.ts +5 -1
- package/src/permission/system-permission/style/permission.scss +18 -12
- package/src/spi-register/message-hub.ts +3 -3
- package/src/typing/model.ts +29 -12
- package/src/util/default-tree-definition.ts +11 -0
- package/src/view/login/LoginWidget.ts +22 -8
- package/src/view/reset-password/FirstResetPasswordWidget.ts +5 -1
- package/src/view/reset-password/ForgetPasswordWidget.ts +7 -3
|
@@ -16,6 +16,7 @@ export declare class ServerActionWidget extends ActionWidget<RuntimeServerAction
|
|
|
16
16
|
protected clickAction(): Promise<ClickResult>;
|
|
17
17
|
protected formValidateProcess(e: HttpClientError): void;
|
|
18
18
|
protected convertFormValidateResults(e: HttpClientError): FormValidateResult[];
|
|
19
|
+
protected notifyValidateResults(e: HttpClientError): void;
|
|
19
20
|
protected submit(action: RuntimeServerAction): Promise<SubmitValue>;
|
|
20
21
|
protected clickActionAfter(result: ClickResult): Promise<ClickResult>;
|
|
21
22
|
protected clickActionAfterRefreshData(result: ClickResult, refreshParent?: boolean): Promise<ClickResult>;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { ActiveRecord, SubmitValue } from '@oinone/kunlun-engine';
|
|
2
|
+
import { StandardString } from '@oinone/kunlun-shared';
|
|
2
3
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
3
4
|
import { TreeNodeResponseBody } from '../../../../service';
|
|
4
|
-
import { TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
5
|
+
import { AddressTypeEnum, ResourceAddress, TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
5
6
|
import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
|
|
6
7
|
export declare class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
8
|
+
static readonly AddressTypes: AddressTypeEnum[];
|
|
7
9
|
protected get changeOnSelect(): boolean;
|
|
8
10
|
protected generatorDefaultTreeDefinition(props: any): TreeNodeMetadata | undefined;
|
|
9
11
|
protected getSubmitField(metadata: TreeNodeMetadata): Record<string, string> | undefined;
|
|
10
12
|
protected $onSelectedChange(selectedNodes: OioTreeNode<TreeData>[] | null | undefined): void;
|
|
13
|
+
protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined): void;
|
|
14
|
+
protected getResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum): {
|
|
15
|
+
code: StandardString;
|
|
16
|
+
name: StandardString;
|
|
17
|
+
} | undefined;
|
|
18
|
+
protected setResourceAddressValue(currentValue: ResourceAddress, type: AddressTypeEnum, code: StandardString, name: StandardString): AddressTypeEnum | null | undefined;
|
|
11
19
|
protected fetchBackfillData(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
|
|
20
|
+
protected fetchBackfillDataNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): Promise<TreeNodeResponseBody[] | undefined>;
|
|
12
21
|
protected generatorCompareRecords(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
|
|
22
|
+
protected generatorCompareRecordsNext(currentValues: ActiveRecord[], metadataList: TreeNodeMetadata[]): ActiveRecord[] | undefined;
|
|
13
23
|
submit(submitValue: SubmitValue): Promise<Record<string, unknown> | undefined>;
|
|
14
24
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { ActiveRecord } from '@oinone/kunlun-engine';
|
|
2
2
|
export interface ResourceAddress extends ActiveRecord {
|
|
3
3
|
id?: string;
|
|
4
|
-
countryCode?: string;
|
|
5
|
-
countryName?: string;
|
|
4
|
+
countryCode?: string | null;
|
|
5
|
+
countryName?: string | null;
|
|
6
6
|
originCountry?: ResourceCountry;
|
|
7
|
-
provinceCode?: string;
|
|
8
|
-
provinceName?: string;
|
|
7
|
+
provinceCode?: string | null;
|
|
8
|
+
provinceName?: string | null;
|
|
9
9
|
originProvince?: ResourceProvince;
|
|
10
|
-
cityCode?: string;
|
|
11
|
-
cityName?: string;
|
|
10
|
+
cityCode?: string | null;
|
|
11
|
+
cityName?: string | null;
|
|
12
12
|
originCity?: ResourceCity;
|
|
13
|
-
districtCode?: string;
|
|
14
|
-
districtName?: string;
|
|
13
|
+
districtCode?: string | null;
|
|
14
|
+
districtName?: string | null;
|
|
15
15
|
originDistrict?: ResourceDistrict;
|
|
16
|
-
streetCode?: string;
|
|
17
|
-
streetName?: string;
|
|
16
|
+
streetCode?: string | null;
|
|
17
|
+
streetName?: string | null;
|
|
18
18
|
originStreet?: ResourceStreet;
|
|
19
19
|
/**
|
|
20
20
|
* 详细地址
|
|
21
21
|
*/
|
|
22
|
-
street2?: string;
|
|
22
|
+
street2?: string | null;
|
|
23
23
|
/**
|
|
24
24
|
* 完整地址
|
|
25
25
|
*/
|
|
26
|
-
fullAddress?: string;
|
|
26
|
+
fullAddress?: string | null;
|
|
27
27
|
}
|
|
28
28
|
export interface ResourceCountry extends ActiveRecord {
|
|
29
29
|
id?: string;
|
|
@@ -51,3 +51,18 @@ export interface ResourceStreet extends ActiveRecord {
|
|
|
51
51
|
code?: string;
|
|
52
52
|
name?: string;
|
|
53
53
|
}
|
|
54
|
+
export interface ResourceRegion extends ActiveRecord {
|
|
55
|
+
id?: string;
|
|
56
|
+
type?: AddressTypeEnum;
|
|
57
|
+
code?: string | null;
|
|
58
|
+
name?: string | null;
|
|
59
|
+
pCode?: string;
|
|
60
|
+
parent?: ResourceRegion;
|
|
61
|
+
}
|
|
62
|
+
export declare enum AddressTypeEnum {
|
|
63
|
+
Country = "Country",
|
|
64
|
+
Province = "Province",
|
|
65
|
+
City = "City",
|
|
66
|
+
District = "District",
|
|
67
|
+
Street = "Street"
|
|
68
|
+
}
|
|
@@ -2,7 +2,7 @@ import { MajorConfig } from '@oinone/kunlun-engine';
|
|
|
2
2
|
import { Router } from '@oinone/kunlun-router';
|
|
3
3
|
import { LoginConfig, LoginData, LoginMode, RuntimeLanguage } from '@oinone/kunlun-vue-ui-common';
|
|
4
4
|
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class LoginWidget extends BaseI18nRouterWidget {
|
|
6
6
|
protected moduleName: string;
|
|
7
7
|
errorMessages: Record<string, string>;
|
|
8
8
|
/**
|
|
@@ -106,3 +106,7 @@ export declare class LoginPageWidget extends BaseI18nRouterWidget {
|
|
|
106
106
|
protected queryLanguageSetting(langCode: any): Promise<Record<string, unknown>>;
|
|
107
107
|
protected beforeMount(): Promise<void>;
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated please using LoginWidget
|
|
111
|
+
*/
|
|
112
|
+
export declare const LoginPageWidget: typeof LoginWidget;
|
|
@@ -2,9 +2,9 @@ import { MajorConfig } from '@oinone/kunlun-engine';
|
|
|
2
2
|
import { Router } from '@oinone/kunlun-router';
|
|
3
3
|
import { FormItemRule, OioFormInstance } from '@oinone/kunlun-vue-ui-antd';
|
|
4
4
|
import { SelectItem } from '@oinone/kunlun-vue-ui-common';
|
|
5
|
+
import { BaseI18nRouterWidget } from '../../basic';
|
|
5
6
|
import { ResourceCountry } from '../../typing';
|
|
6
7
|
import { ResetPasswordData } from './typing';
|
|
7
|
-
import { BaseI18nRouterWidget } from '../../basic/BaseI18nRouterWidget';
|
|
8
8
|
export declare class ForgetPasswordWidget extends BaseI18nRouterWidget {
|
|
9
9
|
protected moduleName: string;
|
|
10
10
|
protected router: Router;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oinone/kunlun-vue-admin-base",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.4",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "rimraf dist",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"doc": "typedoc --out docs src/index.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@oinone/kunlun-vue-admin-layout": "6.2.
|
|
18
|
-
"@oinone/kunlun-vue-router": "6.2.
|
|
19
|
-
"@oinone/kunlun-vue-ui": "6.2.
|
|
20
|
-
"@oinone/kunlun-vue-ui-antd": "6.2.
|
|
21
|
-
"@oinone/kunlun-vue-ui-common": "6.2.
|
|
22
|
-
"@oinone/kunlun-vue-ui-el": "6.2.
|
|
23
|
-
"@oinone/kunlun-vue-widget": "6.2.
|
|
17
|
+
"@oinone/kunlun-vue-admin-layout": "6.2.4",
|
|
18
|
+
"@oinone/kunlun-vue-router": "6.2.4",
|
|
19
|
+
"@oinone/kunlun-vue-ui": "6.2.4",
|
|
20
|
+
"@oinone/kunlun-vue-ui-antd": "6.2.4",
|
|
21
|
+
"@oinone/kunlun-vue-ui-common": "6.2.4",
|
|
22
|
+
"@oinone/kunlun-vue-ui-el": "6.2.4",
|
|
23
|
+
"@oinone/kunlun-vue-widget": "6.2.4",
|
|
24
24
|
"@wangeditor/editor": "5.1.23",
|
|
25
25
|
"@wangeditor/editor-for-vue": "5.1.11",
|
|
26
26
|
"@wangeditor/plugin-upload-attachment": "1.1.0",
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
UpdateOneWithRelationsService
|
|
24
24
|
} from '@oinone/kunlun-engine';
|
|
25
25
|
import { ActionContextType, ActionType, ModelFieldType, ViewType } from '@oinone/kunlun-meta';
|
|
26
|
-
import { HttpClientError, SystemErrorCode } from '@oinone/kunlun-request';
|
|
26
|
+
import { HttpClientError, MessageHub, RequestErrorInterceptor, SystemErrorCode } from '@oinone/kunlun-request';
|
|
27
27
|
import { SPI } from '@oinone/kunlun-spi';
|
|
28
28
|
import { BooleanHelper, CallChaining, debugConsole, OioNotification } from '@oinone/kunlun-vue-ui-antd';
|
|
29
29
|
import { VueWidget, Widget, WidgetSubjection } from '@oinone/kunlun-vue-widget';
|
|
@@ -101,6 +101,7 @@ export class ServerActionWidget extends ActionWidget<RuntimeServerAction> {
|
|
|
101
101
|
|
|
102
102
|
protected formValidateProcess(e: HttpClientError) {
|
|
103
103
|
if (this.view?.type !== ViewType.Form) {
|
|
104
|
+
this.notifyValidateResults(e);
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
const { formValidateCallChaining } = this;
|
|
@@ -141,6 +142,21 @@ export class ServerActionWidget extends ActionWidget<RuntimeServerAction> {
|
|
|
141
142
|
return results;
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
protected notifyValidateResults(e: HttpClientError): void {
|
|
146
|
+
const error = e.errors?.[0];
|
|
147
|
+
if (!error) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (error.extensions?.errorCode !== SystemErrorCode.FORM_VALIDATE_ERROR) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
for (const messageItem of error.extensions?.messages || []) {
|
|
154
|
+
if (RequestErrorInterceptor.ignoredFormValidateMessage(messageItem)) {
|
|
155
|
+
MessageHub.error(messageItem.message);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
144
160
|
protected async submit(action: RuntimeServerAction): Promise<SubmitValue> {
|
|
145
161
|
let records: ActiveRecords | undefined;
|
|
146
162
|
let relationRecords: SubmitRelationValue[] | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RouterWidget } from '@oinone/kunlun-vue-router';
|
|
2
1
|
import { getDefaultBrowser, initI18n, OioProvider, translateValueByKey } from '@oinone/kunlun-engine';
|
|
3
2
|
import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
|
|
3
|
+
import { RouterWidget } from '@oinone/kunlun-vue-router';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 无模块需要国际化的路由页面
|
|
@@ -58,11 +58,17 @@ export default defineComponent({
|
|
|
58
58
|
origin: 'default',
|
|
59
59
|
default: ({ realValue }) => {
|
|
60
60
|
return [
|
|
61
|
-
createVNode(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
createVNode(
|
|
62
|
+
'div',
|
|
63
|
+
{
|
|
64
|
+
class: 'detail-common-field-value',
|
|
65
|
+
title: realValue,
|
|
66
|
+
style: {
|
|
67
|
+
whiteSpace: 'pre-line'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
realValue
|
|
71
|
+
)
|
|
66
72
|
];
|
|
67
73
|
}
|
|
68
74
|
},
|
|
@@ -26,7 +26,7 @@ export class FormHtmlRichTextFieldWidget extends FormStringFieldWidget {
|
|
|
26
26
|
protected get richTextToolbarExcludeKeys(): string[] | null {
|
|
27
27
|
const { richTextToolbarExcludeKeys } = this.getDsl() as { richTextToolbarExcludeKeys?: string };
|
|
28
28
|
if (!richTextToolbarExcludeKeys) {
|
|
29
|
-
return
|
|
29
|
+
return [];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return richTextToolbarExcludeKeys.split(',').map((v) => v.trim());
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ActiveRecord,
|
|
3
|
+
ActiveRecordExtendKeys,
|
|
4
|
+
ExperimentalConfigManager,
|
|
5
|
+
parseConfigs,
|
|
6
|
+
SubmitHandler,
|
|
7
|
+
SubmitValue
|
|
8
|
+
} from '@oinone/kunlun-engine';
|
|
2
9
|
import { ModelFieldType, ViewType } from '@oinone/kunlun-meta';
|
|
3
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
BooleanHelper,
|
|
12
|
+
CastHelper,
|
|
13
|
+
ObjectUtils,
|
|
14
|
+
Optional,
|
|
15
|
+
StandardString,
|
|
16
|
+
uniqueKeyGenerator
|
|
17
|
+
} from '@oinone/kunlun-shared';
|
|
4
18
|
import { SPI } from '@oinone/kunlun-spi';
|
|
5
19
|
import { OioTreeNode } from '@oinone/kunlun-vue-ui-common';
|
|
6
20
|
import { Widget } from '@oinone/kunlun-vue-widget';
|
|
7
21
|
import { FormFieldWidget } from '../../../../basic';
|
|
8
22
|
import { TreeNodeResponseBody, TreeService } from '../../../../service';
|
|
9
|
-
import { TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
23
|
+
import { AddressTypeEnum, ResourceAddress, ResourceRegion, TreeData, TreeNodeMetadata } from '../../../../typing';
|
|
10
24
|
import { FetchUtil } from '../../../../util';
|
|
11
25
|
import { generatorDefaultAddressTreeDefinition } from '../../../../util/default-tree-definition';
|
|
12
26
|
import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidget';
|
|
@@ -19,6 +33,14 @@ import { FormM2OCascaderFieldWidget } from '../cascader/FormM2OCascaderFieldWidg
|
|
|
19
33
|
})
|
|
20
34
|
)
|
|
21
35
|
export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
36
|
+
public static readonly AddressTypes = [
|
|
37
|
+
AddressTypeEnum.Street,
|
|
38
|
+
AddressTypeEnum.District,
|
|
39
|
+
AddressTypeEnum.City,
|
|
40
|
+
AddressTypeEnum.Province,
|
|
41
|
+
AddressTypeEnum.Country
|
|
42
|
+
];
|
|
43
|
+
|
|
22
44
|
@Widget.Reactive()
|
|
23
45
|
protected get changeOnSelect(): boolean {
|
|
24
46
|
return Optional.ofNullable(this.getDsl().changeOnSelect).map(BooleanHelper.toBoolean).orElse(true)!;
|
|
@@ -63,7 +85,7 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
63
85
|
return;
|
|
64
86
|
}
|
|
65
87
|
const { value } = this;
|
|
66
|
-
let currentValue:
|
|
88
|
+
let currentValue: ResourceAddress | undefined;
|
|
67
89
|
if (value) {
|
|
68
90
|
currentValue = FetchUtil.generatorPksObjectByPks(['id'], value);
|
|
69
91
|
if (currentValue) {
|
|
@@ -77,25 +99,130 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
77
99
|
__draftId: uniqueKeyGenerator()
|
|
78
100
|
};
|
|
79
101
|
}
|
|
102
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
103
|
+
this.$onSelectedChangeNext(currentValue, selectedNode);
|
|
104
|
+
} else {
|
|
105
|
+
while (selectedNode) {
|
|
106
|
+
const targetValue = selectedNode.value.data;
|
|
107
|
+
if (targetValue) {
|
|
108
|
+
const submitFields = this.getSubmitField(selectedNode.value.metadata);
|
|
109
|
+
if (submitFields) {
|
|
110
|
+
Object.entries(submitFields).forEach(([relationField, referenceField]) => {
|
|
111
|
+
currentValue![relationField] = targetValue[referenceField as string];
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
selectedNode = selectedNode.parent;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.change(currentValue);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected $onSelectedChangeNext(currentValue: ResourceAddress, selectedNode: OioTreeNode<TreeData> | undefined) {
|
|
122
|
+
let nextAddressType: AddressTypeEnum | null | undefined;
|
|
80
123
|
while (selectedNode) {
|
|
81
|
-
const targetValue = selectedNode.value.data;
|
|
82
|
-
if (targetValue) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
124
|
+
const targetValue = selectedNode.value.data as ResourceRegion | undefined;
|
|
125
|
+
if (!targetValue) {
|
|
126
|
+
selectedNode = selectedNode.parent;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const { type, code, name } = targetValue;
|
|
130
|
+
if (!type) {
|
|
131
|
+
console.error('Invalid region type.', selectedNode);
|
|
132
|
+
this.change(null);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (nextAddressType) {
|
|
136
|
+
while (type !== nextAddressType) {
|
|
137
|
+
nextAddressType = this.setResourceAddressValue(currentValue, nextAddressType, null, null);
|
|
138
|
+
if (nextAddressType === null) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (!nextAddressType) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
88
144
|
}
|
|
145
|
+
} else {
|
|
146
|
+
nextAddressType = type;
|
|
147
|
+
}
|
|
148
|
+
nextAddressType = this.setResourceAddressValue(currentValue, type, code, name);
|
|
149
|
+
if (nextAddressType === null) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (!nextAddressType) {
|
|
153
|
+
return;
|
|
89
154
|
}
|
|
90
155
|
selectedNode = selectedNode.parent;
|
|
91
156
|
}
|
|
92
|
-
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
protected getResourceAddressValue(
|
|
160
|
+
currentValue: ResourceAddress,
|
|
161
|
+
type: AddressTypeEnum
|
|
162
|
+
):
|
|
163
|
+
| {
|
|
164
|
+
code: StandardString;
|
|
165
|
+
name: StandardString;
|
|
166
|
+
}
|
|
167
|
+
| undefined {
|
|
168
|
+
switch (type) {
|
|
169
|
+
case AddressTypeEnum.Country:
|
|
170
|
+
return { code: currentValue.countryCode, name: currentValue.countryName };
|
|
171
|
+
case AddressTypeEnum.Province:
|
|
172
|
+
return { code: currentValue.provinceCode, name: currentValue.provinceName };
|
|
173
|
+
case AddressTypeEnum.City:
|
|
174
|
+
return { code: currentValue.cityCode, name: currentValue.cityName };
|
|
175
|
+
case AddressTypeEnum.District:
|
|
176
|
+
return { code: currentValue.districtCode, name: currentValue.districtName };
|
|
177
|
+
case AddressTypeEnum.Street:
|
|
178
|
+
return { code: currentValue.streetCode, name: currentValue.streetName };
|
|
179
|
+
default:
|
|
180
|
+
console.error('Invalid region type.', type);
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
protected setResourceAddressValue(
|
|
186
|
+
currentValue: ResourceAddress,
|
|
187
|
+
type: AddressTypeEnum,
|
|
188
|
+
code: StandardString,
|
|
189
|
+
name: StandardString
|
|
190
|
+
): AddressTypeEnum | null | undefined {
|
|
191
|
+
switch (type) {
|
|
192
|
+
case AddressTypeEnum.Country:
|
|
193
|
+
currentValue.countryCode = code;
|
|
194
|
+
currentValue.countryName = name;
|
|
195
|
+
return null;
|
|
196
|
+
case AddressTypeEnum.Province:
|
|
197
|
+
currentValue.provinceCode = code;
|
|
198
|
+
currentValue.provinceName = name;
|
|
199
|
+
return AddressTypeEnum.Country;
|
|
200
|
+
case AddressTypeEnum.City:
|
|
201
|
+
currentValue.cityCode = code;
|
|
202
|
+
currentValue.cityName = name;
|
|
203
|
+
return AddressTypeEnum.Province;
|
|
204
|
+
case AddressTypeEnum.District:
|
|
205
|
+
currentValue.districtCode = code;
|
|
206
|
+
currentValue.districtName = name;
|
|
207
|
+
return AddressTypeEnum.City;
|
|
208
|
+
case AddressTypeEnum.Street:
|
|
209
|
+
currentValue.streetCode = code;
|
|
210
|
+
currentValue.streetName = name;
|
|
211
|
+
return AddressTypeEnum.District;
|
|
212
|
+
default:
|
|
213
|
+
console.error('Invalid region type.', type);
|
|
214
|
+
this.change(null);
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
93
217
|
}
|
|
94
218
|
|
|
95
219
|
protected async fetchBackfillData(
|
|
96
220
|
currentValues: ActiveRecord[],
|
|
97
221
|
metadataList: TreeNodeMetadata[]
|
|
98
222
|
): Promise<TreeNodeResponseBody[] | undefined> {
|
|
223
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
224
|
+
return this.fetchBackfillDataNext(currentValues, metadataList);
|
|
225
|
+
}
|
|
99
226
|
const finalValues: ActiveRecord[] = [];
|
|
100
227
|
let finalMetadataList: TreeNodeMetadata[] | undefined;
|
|
101
228
|
for (const currentValue of currentValues) {
|
|
@@ -130,10 +257,37 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
130
257
|
return undefined;
|
|
131
258
|
}
|
|
132
259
|
|
|
260
|
+
protected async fetchBackfillDataNext(
|
|
261
|
+
currentValues: ActiveRecord[],
|
|
262
|
+
metadataList: TreeNodeMetadata[]
|
|
263
|
+
): Promise<TreeNodeResponseBody[] | undefined> {
|
|
264
|
+
const currentValue = currentValues[0] as ResourceAddress | undefined;
|
|
265
|
+
if (!currentValue) {
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
let lastRegion: ResourceRegion | undefined;
|
|
269
|
+
for (const type of FormM2OAddressFieldWidget.AddressTypes) {
|
|
270
|
+
lastRegion = this.getResourceAddressValue(currentValue, type);
|
|
271
|
+
if (lastRegion) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (lastRegion) {
|
|
276
|
+
return TreeService.reverselyQueryWithSize([lastRegion], metadataList, {
|
|
277
|
+
expressionParameters: this.generatorExpressionParameters(),
|
|
278
|
+
disabledIsLeaf: true
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
|
|
133
284
|
protected generatorCompareRecords(
|
|
134
285
|
currentValues: ActiveRecord[],
|
|
135
286
|
metadataList: TreeNodeMetadata[]
|
|
136
287
|
): ActiveRecord[] | undefined {
|
|
288
|
+
if (ExperimentalConfigManager.addressWidgetNext()) {
|
|
289
|
+
return this.generatorCompareRecordsNext(currentValues, metadataList);
|
|
290
|
+
}
|
|
137
291
|
const compareRecords: ActiveRecord[] = [];
|
|
138
292
|
for (const currentValue of currentValues) {
|
|
139
293
|
for (const metadata of metadataList) {
|
|
@@ -161,6 +315,27 @@ export class FormM2OAddressFieldWidget extends FormM2OCascaderFieldWidget {
|
|
|
161
315
|
return [compareRecords[compareRecords.length - 1]];
|
|
162
316
|
}
|
|
163
317
|
|
|
318
|
+
protected generatorCompareRecordsNext(
|
|
319
|
+
currentValues: ActiveRecord[],
|
|
320
|
+
metadataList: TreeNodeMetadata[]
|
|
321
|
+
): ActiveRecord[] | undefined {
|
|
322
|
+
const currentValue = currentValues[0] as ResourceAddress | undefined;
|
|
323
|
+
if (!currentValue) {
|
|
324
|
+
return undefined;
|
|
325
|
+
}
|
|
326
|
+
let lastRegion: ResourceRegion | undefined;
|
|
327
|
+
for (const type of FormM2OAddressFieldWidget.AddressTypes) {
|
|
328
|
+
lastRegion = this.getResourceAddressValue(currentValue, type);
|
|
329
|
+
if (lastRegion) {
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (lastRegion) {
|
|
334
|
+
return [lastRegion];
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
|
|
164
339
|
public async submit(submitValue: SubmitValue) {
|
|
165
340
|
return SubmitHandler.DEFAULT(this.field, this.itemName, submitValue, this.value);
|
|
166
341
|
}
|
|
@@ -18,10 +18,13 @@ export class TableTextFieldWidget extends TableStringFieldWidget {
|
|
|
18
18
|
const value = this.compute(context);
|
|
19
19
|
|
|
20
20
|
return [
|
|
21
|
-
createVNode(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
createVNode(
|
|
22
|
+
'span',
|
|
23
|
+
{
|
|
24
|
+
class: 'table-text-field-value'
|
|
25
|
+
},
|
|
26
|
+
value
|
|
27
|
+
)
|
|
25
28
|
];
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -23,7 +23,11 @@ import { clearSharedSession, getSharedSession, setSharedSession } from './sessio
|
|
|
23
23
|
import SharedMainView from './SharedMainView.vue';
|
|
24
24
|
import { SharedViewUtils } from './utils';
|
|
25
25
|
|
|
26
|
-
@SPI.ClassFactory(
|
|
26
|
+
@SPI.ClassFactory(
|
|
27
|
+
RouterWidget.Token({
|
|
28
|
+
widget: SHARED_VIEW_WIDGET
|
|
29
|
+
})
|
|
30
|
+
)
|
|
27
31
|
export class SharedMainViewWidget extends RouterWidget {
|
|
28
32
|
protected metadataViewWidget: MetadataViewWidget | undefined;
|
|
29
33
|
|
|
@@ -56,15 +56,16 @@
|
|
|
56
56
|
align-items: center;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.ant-tree-
|
|
60
|
-
|
|
59
|
+
.ant-tree-list-holder-inner {
|
|
60
|
+
display: block !important;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.ant-tree-checkbox {
|
|
64
64
|
margin-top: 12px;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.ant-tree-treenode-selected
|
|
67
|
+
.permission-menu .ant-tree-treenode-selected,
|
|
68
|
+
.permission-menu .ant-tree-treenode:hover {
|
|
68
69
|
background: var(--oio-menu-selected-background-color);
|
|
69
70
|
border-radius: 4px;
|
|
70
71
|
.ant-tree-title {
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
.ant-tree .ant-tree-node-content-wrapper:hover {
|
|
76
|
+
.oio-tree.ant-tree .ant-tree-node-content-wrapper:hover {
|
|
76
77
|
background-color: transparent;
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -116,7 +117,7 @@
|
|
|
116
117
|
margin-bottom: 10px;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
.oio-tabs{
|
|
120
|
+
.oio-tabs {
|
|
120
121
|
.oio-tab-content {
|
|
121
122
|
padding: 0;
|
|
122
123
|
}
|
|
@@ -486,11 +487,11 @@
|
|
|
486
487
|
}
|
|
487
488
|
|
|
488
489
|
.permission-dialog-content {
|
|
489
|
-
.oio-modal{
|
|
490
|
+
.oio-modal {
|
|
490
491
|
.ant-modal-body {
|
|
491
492
|
padding: 0 0 var(--oio-margin-md) 0;
|
|
492
493
|
position: relative;
|
|
493
|
-
|
|
494
|
+
|
|
494
495
|
.oio-tabs.ant-tabs-top .ant-tabs-nav .ant-tabs-tab {
|
|
495
496
|
padding: calc(var(--oio-padding) / 2);
|
|
496
497
|
border-top: none;
|
|
@@ -498,7 +499,7 @@
|
|
|
498
499
|
border-bottom: none;
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
|
-
|
|
502
|
+
|
|
502
503
|
.permission-mode-switch {
|
|
503
504
|
position: absolute;
|
|
504
505
|
right: var(--oio-margin);
|
|
@@ -511,22 +512,27 @@
|
|
|
511
512
|
}
|
|
512
513
|
}
|
|
513
514
|
}
|
|
514
|
-
|
|
515
|
+
|
|
516
|
+
.ant-spin-container {
|
|
517
|
+
width: 100%;
|
|
518
|
+
overflow-x: hidden;
|
|
519
|
+
}
|
|
520
|
+
|
|
515
521
|
.oio-tree {
|
|
516
522
|
max-height: 55vh;
|
|
517
523
|
overflow-y: scroll;
|
|
518
524
|
}
|
|
519
|
-
|
|
525
|
+
|
|
520
526
|
.data-permission-tab {
|
|
521
527
|
&-label {
|
|
522
528
|
font-weight: bold;
|
|
523
529
|
font-size: 16px;
|
|
524
530
|
}
|
|
525
|
-
|
|
531
|
+
|
|
526
532
|
.oio-tab {
|
|
527
533
|
padding: var(--oio-padding) 0 var(--oio-padding) 0;
|
|
528
534
|
}
|
|
529
|
-
|
|
535
|
+
|
|
530
536
|
.data-permission-rsql,
|
|
531
537
|
.data-permission-operator {
|
|
532
538
|
color: var(--oio-text-color-secondary);
|
|
@@ -29,9 +29,9 @@ let titleCache: Record<string, string> | undefined;
|
|
|
29
29
|
function getNotificationTitle(type: string): string {
|
|
30
30
|
if (!titleCache) {
|
|
31
31
|
titleCache = {};
|
|
32
|
-
for (const item
|
|
33
|
-
const key = `kunlun.common.${
|
|
34
|
-
titleCache[
|
|
32
|
+
for (const item in NotificationType) {
|
|
33
|
+
const key = `kunlun.common.${item}`;
|
|
34
|
+
titleCache[item] = translateValueByKey(getValue(zh_CN, key) as string);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
return titleCache[type] as string;
|