@coolon/angular-ui-powerups 3.10.0 → 3.10.1
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/CHANGELOG.md +2 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +19 -1
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/tree-table/tree-table-model.js +18 -0
- package/esm2015/lib/components/tree-table/tree-table-model.js.map +1 -1
- package/esm2015/lib/components/tree-table/tree-table-model.metadata.json +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.js +1 -1
- package/esm2015/lib/place/route/visit-sanitiser.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +19 -1
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/tree-table/tree-table-model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,11 +7,29 @@ import { TreeExpansionModel } from './tree-expansion-model';
|
|
|
7
7
|
import { TreeLabelColumnModel } from './tree-label-column-model';
|
|
8
8
|
import { TreeToListModel } from './tree-to-list-model';
|
|
9
9
|
import { SelfAndDescendantsVisitor } from './visitable.class';
|
|
10
|
+
// TODO:
|
|
11
|
+
// Selection Models:
|
|
12
|
+
// - as simple navigation tree
|
|
13
|
+
// - as editable grid (selecte all, even hidden etc?)
|
|
14
|
+
// - fixing selection on underlying model changes.
|
|
15
|
+
// - rendering selection: row highlighting, checkboxes (in the tree renderer or in separate column), both.
|
|
16
|
+
// Expansion Models:
|
|
17
|
+
// - Add ability to auto show to depth
|
|
18
|
+
// - Add a predicate to check default expansion (i.e. has children of a certain type)
|
|
19
|
+
//
|
|
10
20
|
export class TreeTableModel extends AbstractTableModel {
|
|
11
21
|
constructor(source, treeExpansionModel) {
|
|
12
22
|
super(source);
|
|
13
23
|
this.treeExpansionModel = treeExpansionModel;
|
|
14
24
|
}
|
|
25
|
+
static fromRoot(sourceOfTruth, builder) {
|
|
26
|
+
const garbage = new GarbageCollector();
|
|
27
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);
|
|
28
|
+
const children = chain(sourceOfTruth).mapToList(root => [root]);
|
|
29
|
+
const model = this.fromList(children, builder);
|
|
30
|
+
model.registerDisposable(garbage);
|
|
31
|
+
return model;
|
|
32
|
+
}
|
|
15
33
|
static fromChildrenOf(sourceOfTruth, builder) {
|
|
16
34
|
const garbage = new GarbageCollector();
|
|
17
35
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-table-model.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/components/tree-table/tree-table-model.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sGAAsG;AACtG,4EAA4E;AAC5E,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAA4C,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAiB,MAAM,mBAAmB,CAAC;AAG7E,MAAM,OAAO,cAA0C,SAAQ,kBAA0C;IACvG,YAAY,MAAyC,EAAW,kBAA8D;QAC5H,KAAK,CAAC,MAAM,CAAC,CAAC;QADgD,uBAAkB,GAAlB,kBAAkB,CAA4C;IAE9H,CAAC;IAED,MAAM,CAAC,cAAc,CAA4B,aAA8B,EAAE,OAAmD;QAClI,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM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kB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,IAA4B;QACnC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,WAAW,CAAC,IAA4B;QACtC,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,6BAA6B,CAAC,IAA4B;QACxD,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;CAqCF;AA6ID,MAAM,OAAO,eAA8C,SAAQ,yBAA4B;IAK7F,YAAoB,YAAiB;QACnC,KAAK,EAAE,CAAC;QADU,iBAAY,GAAZ,YAAY,CAAK;QAH7B,WAAM,GAAQ,EAAE,CAAC;QAKvB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAI,YAAY,CAAC,CAAC;IAC7C,CAAC;IAES,OAAO,CAAC,EAAK;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAES,qBAAqB,CAAC,EAAK;QACnC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CAEF;AAED,yBAAyB;AACzB,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,uBAAuB;AACvB,EAAE;AACF,kCAAkC;AAClC,EAAE;AACF,qDAAqD;AACrD,gCAAgC;AAChC,sEAAsE;AACtE,oDAAoD;AACpD,YAAY;AACZ,gCAAgC;AAChC,QAAQ;AACR,EAAE;AACF,gBAAgB;AAChB,4BAA4B;AAC5B,QAAQ;AACR,EAAE;AACF,EAAE;AACF,IAAI","sourcesContent":["// import {T } from '@client/api/light-architect/model/area/area.class';\n// import { SelfAndDescendantsVisitor } from '@client/api/light-architect/model/area/visitable.class';\n// import { Zone } from '@client/api/light-architect/model/area/zone.class';\nimport { Dsl, GarbageCollector, ListModel, MutableValueModel, ValueModel } from '@coolon/pectin';\nimport { AbstractTableModel } from '../table/abstract-table-model';\nimport { DecoratedTreeNode } from './decorated-tree-node';\nimport { TreeExpansionModel } from './tree-expansion-model';\nimport { TreeLabelColumnModel } from './tree-label-column-model';\nimport { TreeNode } from './tree-node';\nimport { TreeToListModel } from './tree-to-list-model';\nimport { SelfAndDescendantsVisitor, VisitableTree } from './visitable.class';\n\n\nexport class TreeTableModel<Row extends TreeNode<Row>> extends AbstractTableModel<DecoratedTreeNode<Row>> {\n constructor(source: ListModel<DecoratedTreeNode<Row>>, readonly treeExpansionModel: TreeExpansionModel<DecoratedTreeNode<Row>>) {\n super(source);\n }\n\n static fromChildrenOf<Row extends TreeNode<Row>>(sourceOfTruth: ValueModel<Row>, builder?: (tableModel: TreeTableModel<Row>) => void): TreeTableModel<Row> {\n const garbage = new GarbageCollector();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);\n const children = chain(sourceOfTruth).mapToList(root => root.children); // for some reason pluck list can't see 'children'\n const model = this.fromList(children, builder);\n model.registerDisposable(garbage);\n return model;\n }\n\n static fromList<Row extends TreeNode<Row>>(sourceOfTruth: ListModel<Row>, builder?: (tableModel: TreeTableModel<Row>) => void): TreeTableModel<Row> {\n const treeExpansionModel = new TreeExpansionModel<DecoratedTreeNode<Row>>(sourceOfTruth.identityOf);\n const nodes = new TreeToListModel(sourceOfTruth, treeExpansionModel);\n const model = new TreeTableModel<Row>(nodes, treeExpansionModel);\n model.registerDisposable(nodes);\n if (builder) builder(model);\n return model;\n }\n\n treeControlColumn(builder: (column: TreeLabelColumnModel<Row>) => void) {\n const columnId = 'tree-label';\n const column = new TreeLabelColumnModel<Row>(columnId, () => this.getColumnTextProperties(columnId), this.treeExpansionModel);\n builder(column);\n this.addColumn(column);\n }\n\n expand(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.expand(node);\n }\n\n collapse(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.expand(node);\n }\n\n isCollapsed(node: DecoratedTreeNode<Row>): boolean {\n return this.treeExpansionModel.isCollapsed(node);\n }\n\n ensureAncestorsAndSelfVisible(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.ensureAncestorsAndSelfVisible(node);\n }\n\n\n // saveSelection() {\n // let ids: number[] = [];\n // const selectedArea = this._decoratedSelectionModel.leadSelection.value;\n // if (selectedArea) {\n // ids.push(selectedArea.id);\n // ids = ids.concat(selectedArea.siblingsAfter().map(a => a.id));\n // ids = ids.concat(selectedArea.siblingsBefore().reverse().map(a => a.id));\n // ids = ids.concat(selectedArea.ancestorsToZone().reverse().map(a => a.id));\n // }\n // this._storedSelection = ids;\n // }\n //\n //\n // restoreSelection() {\n // const all = this.rootNodeModel.value.selfAndDescendants();\n // for (let i = 0; i < this._storedSelection.length; i++) {\n // const id = this._storedSelection[i];\n // const found = all.find(area => area.id === id);\n // if (found) {\n // this.selectedAreaId.value = found.id;\n // break;\n // }\n // }\n // }\n //\n // collapseAll(areas: T[]) {\n // this.collapsedAreaIds.value = [].concat(this.collapsedAreaIds.value, areas.map(a => a.id));\n // }\n\n // disableSelection(disable: boolean = true) {\n // this._disableSelection.value = disable;\n // }\n\n\n}\n\n\n// /**\n// * 1. Make this a TreeModel<T extends AbstractTree>\n// * 2. Move the decorated items to the view (along with viewToModel and modelToView)\n// */\n// export class TreeTableModel<T, K extends keyof T> {\n//\n// // public readonly decoratedVisibleAreas: ListModel<T>;\n// //\n// // private decoratorCache = undefined; //new DecoratorCache();\n// // private collapsedAreaIds: MutableListModel<number> = new MutableListModel<number>();\n// //\n// // private _rawSelectionModel: SingleSelectionModel<T, T[K]>;\n// // private _decoratedSelectionModel: SingleSelectionModel<T, T[K]>;\n// //\n// // private readonly _disableSelection = new MutableValueModel<boolean>(false);\n// // private _hoveredAreaModel: MutableValueModel<T> = new MutableValueModel<T>();\n// //\n// // private _decoratedHoverModel: ValueModel<T> = new MutableValueModel<T>();\n// // private _storedSelection: number[] = [];\n// //\n// // readonly visibleNodes: ListModelChain<T>;\n// //\n// // protected constructor(readonly rootNodeModel: ValueModel<T>, identifiedBy: K, readonly selectedAreaId: MutableValueModel<K>) {\n// // super();\n// // const {chain, valueOf, before, when, after, observe, switchOn} = Dsl.disposeWith(this);\n// //\n// // this.visibleNodes = chain(this.rootNodeModel).mapToList(root => {\n// // return root.visit(new FlattenStrategy(this.collapsedAreaIds.value)).flattenedAreas;\n// // }, {dependsOn: this.collapsedAreaIds});\n// //\n// // this.decoratedVisibleAreas = this.visibleNodes.map(area => {\n// // return this.decoratorCache.get(area);\n// // });\n// //\n// // this._rawSelectionModel = this.registerDisposable(SingleSelectionModel.fromList(this.visibleNodes, identifiedBy, {\n// // storeIdIn: this.selectedAreaId,\n// // // toggleSelection: false\n// // }));\n// // this._rawSelectionModel.selectBehaviour.disableWhen(this._disableSelection);\n// // this._decoratedSelectionModel = this.registerDisposable(SingleSelectionModel.fromList(this.decoratedVisibleAreas, identifiedBy, {\n// // storeIdIn: this.selectedAreaId,\n// // toggleSelection: false\n// // }));\n// // this._decoratedSelectionModel.selectBehaviour.disableWhen(this._disableSelection);\n// //\n// // // our areas will be different objects so we have to save, restore the\n// // // selection and rebuild our decorators\n// // before(rootNodeModel).changes(() => this.saveSelection());\n// // before(rootNodeModel).changes(() => this.decoratorCache.clear());\n// // when(rootNodeModel).changes(() => this.restoreSelection(), {asLongAs: () => !!rootNodeModel.value});\n// //\n// //\n// // this.registerDisposable(new Binding(this._decoratedHoverModel, this._hoveredAreaModel, {\n// // toLeft: (area) => area ? this.modelToView(area) : null,\n// // toRight: (decoratedArea) => decoratedArea ? this.viewToModel(decoratedArea) : null\n// // }));\n// //\n// // when(this.decoratedSelectionModel.leadSelection)\n// // .changes(selection => this.ensureAncestorsAndSelfVisible(selection), {\n// // asLongAs: selection => !!selection\n// // });\n// // }\n// //\n// // static fromRoot<T, K extends keyof T>(rootNodeModel: ValueModel<T>, identifiedBy: K, options?: TreeModel.Options<T, K>) {\n// //\n// // }\n// //\n// // public viewToModel(decoratedArea: T): T {\n// // assert.notNil(decoratedArea);\n// // return TreeModel.AreaDecorator.undecorate(decoratedArea);\n// // }\n// //\n// // public modelToView(area: T): T {\n// // assert.notNil(area);\n// // return this.decoratorCache.get(area);\n// // }\n// //\n// // get hoveredAreaModel(): ValueModel<T> {\n// // return this._hoveredAreaModel;\n// // }\n// //\n// // clearHover() {\n// // this._hoveredAreaModel.value = null;\n// // }\n// //\n// // get selectionModel(): SelectionModel<T> {\n// // return this._rawSelectionModel;\n// // }\n// //\n// // get decoratedSelectionModel(): SelectionModel<T> {\n// // return this._decoratedSelectionModel;\n// // }\n// //\n// // get decoratedHoverModel(): ValueModel<T> {\n// // return this._decoratedHoverModel;\n// // }\n// //\n// // decoratedArea(area: T): T {\n// // return this.decoratorCache.get(area);\n// // }\n// //\n// // select(area: T) {\n// // this.selectedAreaId.value = area ? area.id : null;\n// // }\n// }\n\n\nexport namespace TreeTableModel {\n\n export interface Options<T, K extends keyof T> {\n storeIdIn: MutableValueModel<K>\n }\n\n // export interface DecoratedArea extendsTDecorator,T {\n // }\n //\n // export classTDecorator extends Decorator<T> {\n //\n // static decorate(area:T): DecoratedArea {\n // return Decorator.create(area, newTDecorator(area)) as DecoratedArea;\n // }\n //\n // pathToRoot() {\n // return this.object.ancestorsToZone().slice(1);\n // }\n //\n // isLastChild() {\n // return this.object.isLastChild();\n // }\n //\n // isRoot() {\n // return this.object.isZone();\n // }\n // }\n\n}\n\n\nexport class FlattenStrategy<T extends VisitableTree<any>> extends SelfAndDescendantsVisitor<T> {\n\n private _areas: T[] = [];\n private _collapsed: Set<T>;\n\n constructor(private collapsedIds: T[]) {\n super();\n this._collapsed = new Set<T>(collapsedIds);\n }\n\n protected onVisit(it: T) {\n this._areas.push(it);\n }\n\n protected shouldVisitChildrenOf(it: T): boolean {\n return !this._collapsed.has(it);\n }\n\n get flattenedAreas(): T[] {\n return this._areas;\n }\n\n}\n\n// class DecoratorCache {\n//\n// private map = new Map<number, T>();\n//\n// get(area:T): T {\n//\n// if (!area) return null;\n//\n// let decoratedArea = this.map.get(area.id);\n// if (!decoratedArea) {\n// decoratedArea = TreeModel.AreaDecorator.decorate(area);\n// this.map.set(area.id, decoratedArea);\n// }\n// return decoratedArea;\n// }\n//\n// clear() {\n// this.map.clear();\n// }\n//\n//\n// }\n\n\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"tree-table-model.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/components/tree-table/tree-table-model.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sGAAsG;AACtG,4EAA4E;AAC5E,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAA4C,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAiB,MAAM,mBAAmB,CAAC;AAG7E,QAAQ;AACR,uBAAuB;AACvB,mCAAmC;AACnC,0DAA0D;AAC1D,uDAAuD;AACvD,+GAA+G;AAC/G,uBAAuB;AACvB,2CAA2C;AAC3C,0FAA0F;AAC1F,EAAE;AACF,MAAM,OAAO,cAA0C,SAAQ,kBAA0C;IAEvG,YAAY,MAAyC,EAAW,kBAA8D;QAC5H,KAAK,CAAC,MAAM,CAAC,CAAC;QADgD,uBAAkB,GAAlB,kBAAkB,CAA4C;IAE9H,CAAC;IAED,MAAM,CAAC,QAAQ,CAA4B,aAA8B,EAAE,OAAmD;QAC5H,MAAM,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACvC,MAAM,EAAE,KAAK,EA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qB,CAAC,EAAK;QACnC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CAEF;AAED,yBAAyB;AACzB,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,uBAAuB;AACvB,EAAE;AACF,kCAAkC;AAClC,EAAE;AACF,qDAAqD;AACrD,gCAAgC;AAChC,sEAAsE;AACtE,oDAAoD;AACpD,YAAY;AACZ,gCAAgC;AAChC,QAAQ;AACR,EAAE;AACF,gBAAgB;AAChB,4BAA4B;AAC5B,QAAQ;AACR,EAAE;AACF,EAAE;AACF,IAAI","sourcesContent":["// import {T } from '@client/api/light-architect/model/area/area.class';\n// import { SelfAndDescendantsVisitor } from '@client/api/light-architect/model/area/visitable.class';\n// import { Zone } from '@client/api/light-architect/model/area/zone.class';\nimport { Dsl, GarbageCollector, ListModel, MutableValueModel, ValueModel } from '@coolon/pectin';\nimport { AbstractTableModel } from '../table/abstract-table-model';\nimport { DecoratedTreeNode } from './decorated-tree-node';\nimport { TreeExpansionModel } from './tree-expansion-model';\nimport { TreeLabelColumnModel } from './tree-label-column-model';\nimport { TreeNode } from './tree-node';\nimport { TreeToListModel } from './tree-to-list-model';\nimport { SelfAndDescendantsVisitor, VisitableTree } from './visitable.class';\n\n\n// TODO:\n// Selection Models:\n// - as simple navigation tree\n// - as editable grid (selecte all, even hidden etc?)\n// - fixing selection on underlying model changes.\n// - rendering selection: row highlighting, checkboxes (in the tree renderer or in separate column), both.\n// Expansion Models:\n// - Add ability to auto show to depth\n// - Add a predicate to check default expansion (i.e. has children of a certain type)\n//\nexport class TreeTableModel<Row extends TreeNode<Row>> extends AbstractTableModel<DecoratedTreeNode<Row>> {\n\n constructor(source: ListModel<DecoratedTreeNode<Row>>, readonly treeExpansionModel: TreeExpansionModel<DecoratedTreeNode<Row>>) {\n super(source);\n }\n\n static fromRoot<Row extends TreeNode<Row>>(sourceOfTruth: ValueModel<Row>, builder?: (tableModel: TreeTableModel<Row>) => void): TreeTableModel<Row> {\n const garbage = new GarbageCollector();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);\n const children = chain(sourceOfTruth).mapToList(root => [root]);\n const model = this.fromList(children, builder);\n model.registerDisposable(garbage);\n return model;\n }\n\n static fromChildrenOf<Row extends TreeNode<Row>>(sourceOfTruth: ValueModel<Row>, builder?: (tableModel: TreeTableModel<Row>) => void): TreeTableModel<Row> {\n const garbage = new GarbageCollector();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);\n const children = chain(sourceOfTruth).mapToList(root => root.children); // for some reason pluck list can't see 'children'\n const model = this.fromList(children, builder);\n model.registerDisposable(garbage);\n return model;\n }\n\n static fromList<Row extends TreeNode<Row>>(sourceOfTruth: ListModel<Row>, builder?: (tableModel: TreeTableModel<Row>) => void): TreeTableModel<Row> {\n const treeExpansionModel = new TreeExpansionModel<DecoratedTreeNode<Row>>(sourceOfTruth.identityOf);\n const nodes = new TreeToListModel(sourceOfTruth, treeExpansionModel);\n const model = new TreeTableModel<Row>(nodes, treeExpansionModel);\n model.registerDisposable(nodes);\n if (builder) builder(model);\n return model;\n }\n\n treeControlColumn(builder: (column: TreeLabelColumnModel<Row>) => void) {\n const columnId = 'tree-label';\n const column = new TreeLabelColumnModel<Row>(columnId, () => this.getColumnTextProperties(columnId), this.treeExpansionModel);\n builder(column);\n this.addColumn(column);\n }\n\n expand(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.expand(node);\n }\n\n collapse(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.expand(node);\n }\n\n isCollapsed(node: DecoratedTreeNode<Row>): boolean {\n return this.treeExpansionModel.isCollapsed(node);\n }\n\n ensureAncestorsAndSelfVisible(node: DecoratedTreeNode<Row>) {\n this.treeExpansionModel.ensureAncestorsAndSelfVisible(node);\n }\n\n\n // saveSelection() {\n // let ids: number[] = [];\n // const selectedArea = this._decoratedSelectionModel.leadSelection.value;\n // if (selectedArea) {\n // ids.push(selectedArea.id);\n // ids = ids.concat(selectedArea.siblingsAfter().map(a => a.id));\n // ids = ids.concat(selectedArea.siblingsBefore().reverse().map(a => a.id));\n // ids = ids.concat(selectedArea.ancestorsToZone().reverse().map(a => a.id));\n // }\n // this._storedSelection = ids;\n // }\n //\n //\n // restoreSelection() {\n // const all = this.rootNodeModel.value.selfAndDescendants();\n // for (let i = 0; i < this._storedSelection.length; i++) {\n // const id = this._storedSelection[i];\n // const found = all.find(area => area.id === id);\n // if (found) {\n // this.selectedAreaId.value = found.id;\n // break;\n // }\n // }\n // }\n //\n // collapseAll(areas: T[]) {\n // this.collapsedAreaIds.value = [].concat(this.collapsedAreaIds.value, areas.map(a => a.id));\n // }\n\n // disableSelection(disable: boolean = true) {\n // this._disableSelection.value = disable;\n // }\n\n\n}\n\n\n// /**\n// * 1. Make this a TreeModel<T extends AbstractTree>\n// * 2. Move the decorated items to the view (along with viewToModel and modelToView)\n// */\n// export class TreeTableModel<T, K extends keyof T> {\n//\n// // public readonly decoratedVisibleAreas: ListModel<T>;\n// //\n// // private decoratorCache = undefined; //new DecoratorCache();\n// // private collapsedAreaIds: MutableListModel<number> = new MutableListModel<number>();\n// //\n// // private _rawSelectionModel: SingleSelectionModel<T, T[K]>;\n// // private _decoratedSelectionModel: SingleSelectionModel<T, T[K]>;\n// //\n// // private readonly _disableSelection = new MutableValueModel<boolean>(false);\n// // private _hoveredAreaModel: MutableValueModel<T> = new MutableValueModel<T>();\n// //\n// // private _decoratedHoverModel: ValueModel<T> = new MutableValueModel<T>();\n// // private _storedSelection: number[] = [];\n// //\n// // readonly visibleNodes: ListModelChain<T>;\n// //\n// // protected constructor(readonly rootNodeModel: ValueModel<T>, identifiedBy: K, readonly selectedAreaId: MutableValueModel<K>) {\n// // super();\n// // const {chain, valueOf, before, when, after, observe, switchOn} = Dsl.disposeWith(this);\n// //\n// // this.visibleNodes = chain(this.rootNodeModel).mapToList(root => {\n// // return root.visit(new FlattenStrategy(this.collapsedAreaIds.value)).flattenedAreas;\n// // }, {dependsOn: this.collapsedAreaIds});\n// //\n// // this.decoratedVisibleAreas = this.visibleNodes.map(area => {\n// // return this.decoratorCache.get(area);\n// // });\n// //\n// // this._rawSelectionModel = this.registerDisposable(SingleSelectionModel.fromList(this.visibleNodes, identifiedBy, {\n// // storeIdIn: this.selectedAreaId,\n// // // toggleSelection: false\n// // }));\n// // this._rawSelectionModel.selectBehaviour.disableWhen(this._disableSelection);\n// // this._decoratedSelectionModel = this.registerDisposable(SingleSelectionModel.fromList(this.decoratedVisibleAreas, identifiedBy, {\n// // storeIdIn: this.selectedAreaId,\n// // toggleSelection: false\n// // }));\n// // this._decoratedSelectionModel.selectBehaviour.disableWhen(this._disableSelection);\n// //\n// // // our areas will be different objects so we have to save, restore the\n// // // selection and rebuild our decorators\n// // before(rootNodeModel).changes(() => this.saveSelection());\n// // before(rootNodeModel).changes(() => this.decoratorCache.clear());\n// // when(rootNodeModel).changes(() => this.restoreSelection(), {asLongAs: () => !!rootNodeModel.value});\n// //\n// //\n// // this.registerDisposable(new Binding(this._decoratedHoverModel, this._hoveredAreaModel, {\n// // toLeft: (area) => area ? this.modelToView(area) : null,\n// // toRight: (decoratedArea) => decoratedArea ? this.viewToModel(decoratedArea) : null\n// // }));\n// //\n// // when(this.decoratedSelectionModel.leadSelection)\n// // .changes(selection => this.ensureAncestorsAndSelfVisible(selection), {\n// // asLongAs: selection => !!selection\n// // });\n// // }\n// //\n// // static fromRoot<T, K extends keyof T>(rootNodeModel: ValueModel<T>, identifiedBy: K, options?: TreeModel.Options<T, K>) {\n// //\n// // }\n// //\n// // public viewToModel(decoratedArea: T): T {\n// // assert.notNil(decoratedArea);\n// // return TreeModel.AreaDecorator.undecorate(decoratedArea);\n// // }\n// //\n// // public modelToView(area: T): T {\n// // assert.notNil(area);\n// // return this.decoratorCache.get(area);\n// // }\n// //\n// // get hoveredAreaModel(): ValueModel<T> {\n// // return this._hoveredAreaModel;\n// // }\n// //\n// // clearHover() {\n// // this._hoveredAreaModel.value = null;\n// // }\n// //\n// // get selectionModel(): SelectionModel<T> {\n// // return this._rawSelectionModel;\n// // }\n// //\n// // get decoratedSelectionModel(): SelectionModel<T> {\n// // return this._decoratedSelectionModel;\n// // }\n// //\n// // get decoratedHoverModel(): ValueModel<T> {\n// // return this._decoratedHoverModel;\n// // }\n// //\n// // decoratedArea(area: T): T {\n// // return this.decoratorCache.get(area);\n// // }\n// //\n// // select(area: T) {\n// // this.selectedAreaId.value = area ? area.id : null;\n// // }\n// }\n\n\nexport namespace TreeTableModel {\n\n export interface Options<T, K extends keyof T> {\n storeIdIn: MutableValueModel<K>\n }\n\n // export interface DecoratedArea extendsTDecorator,T {\n // }\n //\n // export classTDecorator extends Decorator<T> {\n //\n // static decorate(area:T): DecoratedArea {\n // return Decorator.create(area, newTDecorator(area)) as DecoratedArea;\n // }\n //\n // pathToRoot() {\n // return this.object.ancestorsToZone().slice(1);\n // }\n //\n // isLastChild() {\n // return this.object.isLastChild();\n // }\n //\n // isRoot() {\n // return this.object.isZone();\n // }\n // }\n\n}\n\n\nexport class FlattenStrategy<T extends VisitableTree<any>> extends SelfAndDescendantsVisitor<T> {\n\n private _areas: T[] = [];\n private _collapsed: Set<T>;\n\n constructor(private collapsedIds: T[]) {\n super();\n this._collapsed = new Set<T>(collapsedIds);\n }\n\n protected onVisit(it: T) {\n this._areas.push(it);\n }\n\n protected shouldVisitChildrenOf(it: T): boolean {\n return !this._collapsed.has(it);\n }\n\n get flattenedAreas(): T[] {\n return this._areas;\n }\n\n}\n\n// class DecoratorCache {\n//\n// private map = new Map<number, T>();\n//\n// get(area:T): T {\n//\n// if (!area) return null;\n//\n// let decoratedArea = this.map.get(area.id);\n// if (!decoratedArea) {\n// decoratedArea = TreeModel.AreaDecorator.decorate(area);\n// this.map.set(area.id, decoratedArea);\n// }\n// return decoratedArea;\n// }\n//\n// clear() {\n// this.map.clear();\n// }\n//\n//\n// }\n\n\n\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"TreeTableModel":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../table/abstract-table-model","name":"AbstractTableModel","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"TreeTableModel":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../table/abstract-table-model","name":"AbstractTableModel","line":23,"character":63},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@coolon/pectin","name":"ListModel","line":25,"character":22,"arguments":[{"__symbolic":"reference","module":"./decorated-tree-node","name":"DecoratedTreeNode","line":25,"character":32,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":25,"character":123,"context":{"typeName":"Row"}}]}]},{"__symbolic":"reference","module":"./tree-expansion-model","name":"TreeExpansionModel","line":25,"character":86,"arguments":[{"__symbolic":"reference","module":"./decorated-tree-node","name":"DecoratedTreeNode","line":25,"character":32,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":25,"character":123,"context":{"typeName":"Row"}}]}]}]}],"treeControlColumn":[{"__symbolic":"method"}],"expand":[{"__symbolic":"method"}],"collapse":[{"__symbolic":"method"}],"isCollapsed":[{"__symbolic":"method"}],"ensureAncestorsAndSelfVisible":[{"__symbolic":"method"}]}},"FlattenStrategy":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./visitable.class","name":"SelfAndDescendantsVisitor","line":255,"character":67},"arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":260,"character":36,"context":{"typeName":"T"}}]}]}],"onVisit":[{"__symbolic":"method"}],"shouldVisitChildrenOf":[{"__symbolic":"method"}]}}}}]
|
|
@@ -15,7 +15,7 @@ export class VisitSanitiser {
|
|
|
15
15
|
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
16
16
|
const routeId = visit.getRouteId();
|
|
17
17
|
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState);
|
|
18
|
-
console.log({
|
|
18
|
+
// console.log({routeId, sanitisedValue});
|
|
19
19
|
// ###------- EARLY EXIT --------###
|
|
20
20
|
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
21
21
|
// if the route id has changed we redirect immediately as other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visit-sanitiser.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/visit-sanitiser.ts"],"names":[],"mappings":";AAOA,MAAM,OAAO,cAAc;IACzB,YAAoB,iBAAoC,EAAU,cAAsC,EAAU,MAAc,EAAU,YAA0B,EAAU,QAAkB;QAA5K,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAU,mBAAc,GAAd,cAAc,CAAwB;QAAU,WAAM,GAAN,MAAM,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAc;QAAU,aAAQ,GAAR,QAAQ,CAAU;IAEhM,CAAC;IAED,WAAW;IACL,QAAQ,CAAC,KAAY;;YACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC;YACvC,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE;gBACzB,MAAM,UAAU,GAAG,QAAQ,CAAC,sBAAsB,EAAE,CAAC;gBACrD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;gBACnC,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;gBACtI,
|
|
1
|
+
{"version":3,"file":"visit-sanitiser.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/visit-sanitiser.ts"],"names":[],"mappings":";A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C;gBAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC3C,MAAM,cAAc,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;gBACtI,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE;oBACzC,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;iBAC9D;aACF;YAED,OAAO,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,CAAC;KAAA;CAEF","sourcesContent":["import { Injector } from '@angular/core';\nimport { ActivatedRouteSnapshot, Router } from '@angular/router';\nimport { Trace } from '@coolon/pectin';\nimport { NavigationSession } from '../navigation/session/navigation-session';\nimport { PlaceHistory } from '../place-history';\nimport { Visit } from '../visit';\n\nexport class VisitSanitiser {\n constructor(private navigationSession: NavigationSession, private activatedRoute: ActivatedRouteSnapshot, private router: Router, private placeHistory: PlaceHistory, private injector: Injector) {\n\n }\n\n // @Trace()\n async sanitise(visit: Visit): Promise<Visit> {\n const placeDef = visit.placeDefinition;\n if (placeDef.hasRouteId()) {\n const routeIdDef = placeDef.getRouteIdParameterDef();\n const routeId = visit.getRouteId();\n const sanitisedValue = await routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState);\n // console.log({routeId, sanitisedValue});\n // ###------- EARLY EXIT --------###\n if (routeIdDef.hasChanged(routeId, sanitisedValue)) {\n // if the route id has changed we redirect immediately as other\n // parameter sanitisers might use it.\n return visit.replace(routeIdDef, sanitisedValue);\n }\n }\n\n // if we didn't replace the routeId we continue the url present parameters.\n const parameterDefs = placeDef.getVisitParameterDefs({\n includeRouteParameters: true,\n includeNonRouteParameters: true\n });\n let sanitisedVisit: Visit = visit;\n for (let i = 0; i < parameterDefs.length; i++) {\n const def = parameterDefs[i];\n const value = visit.getParameter(def.name);\n const sanitisedValue = await def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector, this.navigationSession.isPopState);\n if (def.hasChanged(value, sanitisedValue)) {\n sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);\n }\n }\n\n return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;\n }\n\n}\n"]}
|
|
@@ -3246,11 +3246,29 @@ class TreeToListModel extends ComputedListModel {
|
|
|
3246
3246
|
}
|
|
3247
3247
|
|
|
3248
3248
|
// import {T } from '@client/api/light-architect/model/area/area.class';
|
|
3249
|
+
// TODO:
|
|
3250
|
+
// Selection Models:
|
|
3251
|
+
// - as simple navigation tree
|
|
3252
|
+
// - as editable grid (selecte all, even hidden etc?)
|
|
3253
|
+
// - fixing selection on underlying model changes.
|
|
3254
|
+
// - rendering selection: row highlighting, checkboxes (in the tree renderer or in separate column), both.
|
|
3255
|
+
// Expansion Models:
|
|
3256
|
+
// - Add ability to auto show to depth
|
|
3257
|
+
// - Add a predicate to check default expansion (i.e. has children of a certain type)
|
|
3258
|
+
//
|
|
3249
3259
|
class TreeTableModel extends AbstractTableModel {
|
|
3250
3260
|
constructor(source, treeExpansionModel) {
|
|
3251
3261
|
super(source);
|
|
3252
3262
|
this.treeExpansionModel = treeExpansionModel;
|
|
3253
3263
|
}
|
|
3264
|
+
static fromRoot(sourceOfTruth, builder) {
|
|
3265
|
+
const garbage = new GarbageCollector();
|
|
3266
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);
|
|
3267
|
+
const children = chain(sourceOfTruth).mapToList(root => [root]);
|
|
3268
|
+
const model = this.fromList(children, builder);
|
|
3269
|
+
model.registerDisposable(garbage);
|
|
3270
|
+
return model;
|
|
3271
|
+
}
|
|
3254
3272
|
static fromChildrenOf(sourceOfTruth, builder) {
|
|
3255
3273
|
const garbage = new GarbageCollector();
|
|
3256
3274
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(garbage);
|
|
@@ -7338,7 +7356,7 @@ class VisitSanitiser {
|
|
|
7338
7356
|
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
7339
7357
|
const routeId = visit.getRouteId();
|
|
7340
7358
|
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState);
|
|
7341
|
-
console.log({
|
|
7359
|
+
// console.log({routeId, sanitisedValue});
|
|
7342
7360
|
// ###------- EARLY EXIT --------###
|
|
7343
7361
|
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
7344
7362
|
// if the route id has changed we redirect immediately as other
|