@ni/nimble-components 1.0.0-beta.107 → 1.0.0-beta.110
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 +11 -0
- package/dist/esm/tree-item/index.js +7 -9
- package/dist/esm/tree-item/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,11 +10,22 @@ NI-styled web components for web applications.
|
|
|
10
10
|
|
|
11
11
|
## Getting Started
|
|
12
12
|
|
|
13
|
+
### Framework Support
|
|
14
|
+
|
|
13
15
|
If you are using one of the following frameworks see associated wrapper documentation:
|
|
14
16
|
|
|
15
17
|
1. Angular: See the [nimble-angular](/angular-workspace/projects/ni/nimble-angular) documentation.
|
|
16
18
|
2. Blazor WebAssembly or Blazor Server: See the [nimble-blazor](/packages/nimble-blazor) documentation.
|
|
17
19
|
|
|
20
|
+
### Using `nimble-components` in a Webpack Application
|
|
21
|
+
|
|
22
|
+
If you have an existing application that incorporates a module bundler like [Webpack](https://webpack.js.org/) but doesn't include one of the above frameworks, you can use `@ni/nimble-components` directly. Exact instructions will depend on your application, but here are some common steps:
|
|
23
|
+
|
|
24
|
+
1. Install the package from [the public NPM registry](https://www.npmjs.com/package/@ni/nimble-components) by running `npm install @ni/nimble-components`.
|
|
25
|
+
2. Import the component you want to use from the file you want to use it in. For example: `import '@ni/nimble-components/dist/esm/icons/succeeded';`
|
|
26
|
+
3. Add the HTML for the component to your page. You can see sample code for each component in the [Nimble Storybook](https://ni.github.io/nimble/storybook/) by going to the **Docs** tab for the component and clicking **Show code**. For example: `<nimble-succeeded-icon></nimble-succeeded-icon>`.
|
|
27
|
+
4. Nimble components are [standard web components (custom elements)](https://developer.mozilla.org/en-US/docs/Web/Web_Components) so you can configure them via normal DOM APIs like attributes, properties, events, and methods. The [Storybook documentation](https://ni.github.io/nimble/storybook/) for each component describes its custom API.
|
|
28
|
+
|
|
18
29
|
## Contributing
|
|
19
30
|
|
|
20
31
|
Follow the instructions in [CONTRIBUTING.md](/packages/nimble-components/CONTRIBUTING.md) to modify this library.
|
|
@@ -31,27 +31,25 @@ export class TreeItem extends FoundationTreeItem {
|
|
|
31
31
|
if ((leavesOnly && !hasChildren) || !leavesOnly) {
|
|
32
32
|
// if either a leaf tree item, or in a mode that supports select on groups,
|
|
33
33
|
// process click as a select
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
event.stopImmediatePropagation();
|
|
34
|
+
if (!this.selected) {
|
|
35
|
+
this.selected = true;
|
|
36
|
+
this.$emit('selected-change', this);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
else {
|
|
41
40
|
// implicit hasChildren && leavesOnly, so only allow expand/collapse, not select
|
|
42
41
|
this.expanded = !this.expanded;
|
|
43
42
|
this.$emit('expanded-change', this);
|
|
44
|
-
// don't allow base class to process click event, as all we want to happen
|
|
45
|
-
// here is toggling 'expanded', and to issue the expanded-change event
|
|
46
|
-
event.stopImmediatePropagation();
|
|
47
43
|
}
|
|
44
|
+
// don't allow base class to process click event
|
|
45
|
+
event.stopImmediatePropagation();
|
|
48
46
|
};
|
|
49
47
|
// This prevents the toggling of selected state when a TreeItem is clicked multiple times,
|
|
50
48
|
// which is what the FAST TreeItem allows
|
|
51
49
|
this.handleSelectedChange = (event) => {
|
|
52
50
|
// only process selection
|
|
53
|
-
if (event.target === this) {
|
|
54
|
-
this.
|
|
51
|
+
if (event.target === this && this.selected) {
|
|
52
|
+
this.setGroupSelectionOnRootParentTreeItem(this);
|
|
55
53
|
}
|
|
56
54
|
};
|
|
57
55
|
this.addEventListener('click', this.handleClickOverride);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,IAAI,QAAQ,EAC5B,QAAQ,IAAI,kBAAkB,EAE9B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,4BA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AC/D,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAE/B,IAAI,WAAW,GAAmC,QAAQ,CAAC;QAC3D,OAAO,WAAW,EAAE,aAAa,KAAK,IAAI,CAAC,QAAQ,EAAE;YACjD,WAAW,GAAG,WAAW,EAAE,aAAa,CAAC;SAC5C;QAED,IAAI,WAAW,EAAE;YACb,WAAW,CAAC,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;SAC5D;IACL,CAAC;IAEO,oBAAoB,CAAC,OAAoB;QAC7C,IAAI,YAAY,GAAmC,OAAO,CAAC;QAC3D,OACI,YAAY;eACT,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC,EACzD;YACE,YAAY,GAAG,YAAY,EAAE,aAAa,CAAC;SAC9C;QAED,OAAO,YAAwB,CAAC;IACpC,CAAC;IAED;;;OAGG;IACK,iBAAiB;QACrB,MAAM,UAAU,GAAmB,IAAI,CAAC,aAAc,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAChF,OAAO,UAAsB,CAAC;IAClC,CAAC;CACJ;AAED,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAkB;IACrD,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,kBAAkB;IAC7B,QAAQ;IACR,MAAM;IACN,mBAAmB,EAAE,4BAA4B,CAAC,IAAI;CACzD,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/nimble-components",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.110",
|
|
4
4
|
"description": "Styled web components for the NI Nimble Design System",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run build-components && npm run build-storybook",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prettier": "prettier-eslint \"**/*.*\" --list-different --prettier-ignore",
|
|
12
12
|
"prettier-fix": "prettier-eslint \"**/*.*\" --write --prettier-ignore",
|
|
13
13
|
"pack": "npm pack",
|
|
14
|
-
"publish": "npm publish",
|
|
14
|
+
"invoke-publish": "npm publish",
|
|
15
15
|
"storybook": "start-storybook -p 6006",
|
|
16
16
|
"build-storybook": "build-storybook -o dist/storybook",
|
|
17
17
|
"build-components": "tsc -p ./tsconfig.json",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@microsoft/fast-components": "^2.0.0",
|
|
44
44
|
"@microsoft/fast-element": "^1.6.1",
|
|
45
45
|
"@microsoft/fast-foundation": "^2.22.0",
|
|
46
|
-
"@ni/nimble-tokens": "^1.0.0-beta.
|
|
46
|
+
"@ni/nimble-tokens": "^1.0.0-beta.35",
|
|
47
47
|
"hex-rgb": "^5.0.0",
|
|
48
48
|
"lodash-es": "^4.17.21"
|
|
49
49
|
},
|