@nebula.js/sn-org-chart 1.8.0 → 1.10.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/README.md CHANGED
@@ -13,20 +13,85 @@ You can also load through the script tag directly from [https://unpkg.com](https
13
13
  ## Usage
14
14
 
15
15
  ```js
16
-
17
- import { embed } from '@nebula.js/stardust';
18
- import org from '@nebula.js/sn-org-chart';
16
+ import { embed } from "@nebula.js/stardust";
17
+ import org from "@nebula.js/sn-org-chart";
19
18
 
20
19
  // 'app' is an enigma app model
21
20
  const nuked = embed(app, {
22
- types: [{
23
- name: 'orgchart',
24
- load: () => Promise.resolve(org);
25
- }]
21
+ types: [
22
+ {
23
+ name: "orgchart",
24
+ load: () => Promise.resolve(org),
25
+ },
26
+ ],
26
27
  });
27
28
 
28
- embed.render({
29
+ nuked.render({
29
30
  element,
30
- type: 'orgchart',
31
+ type: "orgchart",
32
+ fields: ["EmployeeID", "ManagerID"],
31
33
  });
32
34
  ```
35
+
36
+ ## Data requirements
37
+
38
+ The chart needs exactly two dimensions and accepts one optional measure:
39
+
40
+ | Position | Role | Notes |
41
+ | ----------- | ----------------- | ----------------------------------------------------------------------------- |
42
+ | Dimension 1 | Node id | Must be unique per node. Shown as the card title unless a label is provided. |
43
+ | Dimension 2 | Parent id | Must match another row's node id. A non-matching value makes the node a root. |
44
+ | Measure | Value on the card | Optional. Rendered as `<measure title>: <value>`. |
45
+
46
+ Extra content per node is added as attribute expressions on dimension 1, matched by `id`:
47
+
48
+ | Attribute expression id | Shown as |
49
+ | ----------------------- | ----------------------------------------------- |
50
+ | `labelExpression` | Card title |
51
+ | `subLabelExpression` | Card sub-title |
52
+ | `extraLabelExpression` | Card description (only when no measure is used) |
53
+ | `imageExpression` | Image URL (`http`, `https` or `data:`) |
54
+ | `colorByExpression` | Card background color |
55
+
56
+ Multiple roots are grouped under a synthetic root node, and circular references are reported as a warning. See the [data model documentation](./docs/data-model.md) for details.
57
+
58
+ ## Development
59
+
60
+ Requires Node.js 24 or later and pnpm.
61
+
62
+ ```bash
63
+ pnpm install
64
+ pnpm start # dev server on http://localhost:8000
65
+ pnpm test:unit # vitest
66
+ pnpm test:e2e # playwright rendering tests
67
+ ```
68
+
69
+ ### Building
70
+
71
+ `pnpm install` runs the `prepare` script, which generates translations and then runs `pnpm run generate` to generate the TypeSpec outputs, including the JSON Schema at `tsp-output/@typespec/json-schema/sn-org-chart.json`. These generated files are ignored by Git, so installation must complete before building, including in CI.
72
+
73
+ Run `pnpm generate` again after changing the TypeSpec definitions. If installation was run with lifecycle scripts disabled (for example, `pnpm install --ignore-scripts`), run `pnpm run prepare` manually to generate both translations and TypeSpec outputs.
74
+
75
+ Builds copy the existing schema without regenerating it. The build calls `copyJsonSchema()` from `tools/copy-json-schema.js` to copy it to `api-specifications/sn-org-chart.json` before bundling:
76
+
77
+ ```sh
78
+ pnpm build
79
+ ```
80
+
81
+ For a development build, run `pnpm build:dev`. To rebuild on changes, run `pnpm build:watch`.
82
+
83
+ See [.github/CONTRIBUTION.md](./.github/CONTRIBUTION.md) for the contribution workflow.
84
+
85
+ ## Documentation
86
+
87
+ Deeper documentation lives in [`docs/`](./docs/README.md):
88
+
89
+ - [Data model](./docs/data-model.md) — hypercube setup and how rows become a tree
90
+ - [Architecture](./docs/architecture.md) — modules, render lifecycle, property panel
91
+ - [Layout and navigation](./docs/layout-and-navigation.md) — positioning, expand/collapse, zoom, selections, snapshots
92
+ - [Styling and theming](./docs/styling-and-theming.md) — card styling model, colours, theme integration
93
+ - [Development](./docs/development.md) — scripts, tests, CI and release
94
+
95
+ ## License
96
+
97
+ [MIT](./LICENSE)
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-org-chart:properties",
5
5
  "description": "Org chart generic object definition",
6
- "version": "1.8.0",
6
+ "version": "1.10.0",
7
7
  "license": "MIT",
8
8
  "stability": "experimental",
9
9
  "x-qlik-visibility": "public"