gant-core 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/index.js +23002 -510
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/template/index.html +3 -1
- package/lib/cli/template/tsconfig.react.template.json +1 -0
- package/lib/index.d.ts +67 -28
- package/lib/index.js +247 -133
- package/lib/index.js.map +1 -1
- package/package.json +17 -17
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios__default from 'axios';
|
|
2
2
|
export * from 'axios';
|
|
3
|
-
import { forEach, groupBy, reduce, find, pick, get as get$1, uniqueId, omit, isEmpty,
|
|
3
|
+
import { forEach, groupBy, reduce, find, pick, get as get$1, uniqueId, omit, isEmpty, cloneDeep, mapValues, uniqBy, mergeWith, toLower, isObject, has, join } from 'lodash-es';
|
|
4
4
|
import mitt from 'mitt';
|
|
5
5
|
import CryptoJS from 'crypto-js';
|
|
6
6
|
|
|
@@ -725,7 +725,7 @@ const MENU_BREADCRUMBS_UPDATE = 'MENU_BREADCRUMBS_UPDATE';
|
|
|
725
725
|
class MenuStore {
|
|
726
726
|
menuDataMaps = {};
|
|
727
727
|
menuData = [];
|
|
728
|
-
|
|
728
|
+
menuPathMaps = {};
|
|
729
729
|
breadcrumbs = [];
|
|
730
730
|
menuHistorys = [];
|
|
731
731
|
userId;
|
|
@@ -742,11 +742,9 @@ class MenuStore {
|
|
|
742
742
|
removeListenerBreadcrumbs = (listener) => {
|
|
743
743
|
return emitter.off(MENU_BREADCRUMBS_UPDATE, listener);
|
|
744
744
|
};
|
|
745
|
-
menuAuth = (pathname) => {
|
|
746
|
-
return has(this.menuDataMaps, pathname);
|
|
747
|
-
};
|
|
748
745
|
getTreeMenuData = (data, childrenGroup, parentPath) => {
|
|
749
|
-
return data
|
|
746
|
+
return data
|
|
747
|
+
.map((item) => {
|
|
750
748
|
const { id, path, leaf } = item;
|
|
751
749
|
const childrenData = childrenGroup[id];
|
|
752
750
|
const newItem = {
|
|
@@ -760,7 +758,8 @@ class MenuStore {
|
|
|
760
758
|
}
|
|
761
759
|
this.menuDataMaps[newItem.path] = newItem;
|
|
762
760
|
return newItem;
|
|
763
|
-
})
|
|
761
|
+
})
|
|
762
|
+
.sort((a, b) => a.seqNum - b.seqNum);
|
|
764
763
|
};
|
|
765
764
|
init = (menuData, userId) => {
|
|
766
765
|
const cloneMenuData = cloneDeep(menuData);
|
|
@@ -770,62 +769,68 @@ class MenuStore {
|
|
|
770
769
|
const { ROOT, ...childrenGroup } = groupObj;
|
|
771
770
|
this.menuData = this.getTreeMenuData(ROOT, childrenGroup);
|
|
772
771
|
this.menuData = [...this.menuData];
|
|
773
|
-
this.menuDataMaps
|
|
774
|
-
|
|
775
|
-
};
|
|
776
|
-
const menuMaps = mapValues(this.menuDataMaps, 'name');
|
|
777
|
-
this.updateMenuMaps(menuMaps);
|
|
772
|
+
const menuPathMaps = mapValues(this.menuDataMaps, 'name');
|
|
773
|
+
this.updateMenuMaps(menuPathMaps);
|
|
778
774
|
this.initMenuHistorys(userId);
|
|
779
775
|
return;
|
|
780
776
|
};
|
|
781
|
-
updateMenuMaps = (
|
|
782
|
-
this.
|
|
777
|
+
updateMenuMaps = (menuPathMaps) => {
|
|
778
|
+
this.menuPathMaps = { ...this.menuPathMaps, ...menuPathMaps };
|
|
783
779
|
const historys = this.menuHistorys;
|
|
784
780
|
const newHistorys = historys.map((item) => {
|
|
785
|
-
const itemName = this.
|
|
781
|
+
const itemName = this.menuPathMaps[item.pathname];
|
|
786
782
|
return {
|
|
787
783
|
pathname: item.pathname,
|
|
788
784
|
name: itemName ? itemName : item.name,
|
|
789
785
|
};
|
|
790
786
|
});
|
|
791
787
|
const newBreadcrumbs = this.breadcrumbs.map((item) => {
|
|
792
|
-
const itemName = this.
|
|
788
|
+
const itemName = this.menuPathMaps[item.pathname];
|
|
793
789
|
return {
|
|
794
790
|
...item,
|
|
795
791
|
name: itemName ? itemName : item.name,
|
|
796
792
|
};
|
|
797
793
|
});
|
|
798
|
-
this.
|
|
794
|
+
this.updatehistorys(newHistorys);
|
|
799
795
|
this.updateBreadcrumbs(newBreadcrumbs);
|
|
800
796
|
};
|
|
801
|
-
|
|
797
|
+
liseterHistorys = (pathname) => {
|
|
798
|
+
let historys = this.menuHistorys;
|
|
799
|
+
if (!this.menuDataMaps[pathname]?.leaf ||
|
|
800
|
+
historys.some((item) => item.pathname === pathname))
|
|
801
|
+
return;
|
|
802
|
+
historys = [{ pathname, name: this.menuPathMaps[pathname] }, ...historys];
|
|
803
|
+
this.updatehistorys(historys);
|
|
804
|
+
};
|
|
805
|
+
updatehistorys = (historys) => {
|
|
802
806
|
if (!this.userId)
|
|
803
807
|
return;
|
|
804
808
|
const newHistorys = historys.map((item) => {
|
|
805
809
|
return {
|
|
806
810
|
...item,
|
|
807
|
-
name: item.name ? item.name : this.
|
|
811
|
+
name: item.name ? item.name : this.menuPathMaps[item.pathname],
|
|
808
812
|
};
|
|
809
813
|
});
|
|
810
814
|
this.menuHistorys = newHistorys;
|
|
815
|
+
this.menuHistorys = uniqBy(this.menuHistorys, 'pathname');
|
|
811
816
|
emitter.emit(MENU_HISTORY_UPDATE, this.menuHistorys);
|
|
812
817
|
storage.set(`${this.userId}-menu-history`, this.menuHistorys);
|
|
813
818
|
};
|
|
814
819
|
initMenuHistorys = (userId) => {
|
|
815
820
|
this.userId = userId;
|
|
816
821
|
const historys = storage.get(`${userId}-menu-history`, this.menuHistorys);
|
|
817
|
-
this.
|
|
822
|
+
this.updatehistorys(historys);
|
|
818
823
|
};
|
|
819
824
|
liseterBreadcrumbs = (pathname) => {
|
|
820
825
|
const array = pathname.split('/');
|
|
821
826
|
let index = 1;
|
|
822
827
|
const breadcrumbs = [];
|
|
823
|
-
const current = { pathname, name: this.
|
|
828
|
+
const current = { pathname, name: this.menuPathMaps[pathname] };
|
|
824
829
|
while (index < array.length) {
|
|
825
830
|
const itemPathname = array.slice(0, index).join('/');
|
|
826
|
-
if (!!this.
|
|
831
|
+
if (!!this.menuPathMaps[itemPathname])
|
|
827
832
|
breadcrumbs.push({
|
|
828
|
-
|
|
833
|
+
name: this.menuPathMaps[itemPathname],
|
|
829
834
|
pathname: itemPathname,
|
|
830
835
|
});
|
|
831
836
|
index++;
|
|
@@ -835,6 +840,7 @@ class MenuStore {
|
|
|
835
840
|
};
|
|
836
841
|
updateBreadcrumbs = (breadcrumbs) => {
|
|
837
842
|
this.breadcrumbs = breadcrumbs;
|
|
843
|
+
this.breadcrumbs = uniqBy(this.breadcrumbs, 'pathname');
|
|
838
844
|
emitter.emit(MENU_BREADCRUMBS_UPDATE, breadcrumbs);
|
|
839
845
|
};
|
|
840
846
|
}
|
|
@@ -948,12 +954,13 @@ class BaseLogin {
|
|
|
948
954
|
const pathname = window.location.pathname;
|
|
949
955
|
const url = window.location.href;
|
|
950
956
|
if (this.isLoginPathname)
|
|
951
|
-
return;
|
|
957
|
+
return true;
|
|
952
958
|
const urlParams = new URLSearchParams();
|
|
953
959
|
if (pathname !== this.BASE)
|
|
954
960
|
urlParams.append('redirectUrl', url);
|
|
955
961
|
const searchString = decodeURIComponent(urlParams.toString());
|
|
956
962
|
window.location.replace(`${this.baseLoginPathname}${!!searchString ? '?' + decodeURIComponent(urlParams.toString()) : ''}`);
|
|
963
|
+
return false;
|
|
957
964
|
};
|
|
958
965
|
checkPassword = async () => {
|
|
959
966
|
const res = await checkPasswordApi();
|
|
@@ -971,8 +978,7 @@ class BaseLogin {
|
|
|
971
978
|
const res = await this.baseLogin(params);
|
|
972
979
|
if (res.error)
|
|
973
980
|
return res;
|
|
974
|
-
|
|
975
|
-
return;
|
|
981
|
+
return res;
|
|
976
982
|
};
|
|
977
983
|
baseLogin = async (params) => {
|
|
978
984
|
const result = {
|
|
@@ -1093,14 +1099,14 @@ class LoginStore extends BaseLogin {
|
|
|
1093
1099
|
this.BASE = base;
|
|
1094
1100
|
this.noCheckPermissionsPath = loginConfig?.noCheckPermissionsPath;
|
|
1095
1101
|
this.ssoLogin.init(loginConfig);
|
|
1096
|
-
this.loginPathname = loginConfig?.loginPathname;
|
|
1102
|
+
this.loginPathname = loginConfig?.loginPathname || '/login';
|
|
1097
1103
|
};
|
|
1098
1104
|
isNoLoginRequiredPage = () => {
|
|
1099
1105
|
const pathname = window.location.pathname;
|
|
1100
1106
|
const isNoLogin = this.noCheckPermissionsPath?.some((itemPath) => {
|
|
1101
1107
|
return this.getRealPath(itemPath) == pathname;
|
|
1102
1108
|
});
|
|
1103
|
-
return isNoLogin
|
|
1109
|
+
return isNoLogin;
|
|
1104
1110
|
};
|
|
1105
1111
|
loginOut = async () => {
|
|
1106
1112
|
const isSSO = await this.ssoLogin.isSso();
|
|
@@ -1114,11 +1120,16 @@ class LoginStore extends BaseLogin {
|
|
|
1114
1120
|
return;
|
|
1115
1121
|
};
|
|
1116
1122
|
redirectLogin = async () => {
|
|
1123
|
+
if (this.isNoLoginRequiredPage())
|
|
1124
|
+
return true;
|
|
1117
1125
|
const isSSO = await this.ssoLogin.isSso();
|
|
1118
|
-
if (isSSO)
|
|
1126
|
+
if (isSSO) {
|
|
1119
1127
|
this.ssoLogin.ssoLogin();
|
|
1120
|
-
|
|
1121
|
-
|
|
1128
|
+
return false;
|
|
1129
|
+
}
|
|
1130
|
+
if (this.isLoginPathname)
|
|
1131
|
+
return true;
|
|
1132
|
+
return await this.redirectBaseLogin();
|
|
1122
1133
|
};
|
|
1123
1134
|
}
|
|
1124
1135
|
|
|
@@ -1153,15 +1164,16 @@ class GlobalStoreClass {
|
|
|
1153
1164
|
this.platformLanguages = res.platformLanguages;
|
|
1154
1165
|
this.productInfo = res.productInfo;
|
|
1155
1166
|
};
|
|
1156
|
-
getAggregateInfo = async () => {
|
|
1167
|
+
getAggregateInfo = async (menus) => {
|
|
1157
1168
|
const res = await findUserAggregateInfoApi();
|
|
1158
1169
|
const { user: currentUser, startMenus, isSuperAdmin, ...restInfo } = res;
|
|
1159
1170
|
this.userStore.setUserAggregateInfo({ ...restInfo, currentUser });
|
|
1160
1171
|
this.isSuperAdmin = isSuperAdmin;
|
|
1161
|
-
|
|
1172
|
+
const localeMenus = typeof menus == 'function' ? menus(res) : menus;
|
|
1173
|
+
this.menuStore.init(isEmpty(localeMenus) ? startMenus : localeMenus, currentUser.id);
|
|
1162
1174
|
};
|
|
1163
1175
|
init = async (options) => {
|
|
1164
|
-
const { base = '/' } = options;
|
|
1176
|
+
const { base = '/', menuData } = options;
|
|
1165
1177
|
this.loginStore.init(options?.loginConfig, base);
|
|
1166
1178
|
try {
|
|
1167
1179
|
//检查token
|
|
@@ -1169,7 +1181,7 @@ class GlobalStoreClass {
|
|
|
1169
1181
|
if (res) {
|
|
1170
1182
|
//登录状态下获取聚合信息 保存header
|
|
1171
1183
|
this.userStore.setUserIdentity(res);
|
|
1172
|
-
await this.getAggregateInfo();
|
|
1184
|
+
await this.getAggregateInfo(menuData);
|
|
1173
1185
|
await codeListStoreInstance.findAllCodeList();
|
|
1174
1186
|
await parameterStoreInstance.findAllParameters();
|
|
1175
1187
|
//websocket注册
|
|
@@ -1177,8 +1189,7 @@ class GlobalStoreClass {
|
|
|
1177
1189
|
return true;
|
|
1178
1190
|
}
|
|
1179
1191
|
//未登录情况下跳转到登录
|
|
1180
|
-
await this.loginStore.redirectLogin();
|
|
1181
|
-
return true;
|
|
1192
|
+
return await this.loginStore.redirectLogin();
|
|
1182
1193
|
}
|
|
1183
1194
|
catch (error) {
|
|
1184
1195
|
console.error(error);
|
|
@@ -3982,7 +3993,9 @@ const initDynamicLang = async (language, options) => {
|
|
|
3982
3993
|
return options?.i18n ? instance : null;
|
|
3983
3994
|
};
|
|
3984
3995
|
const defaultTr = (key, agrs, type = 'fe') => {
|
|
3985
|
-
|
|
3996
|
+
let value = get$1(languageMaps, `${type}.${key}`, key);
|
|
3997
|
+
if (!value)
|
|
3998
|
+
value = key;
|
|
3986
3999
|
function replaceVariablesInString(str, arr) {
|
|
3987
4000
|
return str.replace(/\${(\d+)}/g, function (match, index) {
|
|
3988
4001
|
const arrIndex = parseInt(index);
|
|
@@ -3994,21 +4007,6 @@ const defaultTr = (key, agrs, type = 'fe') => {
|
|
|
3994
4007
|
const tr = (key, agrs, type = 'fe') => {
|
|
3995
4008
|
return window['tr'](key, agrs, type);
|
|
3996
4009
|
};
|
|
3997
|
-
const LOCALE_VERSION = 'LOCALE-v1';
|
|
3998
|
-
const getLocaleKey = () => {
|
|
3999
|
-
let key = storage.get(LOCALE_VERSION);
|
|
4000
|
-
if (!!key)
|
|
4001
|
-
return key;
|
|
4002
|
-
const defaultLoacle = find(globalStore.platformLanguages, {
|
|
4003
|
-
isDefault: true,
|
|
4004
|
-
});
|
|
4005
|
-
return get$1(defaultLoacle, 'locale', 'zh_CN');
|
|
4006
|
-
};
|
|
4007
|
-
const setLocaleKey = (locale) => {
|
|
4008
|
-
storage.set(LOCALE_VERSION, locale);
|
|
4009
|
-
location.reload();
|
|
4010
|
-
return locale;
|
|
4011
|
-
};
|
|
4012
4010
|
|
|
4013
4011
|
/**
|
|
4014
4012
|
* Take input from [0, n] and return it as [0, 1]
|
|
@@ -5389,11 +5387,10 @@ const seedToken = {
|
|
|
5389
5387
|
colorTextBase: '',
|
|
5390
5388
|
colorBgBase: '',
|
|
5391
5389
|
// Font
|
|
5392
|
-
fontFamily:
|
|
5393
|
-
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
5394
|
-
'Noto Color Emoji'`,
|
|
5390
|
+
fontFamily: `microsoft yahei,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif`,
|
|
5395
5391
|
fontFamilyCode: `'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,
|
|
5396
|
-
|
|
5392
|
+
fontWeight: 400,
|
|
5393
|
+
fontSize: 12,
|
|
5397
5394
|
// Line
|
|
5398
5395
|
lineWidth: 1,
|
|
5399
5396
|
lineType: 'solid',
|
|
@@ -5427,6 +5424,8 @@ const seedToken = {
|
|
|
5427
5424
|
motion: true,
|
|
5428
5425
|
layoutHeaderHeight: 50,
|
|
5429
5426
|
layoutSiderWidth: 200,
|
|
5427
|
+
layoutIconSize: 24,
|
|
5428
|
+
layoutNavHeight: 40,
|
|
5430
5429
|
};
|
|
5431
5430
|
|
|
5432
5431
|
function genColorMapToken(seed, { generateColorPalettes, generateNeutralColorPalettes }) {
|
|
@@ -5555,7 +5554,7 @@ const genRadius = (radiusBase) => {
|
|
|
5555
5554
|
};
|
|
5556
5555
|
|
|
5557
5556
|
function genCommonMapToken(token) {
|
|
5558
|
-
const { motionUnit, motionBase, borderRadius, lineWidth, opacity } = token;
|
|
5557
|
+
const { motionUnit, motionBase, borderRadius, lineWidth, opacity, layoutHeaderHeight, } = token;
|
|
5559
5558
|
return {
|
|
5560
5559
|
// motion
|
|
5561
5560
|
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
|
|
@@ -5571,8 +5570,8 @@ function genCommonMapToken(token) {
|
|
|
5571
5570
|
};
|
|
5572
5571
|
}
|
|
5573
5572
|
|
|
5574
|
-
const getAlphaColor$
|
|
5575
|
-
const getSolidColor$
|
|
5573
|
+
const getAlphaColor$4 = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
5574
|
+
const getSolidColor$2 = (baseColor, brightness) => {
|
|
5576
5575
|
const instance = new TinyColor(baseColor);
|
|
5577
5576
|
return instance.darken(brightness).toHexString();
|
|
5578
5577
|
};
|
|
@@ -5601,20 +5600,20 @@ const generateNeutralColorPalettes$1 = (bgBaseColor, textBaseColor) => {
|
|
|
5601
5600
|
return {
|
|
5602
5601
|
colorBgBase,
|
|
5603
5602
|
colorTextBase,
|
|
5604
|
-
colorText: getAlphaColor$
|
|
5605
|
-
colorTextSecondary: getAlphaColor$
|
|
5606
|
-
colorTextTertiary: getAlphaColor$
|
|
5607
|
-
colorTextQuaternary: getAlphaColor$
|
|
5608
|
-
colorFill: getAlphaColor$
|
|
5609
|
-
colorFillSecondary: getAlphaColor$
|
|
5610
|
-
colorFillTertiary: getAlphaColor$
|
|
5611
|
-
colorFillQuaternary: getAlphaColor$
|
|
5612
|
-
colorBgLayout: getSolidColor$
|
|
5613
|
-
colorBgContainer: getSolidColor$
|
|
5614
|
-
colorBgElevated: getSolidColor$
|
|
5615
|
-
colorBgSpotlight: getAlphaColor$
|
|
5616
|
-
colorBorder: getSolidColor$
|
|
5617
|
-
colorBorderSecondary: getSolidColor$
|
|
5603
|
+
colorText: getAlphaColor$4(colorTextBase, 0.88),
|
|
5604
|
+
colorTextSecondary: getAlphaColor$4(colorTextBase, 0.65),
|
|
5605
|
+
colorTextTertiary: getAlphaColor$4(colorTextBase, 0.45),
|
|
5606
|
+
colorTextQuaternary: getAlphaColor$4(colorTextBase, 0.25),
|
|
5607
|
+
colorFill: getAlphaColor$4(colorTextBase, 0.15),
|
|
5608
|
+
colorFillSecondary: getAlphaColor$4(colorTextBase, 0.06),
|
|
5609
|
+
colorFillTertiary: getAlphaColor$4(colorTextBase, 0.04),
|
|
5610
|
+
colorFillQuaternary: getAlphaColor$4(colorTextBase, 0.02),
|
|
5611
|
+
colorBgLayout: getSolidColor$2(colorBgBase, 4),
|
|
5612
|
+
colorBgContainer: getSolidColor$2(colorBgBase, 0),
|
|
5613
|
+
colorBgElevated: getSolidColor$2(colorBgBase, 0),
|
|
5614
|
+
colorBgSpotlight: getAlphaColor$4(colorTextBase, 0.85),
|
|
5615
|
+
colorBorder: getSolidColor$2(colorBgBase, 15),
|
|
5616
|
+
colorBorderSecondary: getSolidColor$2(colorBgBase, 6),
|
|
5618
5617
|
};
|
|
5619
5618
|
};
|
|
5620
5619
|
|
|
@@ -5662,7 +5661,7 @@ const genFontMapToken = (fontSize) => {
|
|
|
5662
5661
|
};
|
|
5663
5662
|
};
|
|
5664
5663
|
|
|
5665
|
-
function derivative$
|
|
5664
|
+
function derivative$3(token) {
|
|
5666
5665
|
const colorPalettes = Object.keys(defaultPresetColors)
|
|
5667
5666
|
.map((colorKey) => {
|
|
5668
5667
|
const colors = generate(token[colorKey]);
|
|
@@ -5698,8 +5697,8 @@ function derivative$2(token) {
|
|
|
5698
5697
|
};
|
|
5699
5698
|
}
|
|
5700
5699
|
|
|
5701
|
-
const getAlphaColor$
|
|
5702
|
-
const getSolidColor = (baseColor, brightness) => {
|
|
5700
|
+
const getAlphaColor$3 = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
5701
|
+
const getSolidColor$1 = (baseColor, brightness) => {
|
|
5703
5702
|
const instance = new TinyColor(baseColor);
|
|
5704
5703
|
return instance.lighten(brightness).toHexString();
|
|
5705
5704
|
};
|
|
@@ -5728,24 +5727,24 @@ const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
|
|
|
5728
5727
|
return {
|
|
5729
5728
|
colorBgBase,
|
|
5730
5729
|
colorTextBase,
|
|
5731
|
-
colorText: getAlphaColor$
|
|
5732
|
-
colorTextSecondary: getAlphaColor$
|
|
5733
|
-
colorTextTertiary: getAlphaColor$
|
|
5734
|
-
colorTextQuaternary: getAlphaColor$
|
|
5735
|
-
colorFill: getAlphaColor$
|
|
5736
|
-
colorFillSecondary: getAlphaColor$
|
|
5737
|
-
colorFillTertiary: getAlphaColor$
|
|
5738
|
-
colorFillQuaternary: getAlphaColor$
|
|
5739
|
-
colorBgElevated: getSolidColor(colorBgBase, 12),
|
|
5740
|
-
colorBgContainer: getSolidColor(colorBgBase, 8),
|
|
5741
|
-
colorBgLayout: getSolidColor(colorBgBase, 0),
|
|
5742
|
-
colorBgSpotlight: getSolidColor(colorBgBase, 26),
|
|
5743
|
-
colorBorder: getSolidColor(colorBgBase, 26),
|
|
5744
|
-
colorBorderSecondary: getSolidColor(colorBgBase, 19),
|
|
5730
|
+
colorText: getAlphaColor$3(colorTextBase, 0.85),
|
|
5731
|
+
colorTextSecondary: getAlphaColor$3(colorTextBase, 0.65),
|
|
5732
|
+
colorTextTertiary: getAlphaColor$3(colorTextBase, 0.45),
|
|
5733
|
+
colorTextQuaternary: getAlphaColor$3(colorTextBase, 0.25),
|
|
5734
|
+
colorFill: getAlphaColor$3(colorTextBase, 0.18),
|
|
5735
|
+
colorFillSecondary: getAlphaColor$3(colorTextBase, 0.12),
|
|
5736
|
+
colorFillTertiary: getAlphaColor$3(colorTextBase, 0.08),
|
|
5737
|
+
colorFillQuaternary: getAlphaColor$3(colorTextBase, 0.04),
|
|
5738
|
+
colorBgElevated: getSolidColor$1(colorBgBase, 12),
|
|
5739
|
+
colorBgContainer: getSolidColor$1(colorBgBase, 8),
|
|
5740
|
+
colorBgLayout: getSolidColor$1(colorBgBase, 0),
|
|
5741
|
+
colorBgSpotlight: getSolidColor$1(colorBgBase, 26),
|
|
5742
|
+
colorBorder: getSolidColor$1(colorBgBase, 26),
|
|
5743
|
+
colorBorderSecondary: getSolidColor$1(colorBgBase, 19),
|
|
5745
5744
|
};
|
|
5746
5745
|
};
|
|
5747
5746
|
|
|
5748
|
-
const derivative$
|
|
5747
|
+
const derivative$2 = (token, mapToken) => {
|
|
5749
5748
|
const colorPalettes = Object.keys(defaultPresetColors)
|
|
5750
5749
|
.map((colorKey) => {
|
|
5751
5750
|
const colors = generate(token[colorKey], { theme: 'dark' });
|
|
@@ -5762,7 +5761,7 @@ const derivative$1 = (token, mapToken) => {
|
|
|
5762
5761
|
};
|
|
5763
5762
|
return prev;
|
|
5764
5763
|
}, {});
|
|
5765
|
-
const mergedMapToken = mapToken ?? derivative$
|
|
5764
|
+
const mergedMapToken = mapToken ?? derivative$3(token);
|
|
5766
5765
|
return {
|
|
5767
5766
|
...mergedMapToken,
|
|
5768
5767
|
// Dark tokens
|
|
@@ -5791,8 +5790,8 @@ function genSizeMapToken(token) {
|
|
|
5791
5790
|
};
|
|
5792
5791
|
}
|
|
5793
5792
|
|
|
5794
|
-
const derivative = (token, mapToken) => {
|
|
5795
|
-
const mergedMapToken = mapToken ?? derivative$
|
|
5793
|
+
const derivative$1 = (token, mapToken) => {
|
|
5794
|
+
const mergedMapToken = mapToken ?? derivative$3(token);
|
|
5796
5795
|
const fontSize = mergedMapToken.fontSizeSM; // Smaller size font-size as base
|
|
5797
5796
|
const controlHeight = mergedMapToken.controlHeight - 4;
|
|
5798
5797
|
return {
|
|
@@ -5806,10 +5805,71 @@ const derivative = (token, mapToken) => {
|
|
|
5806
5805
|
};
|
|
5807
5806
|
};
|
|
5808
5807
|
|
|
5808
|
+
const getAlphaColor$2 = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
5809
|
+
const getSolidColor = (baseColor, brightness) => {
|
|
5810
|
+
const instance = new TinyColor(baseColor);
|
|
5811
|
+
return instance.darken(brightness).toHexString();
|
|
5812
|
+
};
|
|
5813
|
+
|
|
5814
|
+
const generateMettingNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
|
|
5815
|
+
const colorBgBase = bgBaseColor || '#fff';
|
|
5816
|
+
const colorTextBase = textBaseColor || '#000';
|
|
5817
|
+
return {
|
|
5818
|
+
colorBgBase,
|
|
5819
|
+
colorTextBase,
|
|
5820
|
+
colorText: getAlphaColor$2(colorTextBase, 1),
|
|
5821
|
+
colorTextSecondary: getAlphaColor$2(colorTextBase, 0.9),
|
|
5822
|
+
colorTextTertiary: getAlphaColor$2(colorTextBase, 0.8),
|
|
5823
|
+
colorTextQuaternary: getAlphaColor$2(colorTextBase, 0.7),
|
|
5824
|
+
colorFill: getAlphaColor$2(colorTextBase, 0.5),
|
|
5825
|
+
colorFillSecondary: getAlphaColor$2(colorTextBase, 0.4),
|
|
5826
|
+
colorFillTertiary: getAlphaColor$2(colorTextBase, 0.3),
|
|
5827
|
+
colorFillQuaternary: getAlphaColor$2(colorTextBase, 0.2),
|
|
5828
|
+
colorBgLayout: getSolidColor(colorBgBase, 10),
|
|
5829
|
+
colorBgContainer: getSolidColor(colorBgBase, 0),
|
|
5830
|
+
colorBgElevated: getSolidColor(colorBgBase, 0),
|
|
5831
|
+
colorBgSpotlight: getAlphaColor$2(colorTextBase, 0.1),
|
|
5832
|
+
colorBorder: getSolidColor(colorBgBase, 30),
|
|
5833
|
+
colorBorderSecondary: getSolidColor(colorBgBase, 24),
|
|
5834
|
+
};
|
|
5835
|
+
};
|
|
5836
|
+
|
|
5837
|
+
function derivative(token, mapToken) {
|
|
5838
|
+
const mergedMapToken = mapToken ?? derivative$3(token);
|
|
5839
|
+
const colorPalettes = Object.keys(defaultPresetColors)
|
|
5840
|
+
.map((colorKey) => {
|
|
5841
|
+
const colors = generate(token[colorKey]);
|
|
5842
|
+
return new Array(10).fill(1).reduce((prev, _, i) => {
|
|
5843
|
+
prev[`${colorKey}-${i + 1}`] = colors[i];
|
|
5844
|
+
prev[`${colorKey}${i + 1}`] = colors[i];
|
|
5845
|
+
return prev;
|
|
5846
|
+
}, {});
|
|
5847
|
+
})
|
|
5848
|
+
.reduce((prev, cur) => {
|
|
5849
|
+
prev = {
|
|
5850
|
+
...prev,
|
|
5851
|
+
...cur,
|
|
5852
|
+
};
|
|
5853
|
+
return prev;
|
|
5854
|
+
}, {});
|
|
5855
|
+
const { fontSize, colorBgBase, colorTextBase } = mergedMapToken;
|
|
5856
|
+
return {
|
|
5857
|
+
...mergedMapToken,
|
|
5858
|
+
...colorPalettes,
|
|
5859
|
+
// Colors
|
|
5860
|
+
...generateMettingNeutralColorPalettes(colorBgBase, colorTextBase),
|
|
5861
|
+
// Font
|
|
5862
|
+
fontSizeSM: fontSize,
|
|
5863
|
+
fontSize: fontSize + 2,
|
|
5864
|
+
fontSizeLG: fontSize + 3,
|
|
5865
|
+
fontSizeXL: fontSize + 4,
|
|
5866
|
+
};
|
|
5867
|
+
}
|
|
5868
|
+
|
|
5809
5869
|
function isStableColor(color) {
|
|
5810
5870
|
return color >= 0 && color <= 255;
|
|
5811
5871
|
}
|
|
5812
|
-
function getAlphaColor(frontColor, backgroundColor) {
|
|
5872
|
+
function getAlphaColor$1(frontColor, backgroundColor) {
|
|
5813
5873
|
const { r: fR, g: fG, b: fB, a: originAlpha } = new TinyColor(frontColor).toRgb();
|
|
5814
5874
|
if (originAlpha < 1) {
|
|
5815
5875
|
return frontColor;
|
|
@@ -5866,7 +5926,7 @@ function formatToken(derivativeToken) {
|
|
|
5866
5926
|
colorBgContainerDisabled: mergedToken.colorFillTertiary,
|
|
5867
5927
|
// ============== Split ============== //
|
|
5868
5928
|
colorBorderBg: mergedToken.colorBgContainer,
|
|
5869
|
-
colorSplit: getAlphaColor(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer),
|
|
5929
|
+
colorSplit: getAlphaColor$1(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer),
|
|
5870
5930
|
// ============== Text ============== //
|
|
5871
5931
|
colorTextPlaceholder: mergedToken.colorTextQuaternary,
|
|
5872
5932
|
colorTextDisabled: mergedToken.colorTextQuaternary,
|
|
@@ -5879,12 +5939,12 @@ function formatToken(derivativeToken) {
|
|
|
5879
5939
|
colorBgTextActive: mergedToken.colorFill,
|
|
5880
5940
|
colorIcon: mergedToken.colorTextTertiary,
|
|
5881
5941
|
colorIconHover: mergedToken.colorText,
|
|
5882
|
-
colorErrorOutline: getAlphaColor(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
|
|
5883
|
-
colorWarningOutline: getAlphaColor(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
|
|
5942
|
+
colorErrorOutline: getAlphaColor$1(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
|
|
5943
|
+
colorWarningOutline: getAlphaColor$1(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
|
|
5884
5944
|
// Font
|
|
5885
5945
|
fontSizeIcon: mergedToken.fontSizeSM,
|
|
5886
5946
|
// Line
|
|
5887
|
-
lineWidthFocus: mergedToken.lineWidth *
|
|
5947
|
+
lineWidthFocus: mergedToken.lineWidth * 2,
|
|
5888
5948
|
// Control
|
|
5889
5949
|
lineWidth: mergedToken.lineWidth,
|
|
5890
5950
|
controlOutlineWidth: mergedToken.lineWidth * 2,
|
|
@@ -5895,7 +5955,7 @@ function formatToken(derivativeToken) {
|
|
|
5895
5955
|
controlItemBgActiveHover: mergedToken.colorPrimaryBgHover,
|
|
5896
5956
|
controlItemBgActiveDisabled: mergedToken.colorFill,
|
|
5897
5957
|
controlTmpOutline: mergedToken.colorFillQuaternary,
|
|
5898
|
-
controlOutline: getAlphaColor(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer),
|
|
5958
|
+
controlOutline: getAlphaColor$1(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer),
|
|
5899
5959
|
lineType: mergedToken.lineType,
|
|
5900
5960
|
borderRadius: mergedToken.borderRadius,
|
|
5901
5961
|
borderRadiusXS: mergedToken.borderRadiusXS,
|
|
@@ -5997,18 +6057,27 @@ function formatToken(derivativeToken) {
|
|
|
5997
6057
|
return aliasToken;
|
|
5998
6058
|
}
|
|
5999
6059
|
|
|
6000
|
-
const getAliasToken = (
|
|
6060
|
+
const getAliasToken = (token = seedToken, type = 'default') => {
|
|
6061
|
+
let seed = pick(token, Object.keys(seedToken));
|
|
6062
|
+
seed = mergeWith(seedToken, seed);
|
|
6063
|
+
const defaultMapToken = derivative$3(seed);
|
|
6064
|
+
const defaultToken = omit(token, Object.keys(seedToken));
|
|
6001
6065
|
let mapToken;
|
|
6002
|
-
const defaultMapToken = derivative$2(seed);
|
|
6003
6066
|
switch (type) {
|
|
6004
6067
|
case 'dark':
|
|
6005
|
-
mapToken = derivative$
|
|
6068
|
+
mapToken = derivative$2(seed, defaultMapToken);
|
|
6069
|
+
break;
|
|
6006
6070
|
case 'compact':
|
|
6071
|
+
mapToken = derivative$1(seed, defaultMapToken);
|
|
6072
|
+
break;
|
|
6073
|
+
case 'meeting':
|
|
6007
6074
|
mapToken = derivative(seed, defaultMapToken);
|
|
6075
|
+
break;
|
|
6008
6076
|
default:
|
|
6009
6077
|
mapToken = defaultMapToken;
|
|
6078
|
+
break;
|
|
6010
6079
|
}
|
|
6011
|
-
return formatToken({ ...mapToken, override:
|
|
6080
|
+
return formatToken({ ...mapToken, override: defaultToken });
|
|
6012
6081
|
};
|
|
6013
6082
|
|
|
6014
6083
|
const PresetColors = [
|
|
@@ -6049,35 +6118,83 @@ function lighten(color, amount) {
|
|
|
6049
6118
|
amount = Math.trunc((255 * amount) / 100);
|
|
6050
6119
|
return `#${addLight(color.substring(0, 2), amount)}${addLight(color.substring(2, 4), amount)}${addLight(color.substring(4, 6), amount)}`;
|
|
6051
6120
|
}
|
|
6052
|
-
function
|
|
6053
|
-
if (typeof data !== 'object' || Array.isArray(data))
|
|
6054
|
-
return;
|
|
6055
|
-
return mapValues(data, (itemValue) => {
|
|
6056
|
-
if (typeof itemValue === 'object')
|
|
6057
|
-
return mapTheme(itemValue);
|
|
6058
|
-
itemValue = typeof itemValue === 'number' ? itemValue + 'px' : itemValue;
|
|
6059
|
-
return itemValue;
|
|
6060
|
-
});
|
|
6061
|
-
}
|
|
6062
|
-
function setCssVar(data, prefix) {
|
|
6121
|
+
function getTokenCssVar(data, prefix) {
|
|
6063
6122
|
if (typeof data !== 'object' || Array.isArray(data))
|
|
6064
6123
|
return;
|
|
6124
|
+
const tokenCss = {};
|
|
6065
6125
|
mapValues(data, (itemValue, name) => {
|
|
6066
6126
|
const varName = prefix ? '--' + `${prefix}-` + name : '--' + name;
|
|
6067
|
-
const value = typeof itemValue === 'number' &&
|
|
6127
|
+
const value = typeof itemValue === 'number' &&
|
|
6128
|
+
!['lineheight', 'opacity', 'weight'].some((key) => toLower(name).includes(key))
|
|
6068
6129
|
? itemValue + 'px'
|
|
6069
6130
|
: itemValue;
|
|
6070
6131
|
if (isObject(itemValue))
|
|
6071
|
-
return
|
|
6072
|
-
|
|
6132
|
+
return getTokenCssVar(value, name);
|
|
6133
|
+
tokenCss[varName] = value;
|
|
6073
6134
|
});
|
|
6135
|
+
return tokenCss;
|
|
6074
6136
|
}
|
|
6075
|
-
|
|
6076
|
-
document?.body?.removeAttribute('style');
|
|
6077
|
-
}
|
|
6137
|
+
const getAlphaColor = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
6078
6138
|
|
|
6079
6139
|
const token = getAliasToken();
|
|
6080
6140
|
|
|
6141
|
+
/**
|
|
6142
|
+
* 异常处理程序
|
|
6143
|
+
*/
|
|
6144
|
+
const TraceIdKey$1 = 'x-g-trace-id';
|
|
6145
|
+
const getTraceId = (response) => get$1(response, 'headers', TraceIdKey$1) ||
|
|
6146
|
+
get$1(response, 'config.headers', TraceIdKey$1);
|
|
6147
|
+
|
|
6148
|
+
const LOCALE_VERSION = 'LOCALE-v1';
|
|
6149
|
+
const getAntdLocaleKey = (localeKey) => {
|
|
6150
|
+
if (localeKey === 'en')
|
|
6151
|
+
return 'en-US';
|
|
6152
|
+
return localeKey;
|
|
6153
|
+
};
|
|
6154
|
+
const getLocaleKey = () => {
|
|
6155
|
+
let key = storage.get(LOCALE_VERSION);
|
|
6156
|
+
if (!!key)
|
|
6157
|
+
return key;
|
|
6158
|
+
const defaultLoacle = find(globalStore?.platformLanguages, {
|
|
6159
|
+
isDefault: true,
|
|
6160
|
+
});
|
|
6161
|
+
return get$1(defaultLoacle, 'locale', 'zh_CN');
|
|
6162
|
+
};
|
|
6163
|
+
const setLocaleKey = (locale) => {
|
|
6164
|
+
storage.set(LOCALE_VERSION, locale);
|
|
6165
|
+
location.reload();
|
|
6166
|
+
return locale;
|
|
6167
|
+
};
|
|
6168
|
+
|
|
6169
|
+
const resolvePath = (...paths) => {
|
|
6170
|
+
let resolved = join(paths, '/');
|
|
6171
|
+
resolved = resolved.replace(/\/+/g, '/');
|
|
6172
|
+
if (!resolved.startsWith('/')) {
|
|
6173
|
+
resolved = '/' + resolved;
|
|
6174
|
+
}
|
|
6175
|
+
return resolved;
|
|
6176
|
+
};
|
|
6177
|
+
const getRoutes = (routesMaps) => {
|
|
6178
|
+
if (isEmpty(routesMaps))
|
|
6179
|
+
return [];
|
|
6180
|
+
const groupRotes = groupBy(routesMaps, 'parentId');
|
|
6181
|
+
const { root, ...otherRoutes } = groupRotes;
|
|
6182
|
+
const mapRoutes = (routes, parentPath = '/') => {
|
|
6183
|
+
return routes.map((itemRoute) => {
|
|
6184
|
+
const { id, path, ...restRoute } = itemRoute;
|
|
6185
|
+
const itemPath = path.indexOf('/**') == 0 ? path : resolvePath(parentPath, path);
|
|
6186
|
+
if (has(otherRoutes, id))
|
|
6187
|
+
return {
|
|
6188
|
+
...restRoute,
|
|
6189
|
+
children: mapRoutes(otherRoutes[id], itemPath),
|
|
6190
|
+
path: itemPath,
|
|
6191
|
+
};
|
|
6192
|
+
return { ...restRoute, path: itemPath };
|
|
6193
|
+
});
|
|
6194
|
+
};
|
|
6195
|
+
return mapRoutes(root);
|
|
6196
|
+
};
|
|
6197
|
+
|
|
6081
6198
|
const TraceIdKey = 'X-G-TRACE-ID';
|
|
6082
6199
|
const useRequestMicroSevices = (microServiceMap) => {
|
|
6083
6200
|
return (config) => {
|
|
@@ -6131,21 +6248,18 @@ const useResponsedecryptParse = (response) => {
|
|
|
6131
6248
|
}
|
|
6132
6249
|
return response;
|
|
6133
6250
|
};
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
requestInstance.interceptors.request.use(useRequestMicroSevices(microServiceMap));
|
|
6137
|
-
requestInstance.interceptors.request.use(useRequestHeader(userLanguage));
|
|
6138
|
-
if (secret)
|
|
6139
|
-
requestInstance.interceptors.response.use(useResponsedecryptParse);
|
|
6140
|
-
};
|
|
6141
|
-
var main = async ({ microServiceMap, secret, loginConfig, getLocaleKey, }) => {
|
|
6142
|
-
defaultRequesetuse({ microServiceMap, secret });
|
|
6251
|
+
var main = async ({ microServiceMap, secret, dynamicLangCallback, ...globalOptions }) => {
|
|
6252
|
+
requestInstance.interceptors.request.use(useRequestMicroSevices(microServiceMap));
|
|
6143
6253
|
await globalStore.findPlantform();
|
|
6144
6254
|
const locale = getLocaleKey();
|
|
6255
|
+
requestInstance.interceptors.request.use(useRequestHeader(locale));
|
|
6256
|
+
if (secret)
|
|
6257
|
+
requestInstance.interceptors.response.use(useResponsedecryptParse);
|
|
6145
6258
|
await initDynamicLang(locale);
|
|
6146
|
-
|
|
6259
|
+
await dynamicLangCallback?.();
|
|
6260
|
+
const res = await globalStore.init(globalOptions);
|
|
6147
6261
|
return res;
|
|
6148
6262
|
};
|
|
6149
6263
|
|
|
6150
|
-
export { MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, PROGRESS_UPDEDATE, PresetColors, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative as compactAlgorithm, index as companydataStore, derivative$
|
|
6264
|
+
export { MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, PROGRESS_UPDEDATE, PresetColors, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative$1 as compactAlgorithm, index as companydataStore, derivative$2 as darkAlgorithm, decryptByAES, derivative$3 as defaultAlgorithm, emitter, encryptByAES, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor, getAntdLocaleKey, getLocaleKey, getMaskHeaderKey, getRoutes, getSecretKey, getTokenCssVar, getTraceId, globalStore, main as init, initDynamicLang, lighten, loginStore, menuStore, parameterStore, Progress as progress, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, toBase64, token, tr, useRequestHeader, useRequestMicroSevices, useResponsedecryptParse, userStore, websocket };
|
|
6151
6265
|
//# sourceMappingURL=index.js.map
|