Disable checkbox by node data property

    // initialize diagram / templates
    public initDiagram = (): go.Diagram => {
        const component: HierarchyComponent = this;
        const $ = go.GraphObject.make;
        const selectedColor = document.documentElement.style.getPropertyValue("--selected-background");

        // This button assumes data binding to the "checked" property.
        // @ts-ignore
        go.GraphObject.defineBuilder("TriStateCheckBoxButton", args => {
            var button = /** @type {Panel} */ (
                go.GraphObject.make("Button",
                    {
                        "ButtonBorder.fill": "white",
                        width: 14,
                        height: 14,
                        margin: new go.Margin(4, 4, 4, 4)
                    },
                    go.GraphObject.make(go.Shape,
                        {
                            name: "ButtonIcon",
                            geometryString: 'M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2',  // a 'check' mark
                            strokeWidth: 2,
                            stretch: go.GraphObject.Fill,  // this Shape expands to fill the Button
                            geometryStretch: go.GraphObject.Uniform,  // the check mark fills the Shape without distortion
                            background: null,
                            visible: false  // visible set to false: not checked, unless data.checked is true
                        },
                        new go.Binding("visible", "checked", p => p === true || p === null),
                        new go.Binding("stroke", "checked", p => p === null ? null : "black"),
                        new go.Binding("background", "checked", p => p === null ? "gray" : null)
                    )
                )
            );

            // @ts-ignore
            function updateCheckBoxesDown(node, val) {
                node.diagram.model.setDataProperty(node.data, "checked", val);
                if (val) {
                    component.basketStoreService.pushToBasket(new BasketItem(node.data.title, "object", node.data.supGuid, ''));
                }
                // @ts-ignore
                node.findTreeChildrenNodes().each(child => updateCheckBoxesDown(child, val))
            }

            // @ts-ignore
            function updateCheckBoxesUp(node) {
                var parent = node.findTreeParentNode();
                if (parent !== null) {
                    // @ts-ignore
                    var anychecked = parent.findTreeChildrenNodes().any(n => n.data.checked !== false && n.data.checked !== undefined);
                    // @ts-ignore
                    var allchecked = parent.findTreeChildrenNodes().all(n => n.data.checked === true);
                    node.diagram.model.setDataProperty(parent.data, "checked", (allchecked ? true : (anychecked ? null : false)));
                    updateCheckBoxesUp(parent);
                }
            }

            button.click = (e, button) => {
                if (!button.isEnabledObject()) return;
                var diagram = e.diagram;
                if (diagram === null || diagram.isReadOnly) return;
                if (diagram.model.isReadOnly) return;
                e.handled = true;
                // @ts-ignore
                var shape = button.findObject('ButtonIcon');
                diagram.startTransaction('checkbox');
                shape.visible = !shape.visible;  // this toggles data.checked due to TwoWay Binding
                // Set this data.checked property and those of all its children to the same value
                //updateCheckBoxesDown(node, newval);
                // Walk up the tree and update all of their checkboxes
                //updateCheckBoxesUp(node);
                // support extra side-effects without clobbering the click event handler:

                var node = button.part;
                var oldval = node!.data.checked;
                var newval = (oldval !== true);

                if(newval){
                    component.basketStoreService.pushToBasket(new BasketItem(node!.data.title, "object", node!.data.supGuid, ''));
                }
                if (typeof button["_doClick"] === "function") button["_doClick"](e, button);
                diagram.commitTransaction("checkbox");
            };
            return button;
        });

        // define diagram
        this.diagram = $(go.Diagram, {
            allowMove: false,
            allowCopy: false,
            allowDelete: false,
            allowHorizontalScroll: false,
            layout:
                $(go.TreeLayout,
                    {
                        alignment: go.TreeLayout.AlignmentStart,
                        angle: 0,
                        compaction: go.TreeLayout.CompactionNone,
                        layerSpacing: 16,
                        layerSpacingParentOverlap: 1,
                        nodeIndentPastParent: 1.0,
                        nodeSpacing: 0,
                        setsPortSpot: false,
                        setsChildPortSpot: false,
                        sorting: go.TreeLayout.SortingAscending,
                        comparer: (a: any, b: any) => {
                            const av = a.node.ob.title;
                            const bv = b.node.ob.title;
                            if (av < bv) return -1;
                            if (av > bv) return 1;
                            return 0;
                        },
                    })
        });

        // define the Node template
        this.diagram.nodeTemplate =
            $(go.Node, {
                    selectionAdorned: false,
                    cursor: 'pointer',
                    click: (e: any, node: any) => {
                        this.router.navigate(['space', this.spcSupGuId, 'views', (node as any).ob.dataSheet, 'objects', (node as any).ob.supGuid, 'DS']);
                    },
                    contextClick: (e: any, node: any) => {
                        this.rightClick.emit((node as any).ob.supGuid);
                    },
                },

                $("TreeExpanderButton", {
                    width: 14,
                    margin: new go.Margin(2, 5, 5, 5),
                    "ButtonBorder.fill": "whitesmoke",
                    "ButtonBorder.stroke": null,
                    "_buttonFillOver": "rgba(0,128,255,0.25)",
                    "_buttonStrokeOver": null
                }),

                $(go.Panel,
                    "Horizontal",
                    {
                        position: new go.Point(16, 0),
                        margin: new go.Margin(2, 5, 5, 5)
                    },
                    $("TriStateCheckBoxButton",
                        new go.Binding("visible", "checkBoxVisible", function (checkBoxVisible) {
                            return checkBoxVisible;
                        }),),
                        new go.Binding("background", "isSelected", (s: any, obj:any) => {
                            return (s ? obj.part.data.selectedColor  : "transparent");
                        }).ofObject(),
                    $(go.Shape,
                        {
                            margin: new go.Margin(0, 4, 0, 0),
                            strokeWidth: 0,
                            width: 18,
                            height: 18
                        },
                        new go.Binding('fill', 'iconColor'),
                        new go.Binding("geometry", "isTreeExpanded", this.geoFunc).ofObject(),
                        new go.Binding("geometry", "isTreeLeaf", this.geoFunc).ofObject()),
                    $(go.TextBlock,
                        {
                            margin: new go.Margin(3, 20, 3, 0)
                        },
                        new go.Binding('font', 'bigfont'),
                        new go.Binding("text", "title", (s: any) => s))
                )
            );

        // define the Link template
        this.diagram.linkTemplate = $(go.Link);
        this.diagram.model = new go.TreeModel(
            this.convertedDataModel
        );

        this.setDefaultExpandLevel(this.diagram, this.defaultHLlevel);
        this.diagram.initialContentAlignment = new go.Spot(0, 0);
        this.printService.isCusomPrint = true;
        this.printService.currentPrintDiagram = this.diagram;
        return this.diagram;
    }

I created the checkbox based on the example https://gojs.net/latest/samples/triStateCheckBoxTree.html Now I want to disable it when its selected by user. Could you please help on this

I’m not sure what you mean by “disable it when it is selected by user”.
I would have thought that when the user selects something, they want to interact with it.

You can set or bind the Panel.isEnabled property of the “Button”.
Panel | GoJS API
CheckBoxes