create-mendix-widget-gleam 1.0.3 → 1.0.4
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/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# create-mendix-widget-gleam
|
|
2
|
+
|
|
3
|
+
Gleam 언어로 Mendix Pluggable Widget 프로젝트를 스케폴딩하는 CLI 도구.
|
|
4
|
+
|
|
5
|
+
JSX 없이, **오직 Gleam + FFI**로 React 컴포넌트를 작성하여 Mendix Studio Pro에서 동작하는 위젯을 만든다.
|
|
6
|
+
|
|
7
|
+
## 사용법
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx create-mendix-widget-gleam my-widget
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
대화형 프롬프트를 통해 프로젝트명과 패키지 매니저를 선택하면, 즉시 개발 가능한 위젯 프로젝트가 생성된다.
|
|
14
|
+
|
|
15
|
+
## 사전 요구사항
|
|
16
|
+
|
|
17
|
+
- [Gleam](https://gleam.run/getting-started/installing/) (최신 버전)
|
|
18
|
+
- [Node.js](https://nodejs.org/) (v18+)
|
|
19
|
+
|
|
20
|
+
## 생성되는 프로젝트 구조
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
my-widget/
|
|
24
|
+
src/
|
|
25
|
+
widget/ # Gleam 위젯 코드
|
|
26
|
+
my_widget.gleam # 메인 위젯 모듈
|
|
27
|
+
react_ffi.mjs # React FFI 어댑터
|
|
28
|
+
mendix_ffi.mjs # Mendix FFI 어댑터
|
|
29
|
+
react.gleam + react/ # React 바인딩 (타입, Props, Hooks, HTML)
|
|
30
|
+
mendix.gleam + mendix/ # Mendix API 바인딩 (전체 Pluggable Widget API)
|
|
31
|
+
editor_config.gleam # Studio Pro 속성 패널
|
|
32
|
+
scripts/ # 빌드/개발 스크립트
|
|
33
|
+
gleam.toml # Gleam 프로젝트 설정
|
|
34
|
+
CLAUDE.md # AI 어시스턴트용 프로젝트 컨텍스트
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 생성 후 시작하기
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cd my-widget
|
|
41
|
+
gleam run -m scripts/install # 의존성 설치
|
|
42
|
+
gleam run -m scripts/dev # 개발 서버 시작
|
|
43
|
+
gleam run -m scripts/build # 프로덕션 빌드 (.mpk 생성)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 포함된 Mendix API 바인딩
|
|
47
|
+
|
|
48
|
+
생성된 프로젝트에는 Mendix Pluggable Widget API 전체에 대한 Gleam 바인딩이 포함되어 있다:
|
|
49
|
+
|
|
50
|
+
- **EditableValue** — 텍스트, 숫자, 날짜 등 편집 가능한 값
|
|
51
|
+
- **ActionValue** — 마이크로플로우/나노플로우 실행
|
|
52
|
+
- **ListValue** — 데이터 목록 (필터, 정렬, 페이지네이션)
|
|
53
|
+
- **SelectionValue** — 단일/다중 선택
|
|
54
|
+
- **ReferenceValue** — 연관 관계 (단일/다중 참조)
|
|
55
|
+
- **JsDate / Big** — JS Date, Big.js 고정밀 십진수 래퍼
|
|
56
|
+
- **Filter** — 필터 조건 빌더
|
|
57
|
+
- **그 외** — DynamicValue, FileValue, WebIcon, ValueFormatter 등
|
|
58
|
+
|
|
59
|
+
## 라이선스
|
|
60
|
+
|
|
61
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mendix-widget-gleam",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Scaffold a Mendix Pluggable Widget powered by Gleam",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/",
|
|
10
10
|
"src/",
|
|
11
|
-
"template/"
|
|
11
|
+
"template/",
|
|
12
|
+
"README.md"
|
|
12
13
|
],
|
|
13
14
|
"engines": {
|
|
14
15
|
"node": ">=18"
|
|
@@ -78,3 +78,15 @@ pub fn milliseconds(date: JsDate) -> Int
|
|
|
78
78
|
/// 요일 (0=일요일, 1=월요일, ..., 6=토요일)
|
|
79
79
|
@external(javascript, "../mendix_ffi.mjs", "date_get_day")
|
|
80
80
|
pub fn day_of_week(date: JsDate) -> Int
|
|
81
|
+
|
|
82
|
+
// === HTML input[type="date"] 변환 ===
|
|
83
|
+
|
|
84
|
+
import gleam/option.{type Option}
|
|
85
|
+
|
|
86
|
+
/// JsDate → "YYYY-MM-DD" 변환 (로컬 시간 기준, input[type="date"] 용)
|
|
87
|
+
@external(javascript, "../mendix_ffi.mjs", "date_to_input_value")
|
|
88
|
+
pub fn to_input_value(date: JsDate) -> String
|
|
89
|
+
|
|
90
|
+
/// "YYYY-MM-DD" → Option(JsDate) 변환 (빈 문자열 → None)
|
|
91
|
+
@external(javascript, "../mendix_ffi.mjs", "input_value_to_date")
|
|
92
|
+
pub fn from_input_value(date_string: String) -> Option(JsDate)
|
|
@@ -352,6 +352,21 @@ export function date_get_day(d) {
|
|
|
352
352
|
return d.getDay();
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
+
// === Date 변환 (JS Date ↔ HTML input[type="date"]) ===
|
|
356
|
+
|
|
357
|
+
export function date_to_input_value(jsDate) {
|
|
358
|
+
const year = jsDate.getFullYear();
|
|
359
|
+
const month = String(jsDate.getMonth() + 1).padStart(2, "0");
|
|
360
|
+
const day = String(jsDate.getDate()).padStart(2, "0");
|
|
361
|
+
return `${year}-${month}-${day}`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function input_value_to_date(dateString) {
|
|
365
|
+
if (!dateString) return new None();
|
|
366
|
+
const [year, month, day] = dateString.split("-").map(Number);
|
|
367
|
+
return new Some(new Date(year, month - 1, day));
|
|
368
|
+
}
|
|
369
|
+
|
|
355
370
|
// === Big.js ===
|
|
356
371
|
|
|
357
372
|
import Big from "big.js";
|