orgchart 6.0.0 → 7.0.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/.github/workflows/publish.yml +11 -8
- package/README.md +47 -35
- package/README.zh-cn.md +73 -30
- package/README.zh-tw.md +73 -30
- package/demo/edit-chart.html +0 -4
- package/demo/edit-hybrid-chart.html +3 -4
- package/demo/index.html +5 -1
- package/demo/ondemand-loading-data.html +137 -80
- package/demo/options-compact-drag.html +82 -0
- package/demo/options-export-navigation.html +76 -0
- package/demo/options-horizontal-template.html +80 -0
- package/demo/options-hybrid-navigation.html +71 -0
- package/dist/css/orgchart.css +12 -1
- package/dist/css/orgchart.min.css +1 -1
- package/dist/js/orgchart.js +896 -523
- package/dist/js/orgchart.min.js +1 -1
- package/dist/js/orgchart.min.js.map +1 -1
- package/gulpfile.js +5 -1
- package/package.json +2 -1
- package/src/css/orgchart.css +12 -1
- package/src/js/orgchart.js +896 -523
- package/test/compatibility/README.md +123 -0
- package/test/compatibility/browser.tests.js +1279 -0
- package/test/compatibility/options.tests.js +628 -0
- package/test/cypress/e2e/demo-interactions.cy.js +3 -3
- package/test/cypress/e2e/demo-rendering.cy.js +62 -1
- package/test/cypress/e2e/drag-drop-hybrid-chart.cy.js +2 -1
- package/test/cypress/e2e/local-datasource.cy.js +16 -16
- package/test/cypress/e2e/ondemand-loading-data.cy.js +34 -10
- package/test/cypress/e2e/toggle-sibs-resp.cy.js +4 -4
- package/test/cypress/e2e/vertical-vevel.cy.js +5 -5
- package/test/integration/init-tests.js +30 -43
- package/test/integration/tests.js +21 -13
- package/test/unit/lifecycle-builders-export.tests.js +179 -118
- package/test/unit/tests.js +33 -34
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Option Compatibility Regression
|
|
2
|
+
|
|
3
|
+
Verified on 2026-10-10 using Node v24.14.0, Mocha, jsdom, and headless Chrome through the existing Puppeteer dependency. The initial audit reproduced 39 failing assertions; runtime fixes and additional workflow regressions are now included in the normal test/build gate.
|
|
4
|
+
|
|
5
|
+
## Results
|
|
6
|
+
|
|
7
|
+
- All 18 top-level `defaultOptions` keys were included: 153 unordered pairs and 830 representative value combinations. All combinations passed the configuration and supported-workflow matrix, plus one coverage-completeness assertion.
|
|
8
|
+
- The complete compatibility suite has 5,848 passing tests and no failures.
|
|
9
|
+
- The DOM suite has 5,677 passing tests; the browser suite has 171 passing tests.
|
|
10
|
+
- The existing unit/integration baseline remains green: 270 passing.
|
|
11
|
+
- All 72 real export checks passed: JSON/UL/family sources, four directions, scales 1/2/3, and PNG/PDF. Scale-3 checks also enable navigation/export options, perform pan/zoom, and click the export button; family cases enable compact layout. Canvas dimensions, all six node colors, PDF headers/page dimensions, filenames, and export-state cleanup are checked.
|
|
12
|
+
- All 128 assignments of seven boolean switches are tested on three datasource types, four directions and three depths: 4,608 structural configurations.
|
|
13
|
+
- A verified 64-profile covering array exercises every one of the eight binary assignments of every triple among 26 public options (2,600 triples), using two representative values per option on JSON/UL/family sources.
|
|
14
|
+
- Twenty real-browser batches execute 128 switch masks each: 2,560 expand/zoom/pan/drag/reconfigure/export workflows across JSON, UL, family, hybrid and compact-data sources in four directions.
|
|
15
|
+
|
|
16
|
+
The configuration matrix is accompanied by actual browser, lifecycle and data-mutation checks. Coverage uses representative valid configurations, not arbitrary invalid values or every possible Cartesian product.
|
|
17
|
+
|
|
18
|
+
## Reproduction
|
|
19
|
+
|
|
20
|
+
Run the full regression suite:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm run compatibility-tests
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The suite is included in `gulp test` and `npm run build`. It must pass; known conflicts are no longer expected failures. No development server is required for the Puppeteer cases.
|
|
27
|
+
|
|
28
|
+
Run only the passing pairwise matrix:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npx mocha test/compatibility/options.tests.js --grep "pairwise" --reporter dot
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Run the real export checks:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npx mocha test/compatibility/browser.tests.js --grep "actual PNG and PDF export pixels"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run the existing baseline:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npx mocha "test/unit/*.js" "test/integration/*.js" --reporter dot
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Resolved Findings
|
|
47
|
+
|
|
48
|
+
| ID | Configuration / action | Fix |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| F01 | Non-default direction with zoom or minimap movement | Preserve the complete rotation/reflection matrix and adjust only scale/translation. |
|
|
51
|
+
| F02 | Custom `nodeId` with hybrid drag/drop | Use the configured identifier for source and target datasource lookups. |
|
|
52
|
+
| F03 | Wheel over minimap with zoom enabled | Handle the event once and stop propagation to the container. |
|
|
53
|
+
| F04 | Repeated initialization or disabling zoom | Unbind old chart/container/document listeners before replacing the chart; retain merged option state. |
|
|
54
|
+
| F05 | Minimap with hidden nodes or limited depth | Filter nodes by their own and their ancestors' visibility; refresh on mutations and resize. |
|
|
55
|
+
| F06 | First pan movement with minimap | Refresh on the first matrix assignment as well as later moves. |
|
|
56
|
+
| F07 | Drag preview after direction/zoom changes | Measure scale from the full matrix instead of one direction-dependent entry. |
|
|
57
|
+
| F08 | Multiple instances with export buttons | Own each button by its chart instance, including loading-state isolation. |
|
|
58
|
+
| F09 | Updating or disabling an export button | Update the existing label or remove the instance's button during initialization. |
|
|
59
|
+
| F10 | Multiple chart class tokens during export | Match class tokens without building an invalid descendant selector; reuse the anchor. |
|
|
60
|
+
| F11 | Native scrolling with minimap | Listen for scrolling and keep both the overlay and viewport synchronized. |
|
|
61
|
+
|
|
62
|
+
Additional regressions cover compact drag/drop and editing, hierarchy queries, vertical/hybrid depth limits, nested event routing, pinch-state changes, loading styles, templates and callbacks. Minimap previews are checked after compact expansion animations; pan preserves fractional translations introduced by zoom.
|
|
63
|
+
|
|
64
|
+
Compact and family moves update the datasource and rebuild affected chart layout while retaining expansion and navigation state. They move the selected node and its own descendants, never the surrounding manager or household. Callers should reacquire rendered node elements after a rebuild.
|
|
65
|
+
|
|
66
|
+
Family regressions check configured identifiers, one-based depth, grouped hierarchy export, complete sibling queries, per-parent container isolation and independent expansion. Editing regressions verify that addChildren/addDescendants/addParent/addSiblings/removeNodes retain their results when options subsequently change. Initialization observers are cleaned up so immediate reconfiguration does not duplicate initCompleted callbacks.
|
|
67
|
+
|
|
68
|
+
## Configuration Rules
|
|
69
|
+
|
|
70
|
+
### Partial Icons
|
|
71
|
+
|
|
72
|
+
`icons` is merged field by field with the defaults. All 11 individual overrides are tested, together with complete custom objects.
|
|
73
|
+
|
|
74
|
+
### Zoom Limits
|
|
75
|
+
|
|
76
|
+
The supported scale interval is inclusive: `zoomoutLimit <= targetScale <= zoominLimit`. Wheel steps multiply by `0.8` or `1.2` and clamp to the configured bounds. Limits must be finite, positive and ordered.
|
|
77
|
+
|
|
78
|
+
Both container zoom and minimap zoom are checked:
|
|
79
|
+
|
|
80
|
+
| Limits | Result from scale `1` |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `zoomoutLimit=0.8`, `zoominLimit=1.2` | Steps reach both boundaries. |
|
|
83
|
+
| `zoomoutLimit=0.9`, `zoominLimit=1.1` | Steps clamp to both boundaries. |
|
|
84
|
+
| `zoomoutLimit=2`, `zoominLimit=1` | A RangeError is thrown before replacing the chart. |
|
|
85
|
+
|
|
86
|
+
`compact` accepts boolean values, a branch-selection callback, or per-node data properties. `drag` aliases `draggable`; the canonical option wins when both are supplied. `visibleLevel` accepts nonnegative integers, `true` for the default depth, and `false` for one level.
|
|
87
|
+
|
|
88
|
+
Vertical/hybrid rules take precedence at nodes where configured; compact layout applies to other branches. A node does not render two different child layouts at once, but depth limits and interactions use the same actual hierarchy in either layout.
|
|
89
|
+
|
|
90
|
+
`minimap=true` intentionally supports its own wheel zoom even when `zoom=false`; the README documents this, so it is not counted as a conflict.
|
|
91
|
+
|
|
92
|
+
## Representative Values
|
|
93
|
+
|
|
94
|
+
| Option | Values checked in the pairwise matrix |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `icons` | Complete defaults; complete custom class-name object |
|
|
97
|
+
| `nodeTitle` | `name`, `label` |
|
|
98
|
+
| `nodeId` | `id`, `key` |
|
|
99
|
+
| `toggleSiblingsResp` | `false`, `true` |
|
|
100
|
+
| `visibleLevel` | `1`, `2`, `999` |
|
|
101
|
+
| `chartClass` | Empty; one token; two tokens |
|
|
102
|
+
| `exportButton` | `false`, `true` |
|
|
103
|
+
| `exportButtonName` | `Export`, `Save Chart` |
|
|
104
|
+
| `exportFilename` | `OrgChart`, `compat-export` |
|
|
105
|
+
| `exportFileextension` | `png`, `pdf`, `PDF` |
|
|
106
|
+
| `exportScale` | `1`, `2`, `3` |
|
|
107
|
+
| `draggable` | `false`, `true` |
|
|
108
|
+
| `direction` | `t2b`, `b2t`, `l2r`, `r2l` |
|
|
109
|
+
| `pan` | `false`, `true` |
|
|
110
|
+
| `minimap` | `false`, `true` |
|
|
111
|
+
| `zoom` | `false`, `true` |
|
|
112
|
+
| `zoominLimit` | `2.5`, `7` |
|
|
113
|
+
| `zoomoutLimit` | `0.5`, `0.6` |
|
|
114
|
+
|
|
115
|
+
Each matrix case uses a fresh six-node JSON tree and checks merged options, labels/IDs, classes/icons, initial visibility, sibling collapse/reveal, pan enablement, container zoom enablement, horizontal drag/reparenting when enabled, and export routing/options/button behavior. Export rendering is stubbed only in the DOM suite; the browser suite uses the actual html2canvas/jsPDF implementations.
|
|
116
|
+
|
|
117
|
+
## Scope Limits
|
|
118
|
+
|
|
119
|
+
- All seven selected boolean switches are enumerated. Other values and callbacks use finite representatives; the full Cartesian product of every public option and every possible number/string/function is not asserted.
|
|
120
|
+
- Browser tests use 1280px and 390px viewport widths for selected minimap checks. Pinch-state transitions and drag events are programmatic; OS drag feedback and actual download dialogs are not asserted.
|
|
121
|
+
- Structural switch and triple-profile coverage includes JSON, native UL and grouped family sources. Browser workflows additionally include hybrid and compact data; arbitrary AJAX callbacks and external assets are outside the finite configuration matrix.
|
|
122
|
+
- Custom icon checks verify configuration and DOM classes, not external icon-font assets. Complete export checks verify node-color presence rather than screenshot-perfect typography.
|
|
123
|
+
- The existing unit/integration suite remains a separate regression gate. The standard build also runs Cypress demo tests.
|