@operato/input 9.0.13 → 9.0.17
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/CHANGELOG.md +18 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-input-formula-help-popup.d.ts +18 -0
- package/dist/src/ox-input-formula-help-popup.js +166 -0
- package/dist/src/ox-input-formula-help-popup.js.map +1 -0
- package/dist/src/ox-input-formula.d.ts +2 -0
- package/dist/src/ox-input-formula.js +149 -193
- package/dist/src/ox-input-formula.js.map +1 -1
- package/dist/src/ox-input-secret.d.ts +16 -0
- package/dist/src/ox-input-secret.js +173 -0
- package/dist/src/ox-input-secret.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/translations/en.json +5 -1
- package/translations/ja.json +5 -1
- package/translations/ko.json +5 -1
- package/translations/ms.json +5 -1
- package/translations/zh.json +5 -1
@@ -4,10 +4,12 @@
|
|
4
4
|
import { __decorate } from "tslib";
|
5
5
|
import '@material/web/icon/icon.js';
|
6
6
|
import '@material/web/button/elevated-button.js';
|
7
|
+
import './ox-input-formula-help-popup.js';
|
7
8
|
import '@operato/i18n/ox-i18n.js';
|
8
9
|
import { css, html } from 'lit';
|
9
10
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
10
11
|
import { OxFormField } from '@operato/input';
|
12
|
+
import { ScrollbarStyles } from '@operato/styles';
|
11
13
|
/**
|
12
14
|
* Formula editor component for KPI calculations
|
13
15
|
*
|
@@ -158,6 +160,7 @@ let KpiFormulaEditor = class KpiFormulaEditor extends OxFormField {
|
|
158
160
|
];
|
159
161
|
}
|
160
162
|
static { this.styles = [
|
163
|
+
ScrollbarStyles,
|
161
164
|
css `
|
162
165
|
:host {
|
163
166
|
display: flex;
|
@@ -380,69 +383,80 @@ let KpiFormulaEditor = class KpiFormulaEditor extends OxFormField {
|
|
380
383
|
max-width: 500px;
|
381
384
|
max-height: 400px;
|
382
385
|
overflow-y: auto;
|
386
|
+
background: white;
|
387
|
+
border-radius: 8px;
|
388
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
383
389
|
}
|
384
390
|
|
385
391
|
.help-title {
|
386
|
-
font-size:
|
392
|
+
font-size: 20px;
|
387
393
|
font-weight: 600;
|
388
|
-
margin-bottom:
|
394
|
+
margin-bottom: 16px;
|
389
395
|
color: var(--md-sys-color-primary);
|
396
|
+
padding: 20px 20px 16px 20px;
|
397
|
+
background: #f8f9fa;
|
398
|
+
border-bottom: 1px solid #e0e0e0;
|
399
|
+
border-radius: 8px 8px 0 0;
|
390
400
|
}
|
391
401
|
|
392
402
|
.help-section {
|
393
|
-
margin-bottom:
|
403
|
+
margin-bottom: 16px;
|
404
|
+
padding: 0 20px;
|
394
405
|
}
|
395
406
|
|
396
407
|
.help-section-title {
|
397
|
-
font-weight:
|
398
|
-
margin-bottom:
|
399
|
-
color:
|
408
|
+
font-weight: 600;
|
409
|
+
margin-bottom: 8px;
|
410
|
+
color: #333;
|
411
|
+
font-size: 14px;
|
412
|
+
border-bottom: 1px solid #e0e0e0;
|
413
|
+
padding-bottom: 4px;
|
400
414
|
}
|
401
415
|
|
402
416
|
.help-content {
|
403
417
|
font-size: 14px;
|
404
|
-
line-height: 1.
|
405
|
-
color:
|
418
|
+
line-height: 1.6;
|
419
|
+
color: #555;
|
420
|
+
padding: 4px 0;
|
406
421
|
}
|
407
422
|
|
408
423
|
.help-syntax {
|
409
|
-
background
|
410
|
-
|
424
|
+
background: #f5f5f5;
|
425
|
+
border: 1px solid #e0e0e0;
|
411
426
|
border-radius: 4px;
|
427
|
+
padding: 12px;
|
412
428
|
font-family: 'Courier New', monospace;
|
413
|
-
font-size:
|
414
|
-
|
415
|
-
|
429
|
+
font-size: 13px;
|
430
|
+
color: #333;
|
431
|
+
margin: 8px 0;
|
416
432
|
}
|
417
433
|
|
418
434
|
.help-example {
|
419
|
-
background
|
420
|
-
|
435
|
+
background: #f0f8ff;
|
436
|
+
border: 1px solid #c8e6c9;
|
421
437
|
border-radius: 4px;
|
438
|
+
padding: 12px;
|
422
439
|
font-family: 'Courier New', monospace;
|
423
|
-
font-size:
|
424
|
-
|
425
|
-
|
440
|
+
font-size: 13px;
|
441
|
+
color: #2e7d32;
|
442
|
+
margin: 8px 0;
|
426
443
|
}
|
427
444
|
|
428
445
|
.help-parameters {
|
429
|
-
margin:
|
446
|
+
margin: 8px 0;
|
430
447
|
}
|
431
448
|
|
432
449
|
.help-parameter {
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
.help-parameter-name {
|
440
|
-
font-weight: 500;
|
441
|
-
font-family: 'Courier New', monospace;
|
450
|
+
background: #f8f9fa;
|
451
|
+
border-left: 3px solid var(--md-sys-color-primary);
|
452
|
+
border-radius: 4px;
|
453
|
+
padding: 8px 12px;
|
454
|
+
margin-bottom: 4px;
|
455
|
+
font-size: 13px;
|
442
456
|
}
|
443
457
|
|
444
458
|
.help-parameter-desc {
|
445
|
-
color:
|
459
|
+
color: #555;
|
446
460
|
}
|
447
461
|
|
448
462
|
/* Dialog specific styles */
|
@@ -464,25 +478,27 @@ let KpiFormulaEditor = class KpiFormulaEditor extends OxFormField {
|
|
464
478
|
.dialog-actions {
|
465
479
|
display: flex;
|
466
480
|
justify-content: flex-end;
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
border-
|
481
|
+
padding: 16px 20px;
|
482
|
+
border-top: 1px solid #e0e0e0;
|
483
|
+
background: #f8f9fa;
|
484
|
+
border-radius: 0 0 8px 8px;
|
471
485
|
}
|
472
486
|
|
473
487
|
.close-btn {
|
474
|
-
padding:
|
475
|
-
border: 1px solid var(--md-sys-color-
|
488
|
+
padding: 8px 16px;
|
489
|
+
border: 1px solid var(--md-sys-color-primary);
|
476
490
|
border-radius: 4px;
|
477
|
-
background-color:
|
491
|
+
background-color: var(--md-sys-color-primary);
|
492
|
+
color: white;
|
478
493
|
cursor: pointer;
|
479
494
|
font-size: 14px;
|
495
|
+
font-weight: 500;
|
480
496
|
transition: all 0.2s ease;
|
481
497
|
}
|
482
498
|
|
483
499
|
.close-btn:hover {
|
484
|
-
background-color:
|
485
|
-
border-color:
|
500
|
+
background-color: #1565c0;
|
501
|
+
border-color: #1565c0;
|
486
502
|
}
|
487
503
|
|
488
504
|
.middle-align {
|
@@ -730,170 +746,110 @@ let KpiFormulaEditor = class KpiFormulaEditor extends OxFormField {
|
|
730
746
|
}
|
731
747
|
_showVariableHelp(e, variable) {
|
732
748
|
e.stopPropagation();
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
예시: ${variable.example || '없음'}
|
740
|
-
`.trim();
|
741
|
-
console.log('Variable help:', message);
|
742
|
-
// dialog 지원 여부 확인
|
743
|
-
if (typeof HTMLDialogElement !== 'undefined') {
|
744
|
-
const dialog = document.createElement('dialog');
|
745
|
-
dialog.className = 'help-dialog';
|
746
|
-
// HTML 문자열로 직접 작성
|
747
|
-
dialog.innerHTML = `
|
748
|
-
<div class="help-popup">
|
749
|
-
<div class="help-title">${variable.name}</div>
|
750
|
-
|
751
|
-
${variable.description
|
752
|
-
? `
|
753
|
-
<div class="help-section">
|
754
|
-
<div class="help-section-title">설명</div>
|
755
|
-
<div class="help-content">${variable.description}</div>
|
756
|
-
</div>
|
757
|
-
`
|
758
|
-
: ''}
|
759
|
-
|
760
|
-
${variable.type
|
761
|
-
? `
|
762
|
-
<div class="help-section">
|
763
|
-
<div class="help-section-title">타입</div>
|
764
|
-
<div class="help-content">${variable.type}</div>
|
765
|
-
</div>
|
766
|
-
`
|
767
|
-
: ''}
|
768
|
-
|
769
|
-
${variable.unit
|
770
|
-
? `
|
771
|
-
<div class="help-section">
|
772
|
-
<div class="help-section-title">단위</div>
|
773
|
-
<div class="help-content">${variable.unit}</div>
|
774
|
-
</div>
|
775
|
-
`
|
776
|
-
: ''}
|
777
|
-
|
778
|
-
${variable.help
|
779
|
-
? `
|
780
|
-
<div class="help-section">
|
781
|
-
<div class="help-section-title">상세 설명</div>
|
782
|
-
<div class="help-content">${variable.help}</div>
|
783
|
-
</div>
|
784
|
-
`
|
785
|
-
: ''}
|
786
|
-
|
787
|
-
${variable.example
|
788
|
-
? `
|
789
|
-
<div class="help-section">
|
790
|
-
<div class="help-section-title">사용 예시</div>
|
791
|
-
<div class="help-example">${variable.example}</div>
|
792
|
-
</div>
|
793
|
-
`
|
794
|
-
: ''}
|
795
|
-
</div>
|
796
|
-
|
797
|
-
<div class="dialog-actions">
|
798
|
-
<button class="close-btn" onclick="this.closest('dialog').close()">닫기</button>
|
799
|
-
</div>
|
800
|
-
`;
|
801
|
-
document.body.appendChild(dialog);
|
802
|
-
dialog.showModal();
|
803
|
-
// 외부 클릭으로 닫기
|
804
|
-
dialog.addEventListener('click', event => {
|
805
|
-
const rect = dialog.getBoundingClientRect();
|
806
|
-
const isInDialog = event.clientX >= rect.left &&
|
807
|
-
event.clientX <= rect.right &&
|
808
|
-
event.clientY >= rect.top &&
|
809
|
-
event.clientY <= rect.bottom;
|
810
|
-
if (!isInDialog) {
|
811
|
-
dialog.close();
|
812
|
-
}
|
749
|
+
const sections = [];
|
750
|
+
if (variable.description) {
|
751
|
+
sections.push({
|
752
|
+
title: '설명',
|
753
|
+
content: variable.description,
|
754
|
+
type: 'text'
|
813
755
|
});
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
756
|
+
}
|
757
|
+
if (variable.type) {
|
758
|
+
sections.push({
|
759
|
+
title: '타입',
|
760
|
+
content: variable.type,
|
761
|
+
type: 'text'
|
762
|
+
});
|
763
|
+
}
|
764
|
+
if (variable.unit) {
|
765
|
+
sections.push({
|
766
|
+
title: '단위',
|
767
|
+
content: variable.unit,
|
768
|
+
type: 'text'
|
769
|
+
});
|
770
|
+
}
|
771
|
+
if (variable.help) {
|
772
|
+
sections.push({
|
773
|
+
title: '상세 설명',
|
774
|
+
content: variable.help,
|
775
|
+
type: 'text'
|
818
776
|
});
|
819
|
-
// ESC 키로 닫기
|
820
|
-
const handleEsc = (e) => {
|
821
|
-
if (e.key === 'Escape') {
|
822
|
-
dialog.close();
|
823
|
-
document.removeEventListener('keydown', handleEsc);
|
824
|
-
}
|
825
|
-
};
|
826
|
-
document.addEventListener('keydown', handleEsc);
|
827
777
|
}
|
828
|
-
|
829
|
-
|
830
|
-
|
778
|
+
if (variable.example) {
|
779
|
+
sections.push({
|
780
|
+
title: '사용 예시',
|
781
|
+
content: variable.example,
|
782
|
+
type: 'example'
|
783
|
+
});
|
831
784
|
}
|
785
|
+
const helpContent = {
|
786
|
+
title: variable.name,
|
787
|
+
sections
|
788
|
+
};
|
789
|
+
this._showHelpPopup(helpContent);
|
832
790
|
}
|
833
791
|
_showFunctionHelp(e, func) {
|
834
792
|
e.stopPropagation();
|
793
|
+
const sections = [
|
794
|
+
{
|
795
|
+
title: '설명',
|
796
|
+
content: func.description,
|
797
|
+
type: 'text'
|
798
|
+
},
|
799
|
+
{
|
800
|
+
title: '구문',
|
801
|
+
content: func.syntax,
|
802
|
+
type: 'code'
|
803
|
+
},
|
804
|
+
{
|
805
|
+
title: '매개변수',
|
806
|
+
content: func.parameters.join('\n'),
|
807
|
+
type: 'parameter'
|
808
|
+
},
|
809
|
+
{
|
810
|
+
title: '반환 타입',
|
811
|
+
content: func.returnType,
|
812
|
+
type: 'text'
|
813
|
+
}
|
814
|
+
];
|
815
|
+
if (func.help) {
|
816
|
+
sections.push({
|
817
|
+
title: '상세 설명',
|
818
|
+
content: func.help,
|
819
|
+
type: 'text'
|
820
|
+
});
|
821
|
+
}
|
822
|
+
if (func.examples && func.examples.length > 0) {
|
823
|
+
sections.push({
|
824
|
+
title: '사용 예시',
|
825
|
+
content: func.examples.join('\n'),
|
826
|
+
type: 'example'
|
827
|
+
});
|
828
|
+
}
|
829
|
+
const helpContent = {
|
830
|
+
title: func.name,
|
831
|
+
sections
|
832
|
+
};
|
833
|
+
this._showHelpPopup(helpContent);
|
834
|
+
}
|
835
|
+
_showHelpPopup(content) {
|
835
836
|
const dialog = document.createElement('dialog');
|
836
|
-
dialog.
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
</div>
|
846
|
-
|
847
|
-
<div class="help-section">
|
848
|
-
<div class="help-section-title">구문</div>
|
849
|
-
<div class="help-syntax">${func.syntax}</div>
|
850
|
-
</div>
|
851
|
-
|
852
|
-
<div class="help-section">
|
853
|
-
<div class="help-section-title">매개변수</div>
|
854
|
-
<div class="help-parameters">
|
855
|
-
${func.parameters
|
856
|
-
.map(param => `
|
857
|
-
<div class="help-parameter">
|
858
|
-
<span class="help-parameter-desc">${param}</span>
|
859
|
-
</div>
|
860
|
-
`)
|
861
|
-
.join('')}
|
862
|
-
</div>
|
863
|
-
</div>
|
864
|
-
|
865
|
-
<div class="help-section">
|
866
|
-
<div class="help-section-title">반환 타입</div>
|
867
|
-
<div class="help-content">${func.returnType}</div>
|
868
|
-
</div>
|
869
|
-
|
870
|
-
${func.help
|
871
|
-
? `
|
872
|
-
<div class="help-section">
|
873
|
-
<div class="help-section-title">상세 설명</div>
|
874
|
-
<div class="help-content">${func.help}</div>
|
875
|
-
</div>
|
876
|
-
`
|
877
|
-
: ''}
|
878
|
-
|
879
|
-
${func.examples && func.examples.length > 0
|
880
|
-
? `
|
881
|
-
<div class="help-section">
|
882
|
-
<div class="help-section-title">사용 예시</div>
|
883
|
-
${func.examples
|
884
|
-
.map(example => `
|
885
|
-
<div class="help-example">${example}</div>
|
886
|
-
`)
|
887
|
-
.join('')}
|
888
|
-
</div>
|
889
|
-
`
|
890
|
-
: ''}
|
891
|
-
</div>
|
892
|
-
|
893
|
-
<div class="dialog-actions">
|
894
|
-
<button class="close-btn" onclick="this.closest('dialog').close()">닫기</button>
|
895
|
-
</div>
|
837
|
+
dialog.style.cssText = `
|
838
|
+
border: none;
|
839
|
+
border-radius: 8px;
|
840
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
841
|
+
padding: 0;
|
842
|
+
max-width: 500px;
|
843
|
+
max-height: 80vh;
|
844
|
+
overflow-y: auto;
|
845
|
+
background-color: white;
|
896
846
|
`;
|
847
|
+
const helpPopup = document.createElement('ox-input-formula-help-popup');
|
848
|
+
helpPopup.content = content;
|
849
|
+
helpPopup.onClose = () => {
|
850
|
+
dialog.close();
|
851
|
+
};
|
852
|
+
dialog.appendChild(helpPopup);
|
897
853
|
document.body.appendChild(dialog);
|
898
854
|
dialog.showModal();
|
899
855
|
// 외부 클릭으로 닫기
|