pds-dev-kit-web-test 2.5.494 → 2.5.495
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/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +9 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/textSpecFormatOptions.d.ts +7 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/textSpecFormatOptions.js +211 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.js +2 -0
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@ var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverB
|
|
|
28
28
|
var S_CB_Box_1 = require("../components/S_CB_Box");
|
|
29
29
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
30
30
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
31
|
+
var textSpecFormatOptions_1 = require("./textSpecFormatOptions");
|
|
31
32
|
function Text(props) {
|
|
32
33
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
33
34
|
var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
|
|
@@ -76,9 +77,15 @@ function Text(props) {
|
|
|
76
77
|
CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE === 'DELEGATEDDATA';
|
|
77
78
|
if (isDataConnected) {
|
|
78
79
|
if (queryContext === null || queryContext === void 0 ? void 0 : queryContext.queryData) {
|
|
79
|
-
|
|
80
|
+
var FORMATOPTION = props.CB_STYLE_PROP_TEXT.CB_STYLE_PROP_TEXT_SPEC_FORMAT;
|
|
81
|
+
var formatOption = textSpecFormatOptions_1.TEXT_SPEC_FORMAT_OPRIONS[FORMATOPTION];
|
|
82
|
+
var value = queryContext.queryData[CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA];
|
|
83
|
+
if (formatOption) {
|
|
84
|
+
return formatOption.formatter(value);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
80
87
|
}
|
|
81
|
-
return 'ERROR';
|
|
88
|
+
return 'ERROR: data connected but no data';
|
|
82
89
|
}
|
|
83
90
|
if (device === 'MOBILE' &&
|
|
84
91
|
mode !== 'EDIT' &&
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEXT_SPEC_FORMAT_OPRIONS = void 0;
|
|
4
|
+
exports.TEXT_SPEC_FORMAT_OPRIONS = {
|
|
5
|
+
TYPE1: {
|
|
6
|
+
name: 'Thousands comma, No decimal',
|
|
7
|
+
description: '천단위 콤마, 소숫점 없음 (반올림)',
|
|
8
|
+
formatter: function (value) {
|
|
9
|
+
var num = Number(value);
|
|
10
|
+
if (isNaN(num))
|
|
11
|
+
return value; // Return original if not a number
|
|
12
|
+
return new Intl.NumberFormat('en-US', {
|
|
13
|
+
maximumFractionDigits: 0
|
|
14
|
+
}).format(num);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
TYPE2: {
|
|
18
|
+
name: 'Thousands comma, 1 decimal place',
|
|
19
|
+
description: '천단위 콤마, 소숫점 1자리 (반올림)',
|
|
20
|
+
formatter: function (value) {
|
|
21
|
+
var num = Number(value);
|
|
22
|
+
if (isNaN(num))
|
|
23
|
+
return value; // Return original if not a number
|
|
24
|
+
return new Intl.NumberFormat('en-US', {
|
|
25
|
+
minimumFractionDigits: 1,
|
|
26
|
+
maximumFractionDigits: 1
|
|
27
|
+
}).format(num);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
TYPE3: {
|
|
31
|
+
name: 'Thousands comma, 2 decimal places',
|
|
32
|
+
description: '천단위 콤마, 소숫점 2자리 (반올림)',
|
|
33
|
+
formatter: function (value) {
|
|
34
|
+
var num = Number(value);
|
|
35
|
+
if (isNaN(num))
|
|
36
|
+
return value; // Return original if not a number
|
|
37
|
+
return new Intl.NumberFormat('en-US', {
|
|
38
|
+
minimumFractionDigits: 2,
|
|
39
|
+
maximumFractionDigits: 2
|
|
40
|
+
}).format(num);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
TYPE4: {
|
|
44
|
+
name: 'Date (YYYY/MM/DD)',
|
|
45
|
+
description: '날짜 (YYYY/MM/dd)',
|
|
46
|
+
formatter: function (value) {
|
|
47
|
+
var d = new Date(value);
|
|
48
|
+
if (isNaN(d.getTime()))
|
|
49
|
+
return value; // Return original if invalid date
|
|
50
|
+
var yyyy = d.getFullYear();
|
|
51
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
52
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
53
|
+
return "".concat(yyyy, "/").concat(mm, "/").concat(dd);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
TYPE5: {
|
|
57
|
+
name: 'Date (YYYY-MM-DD)',
|
|
58
|
+
description: '날짜 (YYYY-MM-dd)',
|
|
59
|
+
formatter: function (value) {
|
|
60
|
+
var d = new Date(value);
|
|
61
|
+
if (isNaN(d.getTime()))
|
|
62
|
+
return value;
|
|
63
|
+
var yyyy = d.getFullYear();
|
|
64
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
65
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
66
|
+
return "".concat(yyyy, "-").concat(mm, "-").concat(dd);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
TYPE6: {
|
|
70
|
+
name: 'Date (YYYY. MM. DD)',
|
|
71
|
+
description: '날짜 (YYYY. MM. dd)',
|
|
72
|
+
formatter: function (value) {
|
|
73
|
+
var d = new Date(value);
|
|
74
|
+
if (isNaN(d.getTime()))
|
|
75
|
+
return value;
|
|
76
|
+
var yyyy = d.getFullYear();
|
|
77
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
78
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
79
|
+
return "".concat(yyyy, ". ").concat(mm, ". ").concat(dd);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
TYPE7: {
|
|
83
|
+
name: 'Date (YY/MM/DD)',
|
|
84
|
+
description: '날짜 (YY/MM/dd)',
|
|
85
|
+
formatter: function (value) {
|
|
86
|
+
var d = new Date(value);
|
|
87
|
+
if (isNaN(d.getTime()))
|
|
88
|
+
return value;
|
|
89
|
+
var yy = String(d.getFullYear()).slice(-2);
|
|
90
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
91
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
92
|
+
return "".concat(yy, "/").concat(mm, "/").concat(dd);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
TYPE8: {
|
|
96
|
+
name: 'Date (MM/DD/YY)',
|
|
97
|
+
description: '날짜 (MM/dd/YY)',
|
|
98
|
+
formatter: function (value) {
|
|
99
|
+
var d = new Date(value);
|
|
100
|
+
if (isNaN(d.getTime()))
|
|
101
|
+
return value;
|
|
102
|
+
var yy = String(d.getFullYear()).slice(-2);
|
|
103
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
104
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
105
|
+
return "".concat(mm, "/").concat(dd, "/").concat(yy);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
TYPE9: {
|
|
109
|
+
name: 'Date (DD/MM/YY)',
|
|
110
|
+
description: '날짜 (dd/MM/YY)',
|
|
111
|
+
formatter: function (value) {
|
|
112
|
+
var d = new Date(value);
|
|
113
|
+
if (isNaN(d.getTime()))
|
|
114
|
+
return value;
|
|
115
|
+
var yy = String(d.getFullYear()).slice(-2);
|
|
116
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
117
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
118
|
+
return "".concat(dd, "/").concat(mm, "/").concat(yy);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
TYPE10: {
|
|
122
|
+
name: 'Date (YYYY-MM-DD Korean)',
|
|
123
|
+
description: '날짜 (YYYY년 MM월 dd일)',
|
|
124
|
+
formatter: function (value) {
|
|
125
|
+
var d = new Date(value);
|
|
126
|
+
if (isNaN(d.getTime()))
|
|
127
|
+
return value;
|
|
128
|
+
var yyyy = d.getFullYear();
|
|
129
|
+
var mm = d.getMonth() + 1;
|
|
130
|
+
var dd = d.getDate();
|
|
131
|
+
return "".concat(yyyy, "\uB144 ").concat(mm, "\uC6D4 ").concat(dd, "\uC77C");
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
TYPE11: {
|
|
135
|
+
name: 'Date (DD MMM)',
|
|
136
|
+
description: '날짜 (dd MMM)',
|
|
137
|
+
formatter: function (value) {
|
|
138
|
+
var d = new Date(value);
|
|
139
|
+
if (isNaN(d.getTime()))
|
|
140
|
+
return value;
|
|
141
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
142
|
+
var mmm = d.toLocaleString('en-US', { month: 'short' });
|
|
143
|
+
return "".concat(dd, " ").concat(mmm);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
TYPE12: {
|
|
147
|
+
name: 'Date (MM. DD)',
|
|
148
|
+
description: '날짜 (MM. dd)',
|
|
149
|
+
formatter: function (value) {
|
|
150
|
+
var d = new Date(value);
|
|
151
|
+
if (isNaN(d.getTime()))
|
|
152
|
+
return value;
|
|
153
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
154
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
155
|
+
return "".concat(mm, ". ").concat(dd);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
TYPE13: {
|
|
159
|
+
name: 'Datetime (YYYY.MM.DD HH:mm:ss)',
|
|
160
|
+
description: '날짜 (YYYY.MM.dd hh:mm:ss)',
|
|
161
|
+
formatter: function (value) {
|
|
162
|
+
// FIX: Return original value if time info is missing.
|
|
163
|
+
if (!value.includes('T') && !value.includes(':')) {
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
var d = new Date(value);
|
|
167
|
+
if (isNaN(d.getTime()))
|
|
168
|
+
return value;
|
|
169
|
+
var yyyy = d.getFullYear();
|
|
170
|
+
var mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
171
|
+
var dd = String(d.getDate()).padStart(2, '0');
|
|
172
|
+
var hh = String(d.getHours()).padStart(2, '0');
|
|
173
|
+
var min = String(d.getMinutes()).padStart(2, '0');
|
|
174
|
+
var ss = String(d.getSeconds()).padStart(2, '0');
|
|
175
|
+
return "".concat(yyyy, ".").concat(mm, ".").concat(dd, " ").concat(hh, ":").concat(min, ":").concat(ss);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
TYPE14: {
|
|
179
|
+
name: 'Time (HH:mm:ss)',
|
|
180
|
+
description: '시간 (hh:mm:ss)',
|
|
181
|
+
formatter: function (value) {
|
|
182
|
+
// FIX: Return original value if time info is missing.
|
|
183
|
+
if (!value.includes('T') && !value.includes(':')) {
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
var d = new Date(value);
|
|
187
|
+
if (isNaN(d.getTime()))
|
|
188
|
+
return value;
|
|
189
|
+
var hh = String(d.getHours()).padStart(2, '0');
|
|
190
|
+
var min = String(d.getMinutes()).padStart(2, '0');
|
|
191
|
+
var ss = String(d.getSeconds()).padStart(2, '0');
|
|
192
|
+
return "".concat(hh, ":").concat(min, ":").concat(ss);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
TYPE15: {
|
|
196
|
+
name: 'Time (HH:mm)',
|
|
197
|
+
description: '시간 (hh:mm)',
|
|
198
|
+
formatter: function (value) {
|
|
199
|
+
// FIX: Return original value if time info is missing.
|
|
200
|
+
if (!value.includes('T') && !value.includes(':')) {
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
var d = new Date(value);
|
|
204
|
+
if (isNaN(d.getTime()))
|
|
205
|
+
return value;
|
|
206
|
+
var hh = String(d.getHours()).padStart(2, '0');
|
|
207
|
+
var min = String(d.getMinutes()).padStart(2, '0');
|
|
208
|
+
return "".concat(hh, ":").concat(min);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
@@ -77,6 +77,7 @@ export type CB_STYLE_PROP_TEXT_SPECS_BASE = {
|
|
|
77
77
|
CB_STYLE_PROP_TEXT_SPEC_COLOR: STRING_8DIGIT_HEX;
|
|
78
78
|
CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL: ENUM_STRING;
|
|
79
79
|
CB_STYLE_PROP_TEXT_SPEC_VERTICAL: ENUM_STRING;
|
|
80
|
+
CB_STYLE_PROP_TEXT_SPEC_FORMAT: ENUM_STRING;
|
|
80
81
|
};
|
|
81
82
|
export type CB_STYLE_PROP_TEXT_SPECS = CB_STYLE_PROP_TEXT_SPECS_BASE & {
|
|
82
83
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE:HOVER': ENUM_STRING | null | undefined;
|
|
@@ -103,6 +104,9 @@ export type CB_STYLE_PROP_TEXT_SPECS = CB_STYLE_PROP_TEXT_SPECS_BASE & {
|
|
|
103
104
|
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:HOVER': ENUM_STRING | null | undefined;
|
|
104
105
|
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE': ENUM_STRING | null | undefined;
|
|
105
106
|
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE:HOVER': ENUM_STRING | null | undefined;
|
|
107
|
+
'CB_STYLE_PROP_TEXT_SPEC_FORMAT:HOVER': ENUM_STRING | null | undefined;
|
|
108
|
+
'CB_STYLE_PROP_TEXT_SPEC_FORMAT:MOBILE': ENUM_STRING | null | undefined;
|
|
109
|
+
'CB_STYLE_PROP_TEXT_SPEC_FORMAT:MOBILE:HOVER': ENUM_STRING | null | undefined;
|
|
106
110
|
};
|
|
107
111
|
export type CBColorPropsKeys = keyof CB_STYLE_PROP_COLOR_SPECS;
|
|
108
112
|
export type CBColorValueSetType = Partial<Record<keyof CB_STYLE_PROP_COLOR_SPECS, CB_STYLE_PROP_COLOR_ENUM_GRADIENT | NUMBER_INTEGER | ENUM_STRING | undefined>>;
|