@simplysm/sd-claude 14.0.89 โ 14.0.90
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/claude/references/sd-simplysm14/README.md +16 -17
- package/claude/references/sd-simplysm14/apis/angular/README.md +52 -30
- package/claude/references/sd-simplysm14/apis/angular/controls.md +200 -38
- package/claude/references/sd-simplysm14/apis/angular/crud.md +41 -53
- package/claude/references/sd-simplysm14/apis/angular/directives.md +66 -22
- package/claude/references/sd-simplysm14/apis/angular/features.md +127 -40
- package/claude/references/sd-simplysm14/apis/angular/infra.md +60 -43
- package/claude/references/sd-simplysm14/apis/angular/layout.md +56 -20
- package/claude/references/sd-simplysm14/apis/angular/overlay.md +74 -74
- package/claude/references/sd-simplysm14/apis/angular/routing-appstructure.md +50 -40
- package/claude/references/sd-simplysm14/apis/angular/selection-managers.md +55 -15
- package/claude/references/sd-simplysm14/apis/angular/shared-data.md +59 -42
- package/claude/references/sd-simplysm14/apis/angular/sheet.md +77 -62
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-auto-update/README.md +8 -7
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-file-system/README.md +71 -43
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-intent/README.md +22 -14
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-usb-storage/README.md +19 -19
- package/claude/references/sd-simplysm14/apis/core-browser/README.md +17 -17
- package/claude/references/sd-simplysm14/apis/core-browser/dom-element.md +28 -28
- package/claude/references/sd-simplysm14/apis/core-browser/indexed-db.md +37 -37
- package/claude/references/sd-simplysm14/apis/core-common/README.md +87 -219
- package/claude/references/sd-simplysm14/apis/core-common/array-ext.md +54 -98
- package/claude/references/sd-simplysm14/apis/core-common/async-runtime.md +57 -99
- package/claude/references/sd-simplysm14/apis/core-common/datetime.md +60 -103
- package/claude/references/sd-simplysm14/apis/core-common/errors.md +42 -47
- package/claude/references/sd-simplysm14/apis/core-common/obj.md +42 -88
- package/claude/references/sd-simplysm14/apis/core-common/serialization.md +55 -0
- package/claude/references/sd-simplysm14/apis/core-node/README.md +6 -7
- package/claude/references/sd-simplysm14/apis/core-node/consola.md +17 -12
- package/claude/references/sd-simplysm14/apis/core-node/cpx.md +14 -13
- package/claude/references/sd-simplysm14/apis/core-node/fs-watcher.md +9 -8
- package/claude/references/sd-simplysm14/apis/core-node/fsx.md +14 -13
- package/claude/references/sd-simplysm14/apis/core-node/pathx.md +4 -8
- package/claude/references/sd-simplysm14/apis/core-node/worker.md +14 -12
- package/claude/references/sd-simplysm14/apis/excel/README.md +22 -22
- package/claude/references/sd-simplysm14/apis/excel/cell.md +37 -29
- package/claude/references/sd-simplysm14/apis/excel/conditional-format.md +29 -15
- package/claude/references/sd-simplysm14/apis/excel/style.md +33 -27
- package/claude/references/sd-simplysm14/apis/excel/utils.md +29 -19
- package/claude/references/sd-simplysm14/apis/excel/workbook-worksheet.md +78 -55
- package/claude/references/sd-simplysm14/apis/excel/wrapper.md +42 -45
- package/claude/references/sd-simplysm14/apis/orm-common/README.md +6 -8
- package/claude/references/sd-simplysm14/apis/orm-common/db-context.md +118 -67
- package/claude/references/sd-simplysm14/apis/orm-common/expr.md +83 -86
- package/claude/references/sd-simplysm14/apis/orm-common/queryable.md +102 -93
- package/claude/references/sd-simplysm14/apis/orm-common/schema.md +138 -81
- package/claude/references/sd-simplysm14/apis/orm-common/types.md +49 -44
- package/claude/references/sd-simplysm14/apis/orm-node/README.md +42 -42
- package/claude/references/sd-simplysm14/apis/orm-node/db-conn.md +44 -33
- package/claude/references/sd-simplysm14/apis/sd-cli/README.md +11 -10
- package/claude/references/sd-simplysm14/apis/service-client/README.md +56 -52
- package/claude/references/sd-simplysm14/apis/service-client/orm.md +33 -28
- package/claude/references/sd-simplysm14/apis/service-client/transport.md +23 -21
- package/claude/references/sd-simplysm14/apis/service-common/README.md +83 -48
- package/claude/references/sd-simplysm14/apis/service-common/app-structure.md +126 -34
- package/claude/references/sd-simplysm14/apis/service-common/protocol.md +109 -54
- package/claude/references/sd-simplysm14/apis/service-server/README.md +69 -81
- package/claude/references/sd-simplysm14/apis/service-server/service-authoring.md +46 -43
- package/claude/references/sd-simplysm14/apis/service-server/transport-internals.md +63 -37
- package/claude/references/sd-simplysm14/apis/service-server/v1-legacy.md +40 -30
- package/claude/references/sd-simplysm14/apis/storage/README.md +17 -17
- package/claude/references/sd-simplysm14/manuals/client-app-structure.md +142 -140
- package/claude/references/sd-simplysm14/manuals/client-orm.md +1 -1
- package/claude/references/sd-simplysm14/manuals/client-service.md +19 -7
- package/claude/references/sd-simplysm14/manuals/client-shared-data.md +2 -2
- package/claude/references/sd-simplysm14/manuals/client-system-log.md +11 -3
- package/claude/references/sd-simplysm14/manuals/data-log.md +0 -1
- package/claude/references/sd-simplysm14/manuals/orm.md +16 -0
- package/claude/rules/sd-design-rules.md +10 -0
- package/claude/skills/sd-demo/SKILL.md +0 -6
- package/claude/skills/sd-docs/SKILL.md +58 -0
- package/claude/{workflows/sd-docs.rules.md โ skills/sd-docs/references/subagent-prompt.md} +103 -103
- package/claude/skills/sd-impl/SKILL.md +7 -4
- package/claude/skills/sd-spec/SKILL.md +842 -15
- package/claude/skills/sd-spec/references/example-spec.md +26 -36
- package/package.json +1 -1
- package/claude/references/sd-simplysm14/apis/core-common/json-transfer.md +0 -53
- package/claude/skills/sd-spec/references/spec-authoring.md +0 -519
- package/claude/workflows/sd-docs.js +0 -84
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# @simplysm/core-node โ worker
|
|
2
2
|
|
|
3
|
-
`worker_threads` ๋ฅผ ํ์
์์ ํ๊ฒ ์ฐ๊ธฐ ์ํ
|
|
3
|
+
`worker_threads` ๋ฅผ ํ์
์์ ํ๊ฒ ์ฐ๊ธฐ ์ํ ๋ํผ (`packages/core-node/src/worker/*`). ์์ปค ํ์ผ์์ `createWorker(methods)` ๋ก ๋ฉ์๋ ๋ฌถ์์ ๋ง๋ค์ด `export default` ํ๊ณ , ๋ฉ์ธ์์ `Worker.create<typeof import("./worker")>(path)` ๋ก ํ๋ก์๋ฅผ ๋ง๋ค์ด `await worker.method(...)` ์ฒ๋ผ ํธ์ถ. ๋ฉ์์ง ์ง๋ ฌํ๋ `@simplysm/core-common` ์ `transfer`(Date ๋ฑ ํน์ํ์
ยทtransferList ์ง์)๋ฅผ ์ฌ์ฉํ๋ค. ๊ฐ๋ฐ(`.ts`)ยทํ๋ก๋์
(`.js`) ์์ชฝ์ ์๋ ๋ถ๊ธฐํ๋ค.
|
|
4
4
|
|
|
5
5
|
## createWorker (์์ปค ์ค๋ ๋ ์ธก)
|
|
6
6
|
|
|
7
7
|
- `createWorker<TMethods, TEvents>(methods): { send; __methods; __events }` โ ์์ปค ์ค๋ ๋ ์ง์
ํ์ผ์์ ํธ์ถํ๊ณ ๊ทธ ๋ฐํ์ `export default`. `parentPort` ๊ฐ ์์ผ๋ฉด(์์ปค ์ปจํ
์คํธ ์๋) `SdError` throw. ๋ฉ์๋ ํธ์ถ ๋ฉ์์ง๋ฅผ ์์ ํด ์คํ ํ ๊ฒฐ๊ณผ/์๋ฌ๋ฅผ ์๋ตํ๊ณ , ์์ปค์ `process.stdout.write` ๋ฅผ ๊ฐ๋ก์ฑ ๋ฉ์ธ์ผ๋ก ๋ก๊ทธ๋ฅผ ์ ๋ฌํ๋ค.
|
|
8
|
-
- `methods: TMethods` (`Record<string, (...args) => unknown>`) โ ์์ปค๊ฐ ์ ๊ณตํ ๋ฉ์๋ ๋งต. ๋๊ธฐ/๋น๋๊ธฐ ๋ชจ๋ ๊ฐ๋ฅ(await
|
|
9
|
-
- ์ ๋ค๋ฆญ `TEvents extends Record<string, unknown>` โ ์์ปค๊ฐ ๋ณด๋ผ ์ด๋ฒคํธ๋ช
โ๋ฐ์ดํฐ ํ์
๋งต(๋ฉ์ธ์ `on` ํ์
์ถ๋ก ์ ์ฌ์ฉ).
|
|
10
|
-
- ๋ฐํ `send<K extends keyof TEvents & string>(event, data?)` โ ์์ปคโ๋ฉ์ธ ์ด๋ฒคํธ ์ ์ก. ์งํ๋ฅ ๋ฑ ๋ฉ์๋ ๋ฐํ๊ณผ
|
|
11
|
-
- ๋ฐํ `__methods
|
|
8
|
+
- `methods: TMethods` (`Record<string, (...args: any[]) => unknown>`) โ ์์ปค๊ฐ ์ ๊ณตํ ๋ฉ์๋ ๋งต. ๋๊ธฐ/๋น๋๊ธฐ ๋ชจ๋ ๊ฐ๋ฅ(๋ด๋ถ์์ await). ์ ์ ์๋ ๋ฉ์๋ ํธ์ถ ์ `SdError("์ ์ ์๋ ๋ฉ์๋: ...")` ๋ก ์๋ต.
|
|
9
|
+
- ์ ๋ค๋ฆญ `TEvents extends Record<string, unknown>`(๊ธฐ๋ณธ `Record<string, never>`) โ ์์ปค๊ฐ ๋ณด๋ผ ์ด๋ฒคํธ๋ช
โ๋ฐ์ดํฐ ํ์
๋งต(๋ฉ์ธ์ `on` ํ์
์ถ๋ก ์ ์ฌ์ฉ).
|
|
10
|
+
- ๋ฐํ `send<K extends keyof TEvents & string>(event, data?): void` โ ์์ปคโ๋ฉ์ธ ์ด๋ฒคํธ ์ ์ก. ์งํ๋ฅ ๋ฑ ๋ฉ์๋ ๋ฐํ๊ณผ ๋ณ๊ฐ์ ํต์ง์ ์ฌ์ฉ.
|
|
11
|
+
- ๋ฐํ `__methods` / `__events` โ ํ์
์ถ๋ก ์ฉ ๋ง์ปค. ๋ฐํ์ ๊ฐ์ด ์๋๋ผ `Worker.create<typeof import(...)>` ์ ํ์
์์๋ง ์ฐธ์กฐ๋จ.
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
// worker.ts
|
|
14
|
+
// worker.ts (์์ปค ์ค๋ ๋ ์ง์
)
|
|
15
|
+
import { createWorker } from "@simplysm/core-node";
|
|
15
16
|
interface MyEvents { progress: number; }
|
|
16
17
|
const methods = {
|
|
17
18
|
calc: (x: number) => { sender.send("progress", 50); return x * 2; },
|
|
@@ -25,10 +26,10 @@ export default sender;
|
|
|
25
26
|
- `Worker.create<TModule extends WorkerModule>(filePath, opt?): WorkerProxy<TModule>` โ ์์ปค ์ค๋ ๋๋ฅผ ๋์ฐ๊ณ ๋ฉ์๋ ํ๋ก์๋ฅผ ๋ฐํ. ๋ฉ์๋ ํธ์ถ์ ๋ฉ์์ง๋ก ์ ๋ฌ๋์ด ๊ฒฐ๊ณผ๊ฐ Promise ๋ก resolve/reject ๋๋ค. ์์ปค stdout/stderr ๋ ๋ฉ์ธ ํ๋ก์ธ์ค๋ก ํ์ดํ๋๋ฉฐ, ์์ปค ๋น์ ์ ์ข
๋ฃ(exit codeโ 0)ยทerror ์ ๋๊ธฐ ์ค์ธ ๋ชจ๋ ํธ์ถ์ด reject ๋๋ค. ๋ก๊ฑฐ ํ๊ทธ `sd-worker`.
|
|
26
27
|
- `filePath: string` โ ์์ปค ํ์ผ ๊ฒฝ๋ก. `file://` URL ๋๋ ์ ๋ ๊ฒฝ๋ก. ํ์ฅ์๊ฐ `.ts` ๋ฉด dev ๋ชจ๋๋ก `lib/worker-dev-proxy.js`(tsx ๋ก TS ๋์ ๋ก๋)๋ฅผ ํตํด ์คํ, `.js` ๋ฉด ์ง์ ์คํ.
|
|
27
28
|
- `opt?: Omit<WorkerRawOptions, "stdout" | "stderr">` โ worker_threads ์ต์
(stdout/stderr ๋ ๋ด๋ถ ๊ณ ์ ์ด๋ผ ์ ์ธ). `env` ๋ `process.env` ์ ๋ณํฉ ์ ๋ฌ, `argv` ๋ dev ๋ชจ๋์์ ์์ปค ๊ฒฝ๋ก ๋ค์ ์ด์ด ๋ถ์.
|
|
28
|
-
- ๋ฐํ `WorkerProxy<TModule>` โ ์๋.
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
|
-
// main.ts
|
|
31
|
+
// main.ts (๋ฉ์ธ ์ธก)
|
|
32
|
+
import { Worker } from "@simplysm/core-node";
|
|
32
33
|
const worker = Worker.create<typeof import("./worker")>("./worker.ts");
|
|
33
34
|
worker.on("progress", (p) => console.log(p));
|
|
34
35
|
const result = await worker.calc(10); // 20
|
|
@@ -39,14 +40,15 @@ await worker.terminate();
|
|
|
39
40
|
|
|
40
41
|
`Worker.create` ๋ฐํ ํ๋ก์. ์์ปค ๋ฉ์๋ + ์์ฝ ๋ฉ์๋ 3์ข
์ ์ ๊ณต.
|
|
41
42
|
|
|
42
|
-
- ๋ฉ์๋ ํ๋ก์: `TModule["default"]["__methods"]` ์ ๊ฐ ๋ฉ์๋๊ฐ `(...args) => Promise<Awaited<R>>` ๋ก ๋
ธ์ถ(`PromisifyMethods`). ๋๊ธฐ ๋ฉ์๋๋ ํญ์ Promise
|
|
43
|
+
- ๋ฉ์๋ ํ๋ก์: `TModule["default"]["__methods"]` ์ ๊ฐ ๋ฉ์๋๊ฐ `(...args) => Promise<Awaited<R>>` ๋ก ๋
ธ์ถ(`PromisifyMethods`). ๋๊ธฐ ๋ฉ์๋๋ postMessage ๊ธฐ๋ฐ์ด๋ผ ํญ์ Promise.
|
|
43
44
|
- `on<TEventName>(event, listener): void` โ ์์ปค `send` ์ด๋ฒคํธ ๊ตฌ๋
. `event`/`listener` ํ์
์ `TEvents` ์์ ์ถ๋ก .
|
|
44
45
|
- `off<TEventName>(event, listener): void` โ ์ด๋ฒคํธ ๊ตฌ๋
ํด์ .
|
|
45
46
|
- `terminate(): Promise<void>` โ ์์ปค ์ข
๋ฃ. ๋๊ธฐ ์ค ํธ์ถ์ "์์ปค๊ฐ ์ข
๋ฃ๋์์ต๋๋ค" ๋ก reject ํ ์ค๋ ๋ ์ข
๋ฃ.
|
|
46
47
|
|
|
47
48
|
## ํ์
|
|
48
49
|
|
|
49
|
-
- `interface WorkerModule { default: { __methods: Record<string, (...args) => unknown>; __events: Record<string, unknown> } }` โ `Worker.create` ์ ์ ๋ค๋ฆญ ์ ์ฝ. `typeof import("./worker")` ๊ฐ ์ด ๊ตฌ์กฐ๋ฅผ ๋ง์กฑ(=`createWorker` ๋ฐํ์ default export).
|
|
50
|
-
- `type PromisifyMethods<TMethods>` โ ๊ฐ ๋ฉ์๋ ๋ฐํ์ `Promise<Awaited<R>>` ๋ก ๋ฐ๊พธ๋ ๋งคํ ํ์
.
|
|
50
|
+
- `interface WorkerModule { default: { __methods: Record<string, (...args: any[]) => unknown>; __events: Record<string, unknown> } }` โ `Worker.create` ์ ์ ๋ค๋ฆญ ์ ์ฝ. `typeof import("./worker")` ๊ฐ ์ด ๊ตฌ์กฐ๋ฅผ ๋ง์กฑ(=`createWorker` ๋ฐํ์ default export).
|
|
51
|
+
- `type PromisifyMethods<TMethods>` โ ๊ฐ ๋ฉ์๋ ๋ฐํ์ `Promise<Awaited<R>>` ๋ก ๋ฐ๊พธ๋ ๋งคํ ํ์
. ํจ์๊ฐ ์๋ ๋ฉค๋ฒ๋ `never`.
|
|
51
52
|
- `type WorkerProxy<TModule>` โ ์ ํ๋ก์ ํ์
.
|
|
52
|
-
- `interface WorkerRequest { id; method; params }`
|
|
53
|
+
- `interface WorkerRequest { id: string; method: string; params: unknown[] }` โ ๋ด๋ถ ์์ฒญ ๋ฉ์์ง.
|
|
54
|
+
- `type WorkerResponse` โ ๋ด๋ถ ์๋ต ๋ฉ์์ง union: `return`(๊ฒฐ๊ณผ) / `error`(Error) / `event`(์์ปค send) / `log`(stdout ์ ๋ฌ). ์ง์ ๋ค๋ฃฐ ์ผ์ ๊ฑฐ์ ์์.
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
# @simplysm/excel
|
|
2
2
|
|
|
3
|
-
OOXML(.xlsx) ์ํฌ๋ถ์ ZIP ๋จ์ lazy-load ๋ก ์ฝ๊ณ ์ฐ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ. ๋์ฉ๋ ํ์ผ์์๋ ์ ๊ทผํ ์
์ ํ์ํ XML ํํธ(SharedStrings/Styles ๋ฑ)๋ง ๊ทธ๋๊ทธ๋
|
|
3
|
+
OOXML(.xlsx) ์ํฌ๋ถ์ ZIP ๋จ์ lazy-load ๋ก ์ฝ๊ณ ์ฐ๋ ์์ TypeScript ๋ผ์ด๋ธ๋ฌ๋ฆฌ. ๋์ฉ๋ ํ์ผ์์๋ ์ ๊ทผํ ์
์ ํ์ํ XML ํํธ(SharedStrings/Styles ๋ฑ)๋ง ๊ทธ๋๊ทธ๋ ๋ก๋ํ๋ฏ๋ก ๋ชจ๋ ์
๋ฉ์๋๊ฐ `async` ๋ค. `ExcelWorkbook` ์ง์
์ ์์ ์ํธ ์ถ๊ฐยท์
๊ฐ/์์ยท์คํ์ผยท์กฐ๊ฑด๋ถ ์์ยท์ด๋ฏธ์งยทํ ๋ณต์ฌยท๋ทฐ ์ค์ ์ ๋ค๋ฃจ๋ฉฐ, Zod ์คํค๋ง ๊ธฐ๋ฐ `ExcelWrapper` ๋ก ๋ ์ฝ๋ ๋ฐฐ์ด โ ์์
๋ณํ๋ ์ง์ํ๋ค. ์ธ๋ถ ์์กด์ `@simplysm/core-common`(DateOnly/DateTime/Time/Bytes), `zod`, `mime` ๋ฟ.
|
|
4
4
|
|
|
5
5
|
## ์ฌ์ฉ ํธ๋ฆฌ๊ฑฐ ์ธ๋ฑ์ค
|
|
6
6
|
|
|
7
|
-
- **ExcelWorkbook / ExcelWorksheet** โ .xlsx
|
|
7
|
+
- **ExcelWorkbook / ExcelWorksheet** โ .xlsx ๋ฅผ ์ด๊ฑฐ๋ ์๋ก ๋ง๋ค๊ณ ์ํธ๋ฅผ ์ถ๊ฐ/์กฐํํ๋ฉฐ ๋ฐ์ดํธยทBlob ๋ก ๋ด๋ณด๋ผ ๋. ์ํธ ๋จ์ ๋ฐ์ดํฐ ํ
์ด๋ธยท๋งคํธ๋ฆญ์คยท๋ ์ฝ๋ ์ฐ๊ธฐยทํ ๋ณต์ฌ/์ฝ์
ยท์ด๋ฏธ์งยท๋ทฐ(zoom/freeze/ํญ์) ์ฒ๋ฆฌ ํฌํจ. ์์ธํ: [workbook-worksheet.md](./workbook-worksheet.md)
|
|
8
8
|
- **ExcelCell / ExcelRow / ExcelCol** โ ๊ฐ๋ณ ์
์ ๊ฐยท์์ยท๋ณํฉยท์คํ์ผ์ ์ฝ๊ณ ์ฐ๊ฑฐ๋ ํ/์ด ๋จ์๋ก ์
์ ์ํํ๊ณ ์ด ๋๋น๋ฅผ ์ค ๋. ์์ธํ: [cell.md](./cell.md)
|
|
9
9
|
- **์
์คํ์ผ (ExcelStyleOptions / ExcelFont)** โ ์
(`cell.setStyle`) ๋๋ ์ํฌ๋ถ default(`wb.setDefaultStyle`)์ ๋ฐฐ๊ฒฝยทํ
๋๋ฆฌยท์ ๋ ฌยท์ซ์ํ์ยทํฐํธ๋ฅผ ์ง์ ํ ๋. ์์ธํ: [style.md](./style.md)
|
|
10
10
|
- **์กฐ๊ฑด๋ถ ์์ (ExcelConditionalRule / ExcelConditionalRuleStyle)** โ ์
/๋ฒ์์ ๊ฐ ๋น๊ตยทํ
์คํธ ๋งค์นญยท์์ ๊ธฐ๋ฐ native CF ๊ท์น์ ์ถ๊ฐํ ๋. ์์ธํ: [conditional-format.md](./conditional-format.md)
|
|
11
11
|
- **ExcelWrapper** โ Zod ์คํค๋ง๋ก ํค๋ ๋งคํยทํ์
๋ณํยท์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ์๋ํํด ๋ ์ฝ๋ ๋ฐฐ์ด โ ์์
์ ๋ณํํ ๋. ์์ธํ: [wrapper.md](./wrapper.md)
|
|
12
12
|
- **ExcelUtils** โ ์
์ฃผ์(A1 โ ์ขํ) ๋ณํ, ์์
๋ ์ง ์๋ฆฌ์ผ โ ํ์์คํฌํ ๋ณํ, ์ซ์ํ์ ์ฝ๋/ID/์ด๋ฆ ์ํธ ๋ณํ์ด ํ์ํ ๋. ์์ธํ: [utils.md](./utils.md)
|
|
13
|
-
- **๊ฐ/์ฃผ์/ํ์ ํ์
** โ ์
๊ฐ ์ ๋์จยท์ซ์ํ์ ํ๋ฆฌ์
ยท์
ํ์
ยท์ฃผ์
|
|
13
|
+
- **๊ฐ/์ฃผ์/ํ์ ํ์
** โ ์
๊ฐ ์ ๋์จยท์ซ์ํ์ ํ๋ฆฌ์
ยท์
ํ์
ยท์ฃผ์ ์ขํยท์ ๋ ฌ/ํ
๋๋ฆฌ/๋ฐ์ค enum ์ ์๊ทธ๋์ฒ์์ ์ฐธ์กฐํ ๋. ์๋ ์ธ๋ผ์ธ ์น์
์ฐธ์กฐ.
|
|
14
14
|
- **OOXML XML-shape ํ์
** โ `ExcelXml*` / `Excel*Data` ๋ฅ. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด๋ถ XML ํ์/์ง๋ ฌํ๊ธฐ๊ฐ ์ฐ๋ OOXML ๋
ธ๋ ๊ตฌ์กฐ ํ์
. ์๋ ์ธ๋ผ์ธ ์น์
์ฐธ์กฐ.
|
|
15
15
|
|
|
16
16
|
## ๊ฐ/์ฃผ์/ํ์ ํ์
|
|
17
17
|
|
|
18
|
-
`./types` ๊ฐ ๋
ธ์ถํ๋ ์ฌ์ฉ์ ๋๋ฉด ํ์
. ์
๊ฐ์ ๋ค๋ฃจ๊ฑฐ๋ ๋ฉ์๋ ์๊ทธ๋์ฒ๋ฅผ ํด์ํ ๋ ์ฐธ์กฐ.
|
|
18
|
+
`./types` ๊ฐ ๋
ธ์ถํ๋ ์ฌ์ฉ์ ๋๋ฉด ๊ฐ/ํ์ ํ์
. ์
๊ฐ์ ๋ค๋ฃจ๊ฑฐ๋ ๋ฉ์๋ ์๊ทธ๋์ฒ๋ฅผ ํด์ํ ๋ ์ฐธ์กฐ.
|
|
19
19
|
|
|
20
|
-
- `ExcelValueType` = `number | string | DateOnly | DateTime | Time | boolean | undefined` โ ์
์ด ๊ฐ์ง ์ ์๋ ๊ฐ ์ ๋์จ. `getValue()` ๋ฐํยท`setValue()` ์ธ์ ํ์
. `undefined` = "๊ฐ ์์"(์ฝ๊ธฐ ์ ๋น ์
, ์ฐ๊ธฐ ์ ์
์ญ์ )์ด๋ฏ๋ก ๊ฒฐ์ธก์ ๋๊น์ง ๋ณด์กด. `DateOnly`/`DateTime`/`Time` ์ `@simplysm/core-common`
|
|
21
|
-
- `ExcelNumberFormat` = `"number" | "string" | "DateOnly" | "DateTime" | "Time"` โ ์ซ์ํ์ ํ๋ฆฌ์
์ด๋ฆ. `"number"` = ์ผ๋ฐ ์์น, `"string"` = ํ
์คํธ ํ์,
|
|
22
|
-
- `ExcelCellType` = `"s" | "b" | "str" | "n" | "inlineStr" | "e"` โ OOXML ์
`t` ์์ฑ. `"s"` = SharedString ์ธ๋ฑ์ค ์ฐธ์กฐ, `"b"` = boolean(`"1"`/`"0"`), `"str"` = ์์ ๊ฒฐ๊ณผ ๋ฌธ์์ด, `"n"` = ์ซ์, `"inlineStr"` = ์ธ๋ผ์ธ ์์ ํ
์คํธ, `"e"` = ์๋ฌ(์ฝ๊ธฐ ์ throw). ๋ณดํต ์ง์ ๋ค๋ฃจ์ง ์๊ณ `getValue`/`setValue` ๊ฐ ์๋
|
|
23
|
-
- `ExcelAddressPoint` = `{ r: number; c: number }` โ 0 ๊ธฐ๋ฐ ํ(`r`)ยท์ด(`c`) ์ขํ. ์
๋จ์ผ ์์น ๋จ์.
|
|
24
|
-
- `ExcelAddressRangePoint` = `{ s: ExcelAddressPoint; e: ExcelAddressPoint }` โ ๋ฒ์ ์ขํ. `s` = ์์(์ข์๋จ), `e` = ๋(
|
|
25
|
-
- `ExcelBorderPosition` = `"left" | "right" | "top" | "bottom"` โ ํ
๋๋ฆฌ ์ ์ฉ ๋ณ. `ExcelStyleOptions.border` ๋ฐฐ์ด ์์.
|
|
26
|
-
- `ExcelHorizontalAlign` = `"center" | "left" | "right"` โ ๊ฐ๋ก ์ ๋ ฌ ๊ฐ.
|
|
27
|
-
- `ExcelVerticalAlign` = `"center" | "top" | "bottom"` โ ์ธ๋ก ์ ๋ ฌ ๊ฐ.
|
|
28
|
-
- `ExcelFontUnderline` = `"single" | "double" | "singleAccounting" | "doubleAccounting"` โ ๋ฐ์ค ์ข
๋ฅ. OOXML `<u val="...">` ์ val ์ ๊ทธ๋๋ก ๋งคํ.
|
|
20
|
+
- `ExcelValueType` = `number | string | DateOnly | DateTime | Time | boolean | undefined` โ ์
์ด ๊ฐ์ง ์ ์๋ ๊ฐ ์ ๋์จ. `getValue()` ๋ฐํยท`setValue()` ์ธ์ ํ์
. `undefined` = "๊ฐ ์์"(์ฝ๊ธฐ ์ ๋น ์
, ์ฐ๊ธฐ ์ ์
์ญ์ )์ด๋ฏ๋ก ๊ฒฐ์ธก์ ๋๊น์ง ๋ณด์กด. `DateOnly`/`DateTime`/`Time` ์ `@simplysm/core-common` ํ์
์ด๋ฉฐ ์
์ ์๋ฆฌ์ผ ์ซ์ + ๋ ์ง numFmt ๋ก ์ ์ฅ๋๋ค.
|
|
21
|
+
- `ExcelNumberFormat` = `"number" | "string" | "DateOnly" | "DateTime" | "Time"` โ ์ซ์ํ์ ํ๋ฆฌ์
์ด๋ฆ. `"number"` = ์ผ๋ฐ ์์น, `"string"` = ํ
์คํธ ํ์, `"DateOnly"`/`"DateTime"`/`"Time"` = ๋ ์ง/์๊ฐ ์๋ฆฌ์ผ ํด์ยทํ์. `ExcelStyleOptions.numberFormat` ์ `ExcelUtils` ๋ณํ์ ๊ณต์ฉ ๋จ์. ๋ ์ง ํ์ ํ๋ฉด์ด๋ฉด ์
๊ฐ์ผ๋ก ์ง์ `DateOnly`/`Time` ์ ๋ฃ์ด ์๋ numFmt ๋ฅผ ๋ฐ๋ ํธ์ด ๋จ์.
|
|
22
|
+
- `ExcelCellType` = `"s" | "b" | "str" | "n" | "inlineStr" | "e"` โ OOXML ์
`t` ์์ฑ. `"s"` = SharedString ์ธ๋ฑ์ค ์ฐธ์กฐ, `"b"` = boolean(`"1"`/`"0"`), `"str"` = ์์ ๊ฒฐ๊ณผ ๋ฌธ์์ด, `"n"` = ์ซ์, `"inlineStr"` = ์ธ๋ผ์ธ ์์ ํ
์คํธ, `"e"` = ์๋ฌ(์ฝ๊ธฐ ์ throw). ๋ณดํต ์ง์ ๋ค๋ฃจ์ง ์๊ณ `getValue`/`setValue` ๊ฐ ์๋ ๋งคํํ๋ฏ๋ก, ์ธ๋ถ ์์ฑ ํ์ผ์ ์
ํ์
๋ถ๊ธฐ๋ฅผ ์ง์ ๊ฒ์ฌํ ๋๋ง ์ฐธ์กฐ.
|
|
23
|
+
- `ExcelAddressPoint` = `{ r: number; c: number }` โ 0 ๊ธฐ๋ฐ ํ(`r`)ยท์ด(`c`) ์ขํ. ์
๋จ์ผ ์์น ๋จ์. `cell(r, c)` ์ธ๋ฑ์ค์ ๋์ผ 0 ๊ธฐ๋ฐ.
|
|
24
|
+
- `ExcelAddressRangePoint` = `{ s: ExcelAddressPoint; e: ExcelAddressPoint }` โ ๋ฒ์ ์ขํ. `s` = ์์(์ข์๋จ), `e` = ๋(์ฐํ๋จ, inclusive). `getRange()` ๋ฐํ ํ์
์ด๋ฉฐ ์ํธ ์ํ ๋ฃจํ ๊ฒฝ๊ณ๋ก ์ด๋ค.
|
|
25
|
+
- `ExcelBorderPosition` = `"left" | "right" | "top" | "bottom"` โ ํ
๋๋ฆฌ ์ ์ฉ ๋ณ. `ExcelStyleOptions.border` ๋ฐฐ์ด ์์. 4๋ณ ์ ๋ถ๋ฉด 4๊ฐ๋ฅผ ๋ฐฐ์ด์ ๋ชจ๋ ๋ฃ์.
|
|
26
|
+
- `ExcelHorizontalAlign` = `"center" | "left" | "right"` โ ๊ฐ๋ก ์ ๋ ฌ ๊ฐ. ๋ฏธ์ง์ ์ ์
๊ธฐ๋ณธ(์์
์๋).
|
|
27
|
+
- `ExcelVerticalAlign` = `"center" | "top" | "bottom"` โ ์ธ๋ก ์ ๋ ฌ ๊ฐ. ๋ฏธ์ง์ ์ ์
๊ธฐ๋ณธ.
|
|
28
|
+
- `ExcelFontUnderline` = `"single" | "double" | "singleAccounting" | "doubleAccounting"` โ ๋ฐ์ค ์ข
๋ฅ. OOXML `<u val="...">` ์ val ์ ๊ทธ๋๋ก ๋งคํ. ํ๊ณ์ฉ ๋ฐ์ค์ด ํ์ํ ๋ `*Accounting`.
|
|
29
29
|
|
|
30
30
|
## OOXML XML-shape ํ์
|
|
31
31
|
|
|
32
|
-
`./types` ๊ฐ ํจ๊ป export ํ๋ ๋ค์ ์ธํฐํ์ด์คยทํ์
์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด๋ถ XML ํ์/์ง๋ ฌํ๊ธฐ๊ฐ OOXML ํํธ์ ํ์ฑ ๊ฒฐ๊ณผ(`xml2js` ์คํ์ผ์ `$`=์์ฑ,
|
|
32
|
+
`./types` ๊ฐ ํจ๊ป export ํ๋ ๋ค์ ์ธํฐํ์ด์คยทํ์
์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด๋ถ XML ํ์/์ง๋ ฌํ๊ธฐ๊ฐ OOXML ํํธ์ ํ์ฑ ๊ฒฐ๊ณผ(`xml2js` ์คํ์ผ์ `$`=์์ฑ, ์์์ ๋จ์ผ ์์ ๋ฐฐ์ด๋ก ๋ํ)๋ฅผ ํํํ๋ ๋ฐ์ดํฐ ๋ชจ๋ธ์ด๋ค. ์ผ๋ฐ ์ฌ์ฉ ํ๋ฆ(๊ฐ/์คํ์ผ/์ํธ API)์์๋ ์ง์ ๋ค๋ฃจ์ง ์์ผ๋ฉฐ, OOXML ๋
ธ๋๋ฅผ ์ง์ ์กฐ์ยท๊ฒ์ฆํ ๋๋ง ์ฐธ์กฐํ๋ค. ํ์ด๋ ๊ฐ ํ์
์ด ํํํ๋ ํํธ 1์ค๋ก ํ์ .
|
|
33
33
|
|
|
34
|
-
- `ExcelXmlContentTypeData` โ `[Content_Types].xml` ์ `Types`(Default
|
|
35
|
-
- `ExcelXmlRelationshipData` / `ExcelRelationshipData` โ `*.rels` ์ `Relationships` ๋ฐ ๊ฐ๋ณ `Relationship`(Id/Target/Type) ๊ตฌ์กฐ.
|
|
34
|
+
- `ExcelXmlContentTypeData` โ `[Content_Types].xml` ์ `Types`(Default ํ์ฅ์ ๋งคํยทOverride ํํธ ๋ฑ๋ก) ๊ตฌ์กฐ.
|
|
35
|
+
- `ExcelXmlRelationshipData` / `ExcelRelationshipData` โ `*.rels` ์ `Relationships` ์ปจํ
์ด๋ ๋ฐ ๊ฐ๋ณ `Relationship`(Id/Target/Type) ๊ตฌ์กฐ.
|
|
36
36
|
- `ExcelXmlWorkbookData` โ `xl/workbook.xml` ์ `workbook`(bookViews/sheets ๋ฑ) ๊ตฌ์กฐ.
|
|
37
|
-
- `ExcelXmlWorksheetData` โ `xl/worksheets/sheetN.xml` ์ `worksheet`(sheetPr
|
|
38
|
-
- `ExcelXmlConditionalFormattingData` / `ExcelXmlCfRuleData` โ `<conditionalFormatting>` ๋ธ๋ก๊ณผ `<cfRule>`(type/operator/priority/dxfId/formula) ๊ตฌ์กฐ. `ExcelXmlCfRuleData["$"]["type"|"operator"]`
|
|
39
|
-
- `ExcelRowData` / `ExcelCellData` โ `<row r="..">` ๊ณผ `<c r=".." s="
|
|
40
|
-
- `ExcelXmlDrawingData` โ `xl/drawings/drawingN.xml` ์ `wsDr`(twoCellAnchor/pic/blipFill/spPr
|
|
41
|
-
- `ExcelXmlSharedStringData` / `ExcelXmlSharedStringDataSi` / `ExcelXmlSharedStringDataText` โ `xl/sharedStrings.xml` ์ `sst` ์ `si` ํญ๋ชฉ(๋จ์ `t` ๋๋ ์์ run `r[]`), ํ
์คํธ ๋
ธ๋(`space="preserve"` ๋ณด์กด) ๊ตฌ์กฐ.
|
|
37
|
+
- `ExcelXmlWorksheetData` โ `xl/worksheets/sheetN.xml` ์ `worksheet`(sheetPr ํญ์/dimension/sheetViews ๋ทฐยทํ๊ณ ์ /cols ์ด๋๋น/sheetData ํยท์
/mergeCells/conditionalFormatting/drawing) ๊ตฌ์กฐ.
|
|
38
|
+
- `ExcelXmlConditionalFormattingData` / `ExcelXmlCfRuleData` โ `<conditionalFormatting sqref="...">` ๋ธ๋ก๊ณผ `<cfRule>`(type/operator/priority/dxfId/text/formula) ๊ตฌ์กฐ. `ExcelXmlCfRuleData["$"]["type"|"operator"]` ์ธ๋ฑ์ค ํ์
์ ๊ท์น spec ๋น๋ ์ ๋ด๋ถ์์ ์ฐธ์กฐ๋๋ค.
|
|
39
|
+
- `ExcelRowData` / `ExcelCellData` โ `<row r="..">` ๊ณผ `<c r=".." s="์คํ์ผID" t="ํ์
">`(v=๊ฐ, f=์์, is=์ธ๋ผ์ธ ๋ฌธ์์ด) ๊ตฌ์กฐ.
|
|
40
|
+
- `ExcelXmlDrawingData` โ `xl/drawings/drawingN.xml` ์ `wsDr`(twoCellAnchor from/to ์ต์ปค, pic/blipFill/spPr ์ด๋ฏธ์ง ๋
ธ๋) ๊ตฌ์กฐ.
|
|
41
|
+
- `ExcelXmlSharedStringData` / `ExcelXmlSharedStringDataSi` / `ExcelXmlSharedStringDataText` โ `xl/sharedStrings.xml` ์ `sst` ์ `si` ํญ๋ชฉ(๋จ์ `t` ๋๋ ์์ run `r[]` ์ ๋์จ), ํ
์คํธ ๋
ธ๋(`space="preserve"` ๊ณต๋ฐฑ ๋ณด์กด) ๊ตฌ์กฐ.
|
|
42
42
|
- `ExcelXmlStyleData` ๋ฐ ํ์(`...Font` / `...Fill` / `...Border` / `...Xf` / `...Dxf`) โ `xl/styles.xml` ์ `styleSheet`(numFmts/fonts/fills/borders/cellXfs/dxfs) ์ ๊ฐ ์์ ๋
ธ๋ ๊ตฌ์กฐ.
|
|
43
|
-
- `ExcelXml` = `{ readonly data: unknown; cleanup(): void }` โ ๋ชจ๋ XML ํํธ
|
|
43
|
+
- `ExcelXml` = `{ readonly data: unknown; cleanup(): void }` โ ๋ชจ๋ XML ํํธ ๋ํผ ํด๋์ค๊ฐ ๋ฐ๋ฅด๋ ๊ณตํต ์ธํฐํ์ด์ค. `data` = ํ์ฑ๋ ๋
ธ๋ ํธ๋ฆฌ, `cleanup()` = ์ง๋ ฌํ ์ง์ ๋น ๋
ธ๋ ์ ๋ฆฌ ๋ฑ ๋ง๋ฌด๋ฆฌ. ์ธ๋ถ์์ ๊ตฌํํ ์ผ์ ๊ฑฐ์ ์๋ค.
|
|
@@ -1,54 +1,62 @@
|
|
|
1
1
|
# @simplysm/excel โ ExcelCell / ExcelRow / ExcelCol
|
|
2
2
|
|
|
3
|
-
๊ฐ๋ณ ์
์ ๊ฐยท์์ยท๋ณํฉยท์คํ์ผ์ ์ฝ๊ณ ์ฐ๊ฑฐ๋, ํ/์ด ๋จ์๋ก ์
์
|
|
3
|
+
๊ฐ๋ณ ์
์ ๊ฐยท์์ยท๋ณํฉยท์คํ์ผ์ ์ฝ๊ณ ์ฐ๊ฑฐ๋, ํ/์ด ๋จ์๋ก ์
์ ์ํํ๊ณ ์ด ๋๋น๋ฅผ ์ค ๋ ํจ๊ป ์ฝ๋ ๋ฌถ์. ์
๊ฐ์ฒด๋ `ws.cell(r,c)` / `ws.row(r)` / `ws.col(c)` ๋ก ์ป์ผ๋ฉฐ(๋ชจ๋ 0 ๊ธฐ๋ฐ, ๋๊ธฐ ๋ฐํยท์ธ์คํด์ค ์บ์), ์ค์ I/O ๋ ์
์ `async` ๋ฉ์๋์์ ์ผ์ด๋๋ค.
|
|
4
4
|
|
|
5
5
|
## ExcelCell
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
`ws.cell(r, c)` ๋๋ `row.cell(c)` / `col.cell(r)` ๋ก ์ป๋๋ค.
|
|
8
|
+
|
|
9
|
+
- `readonly addr: ExcelAddressPoint` โ ์ด ์
์ 0 ๊ธฐ๋ฐ ์ขํ `{ r, c }`. ๋ณํฉยท๋ณต์ฌ ์ธ์๋ก ์ฌ์ฌ์ฉ.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
๊ฐ/์์:
|
|
12
12
|
|
|
13
|
-
- `
|
|
14
|
-
- `
|
|
15
|
-
- `
|
|
16
|
-
- `
|
|
13
|
+
- `getValue(): Promise<ExcelValueType>` โ ์
๊ฐ์ ํ์
์ถ๋ก ํด ๋ฐํ. SharedStringโstring, `b`โboolean, ์ซ์ํ numFmtโnumber, ๋ ์ง/์๊ฐ numFmtโ`DateOnly`/`DateTime`/`Time`, ๋น ์
โ`undefined`. ์
ํ์
์ด `e`(์๋ฌ)์ด๊ฑฐ๋ ์๋ฆฌ์ผ ํ์ฑ ์คํจ๋ฉด throw. ๋ ์ง ํ๋ณ์ ์
์คํ์ผ์ numFmtCode/numFmtId ๋ฅผ ๋ณธ๋ค.
|
|
14
|
+
- `setValue(val: ExcelValueType): Promise<void>` โ ๊ฐ ์ฐ๊ธฐ. `string`โSharedString ๋ฑ๋ก ํ `s` ํ์
, `boolean`โ`b` ํ์
(`"1"`/`"0"`), `number`โ์ซ์, `DateOnly`/`DateTime`/`Time`โ์๋ฆฌ์ผ ์ซ์ + ํด๋น ๋ ์ง numFmt ์๋ ๋ถ์ฌ, `undefined`/`null`โ์
์ญ์ . ๊ทธ ์ธ ํ์
์ throw. ๋ ์งํ ํ๋ฉด์ด๋ฉด ๋ฌธ์์ด ๋ณํ ์์ด ๋ ์ง ๊ฐ์ฒด๋ฅผ ๊ทธ๋๋ก ๋๊ฒจ ์๋ ์์์ ๋ฐ๋ ๊ฒ ๋จ์.
|
|
15
|
+
- `getFormula(): Promise<string | undefined>` โ ์
์์ ๋ฌธ์์ด ๋ฐํ(์์ผ๋ฉด `undefined`).
|
|
16
|
+
- `setFormula(val: string | undefined): Promise<void>` โ ์์ ์ค์ . ์
ํ์
์ `str` ๋ก ๋๊ณ ์บ์ ๊ฐ(v)์ ๋น์ด๋ค. `undefined` ๋ฉด ์
์ญ์ . ์์ ๋ฌธ์์ด์ `=` ์์ด ๋ณธ๋ฌธ๋ง(์: `"SUM(A1:A3)"`).
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
๋ณํฉ:
|
|
19
19
|
|
|
20
|
-
- `merge(r, c): Promise<void>` โ ํ์ฌ
|
|
20
|
+
- `merge(r: number, c: number): Promise<void>` โ ํ์ฌ ์
(์ข์๋จ)๋ถํฐ ๋ ์ขํ `(r, c)`(0 ๊ธฐ๋ฐ, inclusive)๊น์ง ๋ณํฉ. ์: `ws.cell(0,0).merge(2,2)` โ A1:C3(3ร3) ๋ณํฉ.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
์คํ์ผ:
|
|
23
23
|
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
24
|
+
- `getStyleId(): Promise<string | undefined>` โ ์
์ styles.xml cellXfs ์ธ๋ฑ์ค ID ๋ฐํ.
|
|
25
|
+
- `setStyleId(styleId: string | undefined): Promise<void>` โ ์
์คํ์ผ ID ์ง์ ์ง์ (๋ค๋ฅธ ์
๊ณผ ๋์ผ ์คํ์ผ ๊ณต์ ์). `undefined` ๋ฉด ์คํ์ผ ํด์ .
|
|
26
|
+
- `setStyle(opts: ExcelStyleOptions): Promise<void>` โ ๋ฐฐ๊ฒฝยทํ
๋๋ฆฌยท์ ๋ ฌยท์ซ์ํ์ยทํฐํธ ์ ์ฉ. ๊ธฐ์กด ์
์คํ์ผ์ด ์์ผ๋ฉด clone ํ ์ง์ ํ๋๋ง ๋ณํฉํ๋ค(๋ถ๋ถ ๊ฐฑ์ ). ์ต์
ํ์ด๋ [style.md](./style.md).
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
๊ฐ ์ฝ๊ธฐ/์ฐ๊ธฐ ์:
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
await ws.cell(0, 0).setValue("
|
|
32
|
-
await ws.cell(1, 0).setValue(new DateOnly(2026, 6,
|
|
33
|
-
await ws.cell(
|
|
34
|
-
const v = await ws.cell(1, 0).getValue();
|
|
31
|
+
await ws.cell(0, 0).setValue("์ฝ๋");
|
|
32
|
+
await ws.cell(1, 0).setValue(new DateOnly(2026, 6, 3)); // ๋ ์ง numFmt ์๋
|
|
33
|
+
await ws.cell(1, 1).setFormula("SUM(C2:C10)");
|
|
34
|
+
const v = await ws.cell(1, 0).getValue(); // DateOnly ๋ก ๋ณต์
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## ExcelRow
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
cell(c: number): ExcelCell // ์ด ํ์ c์ด ์
(0 ๊ธฐ๋ฐ)
|
|
41
|
-
getCells(): Promise<ExcelCell[]> // ๋ฐ์ดํฐ ๋ฒ์ ํญ๋งํผ ์
๋ฐฐ์ด(์ธ๋ฑ์ค=์ด)
|
|
42
|
-
```
|
|
39
|
+
`ws.row(r)` ๋ก ์ป๋๋ค.
|
|
43
40
|
|
|
44
|
-
- `
|
|
41
|
+
- `cell(c: number): ExcelCell` โ ์ด ํ์ 0 ๊ธฐ๋ฐ ์ด `c` ์
๋ฐํ.
|
|
42
|
+
- `getCells(): Promise<ExcelCell[]>` โ ์ด ํ์์ ์ํธ range ์ ์ด ๋ฒ์์ ํด๋นํ๋ ์
๋ค์ ๋ฐฐ์ด๋ก ๋ฐํ(์ธ๋ฑ์ค = ์ด ๋ฒํธ, ์์ชฝ ๋น ์ด์ ๋น์ด ์์).
|
|
45
43
|
|
|
46
44
|
## ExcelCol
|
|
47
45
|
|
|
46
|
+
`ws.col(c)` ๋ก ์ป๋๋ค.
|
|
47
|
+
|
|
48
|
+
- `cell(r: number): ExcelCell` โ ์ด ์ด์ 0 ๊ธฐ๋ฐ ํ `r` ์
๋ฐํ.
|
|
49
|
+
- `getCells(): Promise<ExcelCell[]>` โ ์ด ์ด์์ ์ํธ range ์ ํ ๋ฒ์์ ํด๋นํ๋ ์
๋ค์ ๋ฐฐ์ด๋ก ๋ฐํ(์ธ๋ฑ์ค = ํ ๋ฒํธ).
|
|
50
|
+
- `setWidth(size: number): Promise<void>` โ ์ด ๋๋น ์ค์ (์์
๋ฌธ์ ๋๋น ๋จ์). ์ด 1๊ฐ ๋จ์๋ก cols ์ ์๋ฅผ ๊ฐฑ์ .
|
|
51
|
+
|
|
52
|
+
์ด ๋๋น ์:
|
|
53
|
+
|
|
48
54
|
```typescript
|
|
49
|
-
|
|
50
|
-
getCells(): Promise<ExcelCell[]> // ๋ฐ์ดํฐ ๋ฒ์ ๋์ด๋งํผ ์
๋ฐฐ์ด(์ธ๋ฑ์ค=ํ)
|
|
51
|
-
setWidth(size: number): Promise<void> // ์ด ๋๋น ์ค์
|
|
55
|
+
await ws.col(0).setWidth(20);
|
|
52
56
|
```
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
## ์ฃผ์์ฌํญ
|
|
59
|
+
|
|
60
|
+
- ํ/์ด/์
์ธ๋ฑ์ค๋ ๋ชจ๋ 0 ๊ธฐ๋ฐ(์์
ํ๋ฉด์ 1ํ/A์ด = ์ธ๋ฑ์ค 0).
|
|
61
|
+
- `getCells()` ๊ฐ ๋ฐํํ๋ ๋ฐฐ์ด์ range ์์ ์ธ๋ฑ์ค๋ถํฐ ์ฑ์์ง๋ฏ๋ก ์์ชฝ ์ธ๋ฑ์ค๊ฐ ๋น์ด ์์ ์ ์๋ค. `for..of` ๋ณด๋ค `range` ๊ฒฝ๊ณ๋ก ์ง์ ์ํํ๋ ํธ์ด ์์ .
|
|
62
|
+
- `setStyle` ์ ๋์ ๋ณํฉ(๊ธฐ์กด ์คํ์ผ ์์ ์ง์ ํ๋๋ง ๋ฎ์ด์)์ด๊ณ , `setStyleId(undefined)` ๋ ์คํ์ผ ์ ์ฒด ํด์ ๋ค. ๋์ ํผ๋ํ์ง ๋ง ๊ฒ.
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
# @simplysm/excel โ ์กฐ๊ฑด๋ถ ์์
|
|
2
2
|
|
|
3
|
-
์
/๋ฒ์์ ๊ฐ ๋น๊ตยทํ
์คํธ ๋งค์นญยท์์ ๊ธฐ๋ฐ์ native
|
|
3
|
+
์
/๋ฒ์์ ๊ฐ ๋น๊ตยทํ
์คํธ ๋งค์นญยท์์ ๊ธฐ๋ฐ์ ์์
native ์กฐ๊ฑด๋ถ ์์(CF)์ ์ถ๊ฐํ ๋ ์ฐธ์กฐ. `ws.addConditionalFormat({ ref, rules })` ํ ๋ฉ์๋๋ก ์ ์ฉํ๋ฉฐ, ๊ท์น์ `ExcelConditionalRule` ์ ๋์จ์ผ๋ก ํํํ๋ค. ์ ์ ์
์คํ์ผ๊ณผ์ ํฉ์ฑ์ ์์
native CF ์ค๋ฒ๋ ์ด์ ์์๋๋ค(๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ง์ ์์ ์น ํ์ง ์์).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## addConditionalFormat
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
addConditionalFormat(opts: { ref: string; rules: ExcelConditionalRule[] }): Promise<void>
|
|
8
|
+
ws.addConditionalFormat(opts: { ref: string; rules: ExcelConditionalRule[] }): Promise<void>
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
- `opts.ref: string` โ ๋จ์ผ ์
(`"A1"`) ๋๋ ๋ฒ์(`"A1:B10"`)
|
|
12
|
-
- `opts.rules: ExcelConditionalRule[]` โ
|
|
13
|
-
- ๊ฐ์ ์ํธ์ ์ฌ๋ฌ ๋ฒ ํธ์ถํ๋ฉด ํธ์ถ๋ง๋ค `<conditionalFormatting>` ๋ธ๋ก์ด ๋์ ๋๋ค. ์ ์ ์
์คํ์ผ๊ณผ์ ํฉ์ฑ์ Excel native CF ์ค๋ฒ๋ ์ด์ ์์.
|
|
11
|
+
- `opts.ref: string` โ ์ ์ฉ ๋์. ๋จ์ผ ์
(`"A1"`) ๋๋ ๋ฒ์(`"A1:B10"`) ์์
์ฃผ์. text ๋ฅ ๊ท์น์ ๋น๊ต ๊ธฐ์ค ์
์ ref ์ ์ข์๋จ ์
.
|
|
12
|
+
- `opts.rules: ExcelConditionalRule[]` โ ์ ์ฉ ๊ท์น ๋ฐฐ์ด. ๋ฐฐ์ด ์์๊ฐ priority(์์ด ์ฐ์ )์ด๋ฉฐ, ๊ฐ์ ์ํธ์ ์ฌ๋ฌ ๋ฒ ํธ์ถํ๋ฉด ํธ์ถ๋ง๋ค `<conditionalFormatting>` ๋ธ๋ก์ด ๋์ ๋๊ณ priority ๋ ์ํธ ์ ์ญ ์นด์ดํฐ๋ก ์ด์ด๋ถ๋๋ค. ๋น ๋ฐฐ์ด์ด๋ฉด no-op.
|
|
14
13
|
|
|
15
14
|
## ExcelConditionalRule
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
๊ฐ ๋น๊ต(๋จ์ผ):
|
|
18
17
|
|
|
19
|
-
- `{ type: "cellIs"; op: "<" | ">" | "<=" | ">=" | "=" | "<>"; value: number | string; style }` โ ๋จ์ผ
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
- `{ type: "cellIs"; op: "<" | ">" | "<=" | ">=" | "=" | "<>"; value: number | string; style }` โ ์
๊ฐ๊ณผ `value` ์ ๋จ์ผ ๋น๊ต. `op` = ๋น๊ต ์ฐ์ฐ์(`"<>"` = ๊ฐ์ง ์์). `value: number` ๋ raw formula(`4999`), `value: string` ์ ๋ฐ์ดํ ๋ฆฌํฐ๋ด(`"OK"`)๋ก emit. ์์น ์๊ณยทํน์ ํ
์คํธ ์ผ์น ๊ฐ์กฐ์.
|
|
19
|
+
|
|
20
|
+
๊ฐ ๋น๊ต(๊ตฌ๊ฐ):
|
|
21
|
+
|
|
22
|
+
- `{ type: "cellIs"; op: "between" | "notBetween"; value: [number, number] | [string, string]; style }` โ ๋ ๊ฐ ์ฌ์ด ๊ตฌ๊ฐ ๋น๊ต(์ ๋ inclusive). `op` = ๊ตฌ๊ฐ ์/๋ฐ. `value` = `[a, b]` ํํ.
|
|
23
|
+
|
|
24
|
+
ํ
์คํธ ๋งค์นญ:
|
|
25
|
+
|
|
26
|
+
- `{ type: "text"; op: "contains" | "notContains" | "beginsWith" | "endsWith"; value: string; style }` โ ๋ฌธ์์ด ๋งค์นญ. `op` = ํฌํจ/๋ฏธํฌํจ/์์/๋. ๋ด๋ถ์ ์ผ๋ก SEARCH ๊ธฐ๋ฐ(๋์๋ฌธ์ ๋ฌด์) formula ๋ก ๋ณํ๋๋ฉฐ ๋น๊ต ๊ธฐ์ค์ ref ์ข์๋จ ์
. ๋ถ๋ถ ๋ฌธ์์ดยท์ ๋/์ ๋ฏธ ๊ฐ์กฐ์.
|
|
27
|
+
|
|
28
|
+
์์:
|
|
29
|
+
|
|
30
|
+
- `{ type: "expression"; formula: string; style }` โ ์์ ์์
์์ ๊ธฐ๋ฐ. `formula` ๊ฐ TRUE ์ธ ์
์ style ์ ์ฉ. `=` ์์ด ๋ณธ๋ฌธ๋ง(์ `"$B2>$C2"`). ๋ค๋ฅธ ์
์ฐธ์กฐยท๋ณตํฉ ์กฐ๊ฑด ๋ฑ ์ ํ๋ฆฌ์
์ผ๋ก ์ ๋๋ ๊ท์น์.
|
|
23
31
|
|
|
24
32
|
## ExcelConditionalRuleStyle
|
|
25
33
|
|
|
@@ -31,11 +39,11 @@ interface ExcelConditionalRuleStyle {
|
|
|
31
39
|
}
|
|
32
40
|
```
|
|
33
41
|
|
|
34
|
-
- `background?: string` โ ๊ฐ์กฐ
|
|
35
|
-
- `fontColor?: string` โ ๊ฐ์กฐ
|
|
36
|
-
- `fontWeight?: "bold" | "normal"` โ ๊ธ์ ๊ตต๊ธฐ. `"bold"` = ๊ตต๊ฒ, `"normal"` = base ๊ฐ bold ๋ผ๋ ๊ฐ์
|
|
42
|
+
- `background?: string` โ ๊ฐ์กฐ ๋ฐฐ๊ฒฝ์(ARGB 8์๋ฆฌ, ์ `"00FFFF00"`). ๋ฏธ์ง์ ์ base ์
๋ฐฐ๊ฒฝ ์ ์ง.
|
|
43
|
+
- `fontColor?: string` โ ๊ฐ์กฐ ๊ธ์์(ARGB 8์๋ฆฌ). ๋ฏธ์ง์ ์ base ๊ธ์์ ์ ์ง.
|
|
44
|
+
- `fontWeight?: "bold" | "normal"` โ ๊ธ์ ๊ตต๊ธฐ. `"bold"` = ๊ตต๊ฒ, `"normal"` = base ๊ฐ bold ๋ผ๋ ๊ฐ์ ๋ณดํต. ๋ฏธ์ง์ ์ base ์ ์ง.
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
์ง์ ํ ํ๋๋ง OOXML dxf ๋ก emit ๋์ด native CF ์ค๋ฒ๋ ์ด๋ก ํฉ์ฑ๋๋ค(๋ฏธ์ง์ ํ๋๋ base ๊ทธ๋๋ก).
|
|
39
47
|
|
|
40
48
|
## ์ฌ์ฉ ์
|
|
41
49
|
|
|
@@ -49,3 +57,9 @@ await ws.addConditionalFormat({
|
|
|
49
57
|
],
|
|
50
58
|
});
|
|
51
59
|
```
|
|
60
|
+
|
|
61
|
+
## ์ฃผ์์ฌํญ
|
|
62
|
+
|
|
63
|
+
- `rules` ๋ฐฐ์ด ์์ = priority(์์ด ์ฐ์ ). ๊ฒน์น๋ ์กฐ๊ฑด์ ์ ๊ท์น์ด ์ด๊ธด๋ค.
|
|
64
|
+
- ์ฌ๋ฌ ๋ฒ ํธ์ถํ๋ฉด ๋ธ๋ก์ด ๋์ ๋๊ณ priority ์นด์ดํฐ๊ฐ ์ํธ ์ ์ญ์ผ๋ก ์ด์ด์ง๋ค โ ํ ๋ฒ์์ ๊ท์น์ ํ ๋ฒ์ ํธ์ถ์ ๋ชจ์ ๋ฃ๋ ํธ์ด ์ฐ์ ์์ ์์ธก์ ์ ๋ฆฌ.
|
|
65
|
+
- `value: string` ๊ณผ `expression.formula` ์ ๋ฐ์ดํ/์ด์ค์ผ์ดํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฒ๋ฆฌํ๋ฏ๋ก ์๋ฌธ ๊ทธ๋๋ก ์ ๋ฌ.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @simplysm/excel โ ์
์คํ์ผ
|
|
2
2
|
|
|
3
|
-
์
(`cell.setStyle`)
|
|
3
|
+
์
(`cell.setStyle(opts)`)์ด๋ ์ํฌ๋ถ default(`wb.setDefaultStyle(opts)`)์ ๋ฐฐ๊ฒฝยทํ
๋๋ฆฌยท์ ๋ ฌยท์ซ์ํ์ยทํฐํธ๋ฅผ ์ค ๋ ์ฐธ์กฐ. ๋ ํธ์ถ ๋ชจ๋ ๋์ผํ `ExcelStyleOptions` ๋ฅผ ๋ฐ๋๋ค. ๋ฏธ์ง์ ํ๋๋ emit ํ์ง ์์ ์์
๊ธฐ๋ณธ๊ฐ์ผ๋ก ํ์๋๋ฉฐ, `cell.setStyle` ์ ๊ธฐ์กด ์
์คํ์ผ์ clone ํ ์ง์ ํ๋๋ง ๋ณํฉ(๋ถ๋ถ ๊ฐฑ์ )ํ๋ค.
|
|
4
4
|
|
|
5
5
|
## ExcelStyleOptions
|
|
6
6
|
|
|
@@ -16,13 +16,13 @@ interface ExcelStyleOptions {
|
|
|
16
16
|
}
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
- `background?: string` โ
|
|
20
|
-
- `border?: ExcelBorderPosition[]` โ ํ
๋๋ฆฌ๋ฅผ ๊ทธ๋ฆด ๋ณ ๋ฐฐ์ด.
|
|
21
|
-
- `horizontalAlign?: "center" | "left" | "right"` โ ๊ฐ๋ก ์ ๋ ฌ.
|
|
22
|
-
- `verticalAlign?: "center" | "top" | "bottom"` โ ์ธ๋ก ์ ๋ ฌ.
|
|
23
|
-
- `numberFormat?: "number" | "string" | "DateOnly" | "DateTime" | "Time"` โ ์ซ์ํ์ ํ๋ฆฌ์
. `"number"` = ์ผ๋ฐ
|
|
24
|
-
- `numberFormatCode?: string` โ ์ปค์คํ
|
|
25
|
-
- `font?: ExcelFont` โ ํฐํธ ๋ฌถ์(์๋). ๋ฏธ์ง์ ์์ฑ์ ์ํฌ๋ถ default ํฐํธ๋ก ํ์.
|
|
19
|
+
- `background?: string` โ ๋ฐฐ๊ฒฝ ์ฑ์์. ARGB 8์๋ฆฌ 16์ง์(์ 2์๋ฆฌ ์ํ, ์ `"00FF0000"` = ๋นจ๊ฐ). ์
๊ฐ์กฐยทํค๋์์ ์ฌ์ฉ.
|
|
20
|
+
- `border?: ExcelBorderPosition[]` โ ํ
๋๋ฆฌ๋ฅผ ๊ทธ๋ฆด ๋ณ ๋ฐฐ์ด. ์์๋ `"left" | "right" | "top" | "bottom"`. 4๋ณ ์ ๋ถ๋ฉด 4๊ฐ๋ฅผ ๋ชจ๋ ๋ฃ์(`["left","right","top","bottom"]`). ๋น ๋ฐฐ์ดยท๋ฏธ์ง์ ์ ํ
๋๋ฆฌ ์์.
|
|
21
|
+
- `horizontalAlign?: "center" | "left" | "right"` โ ๊ฐ๋ก ์ ๋ ฌ. `"center"` = ๊ฐ์ด๋ฐ, `"left"`/`"right"` = ์ข/์ฐ. ๋ฏธ์ง์ ์ ์
๊ธฐ๋ณธ(์์
์๋).
|
|
22
|
+
- `verticalAlign?: "center" | "top" | "bottom"` โ ์ธ๋ก ์ ๋ ฌ. `"center"` = ๊ฐ์ด๋ฐ, `"top"`/`"bottom"` = ์/์๋. ํ ๋์ด๊ฐ ํฐ ์
์์ ์๋ฏธ.
|
|
23
|
+
- `numberFormat?: "number" | "string" | "DateOnly" | "DateTime" | "Time"` โ ์ซ์ํ์ ํ๋ฆฌ์
. `"number"` = ์ผ๋ฐ ์์น(numFmtId 0), `"string"` = ํ
์คํธ(49), `"DateOnly"`(14)/`"DateTime"`(22)/`"Time"`(18) = ๋ ์ง/์๊ฐ ํ์. ํ์ค ํ์์ด๋ฉด ์ด๊ฑธ๋ก ์ถฉ๋ถ.
|
|
24
|
+
- `numberFormatCode?: string` โ ์ปค์คํ
์์
formatCode(์ `"0.000000"`, `"#,##0.00"`, `"0.00%"`). `numberFormat` ๊ณผ ๋์ ์ง์ ์ ์ด ํ๋๊ฐ ์ฐ์ . ์ฒ๋จ์ยท์์ ์๋ฆฟ์ยทํผ์ผํธ ๋ฑ ์ธ๋ฐํ ํ์๊ฐ ํ์ํ ๋.
|
|
25
|
+
- `font?: ExcelFont` โ ํฐํธ ๋ฌถ์(์๋). ์ผ๋ถ ์์ฑ๋ง ์ค๋ ๋๋ฉฐ, ๋ฏธ์ง์ ์์ฑ์ ์ํฌ๋ถ default ํฐํธ๋ก ํ์.
|
|
26
26
|
|
|
27
27
|
## ExcelFont
|
|
28
28
|
|
|
@@ -39,29 +39,35 @@ interface ExcelFont {
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
- `size?: number` โ ํฐํธ ํฌ๊ธฐ(pt).
|
|
42
|
-
- `family?: string` โ ํฐํธ๋ช
(
|
|
43
|
-
- `bold?: boolean` โ ๊ตต๊ฒ. `true`
|
|
44
|
-
- `italic?: boolean` โ ๊ธฐ์ธ์. `true`
|
|
45
|
-
- `underline?: "single" | "double" | "singleAccounting" | "doubleAccounting"` โ ๋ฐ์ค ์ข
๋ฅ.
|
|
46
|
-
- `color?: string` โ ๊ธ์์. ARGB 8์๋ฆฌ(
|
|
47
|
-
- `strike?: boolean` โ ์ทจ์์ . `true`
|
|
42
|
+
- `family?: string` โ ํฐํธ๋ช
(์ `"๋ง์ ๊ณ ๋"`, `"Calibri"`). ํ๊ธ ๋ฌธ์๋ฉด ๋ณดํต `"๋ง์ ๊ณ ๋"`.
|
|
43
|
+
- `bold?: boolean` โ ๊ตต๊ฒ. `true` = ๋ณผ๋, ๋ฏธ์ง์ /`false` = ๋ณดํต.
|
|
44
|
+
- `italic?: boolean` โ ๊ธฐ์ธ์. `true` = ์ดํค๋ฆญ.
|
|
45
|
+
- `underline?: "single" | "double" | "singleAccounting" | "doubleAccounting"` โ ๋ฐ์ค ์ข
๋ฅ. `<u val="...">` ์ val ๋ก ๊ทธ๋๋ก emit. ํ๊ณ์ฉ์ด๋ฉด `*Accounting`.
|
|
46
|
+
- `color?: string` โ ๊ธ์์. ARGB 8์๋ฆฌ(์ `"00FF0000"`).
|
|
47
|
+
- `strike?: boolean` โ ์ทจ์์ . `true` = ์ทจ์์ ํ์.
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## cell.setStyle vs wb.setDefaultStyle
|
|
52
|
-
|
|
53
|
-
- `cell.setStyle(opts)` โ ํด๋น ์
์๋ง ์คํ์ผ ์ ์ฉ. ๊ธฐ์กด ์
์คํ์ผ์ด ์์ผ๋ฉด clone ํ ์ต์
์ ๋ณํฉ.
|
|
54
|
-
- `wb.setDefaultStyle(opts)` โ `xl/styles.xml` ์ `fonts[0]`/`fills[0]`/`borders[0]`(OOXML default ์ฌ๋กฏ) ์์ฒด๋ฅผ ๋ฎ์ด์จ, fontId/fillId/borderId ๋ฅผ ๋ช
์ํ์ง ์์ ๋ชจ๋ ์
์ ์ ์ญ ์ ์ฉ. `horizontalAlign`/`verticalAlign`/`numberFormat`/`numberFormatCode` ๋ 0๋ฒ ์ฌ๋กฏ ๊ฐ๋
์ด ์์ด `cellXfs[0]` ์ ๋ฐํ๋ค. ์ต์
์ด ์๋ ์์์ 0๋ฒ ์ฌ๋กฏ์ด ๋น ์ฌ๋กฏ์ผ๋ก reset ๋๋ฉฐ, ๋ฏธํธ์ถ ์ ์๋ณธ์ด ๋ณด์กด๋๋ค.
|
|
55
|
-
|
|
56
|
-
### ์ฌ์ฉ ์
|
|
49
|
+
## ์ฌ์ฉ ์
|
|
57
50
|
|
|
58
51
|
```typescript
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
// ์
๋จ์
|
|
61
53
|
await ws.cell(0, 0).setStyle({
|
|
62
|
-
background: "00FFFF00",
|
|
54
|
+
background: "00FFFF00", // ๋
ธ๋ ํค๋
|
|
63
55
|
border: ["left", "right", "top", "bottom"],
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
horizontalAlign: "center",
|
|
57
|
+
verticalAlign: "center",
|
|
58
|
+
font: { family: "๋ง์ ๊ณ ๋", bold: true },
|
|
66
59
|
});
|
|
60
|
+
|
|
61
|
+
// ์ปค์คํ
์ซ์ ํ์
|
|
62
|
+
await ws.cell(1, 2).setStyle({ numberFormatCode: "#,##0.00" });
|
|
63
|
+
|
|
64
|
+
// ์ํฌ๋ถ ์ ์ญ default
|
|
65
|
+
await wb.setDefaultStyle({ font: { family: "๋ง์ ๊ณ ๋", size: 10 } });
|
|
67
66
|
```
|
|
67
|
+
|
|
68
|
+
## ์ฃผ์์ฌํญ
|
|
69
|
+
|
|
70
|
+
- `setDefaultStyle` ์ styles.xml ์ 0๋ฒ ์์ ์ฌ๋กฏ(font/fill/border)์ ๋ฎ์ด์ด๋ค โ fontId/fillId/borderId ๋ฅผ ๋ช
์ํ์ง ์์ ๋ชจ๋ ์
์ด ์ํฅ์ ๋ฐ๋๋ค. ์ต์
์ ์๋ ์์์ 0๋ฒ ์ฌ๋กฏ์ด ๋น ์ฌ๋กฏ์ผ๋ก reset ๋๋ฏ๋ก, default ๋ก ์ค ํญ๋ชฉ์ ํ ๋ฒ์ ๋ชจ์ ํธ์ถ.
|
|
71
|
+
- `numberFormat` ๊ณผ `numberFormatCode` ๋์ ์ง์ ์ `numberFormatCode` ์ฐ์ .
|
|
72
|
+
- ์์์ ๋ชจ๋ ARGB 8์๋ฆฌ(์ํ ํฌํจ). RGB 6์๋ฆฌ๋ง ์ฃผ๋ฉด ์๋์ ๋ค๋ฅด๊ฒ ํด์๋ ์ ์๋ค.
|
|
73
|
+
- ๋ ์ง/์๊ฐ ์
์ ๊ฐ์ผ๋ก `DateOnly`/`DateTime`/`Time` ์ ๋ฃ์ผ๋ฉด numFmt ๊ฐ ์๋ ๋ถ์ฌ๋๋ฏ๋ก ๋ณดํต `numberFormat` ์ ๋ฐ๋ก ์ค ํ์๊ฐ ์๋ค.
|
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
# @simplysm/excel โ ExcelUtils
|
|
2
2
|
|
|
3
|
-
์
์ฃผ์(A1
|
|
3
|
+
์
์ฃผ์(A1 โ ์ขํ) ๋ณํ, ์์
๋ ์ง ์๋ฆฌ์ผ โ JS ํ์์คํฌํ ๋ณํ, ์ซ์ํ์ ์ฝ๋/ID/์ด๋ฆ ์ํธ ๋ณํ์ด ํ์ํ ๋ ์ฐ๋ static ์ ํธ ํด๋์ค. ๋ชจ๋ ๋ฉ์๋๊ฐ ์ ์ ์ด๋ฏ๋ก ์ธ์คํด์ค ์์ฑ ์์ด `ExcelUtils.xxx(...)` ๋ก ํธ์ถ. ์ผ๋ฐ ์
API ๊ฐ ๋ด๋ถ์ ์ผ๋ก ์ฐ์ง๋ง, ์ธ๋ถ์์ ์ฃผ์ ๋ฌธ์์ด โ ์ขํ๋ฅผ ์ง์ ๋ค๋ฃฐ ๋ ์ ์ฉํ๋ค.
|
|
4
4
|
|
|
5
5
|
## ์ฃผ์ ๋ณํ
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- `stringifyRowAddr(r: number): string` โ ํ ์ธ๋ฑ์ค โ ํ ๋ฌธ์์ด(0 โ `"1"`).
|
|
9
|
-
- `stringifyColAddr(c: number): string` โ ์ด ์ธ๋ฑ์ค โ ์ด ๋ฌธ์(0 โ `"A"`, 26 โ `"AA"`). 0~16383 ๋ฒ์ ๋ฐ์ด๋ฉด throw.
|
|
10
|
-
- `parseRowAddr(addr: string): number` โ ์ฃผ์ ๋ฌธ์์ด์์ 0 ๊ธฐ๋ฐ ํ ์ธ๋ฑ์ค(`"A3"` โ 2). ํ์ฑ ์คํจ ์ throw.
|
|
11
|
-
- `parseColAddr(addr: string): number` โ ์ฃผ์ ๋ฌธ์์ด์์ 0 ๊ธฐ๋ฐ ์ด ์ธ๋ฑ์ค(`"B3"` โ 1).
|
|
12
|
-
- `parseCellAddr(addr: string): ExcelAddressPoint` โ ์
์ฃผ์ โ ์ขํ(`"B3"` โ `{r:2,c:1}`).
|
|
13
|
-
- `parseRangeAddr(rangeAddr: string): ExcelAddressRangePoint` โ ๋ฒ์ ์ฃผ์ โ ์ขํ ๋ฒ์(`"A1:C3"` โ `{s:{r:0,c:0}, e:{r:2,c:2}}`). `:` ์์ผ๋ฉด ๋จ์ผ ์
์ `s===e` ๋ก.
|
|
14
|
-
- `stringifyRangeAddr(point: ExcelAddressRangePoint): string` โ ์ขํ ๋ฒ์ โ ๋ฌธ์์ด(`"A1:C3"`). `s===e` ๋ฉด ๋จ์ผ ์
๋ฌธ์์ด๋ง ๋ฐํ.
|
|
7
|
+
์ขํ๋ `ExcelAddressPoint`(`{ r, c }`, 0 ๊ธฐ๋ฐ), ๋ฒ์๋ `ExcelAddressRangePoint`(`{ s, e }`).
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
- `stringifyAddr(point: ExcelAddressPoint): string` โ ์ขํ๋ฅผ `"A1"` ํ์ ๋ฌธ์์ด๋ก. ์ `{r:0,c:0}` โ `"A1"`.
|
|
10
|
+
- `stringifyRowAddr(r: number): string` โ 0 ๊ธฐ๋ฐ ํ ์ธ๋ฑ์ค๋ฅผ ํ ์ฃผ์ ๋ฌธ์์ด๋ก(์ `0` โ `"1"`).
|
|
11
|
+
- `stringifyColAddr(c: number): string` โ 0 ๊ธฐ๋ฐ ์ด ์ธ๋ฑ์ค๋ฅผ ์ด ๋ฌธ์๋ก(์ `0` โ `"A"`, `26` โ `"AA"`). ๋ฒ์ 0~16383 ๋ฐ์ด๋ฉด throw.
|
|
12
|
+
- `parseRowAddr(addr: string): number` โ ์
์ฃผ์์์ 0 ๊ธฐ๋ฐ ํ ์ธ๋ฑ์ค ์ถ์ถ(์ `"A3"` โ `2`). ํ ์ซ์ ํ์ฑ ์คํจ ์ throw.
|
|
13
|
+
- `parseColAddr(addr: string): number` โ ์
์ฃผ์์์ 0 ๊ธฐ๋ฐ ์ด ์ธ๋ฑ์ค ์ถ์ถ(์ `"B3"` โ `1`).
|
|
14
|
+
- `parseCellAddr(addr: string): ExcelAddressPoint` โ ์ฃผ์๋ฅผ ์ขํ๋ก(์ `"B3"` โ `{r:2,c:1}`).
|
|
15
|
+
- `parseRangeAddr(rangeAddr: string): ExcelAddressRangePoint` โ ๋ฒ์ ์ฃผ์๋ฅผ ์ขํ๋ก(์ `"A1:C3"` โ `{s:{r:0,c:0}, e:{r:2,c:2}}`). `:` ์๋ ๋จ์ผ ์ฃผ์๋ฉด `s`=`e`.
|
|
16
|
+
- `stringifyRangeAddr(point: ExcelAddressRangePoint): string` โ ๋ฒ์ ์ขํ๋ฅผ ๋ฌธ์์ด๋ก. `s`=`e` ๋ฉด ๋จ์ผ ์ฃผ์ 1๊ฐ๋ง ๋ฐํ.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## ๋ ์ง ์๋ฆฌ์ผ ๋ณํ
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
|
|
20
|
+
์์
์ 1900-01-01 ์ 1 ๋ก ์ธ๋ ์๋ฆฌ์ผ ๋ ์ง ์ฒด๊ณ(1899-12-30 = 0)๋ฅผ ์ด๋ค. ๋ก์ปฌ ํ์์กด ๋ณด์ ์ ํฌํจํ๋ค.
|
|
21
|
+
|
|
22
|
+
- `convertTimeTickToNumber(tick: number): number` โ JS ํ์์คํฌํ(ms)๋ฅผ ์์
๋ ์ง ์๋ฆฌ์ผ ์ซ์๋ก. ์
์ ๋ ์ง๋ฅผ ์ธ ๋ ๋ด๋ถ์ ์ผ๋ก ์ฌ์ฉ.
|
|
23
|
+
- `convertNumberToTimeTick(value: number): number` โ ์์
๋ ์ง ์๋ฆฌ์ผ ์ซ์๋ฅผ JS ํ์์คํฌํ(ms)๋ก. ์
์์ ๋ ์ง๋ฅผ ์ฝ์ ๋ ์ฌ์ฉ.
|
|
22
24
|
|
|
23
25
|
## ์ซ์ํ์ ๋ณํ
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- `
|
|
27
|
+
`ExcelNumberFormat` = `"number" | "string" | "DateOnly" | "DateTime" | "Time"` ์ ์์
formatCode/numFmtId ์ฌ์ด ๋ณํ.
|
|
28
|
+
|
|
29
|
+
- `convertNumFmtCodeToName(numFmtCode: string): ExcelNumberFormat` โ formatCode ๋ฌธ์์ด์ ํ์ ์ด๋ฆ์ผ๋ก. `"General"`โ`"number"`, yy/dd/mmยทh/ss ํจํด ์กฐํฉ์ผ๋ก `"DateOnly"`/`"DateTime"`/`"Time"` ํ๋ณ(์๊ฐ ๋ฌธ๋งฅ์ `mm` ์ ๋ถ์ผ๋ก ์ ์ธ), ์ซ์ ํจํด์ด๋ฉด `"number"`. ๋ฏธํด์ ์ฝ๋๋ฉด throw.
|
|
30
|
+
- `convertNumFmtIdToName(numFmtId: number): ExcelNumberFormat` โ ์์
๋ด์ฅ ํ์ ID ๋ฅผ ์ด๋ฆ์ผ๋ก. 0~13ยท37~40ยท48โ`"number"`, 14~17ยท27~31ยท34~36ยท50~58โ`"DateOnly"`, 22โ`"DateTime"`, 18~21ยท32~33ยท45~47โ`"Time"`, 49โ`"string"`. ๊ทธ ์ธ ID ๋ฉด throw.
|
|
31
|
+
- `convertNumFmtNameToId(numFmtName: ExcelNumberFormat): number` โ ์ด๋ฆ์ ๋ด์ฅ ํ์ ID ๋ก. `"number"`โ0, `"DateOnly"`โ14, `"DateTime"`โ22, `"Time"`โ18, `"string"`โ49.
|
|
28
32
|
|
|
29
33
|
## ์ฌ์ฉ ์
|
|
30
34
|
|
|
31
35
|
```typescript
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
ExcelUtils.parseRangeAddr("A1:C3"); // { s:{r:0,c:0}, e:{r:2,c:2} }
|
|
37
|
+
ExcelUtils.stringifyAddr({ r: 1, c: 2 }); // "C2"
|
|
38
|
+
ExcelUtils.convertNumFmtIdToName(22); // "DateTime"
|
|
35
39
|
```
|
|
40
|
+
|
|
41
|
+
## ์ฃผ์์ฌํญ
|
|
42
|
+
|
|
43
|
+
- ํ/์ด ์ธ๋ฑ์ค๋ 0 ๊ธฐ๋ฐ(์์
ํ๊ธฐ A1 = `{r:0,c:0}`). ์์
ํ๋ฉด ์ซ์์ 1 ์ฐจ์ด.
|
|
44
|
+
- `stringifyColAddr` ์ ์ ํจ ์ด ๋ฒ์๋ 0~16383(์์
์ต๋ 16384์ด, XFD). ๋ฒ์ด๋๋ฉด throw.
|
|
45
|
+
- ๋ ์ง ๋ณํ์ ์๋ฆฌ์ผ 1 = 1900-01-01 ๊ธฐ์ค์ด๋ฉฐ ํ์์กด ๋ณด์ ์ด ๋ค์ด๊ฐ๋ฏ๋ก, ์ง์ ์ฐ์ ํ์ง ๋ง๊ณ ์ด ๋ฉ์๋๋ก ์๋ณต.
|