@neeloong/form 0.1.0 → 0.3.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,219 @@
1
+ neeloongForm
2
+ ===================
3
+
4
+ 一个表单布局渲染库
5
+
6
+ 相应式的实现,目前采用 [tc39/proposal-signals](https://github.com/tc39/proposal-signals) 的 [polyfill](https://github.com/proposal-signals/signal-polyfill.git)
7
+
8
+ ```js
9
+
10
+ import { Store, Layout, render } from '@neeloong/form';
11
+ /** @import { Schema } from '@neeloong/form'; */
12
+ const template = `
13
+ <input !value="a" !bind="$value" />
14
+ <input !bind="a" />
15
+ <ul +a=1>
16
+ <li !value="list" !enum>
17
+ <input !bind="b" />
18
+ <ul !value="c" +x="0">
19
+ <li !enum +b=alias$length +a=2 +k="++x">
20
+ <div !fragment !text="k"></div>
21
+ <button @click="a+=1">a+1:<span !fragment !text="a"></span></button>
22
+ <button @click="b+=1">b+1:<span !fragment !text="b"></span></button>
23
+ <input !bind=a type=number />
24
+ <div !fragment !text="$no"/>. <div !fragment !text="d">1</div> <div !fragment !text>1</div>
25
+ <button @click="$remove">移除</button>
26
+ <button @click="$upMove" :disabled="!$upMovable">上移</button>
27
+ <button @click="$downMove()" :disabled="!$downMovable">下移</button>
28
+ </li>
29
+ <li><button @click="$add(0)">添加</button><button @click="$add( - $length - 1)">添加(<span !fragment !text=" - $length - 1"></span>)</button></li>
30
+ </ul>
31
+ </li>
32
+ </ul>
33
+ `
34
+
35
+ /** @type {Layout.Options} */
36
+ const layoutOptions = {
37
+ creteCalc: value => {
38
+ const fn = new Function('globalThis', `with(globalThis) { return ${value} }`);
39
+ fn.toString = () => value;
40
+ return /** @type {*} */(fn);
41
+ },
42
+ creteEvent: value => {
43
+ const fn = new Function('$event', 'globalThis', `with(globalThis) { ${value} }`);
44
+ fn.toString = () => value;
45
+ return /** @type {*} */(fn);
46
+ },
47
+ }
48
+
49
+ /**
50
+ * @type {Schema}
51
+ */
52
+ const schema = {
53
+ a: { type: 'int', disabled: true },
54
+ list: { array: true, props: {
55
+ b: { type: 'int', disabled: true },
56
+ c: { array: true, type: 'int' },
57
+ },
58
+ },
59
+ };
60
+ const defaultValue = {
61
+ a: 5,
62
+ list: {b: 2, c: [1,2,3,4,5]}
63
+ }
64
+ const layouts = Layout.parse(template, layoutOptions);
65
+
66
+ const store = Store.create(schema);
67
+ store.value = defaultValue
68
+ /** @type {Element} */
69
+ // @ts-ignore
70
+ const app = document.querySelector('#app');
71
+ render(store, layouts, app);
72
+
73
+
74
+ ```
75
+
76
+ ## API
77
+
78
+ - `Layout.parse(template, options)` 解析模板
79
+ - `Store.create(schema)` 创建存储
80
+ - `render(store, layouts, element, global, components)` 渲染表单
81
+
82
+
83
+ ## 模板语法
84
+
85
+ ### 属性绑定
86
+
87
+ ```html
88
+ <div :id="dynamicId"></div>
89
+ ```
90
+
91
+ ### 事件监听
92
+
93
+ ```html
94
+ <div @click="doSomething"></div>
95
+ ```
96
+
97
+ ### 条件渲染
98
+
99
+ ```html
100
+ <h1 !if="a"></h1>
101
+ <h2 !else !if="b"></h2>
102
+ <h3 !else !if="c"></h3>
103
+ <p !else></p>
104
+ ```
105
+
106
+ ### 子属性
107
+
108
+ ```html
109
+ <h1 !value="subField"></h1>
110
+ ```
111
+
112
+ ### 列表子属性
113
+
114
+ ```html
115
+ <h1 !enum="subArrayField"></h1>
116
+ ```
117
+
118
+ ### 字段绑定
119
+
120
+ ```html
121
+ <input !bind="field" />
122
+ ```
123
+
124
+ ### 片段
125
+
126
+ ```html
127
+ <tagName !fragment></tagName>
128
+ ```
129
+
130
+ ### 文本渲染与 html 渲染
131
+
132
+ ```html
133
+ <span !text="text"></span>
134
+ ```
135
+
136
+ ```html
137
+ <div !html="html"></div>
138
+ ```
139
+
140
+ ### 注释
141
+ ```html
142
+ <div !comment="注释内容"></div>
143
+ ```
144
+
145
+ ### 别名与计算值
146
+
147
+ ```
148
+ <div *alias1="v1" *computed="v1 + v2"></div>
149
+ ```
150
+
151
+
152
+ ### 显式变量(局部变量)
153
+
154
+ ```html
155
+ <div +var1="123"></div>
156
+ ```
157
+
158
+
159
+ ### 各用法的优先级
160
+
161
+ 优先级从高到低:
162
+
163
+ 1. 模板定义: `!template`
164
+ 1. 条件: `!if` `!else`
165
+ 1. 子属性: `!value`
166
+ 1. 枚举: `!enum`
167
+ 1. 别名与计算名: `*别名` `*计算名`
168
+ 1. 显式变量: `+变量`
169
+ 1. 片段与模板调用: `!fragment`
170
+ 1. 属性与事件: `:绑定属性` `@事件` `普通属性` `!bind`
171
+ 1. 子内容: `!text` `!html`
172
+ 1. 注释: `!comment`
173
+
174
+
175
+ ### 变量
176
+ 1. 字段扩展隐式属性
177
+ - `$value`
178
+ - `$state`
179
+ - `$null` 只读属性
180
+ - `$index` 只读属性
181
+ - `$no` 只读属性
182
+ - `$length` 只读属性
183
+ - `$creatable` 只读属性
184
+ - `$immutable` 只读属性
185
+ - `$schema` 只读属性
186
+ - `$new` 只读属性
187
+ - `$readonly` 只读属性
188
+ - `$hidden` 只读属性
189
+ - `$clearable` 只读属性
190
+ - `$required` 只读属性
191
+ - `$disabled` 只读属性
192
+ - `$label` 只读属性
193
+ - `$description` 只读属性
194
+ - `$placeholder` 只读属性
195
+ - `$min` 只读属性
196
+ - `$max` 只读属性
197
+ - `$step` 只读属性
198
+ - `$values` 只读属性
199
+ 1. 数组字段扩展隐式函数(只在事件中可用)
200
+ - `$insert(index, value)`
201
+ - `$add(value)`
202
+ - `$remove(index)`
203
+ - `$move(from, to)`
204
+ - `$exchange(a, b)`
205
+ 1. 数组成员字段扩展隐式属性
206
+ - `$upMovable` 只读属性
207
+ - `$downMovable` 只读属性
208
+ 1. 数组成员字段扩展隐式函数(只在事件中可用)
209
+ - `$remove()`
210
+ - `$upMove()`
211
+ - `$downMove()`
212
+ 1. 当前范围及组件范围的所有字段(数组字段的成员除外,因为数组字段成员索引为数字,不符合标识符命名规则)都存在 `field$value` 及 `field$$value` 形式的变量
213
+ 1. 如果别名为字段的别名,则也存在 `alias$value` 形式的变量
214
+ 1. 当存在同名变量时,则会按照变量来源类型决定优先级,从高到低依次为:
215
+ 1. 显式声明(如别名、计算名、显式变量),如果别名是字段的别名,则也包括 `alias$value` 形式的变量
216
+ 1. 全局变量,此部分由 `render` 的参数传入
217
+ 1. 字段声明,包括 `field$value` 及 `field$$value` 形式的变量
218
+ 1. 在同一来源类型重复的变量名,再按照作用域处理
219
+ 1. 同一作用域下的别名(或计算名)与显式变量重名时,由于会先处理别名,所以,显式变量会覆盖别名。
package/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @neeloong/form v0.1.0
2
+ * @neeloong/form v0.3.0
3
3
  * (c) 2024-2025 Fierflame
4
4
  * @license Apache-2.0
5
5
  */
@@ -64,11 +64,19 @@ declare namespace Schema {
64
64
  value: string | number;
65
65
  };
66
66
  namespace Value {
67
+ type Define = Schema.Value | string | number;
67
68
  type Group = {
68
69
  label: string;
69
70
  value?: string | number | undefined;
70
- children: (Schema.Value.Group | Schema.Value | string | number)[];
71
+ children: (Schema.Value.Group | Schema.Value)[];
71
72
  };
73
+ namespace Group {
74
+ type Define = {
75
+ label: string;
76
+ value?: string | number | undefined;
77
+ children: (Schema.Value.Group | Schema.Value.Define)[];
78
+ };
79
+ }
72
80
  }
73
81
  type Object = {
74
82
  type?: null | undefined;
@@ -82,14 +90,52 @@ declare namespace Schema {
82
90
  array?: boolean | undefined;
83
91
  meta?: any;
84
92
  };
93
+ type Event = {
94
+ input?: Function | null | undefined;
95
+ change?: Function | null | undefined;
96
+ click?: Function | null | undefined;
97
+ focus?: Function | null | undefined;
98
+ blur?: Function | null | undefined;
99
+ add?: Function | null | undefined;
100
+ remove?: Function | null | undefined;
101
+ move?: Function | null | undefined;
102
+ };
85
103
  type Attr = {
86
104
  immutable?: boolean | undefined;
87
105
  creatable?: boolean | undefined;
88
- hidden?: boolean | ((store: Store) => boolean) | null | undefined;
89
- clearable?: boolean | ((store: Store) => boolean) | null | undefined;
90
- required?: boolean | ((store: Store) => boolean) | null | undefined;
91
- disabled?: boolean | ((store: Store) => boolean) | null | undefined;
92
- readonly?: boolean | ((store: Store) => boolean) | null | undefined;
106
+ hidden?: boolean | ((store: Store, root: Store) => boolean) | null | undefined;
107
+ clearable?: boolean | ((store: Store, root: Store) => boolean) | null | undefined;
108
+ required?: boolean | ((store: Store, root: Store) => boolean) | null | undefined;
109
+ disabled?: boolean | ((store: Store, root: Store) => boolean) | null | undefined;
110
+ readonly?: boolean | ((store: Store, root: Store) => boolean) | null | undefined;
111
+ /**
112
+ * 字段标签
113
+ */
114
+ label?: string | ((store: Store, root: Store) => string) | null | undefined;
115
+ /**
116
+ * 字段描述
117
+ */
118
+ description?: string | ((store: Store, root: Store) => string) | null | undefined;
119
+ /**
120
+ * 占位符
121
+ */
122
+ placeholder?: string | ((store: Store, root: Store) => string) | null | undefined;
123
+ /**
124
+ * 日期、时间、数字的最小值
125
+ */
126
+ min?: number | ((store: Store, root: Store) => number) | null | undefined;
127
+ /**
128
+ * 日期、时间、数字的最大值
129
+ */
130
+ max?: number | ((store: Store, root: Store) => number) | null | undefined;
131
+ /**
132
+ * 日期、时间、数字的步长
133
+ */
134
+ step?: number | ((store: Store, root: Store) => number) | null | undefined;
135
+ /**
136
+ * 可选值
137
+ */
138
+ values?: (Schema.Value.Define | Schema.Value.Group.Define)[] | undefined;
93
139
  };
94
140
  }
95
141
 
@@ -120,13 +166,22 @@ declare class Store<T = any> {
120
166
  * @param {boolean} [options.required]
121
167
  * @param {boolean} [options.readonly]
122
168
  * @param {boolean} [options.disabled]
169
+ *
170
+ * @param {string} [options.label] 字段标签
171
+ * @param {string} [options.description] 字段描述
172
+ * @param {string} [options.placeholder] 占位符
173
+ * @param {number} [options.min] 日期、时间、数字的最小值
174
+ * @param {number} [options.max] 日期、时间、数字的最大值
175
+ * @param {number} [options.step] 日期、时间、数字的步长
176
+ * @param {(Schema.Value.Group | Schema.Value | string | number)[]} [options.values] 可选值
177
+ *
123
178
  * @param {((value: any) => any)?} [options.setValue]
124
179
  * @param {((value: any) => any)?} [options.setState]
125
180
  * @param {((value: any, state: any) => [value: any, state: any])?} [options.convert]
126
181
  * @param {((value: T?, index: any) => void)?} [options.onUpdate]
127
182
  * @param {((value: T?, index: any) => void)?} [options.onUpdateState]
128
183
  */
129
- constructor(schema: Schema.Field, { null: isNull, state, setValue, setState, convert, onUpdate, onUpdateState, index, length, new: isNew, parent: parentNode, hidden, clearable, required, disabled, readonly, }: {
184
+ constructor(schema: Schema.Field, { null: isNull, state, setValue, setState, convert, onUpdate, onUpdateState, index, length, new: isNew, parent: parentNode, hidden, clearable, required, disabled, readonly, label, description, placeholder, min, max, step, values }: {
130
185
  parent?: any;
131
186
  state?: any;
132
187
  index?: string | number | null | undefined;
@@ -138,6 +193,13 @@ declare class Store<T = any> {
138
193
  required?: boolean | undefined;
139
194
  readonly?: boolean | undefined;
140
195
  disabled?: boolean | undefined;
196
+ label?: string | undefined;
197
+ description?: string | undefined;
198
+ placeholder?: string | undefined;
199
+ min?: number | undefined;
200
+ max?: number | undefined;
201
+ step?: number | undefined;
202
+ values?: (string | number | Schema.Value | Schema.Value.Group)[] | undefined;
141
203
  setValue?: ((value: any) => any) | null | undefined;
142
204
  setState?: ((value: any) => any) | null | undefined;
143
205
  convert?: ((value: any, state: any) => [value: any, state: any]) | null | undefined;
@@ -159,7 +221,6 @@ declare class Store<T = any> {
159
221
  get selfNew(): boolean;
160
222
  set new(v: boolean);
161
223
  get new(): boolean;
162
- get editable(): boolean;
163
224
  set selfHidden(v: boolean | null);
164
225
  get selfHidden(): boolean | null;
165
226
  set hidden(v: boolean);
@@ -180,6 +241,34 @@ declare class Store<T = any> {
180
241
  get selfReadonly(): boolean | null;
181
242
  set readonly(v: boolean);
182
243
  get readonly(): boolean;
244
+ set selfLabel(v: string | null);
245
+ get selfLabel(): string | null;
246
+ set label(v: string | null);
247
+ get label(): string | null;
248
+ set selfDescription(v: string | null);
249
+ get selfDescription(): string | null;
250
+ set description(v: string | null);
251
+ get description(): string | null;
252
+ set selfPlaceholder(v: string | null);
253
+ get selfPlaceholder(): string | null;
254
+ set placeholder(v: string | null);
255
+ get placeholder(): string | null;
256
+ set selfMin(v: number | null);
257
+ get selfMin(): number | null;
258
+ set min(v: number | null);
259
+ get min(): number | null;
260
+ set selfMax(v: number | null);
261
+ get selfMax(): number | null;
262
+ set max(v: number | null);
263
+ get max(): number | null;
264
+ set selfStep(v: number | null);
265
+ get selfStep(): number | null;
266
+ set step(v: number | null);
267
+ get step(): number | null;
268
+ set selfValues(v: (Schema.Value | Schema.Value.Group)[] | null);
269
+ get selfValues(): (Schema.Value | Schema.Value.Group)[] | null;
270
+ set values(v: (Schema.Value | Schema.Value.Group)[] | null);
271
+ get values(): (Schema.Value | Schema.Value.Group)[] | null;
183
272
  /**
184
273
  *
185
274
  * @param {string | number} key
@@ -236,7 +325,8 @@ declare function parse(source: string, { creteCalc, creteEvent, simpleTag, }?: O
236
325
  declare function toString(value: Node | (Node | string)[], formable?: boolean): string;
237
326
 
238
327
  type Directives = {
239
- fragment?: boolean | undefined;
328
+ template?: string | undefined;
329
+ fragment?: string | boolean | undefined;
240
330
  if?: string | Function | undefined;
241
331
  else?: boolean | undefined;
242
332
  /**
@@ -246,7 +336,7 @@ type Directives = {
246
336
  /**
247
337
  * 列表属性枚举
248
338
  */
249
- enum?: boolean | undefined;
339
+ enum?: string | boolean | Function | undefined;
250
340
  bind?: string | undefined;
251
341
  text?: string | Function | undefined;
252
342
  html?: string | Function | undefined;
@@ -267,6 +357,7 @@ type Node = {
267
357
  attrs: Record<string, string | {
268
358
  name: string;
269
359
  } | ((global: any) => void)>;
360
+ params: Record<string, string | ((global: any) => void)>;
270
361
  classes: Record<string, string | boolean | ((global: any) => void)>;
271
362
  styles: Record<string, string | ((global: any) => void)>;
272
363
  events: Record<string, string | (($event: any, global: any) => void)>;