create-mendix-widget-gleam 2.0.9 → 2.0.12
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/package.json
CHANGED
|
@@ -1708,6 +1708,8 @@ case formatter.parse(fmt, "123.45") {
|
|
|
1708
1708
|
|
|
1709
1709
|
Studio Pro의 editorConfig에서 속성을 조건부로 숨기거나, 그룹을 탭으로 변환하는 등의 작업을 순수 Gleam으로 작성할 수 있습니다. `@mendix/pluggable-widgets-tools`의 헬퍼 함수를 래핑합니다.
|
|
1710
1710
|
|
|
1711
|
+
> **Jint 호환성**: Studio Pro는 editorConfig를 **Jint**(.NET JavaScript 엔진)로 실행합니다. Jint는 Gleam 컴파일러가 생성하는 `List` 런타임(WeakMap, Symbol.iterator, class inheritance)을 지원하지 않으므로, 이 모듈의 모든 함수는 `List` 타입을 사용하지 않습니다. 여러 키를 전달할 때는 **콤마 구분 String**을 사용합니다.
|
|
1712
|
+
|
|
1711
1713
|
#### Properties 타입
|
|
1712
1714
|
|
|
1713
1715
|
`Properties`는 Studio Pro가 `getProperties`에 전달하는 `PropertyGroup[]` 배열의 opaque 래퍼입니다. 모든 함수가 `Properties`를 반환하므로 파이프라인 체이닝이 가능합니다.
|
|
@@ -1720,14 +1722,14 @@ import glendix/editor_config.{type Properties}
|
|
|
1720
1722
|
// 단일 속성 숨기기
|
|
1721
1723
|
let props = editor_config.hide_property(default_properties, "barWidth")
|
|
1722
1724
|
|
|
1723
|
-
// 여러 속성 한 번에 숨기기
|
|
1724
|
-
let props = editor_config.hide_properties(default_properties,
|
|
1725
|
+
// 여러 속성 한 번에 숨기기 (콤마 구분 String)
|
|
1726
|
+
let props = editor_config.hide_properties(default_properties, "barWidth,barColor")
|
|
1725
1727
|
|
|
1726
1728
|
// 중첩 속성 숨기기 (배열 타입 속성의 특정 인덱스 내부)
|
|
1727
1729
|
let props = editor_config.hide_nested_property(default_properties, "columns", 0, "width")
|
|
1728
1730
|
|
|
1729
|
-
// 여러 중첩 속성 한 번에 숨기기
|
|
1730
|
-
let props = editor_config.hide_nested_properties(default_properties, "columns", 0,
|
|
1731
|
+
// 여러 중첩 속성 한 번에 숨기기 (콤마 구분 String)
|
|
1732
|
+
let props = editor_config.hide_nested_properties(default_properties, "columns", 0, "width,alignment")
|
|
1731
1733
|
```
|
|
1732
1734
|
|
|
1733
1735
|
#### 탭 변환 / 속성 순서 변경
|
|
@@ -1744,11 +1746,17 @@ let props = editor_config.move_property(default_properties, 0, 2)
|
|
|
1744
1746
|
|
|
1745
1747
|
사용자의 `src/editor_config.gleam`에서 `getProperties` 로직을 작성합니다. 이 파일이 존재하면 `run_with_bridge` 실행 시 editorConfig 브릿지 JS가 자동 생성됩니다.
|
|
1746
1748
|
|
|
1749
|
+
> **주의**: editorConfig 코드에서는 Gleam `List`를 사용하지 마세요. `["a", "b"]` 같은 리스트 리터럴은 Gleam List 런타임 클래스를 번들에 포함시켜 Jint에서 크래시를 일으킵니다. 여러 키를 조합할 때는 `const`와 String 연결(`<>`)을 사용하세요.
|
|
1750
|
+
|
|
1747
1751
|
```gleam
|
|
1748
1752
|
import glendix/editor_config.{type Properties}
|
|
1749
1753
|
import glendix/mendix
|
|
1750
1754
|
import glendix/react.{type JsProps}
|
|
1751
1755
|
|
|
1756
|
+
const bar_keys = "barWidth,barColor"
|
|
1757
|
+
|
|
1758
|
+
const line_keys = "lineStyle,lineCurve"
|
|
1759
|
+
|
|
1752
1760
|
pub fn get_properties(
|
|
1753
1761
|
values: JsProps,
|
|
1754
1762
|
default_properties: Properties,
|
|
@@ -1759,10 +1767,10 @@ pub fn get_properties(
|
|
|
1759
1767
|
let props = case chart_type {
|
|
1760
1768
|
"line" ->
|
|
1761
1769
|
default_properties
|
|
1762
|
-
|> editor_config.hide_properties(
|
|
1770
|
+
|> editor_config.hide_properties(bar_keys)
|
|
1763
1771
|
"bar" ->
|
|
1764
1772
|
default_properties
|
|
1765
|
-
|> editor_config.hide_properties(
|
|
1773
|
+
|> editor_config.hide_properties(line_keys)
|
|
1766
1774
|
_ -> default_properties
|
|
1767
1775
|
}
|
|
1768
1776
|
|
|
@@ -1778,9 +1786,9 @@ pub fn get_properties(
|
|
|
1778
1786
|
| 함수 | 설명 |
|
|
1779
1787
|
|------|------|
|
|
1780
1788
|
| `hide_property(properties, key)` | 단일 속성 숨기기 |
|
|
1781
|
-
| `hide_properties(properties, keys)` | 여러 속성
|
|
1789
|
+
| `hide_properties(properties, keys)` | 여러 속성 숨기기 (콤마 구분 String) |
|
|
1782
1790
|
| `hide_nested_property(properties, key, index, nested_key)` | 중첩 속성 숨기기 |
|
|
1783
|
-
| `hide_nested_properties(properties, key, index, nested_keys)` | 여러 중첩 속성 숨기기 |
|
|
1791
|
+
| `hide_nested_properties(properties, key, index, nested_keys)` | 여러 중첩 속성 숨기기 (콤마 구분 String) |
|
|
1784
1792
|
| `transform_groups_into_tabs(properties)` | 그룹 → 탭 변환 |
|
|
1785
1793
|
| `move_property(properties, from_index, to_index)` | 속성 순서 변경 |
|
|
1786
1794
|
|
package/template/gleam.toml
CHANGED
package/template/.gitattributes
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
2
|
-
* text=auto
|
|
3
|
-
|
|
4
|
-
# Explicitly declare text files you want to always be normalized and converted
|
|
5
|
-
# to native line endings on checkout.
|
|
6
|
-
*.ts text eol=lf
|
|
7
|
-
*.tsx text eol=lf
|
|
8
|
-
*.js text eol=lf
|
|
9
|
-
*.jsx text eol=lf
|
|
10
|
-
*.css text eol=lf
|
|
11
|
-
*.scss text eol=lf
|
|
12
|
-
*.json text eol=lf
|
|
13
|
-
*.xml text eol=lf
|
|
14
|
-
*.md text eol=lf
|
|
15
|
-
*.gitattributes eol=lf
|
|
16
|
-
*.gitignore eol=lf
|
|
17
|
-
|
|
18
|
-
# Denote all files that are truly binary and should not be modified.
|
|
19
|
-
*.png binary
|
|
20
|
-
*.jpg binary
|
|
21
|
-
*.gif binary
|