@iyulab/modern-app 0.12.0 → 0.13.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.13.0] - 2026-08-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`u-info-field` accepts `format` (`'number' | 'currency' | 'date'`) and `currency`.**
|
|
8
|
+
When set, the value renders through `@iyulab/components`' `formatNumber`/`formatCurrency`/
|
|
9
|
+
`formatDate` instead of a plain `String(value)`, and `format="number"`/`"currency"` implies
|
|
10
|
+
the existing `numeric` (right-aligned, tabular-nums) styling automatically. `currency` has
|
|
11
|
+
no default — omitting it while `format="currency"` degrades to plain number formatting
|
|
12
|
+
rather than throwing. Existing usage without `format` is unaffected.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **`@iyulab/components` dependency floor raised to `^1.27.0`** (the feature above needs
|
|
17
|
+
`formatNumber`/`formatCurrency`/`formatDate`, added in that release).
|
|
18
|
+
|
|
3
19
|
## [0.12.0] - 2026-08-07
|
|
4
20
|
|
|
5
21
|
### Added
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StyledElement } from '../internals/StyledElement.js';
|
|
2
2
|
type ElementParts = 'host' | 'label' | 'value';
|
|
3
|
+
export type InfoFieldFormat = 'number' | 'currency' | 'date';
|
|
3
4
|
/** 값이 "아직 없음"인가 — `0` 과 `false` 는 **값이다**. */
|
|
4
5
|
export declare function isBlank(v: unknown): boolean;
|
|
5
6
|
/**
|
|
@@ -16,6 +17,7 @@ export declare function isBlank(v: unknown): boolean;
|
|
|
16
17
|
* ```html
|
|
17
18
|
* <u-info-field label="부수" .value=${order.quantity} numeric></u-info-field>
|
|
18
19
|
* <u-info-field label="거래처">동서인쇄</u-info-field> <!-- 슬롯이 value 를 이긴다 -->
|
|
20
|
+
* <u-info-field label="합계" format="currency" currency="KRW" .value=${order.total}></u-info-field>
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
23
|
export declare class InfoField extends StyledElement<ElementParts> {
|
|
@@ -27,7 +29,8 @@ export declare class InfoField extends StyledElement<ElementParts> {
|
|
|
27
29
|
* ⚠`0`·`false` 는 **대체되지 않는다** — 값이기 때문이다.
|
|
28
30
|
* 속성(`value="…"`)과 프로퍼티(`.value=`) 둘 다 받는다 — HTML 속성은 항상 문자열이라
|
|
29
31
|
* `type: String` 변환기가 붙어도 `.value=${order.quantity}` 같은 비-문자열 프로퍼티
|
|
30
|
-
* 바인딩은 그대로 통과한다(변환기는 속성 파싱에만 관여한다). 렌더는
|
|
32
|
+
* 바인딩은 그대로 통과한다(변환기는 속성 파싱에만 관여한다). 렌더는 `format` 이 없으면
|
|
33
|
+
* 항상 `String(value)`.
|
|
31
34
|
*/
|
|
32
35
|
value?: unknown;
|
|
33
36
|
/** "아직 없음"을 나타낼 문구. */
|
|
@@ -35,9 +38,21 @@ export declare class InfoField extends StyledElement<ElementParts> {
|
|
|
35
38
|
/**
|
|
36
39
|
* 숫자 값 — 우정렬 + 고정폭 숫자(`tabular-nums`).
|
|
37
40
|
* ★자릿수가 세로로 맞아야 크기 비교가 눈으로 된다. LOB 화면은 금액·수량이 절반이다.
|
|
41
|
+
* `format` 이 `'number'`/`'currency'` 면 이 정렬이 자동으로 함의된다 — 따로 켤 필요 없다.
|
|
38
42
|
*/
|
|
39
43
|
numeric: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Renders the value through `@iyulab/components`' `formatNumber`/`formatCurrency`/
|
|
46
|
+
* `formatDate`. When unset (default), falls back to plain `String(value)` as before.
|
|
47
|
+
*/
|
|
48
|
+
format?: InfoFieldFormat;
|
|
49
|
+
/**
|
|
50
|
+
* Currency code to use when `format="currency"` (e.g. `'KRW'`). **No default** — if
|
|
51
|
+
* omitted, degrades to plain number formatting without a currency symbol (does not throw).
|
|
52
|
+
*/
|
|
53
|
+
currency?: string;
|
|
40
54
|
private get hasSlotted();
|
|
55
|
+
private formatValue;
|
|
41
56
|
render(): import('lit-html').TemplateResult<1>;
|
|
42
57
|
}
|
|
43
58
|
declare global {
|
|
@@ -4,11 +4,12 @@ import { StyledElement as n } from "../internals/StyledElement.js";
|
|
|
4
4
|
import { styles as r } from "./InfoField.styles.js";
|
|
5
5
|
import { html as i } from "lit";
|
|
6
6
|
import { customElement as a, property as o } from "lit/decorators.js";
|
|
7
|
+
import { formatCurrency as s, formatDate as c, formatNumber as l } from "@iyulab/components";
|
|
7
8
|
//#region src/components/InfoField.ts
|
|
8
|
-
function
|
|
9
|
+
function u(e) {
|
|
9
10
|
return e == null || typeof e == "string" && e.trim() === "";
|
|
10
11
|
}
|
|
11
|
-
var
|
|
12
|
+
var d = class extends n {
|
|
12
13
|
constructor(...e) {
|
|
13
14
|
super(...e), this.label = "", this.blank = "—", this.numeric = !1;
|
|
14
15
|
}
|
|
@@ -18,16 +19,19 @@ var c = class extends n {
|
|
|
18
19
|
get hasSlotted() {
|
|
19
20
|
return this.childNodes.length > 0 && [...this.childNodes].some((e) => e.nodeType !== Node.TEXT_NODE || (e.textContent ?? "").trim() !== "");
|
|
20
21
|
}
|
|
22
|
+
formatValue() {
|
|
23
|
+
return this.format === "currency" ? this.currency ? s(Number(this.value), this.currency) : l(Number(this.value)) : this.format === "number" ? l(Number(this.value)) : this.format === "date" ? c(this.value) : String(this.value);
|
|
24
|
+
}
|
|
21
25
|
render() {
|
|
22
|
-
let e = !this.hasSlotted &&
|
|
26
|
+
let e = !this.hasSlotted && u(this.value), t = this.numeric || this.format === "number" || this.format === "currency";
|
|
23
27
|
return i`
|
|
24
28
|
<div class="label" part="label">${this.label}</div>
|
|
25
|
-
<div class="value ${
|
|
26
|
-
${this.hasSlotted ? i`<slot></slot>` : e ? this.blank :
|
|
29
|
+
<div class="value ${t ? "numeric" : ""} ${e ? "blank" : ""}" part="value">
|
|
30
|
+
${this.hasSlotted ? i`<slot></slot>` : e ? this.blank : this.formatValue()}
|
|
27
31
|
</div>
|
|
28
32
|
`;
|
|
29
33
|
}
|
|
30
34
|
};
|
|
31
|
-
t([o({ type: String }), e("design:type", Object)],
|
|
35
|
+
t([o({ type: String }), e("design:type", Object)], d.prototype, "label", void 0), t([o({ type: String }), e("design:type", Object)], d.prototype, "value", void 0), t([o({ type: String }), e("design:type", Object)], d.prototype, "blank", void 0), t([o({ type: Boolean }), e("design:type", Object)], d.prototype, "numeric", void 0), t([o({ type: String }), e("design:type", Object)], d.prototype, "format", void 0), t([o({ type: String }), e("design:type", String)], d.prototype, "currency", void 0), d = t([a("u-info-field")], d);
|
|
32
36
|
//#endregion
|
|
33
|
-
export {
|
|
37
|
+
export { d as InfoField, u as isBlank };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/modern-app",
|
|
3
3
|
"description": "web-framework by iyulab based on lit-element",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"web-framework",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"typecheck": "tsc --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@iyulab/components": "^1.
|
|
56
|
+
"@iyulab/components": "^1.27.0",
|
|
57
57
|
"@iyulab/router": "^0.11.0",
|
|
58
58
|
"i18next": "^26.3.6",
|
|
59
59
|
"lit": "^3.3.3"
|
|
@@ -34,10 +34,16 @@ and those are different states of the business. So the component owns the rule.
|
|
|
34
34
|
| `value` | `unknown` | — | | Value; property only (`attribute: false`) |
|
|
35
35
|
| `blank` | `string` | `'—'` | | Placeholder for null/undefined/empty — **not** for `0` or `false` |
|
|
36
36
|
| `numeric` | `boolean` | `false` | | Right-align with tabular figures so digits line up vertically |
|
|
37
|
+
| `format` | `'number'\|'currency'\|'date'` | — | | Renders `value` through `@iyulab/components`' `formatNumber`/`formatCurrency`/`formatDate`; unset falls back to plain `String(value)` |
|
|
38
|
+
| `currency` | `string` | — | | Currency code for `format="currency"` (e.g. `'KRW'`); omitted degrades to plain number formatting, does not throw |
|
|
37
39
|
|
|
38
40
|
⚠ `numeric` earns its keep in **tables**, where columns of figures are compared by eye. On a
|
|
39
41
|
lone field it just pushes the value away from its label.
|
|
40
42
|
|
|
43
|
+
```html
|
|
44
|
+
<u-info-field label="Total" format="currency" currency="KRW" .value=${order.total}></u-info-field>
|
|
45
|
+
```
|
|
46
|
+
|
|
41
47
|
## CSS Parts
|
|
42
48
|
|
|
43
49
|
| Part | Description |
|