Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ concurrency:
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
node-version: [20.19.5]
node-version: [24.22.1]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-oidc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:

publish-npm:
# needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20.19.5]
node-version: [24.22.1]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Check out repo
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-token.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

publish-npm:
# needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20.19.5]
node-version: [24.22.1]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Check out repo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ npm-debug.log
*.swp

/dist
/tmp

compiled

Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.22.1
70 changes: 70 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What this is

`@talentia/angular-tree-component` is a **fork of [CirclonGroup/angular-tree-component](https://github.com/CirclonGroup/angular-tree-component)**
(git remote `upstream`), kept current with Angular by Talentia. It is consumed by `@talentia/components`
(core-components) and by the HCM front-end — check real usage there before changing behavior.
State management is **MobX 4** (peer `mobx ~4.14.1`), not signals or RxJS.

The workspace has two projects: the library (`projects/angular-tree-component`) and a demo app
(`projects/demo`, 18 routes: basic, fields, templates, filter, async, checkboxes, drag, virtual, api,
actions, context-menu, ...). The library version follows the release branch name (e.g. `11.0.13`).

## Commands

```bash
npm run build # clean:build + build:prod; build:prod = ng build + create:dir + copy:file (CSS)
npm run build:dev # development build — does NOT copy the CSS into dist
npm start # build:dev + ng serve demo (http://localhost:4200)
npm run watch # lib + demo in watch mode
npm run demo:prod # production build of the demo (also demo:dev); CI runs build:prod + demo:prod
npm run lint # ng lint (lib + demo)
npm run lint:lib-fix # ng lint of the library with --fix
npm run update-browserslist
```

There is no test framework (no Jest/Karma, no `*.spec.ts`): verify behavior in the demo or in a
consumer. Node version: `.nvmrc`.

## Architecture

Everything lives in `projects/angular-tree-component/src/lib/`:

- **`models/`** — the tree state: `TreeModel` (root, focus/active/selection, filtering, drag & drop,
API), `TreeNode`, `TreeOptions` (normalizes `ITreeOptions`), `TreeVirtualScroll`. Observable
state and actions use MobX 4 through the re-exported decorators in `mobx-angular/mobx-proxy.ts`.
- **`mobx-angular/`** — `mobx-proxy.ts` (MobX `action`/`computed`/`observable` re-exported for AOT) and
`TreeMobxAutorunDirective` (`[treeMobxAutorun]`): re-renders a template inside a MobX `autorun`.
- **`components/`** — `tree-root`, `tree-viewport`, `tree-node`, `tree-node-collection`,
`tree-node-children`, `tree-node-wrapper`, `tree-node-content`, `tree-node-expander`,
`tree-node-checkbox`, `tree-node-drop-slot`, `tree-loading-component`. All `standalone: false`,
declared in `TreeModule`; templates use `@if`/`@for` and `ngTemplateOutlet` for custom templates.
- **`directives/`** — `treeDrag` (HTML5 dragstart outside the Angular zone), `treeDrop`,
`treeAnimateOpen`.
- **`defs/api.ts`** — the public interfaces (`ITreeOptions`, `ITreeNode`, `ITreeState`, ...), with
the option documentation in JSDoc.
- **`angular-tree-component.module.ts`** — `TreeModule`; it imports `CommonModule`, which is needed
for `ngTemplateOutlet`. `public-api.ts` re-exports the module file.
- **`angular-tree-component.css`** — shipped separately: `build:prod` copies it to
`dist/angular-tree-component/css/`. The package `exports` don't expose `./css/*`, so consumers add
`node_modules/@talentia/angular-tree-component/css/angular-tree-component.css` to the `styles` in
`angular.json` (as core-components and HCM do).

## Working in this codebase

- Angular upgrades are done **without adopting new Angular features**: components stay
`standalone: false`, the demo keeps zone.js via `provideZoneChangeDetection()`.
- **Change detection is the risky area.** The tree updates through MobX + `NgZone`, so it relies on
the implicit CheckAlways strategy; no component declares `changeDetection`. In Angular 22 OnPush
becomes the default for components compiled with v22: before compiling the library with v22 add
`changeDetection: ChangeDetectionStrategy.Eager` to all components (and raise the peer to
`^21.2.0` at least, since `Eager` only exists from 21.2) or adapt the library to OnPush. A library
compiled with v21 keeps Eager even inside a v22 app (decided by the linker from the compile version).
- `uuid` is a devDependency used only by the demo; the library has its own internal `uuid()`.
- `@angular/*` versions are pinned exactly; peer range `^<major>.0.0`. No `overrides` in
`package.json`: transitive `@angular-devkit/*` are kept on the framework patch only by the lock.
- `tmp/` is git-ignored and may contain task worklogs/scripts (e.g. `tmp/HCM-8031/`, including a
Playwright test of the demo).
51 changes: 29 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@

A simple yet powerful tree component for Angular

## Compatibility

| @talentia/angular-tree-component | Angular |
| -------------------------------- | ------- |
| 11.0.13 | 21.x |
| 11.0.12 | 20.x |
| 11.0.10 - 11.0.11 | 19.x |
| 11.0.9 | 18.x |
| 11.0.8 | 17.x |
| 11.0.6 - 11.0.7 | 16.x |
| 11.0.5 | 15.x |

## Getting started

Install `angular-tree-component`:
Install `@talentia/angular-tree-component` and its peer dependency `mobx` (4.14.x):

```npm install @talentia/angular-tree-component```
```bash
npm install @talentia/angular-tree-component mobx@~4.14.1
```

Import `TreeModule`:

```
import { TreeModule } from '@circlon/angular-tree-component';
```ts
import { TreeModule } from '@talentia/angular-tree-component';

@NgModule({
declarations: [AppComponent],
Expand All @@ -21,10 +35,12 @@ import { TreeModule } from '@circlon/angular-tree-component';
export class AppModule {}
```

Add css to `styles.scss` or include in `angular.json`:
Add the css to the `styles` of your project in `angular.json`:

```
@import '~@circlon/angular-tree-component/css/angular-tree-component.css';
```json
"styles": [
"node_modules/@talentia/angular-tree-component/css/angular-tree-component.css"
]
```

## Docs, Demos & More
Expand All @@ -40,23 +56,14 @@ The API Reference is still in our old documentation for now:

[Slack Community](https://angular-tree-component.herokuapp.com/)

## Angular supported version

angular-tree-component supports angular 2 and above, and AoT compilation.
## Build & Run

## Contributing

Run `npm run build` (`npm run build:win` for windows users) to build. Run `npm start:example-app` and open [localhost:4200](http://localhost:4200) to test your code before submitting a pull request.

To run tests locally - make sure port 4200 is available and run:

```
$ npm run build # build:win for windows; wait until build finished
$ npm run start:example-app # Wait until webpack finishes and http://localhost:4200 is available
$ npm run test:dev
```
Run `npm run build` to build the library. The build artifacts will be stored in the `dist/angular-tree-component` directory.
Run `npm run start` to build the library and run the demo on [localhost:4200](http://localhost:4200).
Run `npm run watch` to run the library and the demo in watch mode.
Run `npm run lint` to lint the library and the demo.

Please check the issues / project before starting to work on a feature / bug to make sure it's not already in progress.
This project currently uses [Angular CLI](https://github.com/angular/angular-cli) version 21.2.25.

## Contributors

Expand Down
3 changes: 3 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,8 @@
"@schematics/angular:resolver": {
"typeSeparator": "."
}
},
"cli": {
"analytics": false
}
}
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// @ts-check
const { defineConfig } = require("eslint/config");
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");

module.exports = tseslint.config(
module.exports = defineConfig(
{
files: ["**/*.ts"],
extends: [
Expand Down
Loading