How to use cx - 10 common examples

To help you get started, we’ve selected a few cx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github schrodinger / fixed-data-table-2 / src / FixedDataTable.js View on Github external
onColumnResize={this._onColumnResize}
        onColumnReorder={onColumnReorder}
        onColumnReorderMove={this._onColumnReorderMove}
        onColumnReorderEnd={this._onColumnReorderEnd}
        isColumnReordering={!!isColumnReordering}
        columnReorderingData={columnReorderingData}
        showScrollbarY={scrollEnabledY}
        isRTL={this.props.isRTL}
      />;

    let topShadow;
    if (scrollY) {
      topShadow =
        <div style="{{top:">;
    }

    // ownerScrollAvailable is true if the rows rendered will overflow the owner element
    // so we show a shadow in that case even if the FDT component can't scroll anymore
    const ownerScrollAvailable = ownerHeight &amp;&amp; ownerHeight &lt; componentHeight &amp;&amp;
      scrollContentHeight &gt; visibleRowsHeight;
    let bottomShadow;
    if (ownerScrollAvailable || scrollY &lt; maxScrollY) {
      bottomShadow =
        </div>
github codaxy / dashboards / app / index.js View on Github external
import { Store } from "cx/data";
import { Url, History, Widget, startAppLoop } from "cx/ui";
import { Timing, Debug } from "cx/util";
//css
import "./index.scss";
import "cx-theme-aquamarine";

//store
const store = new Store();

//webpack (HMR)
if (module.hot) {
	// accept itself
	module.hot.accept();

	// remember data on dispose
	module.hot.dispose(function(data) {
		data.state = store.getData();
		if (stop) stop();
	});

	//apply data on hot replace
	if (module.hot.data) store.load(module.hot.data.state);
}
github codaxy / dashboards / app / index.js View on Github external
module.hot.accept();

	// remember data on dispose
	module.hot.dispose(function(data) {
		data.state = store.getData();
		if (stop) stop();
	});

	//apply data on hot replace
	if (module.hot.data) store.load(module.hot.data.state);
}

//routing

Url.setBaseFromScript("app*.js");
History.connect(store, "url");

//debug

Widget.resetCounter();
Timing.enable("app-loop");
Debug.enable("app-data");

//app loop
import Routes from "./routes";

let stop = startAppLoop(document.getElementById("app"), store, Routes);
github codaxy / dashboards / app / routes / default / index.js View on Github external
this.unsubscribe = watch(dashboardPath, (w, error) => {
            if (error) {
                Toast.create({
                    children:
                    "Error occurred while loading dashboard: " + error.toString(),
                    timeout: 10000,
                    mod: "error"
                }).open();
                console.log(error);
                History.pushState({}, null, "~/");
            } else {
                this.store.set("$page.dashboard", {
                    width: 80,
                    height: 40,
                    ...w
                });
                if (!isNonEmptyArray(w.widgets)) {
                    if (this.store.set('$page.add', true)) {
                        Toast.create({
                            children: 'Drag & drop widgets from the right sidebar on the board.',
                            timeout: 5000,
                            mod: "primary"
                        }).open();
                    }
                }
            }
github codaxy / tdo / app / routes / board / Controller.js View on Github external
batchUpdatesAndNotify(() =&gt; {
            taskTracker.update(task.id, {
                deleted: true,
                deletedDate: new Date().toISOString()
            }, { suppressUpdate: true });
            taskTracker.reorderList(task.listId, true);
            refreshTasks();
        }, () =&gt; {
            if (nextTask) {
                activateTask(nextTask.id);
                console.log(nextTask);
            }
        });

        Toast.create({
            mod: 'warning',
            timeout: 4000,
            items: (
                
                    <div>
                        </div>
                
            )
        }).open();
    }
github codaxy / dashboards / app / routes / default / index.js View on Github external
children:
                    "Error occurred while loading dashboard: " + error.toString(),
                    timeout: 10000,
                    mod: "error"
                }).open();
                console.log(error);
                History.pushState({}, null, "~/");
            } else {
                this.store.set("$page.dashboard", {
                    width: 80,
                    height: 40,
                    ...w
                });
                if (!isNonEmptyArray(w.widgets)) {
                    if (this.store.set('$page.add', true)) {
                        Toast.create({
                            children: 'Drag & drop widgets from the right sidebar on the board.',
                            timeout: 5000,
                            mod: "primary"
                        }).open();
                    }
                }
            }
        });
github codaxy / tdo / app / util / getAdvancedSearchQueryPredicate.js View on Github external
break;

            case 'NOT':
                if (opExpected)
                    fstr.push(" && ");
                fstr.push("!");
                opExpected = false;
                break;

            default:
                let x = p.trim();
                if (x) {
                    if (opExpected)
                        fstr.push(" && ");
                    fstr.push(`check('${x}', q)`);
                    checks[x] = getSearchQueryPredicate(x);
                    opExpected = true;
                }
                break;
        }
    }

    if (fstr.length == 1)
        return () => true;

    function check(word, query) {
        return checks[word](query)
    }

    try {
        let fbody = fstr.join('');
        //console.log(fbody);
github codaxy / tdo / app / util / getAdvancedSearchQueryPredicate.js View on Github external
}

    if (fstr.length == 1)
        return () => true;

    function check(word, query) {
        return checks[word](query)
    }

    try {
        let fbody = fstr.join('');
        //console.log(fbody);
        return new Function('check', 'q', fbody).bind(null, check);
    }
    catch (err) {
        return getSearchQueryPredicate(query);
    }
}
github codaxy / tdo / app / routes / Controller.js View on Github external
onInit() {
            this.store.set("layout.mode", this.getLayoutMode());
            ResizeManager.subscribe(() => {
                this.store.set("layout.mode", this.getLayoutMode());
            });

            this.store.set('settings.showTooltips', true);

            auth.onAuthStateChanged(user => {

                if (!user) {
                    this.signInAnonymously();
                    return;
                }

                if (user.isAnonymous) {
                    this.store.set("user", {
                        id: user.uid,
                        name: "Anonymous",
github schrodinger / fixed-data-table-2 / src / FixedDataTableRow.js View on Github external
onMouseEnter={this.props.onMouseEnter || this.props.onMouseLeave ? this._onMouseEnter : null}
        onMouseLeave={this.props.onMouseLeave ? this._onMouseLeave : null}
        onTouchStart={this.props.onTouchStart ? this._onTouchStart : null}
        onTouchEnd={this.props.onTouchEnd ? this._onTouchEnd : null}
        onTouchMove={this.props.onTouchMove ? this._onTouchMove : null}
        style={style}&gt;
        <div>
          {fixedColumns}
          {scrollableColumns}
          {columnsLeftShadow}
          {fixedRightColumns}
          {fixedRightColumnsShadow}
          {scrollbarSpacer}
        </div>
        {rowExpanded &amp;&amp; <div style="{rowExpandedStyle}">
          {rowExpanded}
        </div>}
        {columnsRightShadow}
      
    );
  }