Skip to content

Commit 8ff9b42

Browse files
committed
support complexer 2way bindings
1 parent b44fc3d commit 8ff9b42

3 files changed

Lines changed: 35 additions & 23 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"window.title": "${dirty}${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}${appName}${separator}[Branch: master]"
3+
}

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
{
2-
"description": "Base Custom Webcomponent",
3-
"name": "@node-projects/base-custom-webcomponent",
4-
"version": "0.23.0",
5-
"type": "module",
6-
"main": "./dist/index.js",
7-
"author": "",
8-
"license": "BSD-3-Clause",
9-
"scripts": {
10-
"tsc": "tsc"
11-
},
12-
"devDependencies": {
13-
"typescript": "^5.3.3"
14-
},
15-
"repository": {
16-
"type": "git",
17-
"url": "git+https://github.com/node-projects/base-custom-webcomponent.git"
18-
},
19-
"bugs": {
20-
"url": "https://github.com/node-projects/base-custom-webcomponent/issues"
21-
},
22-
"homepage": "https://github.com/node-projects/base-custom-webcomponent#readme"
23-
}
1+
{
2+
"description": "Base Custom Webcomponent",
3+
"name": "@node-projects/base-custom-webcomponent",
4+
"version": "0.24.0",
5+
"type": "module",
6+
"main": "./dist/index.js",
7+
"author": "",
8+
"license": "BSD-3-Clause",
9+
"scripts": {
10+
"tsc": "tsc"
11+
},
12+
"devDependencies": {
13+
"typescript": "^5.3.3"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/node-projects/base-custom-webcomponent.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/node-projects/base-custom-webcomponent/issues"
21+
},
22+
"homepage": "https://github.com/node-projects/base-custom-webcomponent#readme"
23+
}

src/BaseCustomWebComponent.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,15 @@ export class BaseCustomWebComponentNoAttachedTemplate extends HTMLElement {
505505
return;
506506
}
507507

508+
if (path.includes("[")) {
509+
//support binding like this: {{this.picks?.[this.currentPick]?.ConfirmQuantity::value-changed}}
510+
let p = path.replaceAll(".[", "[");
511+
p += "=" + value + ";";
512+
p = "try { " + p + " } catch (err) { console.warn(err); }";
513+
eval(p);
514+
return;
515+
}
516+
508517
let target = obj;
509518
if (path.startsWith('this.')) {
510519
path = path.substr(5);

0 commit comments

Comments
 (0)