danoniplus 40.1.0 → 40.2.0
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/js/danoni_main.js +51 -36
- package/package.json +1 -1
package/js/danoni_main.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Source by tickle
|
|
6
6
|
* Created : 2018/10/08
|
|
7
|
-
* Revised : 2025/03/
|
|
7
|
+
* Revised : 2025/03/07
|
|
8
8
|
*
|
|
9
9
|
* https://github.com/cwtickle/danoniplus
|
|
10
10
|
*/
|
|
11
|
-
const g_version = `Ver 40.
|
|
12
|
-
const g_revisedDate = `2025/03/
|
|
11
|
+
const g_version = `Ver 40.2.0`;
|
|
12
|
+
const g_revisedDate = `2025/03/07`;
|
|
13
13
|
|
|
14
14
|
// カスタム用バージョン (danoni_custom.js 等で指定可)
|
|
15
15
|
let g_localVersion = ``;
|
|
@@ -496,44 +496,53 @@ const viewKeyStorage = (_name, _key = ``) => {
|
|
|
496
496
|
* オブジェクトのネスト表示処理
|
|
497
497
|
* @param {Object} _obj
|
|
498
498
|
* @param {Number} _indent
|
|
499
|
-
* @param {
|
|
500
|
-
* @param {
|
|
501
|
-
* @param {string} [key='']
|
|
499
|
+
* @param {boolean} [colorFmt=true] フォーマット加工フラグ
|
|
500
|
+
* @param {string} [rootKey=''] オブジェクトの最上位プロパティ名
|
|
502
501
|
* @param {Object} [_parent=null]
|
|
503
502
|
* @returns {string}
|
|
504
503
|
*/
|
|
505
|
-
const formatObject = (_obj, _indent = 0, {
|
|
504
|
+
const formatObject = (_obj, _indent = 0, { colorFmt = true, rootKey = `` } = {}) => {
|
|
506
505
|
if (_obj === null || typeof _obj !== 'object') {
|
|
507
506
|
return JSON.stringify(_obj);
|
|
508
507
|
}
|
|
509
|
-
if (seen.has(_obj)) {
|
|
510
|
-
return '[Circular]';
|
|
511
|
-
}
|
|
512
|
-
seen.add(_obj);
|
|
513
508
|
const baseIndent = getIndent(_indent);
|
|
514
509
|
const nestedIndent = getIndent(_indent + 1);
|
|
515
510
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
511
|
+
/**
|
|
512
|
+
* データの装飾処理
|
|
513
|
+
* @param {string|boolean|number|Object} _value
|
|
514
|
+
* @param {string} _rootKey
|
|
515
|
+
* @returns {string}
|
|
516
|
+
*/
|
|
517
|
+
const formatValue = (_value, _rootKey) => {
|
|
519
518
|
if (colorFmt) {
|
|
520
|
-
if (typeof _value ===
|
|
521
|
-
|
|
519
|
+
if (typeof _value === C_TYP_STRING) {
|
|
520
|
+
|
|
521
|
+
// カラーコードの色付け処理
|
|
522
|
+
_value = escapeHtml(_value).replaceAll(`\n`, `<br>`);
|
|
523
|
+
const colorCodePattern = /(#|0x)(?:[A-Fa-f0-9]{6}(?:[A-Fa-f0-9]{2})?|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{3})/g;
|
|
522
524
|
if (colorCodePattern.test(_value)) {
|
|
523
525
|
return _value.replace(colorCodePattern, (match) =>
|
|
524
526
|
`<span style="color:${match.replace(`0x`, `#`)}">◆</span>${match.replace(`0x`, `#`)}`);
|
|
525
527
|
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
528
|
+
} else if (typeof _value === C_TYP_BOOLEAN) {
|
|
529
|
+
|
|
530
|
+
// boolean値の色付け処理
|
|
531
|
+
return (_value ? `<span style="color:#66ff66">✔ true</span>` :
|
|
532
|
+
`<span style="color:#ff9999">❌ false</span>`);
|
|
533
|
+
|
|
534
|
+
} else if (typeof _value === C_TYP_NUMBER) {
|
|
535
|
+
|
|
536
|
+
if (_rootKey.startsWith(`scrollDir`)) {
|
|
537
|
+
// scrollDirXのスクロール方向表示処理
|
|
538
|
+
return _value === 1 ? `1|<span style="color:#ff9999">↑</span>` : `-1|<span style="color:#66ff66">↓</span>`;
|
|
539
|
+
|
|
540
|
+
} else if (_rootKey.startsWith(`keyCtrl`) && !_rootKey.startsWith(`keyCtrlPtn`)) {
|
|
541
|
+
// keyCtrlXの対応キー表示処理
|
|
542
|
+
return (g_kCd[_value] && _value !== 0) ? `${_value}|<span style="color:#ffff66">${g_kCd[_value]}</span>` : `----`;
|
|
532
543
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
if (typeof _value === 'object' && _value !== null) {
|
|
536
|
-
return formatObject(_value, _indent + 1, { seen, colorFmt, key }, _parent);
|
|
544
|
+
} else if (typeof _value === C_TYP_OBJECT && _value !== null) {
|
|
545
|
+
return formatObject(_value, _indent + 1, { colorFmt, rootKey: _rootKey });
|
|
537
546
|
}
|
|
538
547
|
}
|
|
539
548
|
return JSON.stringify(_value);
|
|
@@ -547,7 +556,7 @@ const formatObject = (_obj, _indent = 0, { seen = new WeakSet(), colorFmt = true
|
|
|
547
556
|
if (colorFmt && _obj.length > 100) {
|
|
548
557
|
const filteredArray = _obj.reduce((result, value, index) => {
|
|
549
558
|
if (hasVal(value)) {
|
|
550
|
-
result.push(`${index}: ${formatValue(value,
|
|
559
|
+
result.push(`${index}: ${formatValue(value, rootKey)}`);
|
|
551
560
|
}
|
|
552
561
|
return result;
|
|
553
562
|
}, []);
|
|
@@ -558,11 +567,11 @@ const formatObject = (_obj, _indent = 0, { seen = new WeakSet(), colorFmt = true
|
|
|
558
567
|
.map(value => {
|
|
559
568
|
const isNestedObject = typeof value === 'object' && value !== null;
|
|
560
569
|
return isArrayOfArrays
|
|
561
|
-
? `${nestedIndent}${formatValue(value,
|
|
570
|
+
? `${nestedIndent}${formatValue(value, rootKey)}`
|
|
562
571
|
: isNestedObject
|
|
563
|
-
? formatObject(value, _indent + 1, {
|
|
564
|
-
: formatValue(value,
|
|
565
|
-
}).join(isArrayOfArrays ? `,<br>` : `, `);
|
|
572
|
+
? formatObject(value, _indent + 1, { colorFmt, rootKey })
|
|
573
|
+
: formatValue(value, rootKey)
|
|
574
|
+
}).filter(val => !hasVal(val) || val !== `----`).join(isArrayOfArrays ? `,<br>` : `, `);
|
|
566
575
|
|
|
567
576
|
return `[${isArrayOfArrays ? `<br>` : ``}${formattedArray}${isArrayOfArrays ? `<br>${baseIndent}` : ''}]`;
|
|
568
577
|
}
|
|
@@ -571,12 +580,12 @@ const formatObject = (_obj, _indent = 0, { seen = new WeakSet(), colorFmt = true
|
|
|
571
580
|
const formattedEntries = Object.entries(_obj)
|
|
572
581
|
.map(([key, value]) => {
|
|
573
582
|
const isNestedObject = typeof value === 'object' && value !== null;
|
|
574
|
-
const
|
|
583
|
+
const baseKey = rootKey === `` ? key : rootKey;
|
|
575
584
|
const formattedValue = isNestedObject
|
|
576
|
-
? formatObject(value, _indent + 1, {
|
|
577
|
-
: formatValue(value,
|
|
585
|
+
? formatObject(value, _indent + 1, { colorFmt, rootKey: baseKey }, _obj)
|
|
586
|
+
: formatValue(value, baseKey);
|
|
578
587
|
return `<br>${nestedIndent}"${key}": ${formattedValue}`;
|
|
579
|
-
}).join(`,`);
|
|
588
|
+
}).filter(val => !hasVal(val) || val !== `----`).join(`,`);
|
|
580
589
|
|
|
581
590
|
let result = `{${formattedEntries}<br>${baseIndent}}`;
|
|
582
591
|
if (!colorFmt) {
|
|
@@ -5030,7 +5039,7 @@ const dataMgtInit = () => {
|
|
|
5030
5039
|
multiAppend(divRoot,
|
|
5031
5040
|
createCss2Button(`btnBack`, g_lblNameObj.b_back, () => true,
|
|
5032
5041
|
Object.assign(g_lblPosObj.btnResetBack, {
|
|
5033
|
-
resetFunc: () =>
|
|
5042
|
+
resetFunc: () => [`title`, `precondition`].includes(prevPage) ? titleInit() : g_moveSettingWindow(false),
|
|
5034
5043
|
}), g_cssObj.button_Back),
|
|
5035
5044
|
|
|
5036
5045
|
createCss2Button(`btnPrecond`, g_lblNameObj.b_precond, () => true,
|
|
@@ -5185,6 +5194,12 @@ const preconditionInit = () => {
|
|
|
5185
5194
|
g_customJsObj.precondition.forEach(func => func());
|
|
5186
5195
|
|
|
5187
5196
|
multiAppend(divRoot,
|
|
5197
|
+
|
|
5198
|
+
// データ管理画面へ移動
|
|
5199
|
+
createCss2Button(`btnReset`, g_lblNameObj.dataReset, () => {
|
|
5200
|
+
dataMgtInit();
|
|
5201
|
+
}, g_lblPosObj.btnReset, g_cssObj.button_Reset),
|
|
5202
|
+
|
|
5188
5203
|
createCss2Button(`btnBack`, g_lblNameObj.b_back, () => true,
|
|
5189
5204
|
Object.assign(g_lblPosObj.btnPrecond, {
|
|
5190
5205
|
resetFunc: () => {
|