ezfw-core 1.0.49 → 1.0.50

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.
@@ -7,6 +7,7 @@ const cls = cx(styles);
7
7
 
8
8
  declare const ez: {
9
9
  _createElement(config: unknown): Promise<HTMLElement>;
10
+ getControllerSync(name: string): { state: Record<string, unknown>; [key: string]: unknown } | null;
10
11
  };
11
12
 
12
13
  export interface EzInputConfig extends EzBaseComponentConfig {
@@ -156,11 +157,18 @@ export class EzInput extends EzBaseComponent {
156
157
  }
157
158
 
158
159
  // Handle onEnter
159
- if (cfg.onEnter && typeof cfg.onEnter === 'function') {
160
- const onEnterFn = cfg.onEnter;
160
+ if (cfg.onEnter) {
161
161
  this._input.addEventListener('keydown', e => {
162
162
  if (e.key === 'Enter') {
163
- onEnterFn(this._input!.value);
163
+ if (typeof cfg.onEnter === 'function') {
164
+ cfg.onEnter(this._input!.value);
165
+ } else if (typeof cfg.onEnter === 'string' && cfg.controller) {
166
+ const ctrl = ez.getControllerSync(cfg.controller);
167
+ const method = ctrl?.[cfg.onEnter];
168
+ if (typeof method === 'function') {
169
+ (method as (value: string) => void).call(ctrl, this._input!.value);
170
+ }
171
+ }
164
172
  }
165
173
  });
166
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezfw-core",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Ez Framework - A declarative component framework for building modern web applications",
5
5
  "type": "module",
6
6
  "main": "./core/ez.ts",