Skip to content

Commit c9e98f2

Browse files
committed
2 parents 63f7509 + 566c237 commit c9e98f2

File tree

227 files changed

+11143
-10862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+11143
-10862
lines changed

build/jsdocs/classic/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"src/common/lang/locales"
6161
]
6262
},
63-
"plugins": ["plugins/markdown"],
63+
"plugins": ["plugins/markdown", "../plugins/moduleCategories"],
6464
"templates": {
6565
"cleverLinks": false,
6666
"monospaceLinks": false,

build/jsdocs/leaflet/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"src/leaflet/core/CommontypesConversion"
7878
]
7979
},
80-
"plugins": ["plugins/markdown","../plugins/usage"],
80+
"plugins": ["plugins/markdown","../plugins/usage", "../plugins/moduleCategories"],
8181
"markdown": {
8282
"tags": ["usage"]
8383
},

build/jsdocs/mapboxgl/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"src/mapboxgl/core/Util"
6868
]
6969
},
70-
"plugins": ["plugins/markdown","../plugins/usage"],
70+
"plugins": ["plugins/markdown","../plugins/usage", "../plugins/moduleCategories"],
7171
"markdown": {
7272
"tags": ["usage"]
7373
},

build/jsdocs/maplibregl/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"src/mapboxgl/core/Util"
6666
]
6767
},
68-
"plugins": ["plugins/markdown", "../plugins/usage"],
68+
"plugins": ["plugins/markdown", "../plugins/usage", "../plugins/moduleCategories"],
6969
"markdown": {
7070
"tags": ["usage"]
7171
},

build/jsdocs/openlayers/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"src/openlayers/core/Util"
6868
]
6969
},
70-
"plugins": ["plugins/markdown","../plugins/usage"],
70+
"plugins": ["plugins/markdown","../plugins/usage", "../plugins/moduleCategories"],
7171
"markdown": {
7272
"tags": ["usage"]
7373
},
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const env = require('jsdoc/lib/jsdoc/env');
2+
3+
const globalParams = env.conf.templates;
4+
exports.defineTags = function (dictionary) {
5+
dictionary.defineTag('modulecategory', {
6+
mustHaveValue: true,
7+
mustNotHaveDescription: false,
8+
canHaveType: false,
9+
canHaveName: false,
10+
onTagged: function (doclet, tag) {
11+
doclet.modulecategory = {
12+
globalParams,
13+
category: tag.value,
14+
name: doclet.name,
15+
des_en: doclet.name
16+
};
17+
}
18+
});
19+
};
20+
21+
exports.handlers = {
22+
newDoclet: function (e) {
23+
const modulecategory = e.doclet.modulecategory;
24+
if (modulecategory) {
25+
e.doclet.modulecategory.className = modulecategory.name;
26+
if (!modulecategory.name.startsWith('SuperMap')) {
27+
const matchTag = e.doclet.tags.find(tag => tag.title === 'browsernamespace') || {};
28+
const prefix = matchTag.value || globalParams.namespace;
29+
e.doclet.modulecategory.name = `${prefix}.${modulecategory.name}`;
30+
}
31+
e.doclet.modulecategory.des = (e.doclet.classdesc || '').split('。')[0].replace('<p>', '').replace('类', '');
32+
}
33+
}
34+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"moduleRoots": {
3+
"ol": "SuperMap iClient for OpenLayers",
4+
"L": "SuperMap iClient for Leaflet",
5+
"SuperMap": "SuperMap iClient Classic",
6+
"mapboxgl": "SuperMap iClient for MapboxGL",
7+
"maplibregl": "SuperMap iClient for MapLibreGL"
8+
},
9+
"moduleCategories": {
10+
"Mapping": {
11+
"des": "基础地图模块",
12+
"des_en": "Basic map module"
13+
},
14+
"Services": {
15+
"des": "服务模块",
16+
"des_en": "Service module"
17+
},
18+
"Overlay": {
19+
"des": "可视化与计算模块",
20+
"des_en": "Visualization and calculation module"
21+
},
22+
"Control": {
23+
"des": "功能控件模块",
24+
"des_en": "Control module"
25+
},
26+
"Components": {
27+
"des": "组件模块",
28+
"des_en": "Component module"
29+
}
30+
}
31+
}

build/jsdocs/template/publish.js

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var template = require('jsdoc/template'),
88
helper = require('jsdoc/util/templateHelper'),
99
logger = require('jsdoc/util/logger'),
1010
typeLinks = require('./typeLinkExt').typeLinks,
11+
moduleCategoriesConfig = require('./module-categories.json'),
1112
_ = require('underscore'),
1213
htmlsafe = helper.htmlsafe,
1314
linkto = helper.linkto,
@@ -20,6 +21,7 @@ var template = require('jsdoc/template'),
2021
language,
2122
outdir = env.opts.destination;
2223
var util = require('util');
24+
var chalk = require('chalk');
2325

2426
function find(spec) {
2527
return helper.find(data, spec);
@@ -259,7 +261,7 @@ function buildNav(members, view, templatePath) {
259261
}else{
260262
methods[element.fileName] = m;
261263
}
262-
264+
263265
}
264266
}
265267
var methodsPath = path.join(outdir, 'methods.json');
@@ -298,6 +300,50 @@ function buildCategories(members, templatePath) {
298300
return categories;
299301
}
300302

303+
function buildModuleCategories(data, outdir, conf) {
304+
var clientModuleName = conf.namespace.replace('.supermap', '');
305+
var moduleCategories = moduleCategoriesConfig.moduleCategories;
306+
var rootDes = moduleCategoriesConfig.moduleRoots[clientModuleName];
307+
var categories = Object.keys(moduleCategories).reduce((sum, key) => {
308+
const info = moduleCategories[key];
309+
sum[key] = {
310+
name: key,
311+
...info,
312+
children: []
313+
}
314+
return sum;
315+
}, {});
316+
317+
data().each(function (v) {
318+
var categoryInfo = v.modulecategory;
319+
if (!categoryInfo) {
320+
return;
321+
}
322+
if (!categories[categoryInfo.category]) {
323+
console.log(chalk.red(`ERROR [${clientModuleName}]: The @modulecategory(${categoryInfo.category}) is not exsist in ${v.meta.filename}\n`));
324+
return;
325+
}
326+
if (!categoryInfo.des) {
327+
console.log(chalk.red(`ERROR [${clientModuleName}]: The @classdesc cannot be empty in ${v.meta.filename}\n`));
328+
}
329+
categories[categoryInfo.category].children.push({
330+
name: categoryInfo.name,
331+
des: categoryInfo.des,
332+
des_en: categoryInfo.des_en,
333+
docName: categoryInfo.className
334+
});
335+
});
336+
const finalContent = {
337+
id: clientModuleName,
338+
name: rootDes,
339+
des: rootDes,
340+
children: Object.values(categories).filter(item => item.children.length > 0)
341+
}
342+
var outpath = path.join(outdir, 'module-categories.js');
343+
fs.writeFileSync(outpath, `var deps = ${JSON.stringify(finalContent, null, 2)}`, 'utf8');
344+
return categories;
345+
}
346+
301347
/**
302348
* Create the navigation sidebar.
303349
* @param {object} members The members that will be used to create the sidebar.
@@ -1139,7 +1185,8 @@ exports.publish = function (taffyData, opts, tutorials) {
11391185
const dir = outdir.replace('./docs/', '');
11401186
return whiteLists[dir];
11411187
}
1142-
1188+
// 生成产品介绍中模块说明的g6配置
1189+
buildModuleCategories(data, outdir, conf);
11431190
const allFiles = getFileNames();
11441191
console.error('生成的多余的文档页面: ', getMorePages(allFiles, getHtmlLinks(allFiles)));
11451192
console.error('没有链接的类型: ', getWrongLink(allFiles));

build/jsdocs/template/static/styles/jaguar.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ a:hover, a:active, a:focus{
4848
width: 240px;
4949
height: 100%;
5050
padding-top: 0px;
51-
background-color: var(--background-color);
52-
51+
background-color: var(--sidebar-background-color)
5352
}
5453

5554
.main-sidebar .applicationName {
@@ -114,7 +113,7 @@ a:hover, a:active, a:focus{
114113
}
115114

116115
.main-sidebar li.item a:hover {
117-
color: #282828 ;
116+
color: var(--active-color) ;
118117
}
119118

120119
.main-sidebar li.item .title {

build/pack.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { Command } = require('commander');
22
const program = new Command();
33
var shell = require("shelljs");
4-
require("./deps");
54
program.description('Customized pack iClient.');
65

76
var excludeFields = ['title', 'description', 'description_en'];
@@ -70,4 +69,4 @@ function getCommonModulePaths() {
7069
})
7170
}
7271
return modulePaths;
73-
}
72+
}

examples/css/sideBar.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515

1616
.skin-blue .main-sidebar {
17-
background-color: var(--background-color);
17+
background-color: var(--sidebar-background-color);
1818
}
1919

2020
.skin-blue .sidebar-menu > li.treeview:hover > a {
@@ -62,7 +62,7 @@ a.sidebar-toggle {
6262
height: 36px;
6363
line-height: 36px;
6464
text-align: center;
65-
background-color: var(--background-color);
65+
background-color: var(--sidebar-background-color);
6666
color: var(--text-color) !important;
6767
display: block;
6868
}
@@ -86,7 +86,7 @@ a.sidebar-toggle {
8686
color: var(--active-color);
8787
}
8888
.skin-blue .treeview-menu li > a {
89-
border-left: 3px solid var(--background-color);
89+
border-left: 3px solid var(--sidebar-background-color);
9090
}
9191

9292
.skin-blue .treeview-menu li > a:hover,
@@ -107,11 +107,11 @@ a.sidebar-toggle {
107107

108108
.skin-blue .sidebar-menu > li > .treeview-menu {
109109
margin: 0;
110-
background: var(--background-color);
110+
background: var(--sidebar-background-color);
111111
}
112112

113113
.sidebar-menu li.active > .treeview-menu {
114-
background: var(--background-color);
114+
background: var(--sidebar-background-color);
115115
}
116116

117117
.sidebar-title-bar .fa-angle-down,
@@ -143,7 +143,7 @@ a.sidebar-toggle {
143143
.skin-blue .sidebar-menu > li:hover > a,
144144
.skin-blue .sidebar-menu > li.active > a {
145145
color: var(--text-color);
146-
background: var(--background-color);
146+
background: var(--sidebar-background-color);
147147
}
148148

149149
.skin-blue .treeview-menu > li.active > a,

examples/js/editor.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.*/
22
$(document).ready(function () {
33
window.initI18N(function(){
4-
var pageConfig = getActiveExampleConfig();
5-
initPage(pageConfig);
4+
initPage();
65
bindEvents();
76
sidebarScrollFix();
87
});
@@ -11,10 +10,9 @@ $(document).ready(function () {
1110
var aceEditor;
1211
var containExamples = true;
1312

14-
function initPage(pageConfig) {
15-
var showCode = pageConfig.showCode;
13+
function initPage() {
1614
initSideBar();
17-
initEditor(showCode);
15+
initEditor();
1816
screenResize();
1917
}
2018

@@ -60,10 +58,11 @@ function screenResize() {
6058

6159
//初始化编辑器
6260
function initCodeEditor(showCode) {
61+
const codeBtn = document.getElementById("showCodeBtn");
6362
if(showCode === false){
63+
codeBtn.classList.add('hide');
6464
return
6565
}
66-
const codeBtn = document.getElementById("showCodeBtn");
6766
codeBtn.classList.remove('hide');
6867
if (!aceEditor) {
6968
aceEditor = ace.edit("editor");
@@ -79,9 +78,10 @@ function initCodeEditor(showCode) {
7978
}
8079

8180
//初始化编辑器以及预览内容
82-
function initEditor(showCode) {
81+
function initEditor() {
82+
var pageConfig = getActiveExampleConfig();
8383
loadExampleHtml();
84-
initCodeEditor(showCode);
84+
initCodeEditor(pageConfig.showCode);
8585
}
8686

8787
function loadExampleHtml() {

examples/js/sidebar.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,7 @@ function sidebarScrollFix() {
2727
"width": "233px"
2828
});
2929

30-
//如果底部空间不够,动态增加侧边栏高度
3130
var visibleOffsetTop = $(this).offset().top - $(window).scrollTop();
32-
var offsetBottom = $('.sidebar-menu').height() - visibleOffsetTop;
33-
var requireVisibleHeight = $(this).height() + $(this).children('ul').height();
34-
if (offsetBottom <= requireVisibleHeight) {
35-
$('.sidebar-menu').css({
36-
"height": (requireVisibleHeight + $(window).height()) + "px"
37-
})
38-
}
3931

4032
//调整一级菜单li下子列表的布局位置至右侧
4133
var offsetTop = visibleOffsetTop + $(this).height();
@@ -45,16 +37,11 @@ function sidebarScrollFix() {
4537

4638
//fix小尺寸屏幕下二级菜单高度高于窗口高度时显示不全的情况
4739
var $activeList = $(this).children('ul');
48-
var activeListOffsetBottom = Math.abs($(window).height() - visibleOffsetTop - $(this).height());
49-
var requireActiveListHeight = $activeList.height();
50-
if (activeListOffsetBottom < requireActiveListHeight) {
51-
$activeList.css({
52-
"height": requireActiveListHeight
53-
});
54-
//滚动条样式
55-
$activeList.addClass('scroll-list');
56-
}
57-
40+
var maxHeight = Math.abs($(window).height() - offsetTop);
41+
$activeList.css({
42+
"max-height": maxHeight
43+
});
44+
$activeList.addClass('scroll-list');
5845
}, function (evt) {
5946
if (!$('body').hasClass('sidebar-collapse')) {
6047
return;
@@ -63,7 +50,7 @@ function sidebarScrollFix() {
6350
$(this).children('ul').removeClass('scroll-list');
6451
//恢复原来的高度
6552
$(this).children('ul').css({
66-
"height": "auto"
53+
"max-height": ''
6754
});
6855
});
6956
$('.main-sidebar').on('scroll', function (evt) {

examples/js/theme/theme.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ function setRootStyle (theme) {
4747
rootStyleTag.innerHTML = rootStyle;
4848
}
4949

50+
var getCookie = utils.getCookie;
5051
document.addEventListener("DOMContentLoaded", function() {
5152
initSkin();
5253
});
5354

5455
function initSkin() {
55-
var skin = utils.getCookie('theme') || 'dark';
56+
var skin = getCookie('theme') || 'dark';
5657
var bodyElem = document.querySelector('body');
5758
bodyElem.classList.remove("light", "dark");
5859
bodyElem.classList.add(skin);

0 commit comments

Comments
 (0)