-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
120 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import MdUI from "@refina/mdui"; | ||
import MdUI2 from "@refina/mdui2"; | ||
import { Plugin } from "refina"; | ||
|
||
const QuasiRuntime = new Plugin("quasi-runtime", (app) => { | ||
MdUI.install(app, "indigo", "blue"); | ||
MdUI2.install(app); | ||
}); | ||
export default QuasiRuntime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { ComponentContext, Content, OutputComponent, byIndex, bySelf } from "refina"; | ||
import QuasiRuntime from "./plugin"; | ||
// import { ComponentContext, Content, OutputComponent, byIndex, bySelf } from "refina"; | ||
// import QuasiRuntime from "./plugin"; | ||
|
||
export const currentTableSymbol = Symbol("currentTable"); | ||
// export const currentTableSymbol = Symbol("currentTable"); | ||
|
||
export interface TableProps { | ||
inner: Content; | ||
class: string; | ||
data: Iterable<any>; | ||
key: string; | ||
} | ||
// export interface TableProps { | ||
// inner: Content; | ||
// class: string; | ||
// data: Iterable<any>; | ||
// key: string; | ||
// } | ||
|
||
export class TableModel { | ||
renderingState: "head" | "body"; | ||
current: any; | ||
} | ||
// export class TableModel { | ||
// renderingState: "head" | "body"; | ||
// current: any; | ||
// } | ||
|
||
@QuasiRuntime.outputComponent("table") | ||
export class QTable extends OutputComponent { | ||
main(_: ComponentContext, model: TableModel, props: TableProps): void { | ||
_.provide(currentTableSymbol, model, _ => { | ||
_.$cls(props.class); | ||
_.mdTable( | ||
props.data, | ||
_ => { | ||
model.renderingState = "head"; | ||
_.embed(props.inner); | ||
}, | ||
props.key === "$index" ? byIndex : props.key === "$self" ? bySelf : props.key, | ||
v => { | ||
model.renderingState = "body"; | ||
model.current = v; | ||
_.embed(props.inner); | ||
}, | ||
); | ||
model.current = null; | ||
}); | ||
} | ||
} | ||
// @QuasiRuntime.outputComponent("table") | ||
// export class QTable extends OutputComponent { | ||
// main(_: ComponentContext, model: TableModel, props: TableProps): void { | ||
// _.provide(currentTableSymbol, model, _ => { | ||
// _.$cls(props.class); | ||
// _.mdTable( | ||
// props.data, | ||
// _ => { | ||
// model.renderingState = "head"; | ||
// _.embed(props.inner); | ||
// }, | ||
// props.key === "$index" ? byIndex : props.key === "$self" ? bySelf : props.key, | ||
// v => { | ||
// model.renderingState = "body"; | ||
// model.current = v; | ||
// _.embed(props.inner); | ||
// }, | ||
// ); | ||
// model.current = null; | ||
// }); | ||
// } | ||
// } | ||
|
||
declare module "refina" { | ||
interface OutputComponents { | ||
table: QTable; | ||
} | ||
} | ||
// declare module "refina" { | ||
// interface OutputComponents { | ||
// table: QTable; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import { ComponentContext, Content, OutputComponent } from "refina"; | ||
import QuasiRuntime from "./plugin"; | ||
import { TableModel, currentTableSymbol } from "./table.r"; | ||
// import { ComponentContext, Content, OutputComponent } from "refina"; | ||
// import QuasiRuntime from "./plugin"; | ||
// import { TableModel, currentTableSymbol } from "./table.r"; | ||
|
||
export interface TableColProps { | ||
inner: Content; | ||
prop: string; | ||
header: string; | ||
"head class": string; | ||
"cell class": string; | ||
} | ||
// export interface TableColProps { | ||
// inner: Content; | ||
// prop: string; | ||
// header: string; | ||
// "head class": string; | ||
// "cell class": string; | ||
// } | ||
|
||
export class TableColModel { | ||
value: any; | ||
} | ||
// export class TableColModel { | ||
// value: any; | ||
// } | ||
|
||
@QuasiRuntime.outputComponent("tableCol") | ||
export class QTableCol extends OutputComponent { | ||
main(_: ComponentContext, model: TableColModel, props: TableColProps): void { | ||
const currentTable = _.$runtimeData[currentTableSymbol] as TableModel; | ||
if (currentTable.renderingState === "head") { | ||
_.$cls(props["head class"]); | ||
_.mdTableHeader(props.header === "$prop" ? props.prop : props.header); | ||
} else { | ||
model.value = currentTable.current[props.prop]; | ||
_.$cls(props["cell class"]); | ||
_.mdTableCell(props.inner); | ||
} | ||
} | ||
} | ||
// @QuasiRuntime.outputComponent("tableCol") | ||
// export class QTableCol extends OutputComponent { | ||
// main(_: ComponentContext, model: TableColModel, props: TableColProps): void { | ||
// const currentTable = _.$runtimeData[currentTableSymbol] as TableModel; | ||
// if (currentTable.renderingState === "head") { | ||
// _.$cls(props["head class"]); | ||
// _.mdTableHeader(props.header === "$prop" ? props.prop : props.header); | ||
// } else { | ||
// model.value = currentTable.current[props.prop]; | ||
// _.$cls(props["cell class"]); | ||
// _.mdTableCell(props.inner); | ||
// } | ||
// } | ||
// } | ||
|
||
declare module "refina" { | ||
interface OutputComponents { | ||
tableCol: QTableCol; | ||
} | ||
} | ||
// declare module "refina" { | ||
// interface OutputComponents { | ||
// tableCol: QTableCol; | ||
// } | ||
// } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.