@ibiz-template/runtime 0.7.19 → 0.7.21
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/index.esm.js +10870 -10255
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +30 -1
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +44 -0
- package/out/application.d.ts +24 -0
- package/out/application.d.ts.map +1 -1
- package/out/application.js +24 -0
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +2 -1
- package/out/controller/control/calendar/calendar.controller.d.ts +7 -0
- package/out/controller/control/calendar/calendar.controller.d.ts.map +1 -1
- package/out/controller/control/calendar/calendar.controller.js +25 -0
- package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
- package/out/controller/control/chart/generator/base-series-generator.js +6 -8
- package/out/controller/control/data-view/data-view.controller.d.ts +7 -0
- package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
- package/out/controller/control/data-view/data-view.controller.js +31 -0
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts +7 -0
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +11 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts +16 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.js +21 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts +22 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.js +27 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts +9 -0
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.js +9 -0
- package/out/controller/control/gantt/gantt.controller.js +8 -8
- package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
- package/out/controller/control/gantt/gantt.service.js +14 -4
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +3 -4
- package/out/controller/control/list/list.controller.d.ts +7 -0
- package/out/controller/control/list/list.controller.d.ts.map +1 -1
- package/out/controller/control/list/list.controller.js +31 -0
- package/out/controller/control/tree/tree.service.d.ts +17 -0
- package/out/controller/control/tree/tree.service.d.ts.map +1 -1
- package/out/controller/control/tree/tree.service.js +38 -7
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +4 -4
- package/out/de-logic/de-logic-param/de-logic-param.js +2 -2
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +4 -0
- package/out/engine/view-base.engine.d.ts +15 -0
- package/out/engine/view-base.engine.d.ts.map +1 -1
- package/out/engine/view-base.engine.js +35 -2
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +31 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/common/i-app-service/i-app-service.d.ts +24 -0
- package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-data-view-control.state.d.ts +7 -0
- package/out/interface/controller/state/control/i-data-view-control.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-grid.state.d.ts +0 -7
- package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-list.state.d.ts +7 -0
- package/out/interface/controller/state/control/i-list.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-md-control.state.d.ts +7 -0
- package/out/interface/controller/state/control/i-md-control.state.d.ts.map +1 -1
- package/out/interface/provider/model-loader.provider.d.ts +31 -1
- package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
- package/out/locale/en/index.d.ts +8 -6
- package/out/locale/en/index.d.ts.map +1 -1
- package/out/locale/en/index.js +8 -6
- package/out/locale/zh-CN/index.d.ts +8 -6
- package/out/locale/zh-CN/index.d.ts.map +1 -1
- package/out/locale/zh-CN/index.js +8 -6
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +1 -0
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +1 -0
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +1 -0
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +1 -0
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +1 -0
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +1 -0
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +2 -0
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +2 -0
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +1 -0
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-param/ui-logic-param.js +2 -2
- package/out/utils/theme-util/custom-theme-util.d.ts +110 -0
- package/out/utils/theme-util/custom-theme-util.d.ts.map +1 -0
- package/out/utils/theme-util/custom-theme-util.js +199 -0
- package/out/utils/theme-util/theme-util.d.ts +79 -0
- package/out/utils/theme-util/theme-util.d.ts.map +1 -1
- package/out/utils/theme-util/theme-util.js +103 -0
- package/package.json +2 -2
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { notNilEmpty } from 'qx-util';
|
|
2
|
+
import { ConfigService } from '../../service';
|
|
3
|
+
/**
|
|
4
|
+
* 自定义主题工具类
|
|
5
|
+
*
|
|
6
|
+
* @author zzq
|
|
7
|
+
* @date 2024-05-10 23:12:15
|
|
8
|
+
* @export
|
|
9
|
+
* @class CustomThemeUtil
|
|
10
|
+
*/
|
|
11
|
+
export class CustomThemeUtil {
|
|
12
|
+
constructor(themeUtil) {
|
|
13
|
+
this.themeUtil = themeUtil;
|
|
14
|
+
/**
|
|
15
|
+
* 自定义主题状态
|
|
16
|
+
*
|
|
17
|
+
* @type {ICustomThemeState}
|
|
18
|
+
* @memberof CustomThemeUtil
|
|
19
|
+
*/
|
|
20
|
+
this.state = {};
|
|
21
|
+
this.state.themeTag = ibiz.util.theme.getTheme();
|
|
22
|
+
this.state.themeVars = {};
|
|
23
|
+
const { appData } = ibiz;
|
|
24
|
+
if (!appData) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const app = ibiz.hub.getApp();
|
|
28
|
+
this.config = new ConfigService(app.appId, 'customtheme', `theme_config_${appData.context.srfuserid}`);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 转换自定义变量
|
|
32
|
+
*
|
|
33
|
+
* @param {Record<string, string>} themeVars
|
|
34
|
+
* @return {string}
|
|
35
|
+
* @memberof CustomThemeUtil
|
|
36
|
+
*/
|
|
37
|
+
transCustomVars(themeVars) {
|
|
38
|
+
let result = '';
|
|
39
|
+
for (const key in themeVars) {
|
|
40
|
+
if (Object.prototype.hasOwnProperty.call(themeVars, key)) {
|
|
41
|
+
const val = themeVars[key];
|
|
42
|
+
result += `.${key}{${val}}`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 设置自定义主题测试
|
|
49
|
+
*
|
|
50
|
+
* @param {string} themeTag
|
|
51
|
+
* @param {Record<string, string>} themeVars
|
|
52
|
+
* @memberof CustomThemeUtil
|
|
53
|
+
*/
|
|
54
|
+
setCustomThemeParams(themeTag, themeVars) {
|
|
55
|
+
const themeStyle = document.getElementById(themeTag);
|
|
56
|
+
if (themeStyle) {
|
|
57
|
+
themeStyle.remove();
|
|
58
|
+
}
|
|
59
|
+
const otherContent = {};
|
|
60
|
+
let content = `:root.${themeTag}{`;
|
|
61
|
+
for (const key in themeVars) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(themeVars, key)) {
|
|
63
|
+
if (key.split(':').length === 2) {
|
|
64
|
+
const className = key.split(':')[0];
|
|
65
|
+
const varName = key.split(':')[1];
|
|
66
|
+
const val = themeVars[key];
|
|
67
|
+
if (!otherContent[className]) {
|
|
68
|
+
otherContent[className] = '';
|
|
69
|
+
}
|
|
70
|
+
otherContent[className] +=
|
|
71
|
+
`${varName}: ${val}${val.endsWith(';') ? '' : ';'}`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const val = themeVars[key];
|
|
75
|
+
content += `${key}: ${val}${val.endsWith(';') ? '' : ';'}`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
content += '}';
|
|
80
|
+
content += this.transCustomVars(otherContent);
|
|
81
|
+
const script = document.createElement('style');
|
|
82
|
+
script.id = themeTag;
|
|
83
|
+
script.type = 'text/css';
|
|
84
|
+
script.innerHTML = content;
|
|
85
|
+
document.head.appendChild(script);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 清除自定义主题参数
|
|
89
|
+
*
|
|
90
|
+
* @memberof CustomThemeUtil
|
|
91
|
+
*/
|
|
92
|
+
clearCustomThemeParams() {
|
|
93
|
+
this.state.themeVars = {};
|
|
94
|
+
const themeStyle = document.getElementById(this.state.themeTag);
|
|
95
|
+
if (themeStyle) {
|
|
96
|
+
themeStyle.remove();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 加载自定义主题
|
|
101
|
+
*
|
|
102
|
+
* @return {*} {Promise<IData>}
|
|
103
|
+
* @memberof CustomThemeUtil
|
|
104
|
+
*/
|
|
105
|
+
async loadCustomTheme() {
|
|
106
|
+
const res = await this.config.load();
|
|
107
|
+
if (res.themeTag) {
|
|
108
|
+
this.state.themeTag = res.themeTag;
|
|
109
|
+
ibiz.util.theme.setTheme(this.state.themeTag);
|
|
110
|
+
}
|
|
111
|
+
if (notNilEmpty(res.themeVars)) {
|
|
112
|
+
this.state.themeVars = res.themeVars;
|
|
113
|
+
this.setCustomThemeParams(this.state.themeTag, res.themeVars);
|
|
114
|
+
}
|
|
115
|
+
return res;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 预览自定义主题
|
|
119
|
+
*
|
|
120
|
+
* @param {string} themeTag
|
|
121
|
+
* @param {Record<string, string>} themeVars
|
|
122
|
+
* @return {*} {ICustomThemeState}
|
|
123
|
+
* @memberof CustomThemeUtil
|
|
124
|
+
*/
|
|
125
|
+
previewCustomTheme(themeTag, themeVars) {
|
|
126
|
+
if (themeTag) {
|
|
127
|
+
this.state.themeTag = themeTag;
|
|
128
|
+
ibiz.util.theme.setTheme(this.state.themeTag);
|
|
129
|
+
}
|
|
130
|
+
if (notNilEmpty(themeVars)) {
|
|
131
|
+
this.state.themeVars = themeVars;
|
|
132
|
+
this.setCustomThemeParams(this.state.themeTag, themeVars);
|
|
133
|
+
}
|
|
134
|
+
return this.state;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 保存自定义主题
|
|
138
|
+
*
|
|
139
|
+
* @param {string} themeTag
|
|
140
|
+
* @param {Record<string, string>} themeVars
|
|
141
|
+
* @return {*} {Promise<boolean>}
|
|
142
|
+
* @memberof CustomThemeUtil
|
|
143
|
+
*/
|
|
144
|
+
async saveCustomTheme(themeTag, themeVars) {
|
|
145
|
+
const data = {
|
|
146
|
+
themeTag,
|
|
147
|
+
themeVars,
|
|
148
|
+
};
|
|
149
|
+
const result = await this.config.save(data);
|
|
150
|
+
if (result) {
|
|
151
|
+
ibiz.message.success('保存自定义主题成功!');
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 分享自定义主题
|
|
157
|
+
*
|
|
158
|
+
* @param {string} themeTag
|
|
159
|
+
* @param {Record<string, string>} themeVars
|
|
160
|
+
* @return {*} {(Promise<string | undefined>)}
|
|
161
|
+
* @memberof CustomThemeUtil
|
|
162
|
+
*/
|
|
163
|
+
async shareCustomTheme(themeTag, themeVars) {
|
|
164
|
+
const { appData } = ibiz;
|
|
165
|
+
if (!appData) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const data = {
|
|
169
|
+
themeTag,
|
|
170
|
+
themeVars,
|
|
171
|
+
};
|
|
172
|
+
const app = ibiz.hub.getApp();
|
|
173
|
+
const timestamp = Date.now();
|
|
174
|
+
const shareConfig = new ConfigService(app.appId, 'customtheme', `theme_share_${appData.context.srfuserid}_${timestamp}`);
|
|
175
|
+
const result = await shareConfig.save(data);
|
|
176
|
+
if (result) {
|
|
177
|
+
const { origin, pathname } = window.location;
|
|
178
|
+
const shareThemeId = `shareThemeId=${window.btoa(timestamp.toString())}`;
|
|
179
|
+
const shareUserName = `shareUserName=${encodeURIComponent(appData.context.srfusername)}`;
|
|
180
|
+
const shareUserId = `shareUserId=${encodeURIComponent(appData.context.srfuserid)}`;
|
|
181
|
+
const url = `/share?${shareThemeId}&${shareUserName}&${shareUserId}`;
|
|
182
|
+
return `${origin}${pathname}#${url}`;
|
|
183
|
+
}
|
|
184
|
+
ibiz.message.error('分享自定义主题失败!');
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 获取分享主题
|
|
188
|
+
*
|
|
189
|
+
* @param {string} userId
|
|
190
|
+
* @param {string} themeId
|
|
191
|
+
* @return {*} {Promise<IData>}
|
|
192
|
+
* @memberof CustomThemeUtil
|
|
193
|
+
*/
|
|
194
|
+
async getShareTheme(userId, themeId) {
|
|
195
|
+
const app = ibiz.hub.getApp();
|
|
196
|
+
const shareConfig = new ConfigService(app.appId, 'customtheme', `theme_share_${userId}_${themeId}`);
|
|
197
|
+
return shareConfig.load();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAppUITheme } from '@ibiz/model-core';
|
|
2
|
+
import { CustomThemeUtil, ICustomThemeState } from './custom-theme-util';
|
|
2
3
|
/**
|
|
3
4
|
* 主题工具类
|
|
4
5
|
*
|
|
@@ -17,6 +18,14 @@ export declare class ThemeUtil {
|
|
|
17
18
|
* @type {HTMLElement}
|
|
18
19
|
*/
|
|
19
20
|
protected html: HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义主题工具类
|
|
23
|
+
*
|
|
24
|
+
* @protected
|
|
25
|
+
* @type {CustomThemeUtil}
|
|
26
|
+
* @memberof ThemeUtil
|
|
27
|
+
*/
|
|
28
|
+
protected customUtil: CustomThemeUtil;
|
|
20
29
|
/**
|
|
21
30
|
* 加载主题插件
|
|
22
31
|
*
|
|
@@ -53,5 +62,75 @@ export declare class ThemeUtil {
|
|
|
53
62
|
* @return {*} {string}
|
|
54
63
|
*/
|
|
55
64
|
getTheme(): string;
|
|
65
|
+
/**
|
|
66
|
+
* 自定义主题
|
|
67
|
+
*
|
|
68
|
+
* @memberof ThemeUtil
|
|
69
|
+
*/
|
|
70
|
+
customTheme(): void;
|
|
71
|
+
/**
|
|
72
|
+
* 初始化自定义主题
|
|
73
|
+
*
|
|
74
|
+
* @return {*} {Promise<void>}
|
|
75
|
+
* @memberof ThemeUtil
|
|
76
|
+
*/
|
|
77
|
+
initCustomTheme(needLoad?: boolean): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* 获取自定义主题
|
|
80
|
+
*
|
|
81
|
+
* @return {*} {ICustomThemeState}
|
|
82
|
+
* @memberof ThemeUtil
|
|
83
|
+
*/
|
|
84
|
+
getCustomTheme(): ICustomThemeState;
|
|
85
|
+
/**
|
|
86
|
+
* 设置自定义主题
|
|
87
|
+
*
|
|
88
|
+
* @param {IData} data
|
|
89
|
+
* @memberof ThemeUtil
|
|
90
|
+
*/
|
|
91
|
+
setCustomTheme(data: IData): void;
|
|
92
|
+
/**
|
|
93
|
+
* 预览自定义主题
|
|
94
|
+
*
|
|
95
|
+
* @param {string} themeTag
|
|
96
|
+
* @param {Record<string, string>} themeVars
|
|
97
|
+
* @return {*} {ICustomThemeState}
|
|
98
|
+
* @memberof ThemeUtil
|
|
99
|
+
*/
|
|
100
|
+
previewCustomTheme(themeTag: string, themeVars: Record<string, string>): ICustomThemeState;
|
|
101
|
+
/**
|
|
102
|
+
* 还原自定义主题
|
|
103
|
+
*
|
|
104
|
+
* @return {*} {void}
|
|
105
|
+
* @memberof ThemeUtil
|
|
106
|
+
*/
|
|
107
|
+
resetCustomTheme(): void;
|
|
108
|
+
/**
|
|
109
|
+
* 保存自定义主题
|
|
110
|
+
*
|
|
111
|
+
* @param {string} themeTag
|
|
112
|
+
* @param {Record<string, string>} themeVars
|
|
113
|
+
* @return {*} {(Promise<boolean | undefined>)}
|
|
114
|
+
* @memberof ThemeUtil
|
|
115
|
+
*/
|
|
116
|
+
saveCustomTheme(themeTag: string, themeVars: Record<string, string>): Promise<boolean | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* 分享自定义主题
|
|
119
|
+
*
|
|
120
|
+
* @param {string} themeTag
|
|
121
|
+
* @param {Record<string, string>} themeVars
|
|
122
|
+
* @return {*} {(Promise<string | undefined>)}
|
|
123
|
+
* @memberof ThemeUtil
|
|
124
|
+
*/
|
|
125
|
+
shareCustomTheme(themeTag: string, themeVars: Record<string, string>): Promise<string | undefined>;
|
|
126
|
+
/**
|
|
127
|
+
* 获取分享主题
|
|
128
|
+
*
|
|
129
|
+
* @param {string} userId
|
|
130
|
+
* @param {string} themeId
|
|
131
|
+
* @return {*} {Promise<IData>}
|
|
132
|
+
* @memberof ThemeUtil
|
|
133
|
+
*/
|
|
134
|
+
getShareTheme(userId: string, themeId: string): Promise<IData>;
|
|
56
135
|
}
|
|
57
136
|
//# sourceMappingURL=theme-util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-util.d.ts","sourceRoot":"","sources":["../../../src/utils/theme-util/theme-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"theme-util.d.ts","sourceRoot":"","sources":["../../../src/utils/theme-util/theme-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB;;;;;;;OAOG;IACH,SAAS,CAAC,IAAI,EAAE,WAAW,CAA4C;IAEvE;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,EAAE,eAAe,CAAyB;IAE9D;;;;;;;OAOG;IACG,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAclD;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CACtB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,IAAI;IAoBP;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAO3B;;;;;;OAMG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,WAAW,IAAI,IAAI;IAOnB;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D;;;;;OAKG;IACH,cAAc,IAAI,iBAAiB;IAInC;;;;;OAKG;IACH,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,kBAAkB,CAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,iBAAiB;IAIpB;;;;;OAKG;IACH,gBAAgB,IAAI,IAAI;IAIxB;;;;;;;OAOG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAI/B;;;;;;;OAOG;IACG,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI9B;;;;;;;OAOG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAGrE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { clone } from 'ramda';
|
|
2
|
+
import { CustomThemeUtil } from './custom-theme-util';
|
|
2
3
|
/**
|
|
3
4
|
* 主题工具类
|
|
4
5
|
*
|
|
@@ -18,6 +19,14 @@ export class ThemeUtil {
|
|
|
18
19
|
* @type {HTMLElement}
|
|
19
20
|
*/
|
|
20
21
|
this.html = document.getElementsByTagName('html')[0];
|
|
22
|
+
/**
|
|
23
|
+
* 自定义主题工具类
|
|
24
|
+
*
|
|
25
|
+
* @protected
|
|
26
|
+
* @type {CustomThemeUtil}
|
|
27
|
+
* @memberof ThemeUtil
|
|
28
|
+
*/
|
|
29
|
+
this.customUtil = {};
|
|
21
30
|
}
|
|
22
31
|
/**
|
|
23
32
|
* 加载主题插件
|
|
@@ -92,4 +101,98 @@ export class ThemeUtil {
|
|
|
92
101
|
getTheme() {
|
|
93
102
|
return this.html.getAttribute('theme');
|
|
94
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* 自定义主题
|
|
106
|
+
*
|
|
107
|
+
* @memberof ThemeUtil
|
|
108
|
+
*/
|
|
109
|
+
customTheme() {
|
|
110
|
+
ibiz.overlay.drawer('IBizCustomTheme', undefined, {
|
|
111
|
+
width: 30,
|
|
112
|
+
placement: 'right',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 初始化自定义主题
|
|
117
|
+
*
|
|
118
|
+
* @return {*} {Promise<void>}
|
|
119
|
+
* @memberof ThemeUtil
|
|
120
|
+
*/
|
|
121
|
+
async initCustomTheme(needLoad = true) {
|
|
122
|
+
this.customUtil = new CustomThemeUtil(this);
|
|
123
|
+
if (needLoad) {
|
|
124
|
+
await this.customUtil.loadCustomTheme();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 获取自定义主题
|
|
129
|
+
*
|
|
130
|
+
* @return {*} {ICustomThemeState}
|
|
131
|
+
* @memberof ThemeUtil
|
|
132
|
+
*/
|
|
133
|
+
getCustomTheme() {
|
|
134
|
+
return this.customUtil.state;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 设置自定义主题
|
|
138
|
+
*
|
|
139
|
+
* @param {IData} data
|
|
140
|
+
* @memberof ThemeUtil
|
|
141
|
+
*/
|
|
142
|
+
setCustomTheme(data) {
|
|
143
|
+
Object.assign(this.customUtil.state, data);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 预览自定义主题
|
|
147
|
+
*
|
|
148
|
+
* @param {string} themeTag
|
|
149
|
+
* @param {Record<string, string>} themeVars
|
|
150
|
+
* @return {*} {ICustomThemeState}
|
|
151
|
+
* @memberof ThemeUtil
|
|
152
|
+
*/
|
|
153
|
+
previewCustomTheme(themeTag, themeVars) {
|
|
154
|
+
return this.customUtil.previewCustomTheme(themeTag, themeVars);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 还原自定义主题
|
|
158
|
+
*
|
|
159
|
+
* @return {*} {void}
|
|
160
|
+
* @memberof ThemeUtil
|
|
161
|
+
*/
|
|
162
|
+
resetCustomTheme() {
|
|
163
|
+
return this.customUtil.clearCustomThemeParams();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 保存自定义主题
|
|
167
|
+
*
|
|
168
|
+
* @param {string} themeTag
|
|
169
|
+
* @param {Record<string, string>} themeVars
|
|
170
|
+
* @return {*} {(Promise<boolean | undefined>)}
|
|
171
|
+
* @memberof ThemeUtil
|
|
172
|
+
*/
|
|
173
|
+
async saveCustomTheme(themeTag, themeVars) {
|
|
174
|
+
return this.customUtil.saveCustomTheme(themeTag, themeVars);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* 分享自定义主题
|
|
178
|
+
*
|
|
179
|
+
* @param {string} themeTag
|
|
180
|
+
* @param {Record<string, string>} themeVars
|
|
181
|
+
* @return {*} {(Promise<string | undefined>)}
|
|
182
|
+
* @memberof ThemeUtil
|
|
183
|
+
*/
|
|
184
|
+
async shareCustomTheme(themeTag, themeVars) {
|
|
185
|
+
return this.customUtil.shareCustomTheme(themeTag, themeVars);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 获取分享主题
|
|
189
|
+
*
|
|
190
|
+
* @param {string} userId
|
|
191
|
+
* @param {string} themeId
|
|
192
|
+
* @return {*} {Promise<IData>}
|
|
193
|
+
* @memberof ThemeUtil
|
|
194
|
+
*/
|
|
195
|
+
async getShareTheme(userId, themeId) {
|
|
196
|
+
return this.customUtil.getShareTheme(userId, themeId);
|
|
197
|
+
}
|
|
95
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.21",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"qx-util": "^0.4.8",
|
|
67
67
|
"ramda": "^0.29.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "cae794a2466f2ca5614332344f66f1797ea6a4f4"
|
|
70
70
|
}
|