{"id":22125431,"url":"https://github.com/notadd/ngx-tree-dnd","last_synced_at":"2025-07-25T15:32:25.135Z","repository":{"id":54550794,"uuid":"142515496","full_name":"notadd/ngx-tree-dnd","owner":"notadd","description":"基于@swimlane/ngx-dnd，可拖拽，可配置actions的Angular树组件","archived":false,"fork":false,"pushed_at":"2021-02-11T06:07:59.000Z","size":1662,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-03-24T16:20:26.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://notadd.github.io/ngx-tree-dnd/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notadd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-27T02:05:37.000Z","updated_at":"2023-03-30T02:31:39.000Z","dependencies_parsed_at":"2022-08-13T19:20:54.195Z","dependency_job_id":null,"html_url":"https://github.com/notadd/ngx-tree-dnd","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadd%2Fngx-tree-dnd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadd%2Fngx-tree-dnd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadd%2Fngx-tree-dnd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notadd%2Fngx-tree-dnd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notadd","download_url":"https://codeload.github.com/notadd/ngx-tree-dnd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227590965,"owners_count":17790563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T16:20:54.668Z","updated_at":"2024-12-01T16:20:55.377Z","avatar_url":"https://github.com/notadd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NgxTreeDnd\n\n基于[@swimlane/ngx-dnd](https://github.com/swimlane/ngx-dnd)，可拖拽,可配置actions的Angular树组件  \n保留原有的api和feature，修改了默认样式，添加了折叠、action配置\n\n## How to use\n### step-1\n\n#### 安装`@notadd/ngx-tree-dnd`\n+ `npm install @notadd/ngx-tree-dnd` \n \n#### 安装依赖\n+ `npm install @swimlane/dragula material-design-icons`\n\n#### step-2\n+ 添加NgxTreeDnDModule到你的AppModule\n+ 引入material-design-icons\n\u003e 如果你的项目是Angular6，需要在polyfills.ts中添加如下代码：  \n`(window as any).global = window;`\n\n#### step-3\n+ 在你的component中添加`ngx-tree-dnd-container`组件\n```html\n\u003cngx-tree-dnd-container\n    [model]=\"nestedLists\"\n    [actions]=\"actions\"\u003e\n\u003c/ngx-tree-dnd-container\u003e \n```\n\n```js\nnestedLists = [\n  {\n    label: 'Item 1',\n    children: []\n  },\n  {\n    label: 'Item 2',\n    children: [\n      {\n        label: 'Item 2a',\n        children: []\n      },\n      {\n        label: 'Item 2b',\n        children: []\n      },\n      {\n        label: 'Item 2c',\n        children: []\n      }\n    ]\n  },\n  {\n    label: 'Item 3',\n    children: [\n      {\n        label: 'Item 3a',\n        children: []\n      },\n      {\n        label: 'Item 3b',\n        children: []\n      },\n      {\n        label: 'Item 3c',\n        children: []\n      }\n    ]\n  }\n];\n```\n```js\nactions = [\n    {\n      // action按钮material icon\n      icon: 'remove_red_eye',\n      /* 点击action按钮的回调函数 */\n      callback: (model) =\u003e {\n        /* model为当前actions所在item的model */\n        /* do something */\n      }\n    },\n    {\n      icon: 'edit',\n      callback: (model) =\u003e {}\n    },\n    {\n      icon: 'delete',\n      callback: (model) =\u003e {}\n    }\n  ];\n```\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotadd%2Fngx-tree-dnd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotadd%2Fngx-tree-dnd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotadd%2Fngx-tree-dnd/lists"}