Linting, fixes, dragpreview fix
This commit is contained in:
parent
02af80d3dc
commit
babc8fcfcd
12
app/client/.editorconfig
Normal file
12
app/client/.editorconfig
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
23
app/client/.eslintrc.js
Normal file
23
app/client/.eslintrc.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
module.exports = {
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
// plugins: ['@typescript-eslint', 'react'],
|
||||||
|
extends: [
|
||||||
|
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
|
||||||
|
'plugin:@typescript-eslint/recommended'
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
|
||||||
|
sourceType: "module", // Allows for the use of imports
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true // Allows for the parsing of JSX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
1
app/client/.nvmrc
Normal file
1
app/client/.nvmrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
lts/dubnium
|
||||||
6
app/client/.prettierignore
Normal file
6
app/client/.prettierignore
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
build/
|
||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
package.json
|
||||||
|
|
||||||
9
app/client/.prettierrc
Normal file
9
app/client/.prettierrc
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": false,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
||||||
18943
app/client/package-lock.json
generated
18943
app/client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "picasso",
|
"name": "appsmith",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"@types/jest": "^23.3.13",
|
"@types/jest": "^23.3.13",
|
||||||
"@types/lodash": "^4.14.120",
|
"@types/lodash": "^4.14.120",
|
||||||
"@types/moment-timezone": "^0.5.10",
|
"@types/moment-timezone": "^0.5.10",
|
||||||
|
"@types/nanoid": "^2.0.0",
|
||||||
"@types/node": "^10.12.18",
|
"@types/node": "^10.12.18",
|
||||||
"@types/react": "^16.8.2",
|
"@types/react": "^16.8.2",
|
||||||
"@types/react-dom": "^16.8.0",
|
"@types/react-dom": "^16.8.0",
|
||||||
|
|
@ -22,6 +23,7 @@
|
||||||
"husky": "^1.3.1",
|
"husky": "^1.3.1",
|
||||||
"lint-staged": "^8.1.0",
|
"lint-staged": "^8.1.0",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
|
"nanoid": "^2.0.4",
|
||||||
"node-sass": "^4.11.0",
|
"node-sass": "^4.11.0",
|
||||||
"normalizr": "^3.3.0",
|
"normalizr": "^3.3.0",
|
||||||
"prettier": "^1.16.0",
|
"prettier": "^1.16.0",
|
||||||
|
|
@ -32,10 +34,11 @@
|
||||||
"react-redux": "^6.0.0",
|
"react-redux": "^6.0.0",
|
||||||
"react-router": "^4.3.1",
|
"react-router": "^4.3.1",
|
||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"react-scripts": "2.1.3",
|
"react-scripts": "^3.1.1",
|
||||||
"redux": "^4.0.1",
|
"redux": "^4.0.1",
|
||||||
"redux-saga": "^1.0.0",
|
"redux-saga": "^1.0.0",
|
||||||
"styled-components": "^4.1.3",
|
"styled-components": "^4.1.3",
|
||||||
|
"ts-loader": "^6.0.4",
|
||||||
"typescript": "^3.2.4"
|
"typescript": "^3.2.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -55,6 +58,10 @@
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.0.0",
|
||||||
|
"@typescript-eslint/parser": "^2.0.0",
|
||||||
|
"eslint-config-prettier": "^6.1.0",
|
||||||
|
"eslint-plugin-prettier": "^3.1.0",
|
||||||
"redux-devtools": "^3.5.0"
|
"redux-devtools": "^3.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
ReduxAction,
|
|
||||||
ActionTypes
|
ActionTypes
|
||||||
} from "../constants/ActionConstants"
|
} from "../constants/ActionConstants"
|
||||||
import { IWidgetCardProps } from '../widgets/BaseWidget'
|
import { IWidgetCardProps } from '../widgets/BaseWidget'
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
import Api from "./Api"
|
import Api from "./Api"
|
||||||
import { IContainerWidgetProps } from "../widgets/ContainerWidget"
|
import { ContainerWidgetProps } from "../widgets/ContainerWidget"
|
||||||
import { ApiResponse } from "./ApiResponses"
|
import { ApiResponse } from "./ApiResponses"
|
||||||
import { RenderMode } from "../constants/WidgetConstants";
|
import { RenderMode } from "../constants/WidgetConstants";
|
||||||
|
|
||||||
export interface PageRequest {
|
export interface PageRequest {
|
||||||
pageId: string,
|
pageId: string;
|
||||||
renderMode: RenderMode
|
renderMode: RenderMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SavePageRequest {
|
export interface SavePageRequest {
|
||||||
pageWidget: IContainerWidgetProps<any>
|
pageWidget: ContainerWidgetProps<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PageResponse extends ApiResponse {
|
export interface PageResponse extends ApiResponse {
|
||||||
pageWidget: IContainerWidgetProps<any>
|
pageWidget: ContainerWidgetProps<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SavePageResponse {
|
export interface SavePageResponse {
|
||||||
pageId: string
|
pageId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PageApi extends Api {
|
class PageApi extends Api {
|
||||||
static url: string = "/page"
|
static url = "/page"
|
||||||
|
|
||||||
static fetchPage(pageRequest: PageRequest): Promise<PageResponse> {
|
static fetchPage(pageRequest: PageRequest): Promise<PageResponse> {
|
||||||
return Api.get(PageApi.url + "/" + pageRequest.pageId, pageRequest)
|
return Api.get(PageApi.url + "/" + pageRequest.pageId, pageRequest)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import Api from "./Api"
|
import Api from "./Api"
|
||||||
import { IWidgetCardProps } from "../widgets/BaseWidget"
|
import { IWidgetCardProps } from "../widgets/BaseWidget"
|
||||||
import { IContainerWidgetProps } from "../widgets/ContainerWidget"
|
|
||||||
import { ApiResponse } from "./ApiResponses"
|
|
||||||
|
|
||||||
export interface WidgetCardsPaneResponse {
|
export interface WidgetCardsPaneResponse {
|
||||||
cards : { [id: string]: IWidgetCardProps[]}
|
cards : { [id: string]: IWidgetCardProps[]}
|
||||||
|
|
|
||||||
BIN
app/client/src/assets/images/blank.png
Normal file
BIN
app/client/src/assets/images/blank.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 B |
|
|
@ -1,4 +1,4 @@
|
||||||
import ContainerWidget from "../widgets/ContainerWidget"
|
// import ContainerWidget from "../widgets/ContainerWidget"
|
||||||
import { IWidgetProps, IWidgetCardProps } from "../widgets/BaseWidget"
|
import { IWidgetProps, IWidgetCardProps } from "../widgets/BaseWidget"
|
||||||
|
|
||||||
export type ActionType =
|
export type ActionType =
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export type ContentType = "application/json" | "application/x-www-form-urlencode
|
||||||
export type EncodingType = "gzip"
|
export type EncodingType = "gzip"
|
||||||
|
|
||||||
export const PROD_BASE_URL = "https://mobtools.com/api/"
|
export const PROD_BASE_URL = "https://mobtools.com/api/"
|
||||||
export const MOCK_BASE_URL = "https://f1a8b631-ef37-4932-8f41-75cf127fcc55.mock.pstmn.io"
|
export const MOCK_BASE_URL = "https://d952e53e-3dac-42b7-a55d-a93c5df678b8.mock.pstmn.io"
|
||||||
export const STAGE_BASE_URL = "https://14157cb0-190f-4082-a791-886a8df05930.mock.pstmn.io"
|
export const STAGE_BASE_URL = "https://14157cb0-190f-4082-a791-886a8df05930.mock.pstmn.io"
|
||||||
export const BASE_URL = MOCK_BASE_URL
|
export const BASE_URL = MOCK_BASE_URL
|
||||||
export const REQUEST_TIMEOUT_MS = 2000
|
export const REQUEST_TIMEOUT_MS = 2000
|
||||||
|
|
@ -14,3 +14,8 @@ export const REQUEST_HEADERS: ApiHeaders = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface APIException {
|
||||||
|
error: number;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,6 @@ export const RenderModes: { [id: string]: RenderMode } = {
|
||||||
|
|
||||||
export const CSSUnits: { [id: string]: CSSUnit } = {
|
export const CSSUnits: { [id: string]: CSSUnit } = {
|
||||||
PIXEL: "px",
|
PIXEL: "px",
|
||||||
RELATIVE_FONTSIZE: "em",
|
RELATIVE_FONTSIZE: "rem",
|
||||||
RELATIVE_PARENT: "%"
|
RELATIVE_PARENT: "%"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,28 @@
|
||||||
import { Component } from "react"
|
import { Component } from "react"
|
||||||
import React from "react"
|
|
||||||
import { PositionType, CSSUnit } from "../constants/WidgetConstants"
|
import { PositionType, CSSUnit } from "../constants/WidgetConstants"
|
||||||
import { Color } from "../constants/StyleConstants"
|
import { Color } from "../constants/StyleConstants"
|
||||||
/***
|
/***
|
||||||
* Components are responsible for binding render inputs to corresponding UI SDKs
|
* Components are responsible for binding render inputs to corresponding UI SDKs
|
||||||
*/
|
*/
|
||||||
abstract class BaseComponent<T extends IComponentProps> extends Component<T> {
|
abstract class BaseComponent<T extends IComponentProps> extends Component<T> {}
|
||||||
|
|
||||||
constructor(componentProps: T) {
|
|
||||||
super(componentProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BaseStyle {
|
export interface BaseStyle {
|
||||||
height?: number
|
height?: number;
|
||||||
width?: number
|
width?: number;
|
||||||
positionType: PositionType
|
positionType: PositionType;
|
||||||
xPosition: number
|
xPosition: number;
|
||||||
yPosition: number
|
yPosition: number;
|
||||||
xPositionUnit: CSSUnit
|
xPositionUnit: CSSUnit;
|
||||||
yPositionUnit: CSSUnit
|
yPositionUnit: CSSUnit;
|
||||||
heightUnit?: CSSUnit
|
heightUnit?: CSSUnit;
|
||||||
widthUnit?: CSSUnit
|
widthUnit?: CSSUnit;
|
||||||
backgroundColor?: Color
|
backgroundColor?: Color;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IComponentProps {
|
export interface IComponentProps {
|
||||||
widgetId: string
|
widgetId: string;
|
||||||
style: BaseStyle
|
style: BaseStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BaseComponent
|
export default BaseComponent
|
||||||
|
|
@ -3,13 +3,11 @@ import { IComponentProps } from "./BaseComponent"
|
||||||
import {
|
import {
|
||||||
Boundary,
|
Boundary,
|
||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
Breadcrumb,
|
|
||||||
Card,
|
|
||||||
IBreadcrumbProps
|
IBreadcrumbProps
|
||||||
} from "@blueprintjs/core"
|
} from "@blueprintjs/core"
|
||||||
import { Container } from "./ContainerComponent"
|
import { Container } from "./ContainerComponent"
|
||||||
|
|
||||||
class BreadcrumbsComponent extends React.Component<IBreadcrumbsComponentProps> {
|
class BreadcrumbsComponent extends React.Component<BreadcrumbsComponentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container {...this.props}>
|
<Container {...this.props}>
|
||||||
|
|
@ -24,12 +22,12 @@ class BreadcrumbsComponent extends React.Component<IBreadcrumbsComponentProps> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBreadcrumbsComponentProps extends IComponentProps {
|
export interface BreadcrumbsComponentProps extends IComponentProps {
|
||||||
width?: number
|
width?: number;
|
||||||
collapseFrom?: Boundary
|
collapseFrom?: Boundary;
|
||||||
className?: string
|
className?: string;
|
||||||
minVisibleItems?: number
|
minVisibleItems?: number;
|
||||||
items?: IBreadcrumbProps[]
|
items?: IBreadcrumbProps[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BreadcrumbsComponent
|
export default BreadcrumbsComponent
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
import BaseComponent, { IComponentProps } from "./BaseComponent"
|
import { IComponentProps } from "./BaseComponent";
|
||||||
import { ContainerOrientation } from "../constants/WidgetConstants"
|
import { ContainerOrientation } from "../constants/WidgetConstants";
|
||||||
import styled from "../constants/DefaultTheme"
|
import styled from "../constants/DefaultTheme";
|
||||||
import React from "react"
|
import { useDrop } from "react-dnd"
|
||||||
|
import { WidgetTypes } from "../constants/WidgetConstants"
|
||||||
|
import { DraggableWidget } from "../widgets/BaseWidget"
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export const Container = styled("div")<IContainerProps>`
|
export const Container = styled("div")<ContainerProps>`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: ${props => {
|
flexDirection: ${props => {
|
||||||
return props.orientation === "HORIZONTAL" ? "row" : "column"
|
return props.orientation === "HORIZONTAL" ? "row" : "column"
|
||||||
}};
|
}};
|
||||||
background: ${props => props.style.backgroundColor};
|
background: ${props => props.style.backgroundColor};
|
||||||
|
|
@ -19,17 +22,41 @@ export const Container = styled("div")<IContainerProps>`
|
||||||
top: ${props => {
|
top: ${props => {
|
||||||
return props.style.positionType !== "ABSOLUTE" ? undefined : props.style.yPosition + props.style.yPositionUnit
|
return props.style.positionType !== "ABSOLUTE" ? undefined : props.style.yPosition + props.style.yPositionUnit
|
||||||
}};
|
}};
|
||||||
`
|
`;
|
||||||
|
const ContainerComponent = (props: ContainerProps) => {
|
||||||
class ContainerComponent extends BaseComponent<IContainerProps> {
|
const addWidgetFn = props.addWidget;
|
||||||
render() {
|
const [, drop] = useDrop({
|
||||||
return <Container {...this.props}>{this.props.children}</Container>
|
accept: Object.values(WidgetTypes),
|
||||||
|
drop(item: DraggableWidget, monitor) {
|
||||||
|
if (addWidgetFn && monitor.isOver({shallow: true})){
|
||||||
|
addWidgetFn(item.type);
|
||||||
}
|
}
|
||||||
|
return undefined
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return <Container ref={drop} {...props}>{props.children}</Container>
|
||||||
}
|
}
|
||||||
|
// class ContainerComponent extends BaseComponent<ContainerProps> {
|
||||||
|
// render() {
|
||||||
|
// const addWidgetFn = this.props.addWidget;
|
||||||
|
// const [, drop] = useDrop({
|
||||||
|
// accept: Object.values(WidgetTypes),
|
||||||
|
// drop(item: DraggableWidget, monitor) {
|
||||||
|
// console.log("dropped")
|
||||||
|
// if (addWidgetFn){
|
||||||
|
// addWidgetFn(item.type);
|
||||||
|
// }
|
||||||
|
// return undefined
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// return <Container {...this.props}>{this.props.children}</Container>
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
export interface IContainerProps extends IComponentProps {
|
export interface ContainerProps extends IComponentProps {
|
||||||
children?: JSX.Element[] | JSX.Element
|
children?: JSX.Element[] | JSX.Element;
|
||||||
orientation?: ContainerOrientation
|
orientation?: ContainerOrientation;
|
||||||
|
addWidget?: Function;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ContainerComponent
|
export default ContainerComponent
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,14 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "../widgets/BaseWidget"
|
import { IWidgetProps, IWidgetState } from "../widgets/BaseWidget"
|
||||||
import _ from "lodash"
|
|
||||||
import { DragSource, DragSourceConnector, DragSourceMonitor } from "react-dnd"
|
import { DragSource, DragSourceConnector, DragSourceMonitor } from "react-dnd"
|
||||||
import { IContainerProps } from "./ContainerComponent"
|
import { ContainerProps } from "./ContainerComponent"
|
||||||
|
|
||||||
export interface IDraggableProps extends IContainerProps {
|
export interface DraggableProps extends ContainerProps {
|
||||||
connectDragSource: Function
|
connectDragSource: Function;
|
||||||
isDragging?: boolean
|
isDragging?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DraggableComponent extends React.Component<
|
class DraggableComponent extends React.Component<DraggableProps, IWidgetState> {
|
||||||
IDraggableProps,
|
|
||||||
IWidgetState
|
|
||||||
> {
|
|
||||||
render() {
|
render() {
|
||||||
return this.props.connectDragSource(
|
return this.props.connectDragSource(
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { IWidgetProps, IWidgetState } from "../widgets/BaseWidget"
|
import { IWidgetProps, IWidgetState } from "../widgets/BaseWidget"
|
||||||
import _ from "lodash"
|
|
||||||
import { DropTargetConnector, DropTargetMonitor, DropTarget, XYCoord } from "react-dnd"
|
import { DropTargetConnector, DropTargetMonitor, DropTarget, XYCoord } from "react-dnd"
|
||||||
import { IContainerProps } from "./ContainerComponent"
|
import { ContainerProps } from "./ContainerComponent"
|
||||||
import WidgetFactory from "../utils/WidgetFactory";
|
import WidgetFactory from "../utils/WidgetFactory";
|
||||||
|
|
||||||
export interface IDroppableProps extends IContainerProps {
|
export interface DroppableProps extends ContainerProps {
|
||||||
connectDropTarget: Function
|
connectDropTarget: Function;
|
||||||
isOver?: boolean
|
isOver?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DroppableComponent extends React.Component<
|
class DroppableComponent extends React.Component<
|
||||||
IDroppableProps,
|
DroppableProps,
|
||||||
IWidgetState
|
IWidgetState
|
||||||
> {
|
> {
|
||||||
render() {
|
render() {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { IComponentProps } from "./BaseComponent"
|
||||||
import { Icon, Intent } from "@blueprintjs/core"
|
import { Icon, Intent } from "@blueprintjs/core"
|
||||||
import { IconName } from "@blueprintjs/icons"
|
import { IconName } from "@blueprintjs/icons"
|
||||||
import { Container } from "./ContainerComponent"
|
import { Container } from "./ContainerComponent"
|
||||||
class IconComponent extends React.Component<IIconComponentProps> {
|
class IconComponent extends React.Component<IconComponentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container {...this.props}>
|
<Container {...this.props}>
|
||||||
|
|
@ -17,11 +17,11 @@ class IconComponent extends React.Component<IIconComponentProps> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIconComponentProps extends IComponentProps {
|
export interface IconComponentProps extends IComponentProps {
|
||||||
iconSize?: number
|
iconSize?: number;
|
||||||
icon?: IconName
|
icon?: IconName;
|
||||||
intent?: Intent
|
intent?: Intent;
|
||||||
ellipsize?: boolean
|
ellipsize?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IconComponent
|
export default IconComponent
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import * as React from "react"
|
||||||
import { IComponentProps } from "./BaseComponent"
|
import { IComponentProps } from "./BaseComponent"
|
||||||
import { Radio, RadioGroup, IOptionProps } from "@blueprintjs/core"
|
import { Radio, RadioGroup, IOptionProps } from "@blueprintjs/core"
|
||||||
import { Container } from "./ContainerComponent"
|
import { Container } from "./ContainerComponent"
|
||||||
class RadioGroupComponent extends React.Component<IRadioGroupComponentProps> {
|
class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container {...this.props}>
|
<Container {...this.props}>
|
||||||
|
|
@ -25,19 +25,19 @@ class RadioGroupComponent extends React.Component<IRadioGroupComponentProps> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRadioGroupComponentProps extends IComponentProps {
|
export interface RadioGroupComponentProps extends IComponentProps {
|
||||||
label: string
|
label: string;
|
||||||
inline: boolean
|
inline: boolean;
|
||||||
selectedValue: string | number
|
selectedValue: string | number;
|
||||||
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void
|
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void;
|
||||||
disabled: boolean
|
disabled: boolean;
|
||||||
className: string
|
className: string;
|
||||||
name: string
|
name: string;
|
||||||
options: IOptionProps[]
|
options: IOptionProps[];
|
||||||
items: Array<{
|
items: Array<{
|
||||||
label: string
|
label: string;
|
||||||
value: number | string
|
value: number | string;
|
||||||
}>
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RadioGroupComponent
|
export default RadioGroupComponent
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { IComponentProps } from "./BaseComponent"
|
||||||
import { Spinner, Intent } from "@blueprintjs/core"
|
import { Spinner, Intent } from "@blueprintjs/core"
|
||||||
import { Container } from "./ContainerComponent"
|
import { Container } from "./ContainerComponent"
|
||||||
|
|
||||||
class SpinnerComponent extends React.Component<ISpinnerComponentProps> {
|
class SpinnerComponent extends React.Component<SpinnerComponentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container {...this.props}>
|
<Container {...this.props}>
|
||||||
|
|
@ -17,7 +17,7 @@ class SpinnerComponent extends React.Component<ISpinnerComponentProps> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISpinnerComponentProps extends IComponentProps {
|
export interface SpinnerComponentProps extends IComponentProps {
|
||||||
size?: number
|
size?: number
|
||||||
value?: number
|
value?: number
|
||||||
intent?: Intent
|
intent?: Intent
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import * as React from "react"
|
||||||
import { IComponentProps } from "./BaseComponent"
|
import { IComponentProps } from "./BaseComponent"
|
||||||
import { Intent, ITagProps, TagInput, HTMLInputProps } from "@blueprintjs/core"
|
import { Intent, ITagProps, TagInput, HTMLInputProps } from "@blueprintjs/core"
|
||||||
import { Container } from "./ContainerComponent"
|
import { Container } from "./ContainerComponent"
|
||||||
class TagInputComponent extends React.Component<ITagInputComponentProps> {
|
class TagInputComponent extends React.Component<TagInputComponentProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container {...this.props}>
|
<Container {...this.props}>
|
||||||
|
|
@ -15,7 +15,7 @@ class TagInputComponent extends React.Component<ITagInputComponentProps> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITagInputComponentProps extends IComponentProps {
|
export interface TagInputComponentProps extends IComponentProps {
|
||||||
addOnPaste?: boolean
|
addOnPaste?: boolean
|
||||||
className?: string
|
className?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import WidgetBuilderRegistry from "./utils/WidgetRegistry";
|
||||||
import { ThemeProvider, theme } from "./constants/DefaultTheme";
|
import { ThemeProvider, theme } from "./constants/DefaultTheme";
|
||||||
import createSagaMiddleware from 'redux-saga'
|
import createSagaMiddleware from 'redux-saga'
|
||||||
import { rootSaga } from "./sagas"
|
import { rootSaga } from "./sagas"
|
||||||
import { ActionType, ReduxAction } from "./constants/ActionConstants";
|
// import { ActionType, ReduxAction } from "./constants/ActionConstants";
|
||||||
|
|
||||||
import { DndProvider } from "react-dnd"
|
import { DndProvider } from "react-dnd"
|
||||||
import HTML5Backend from "react-dnd-html5-backend"
|
import HTML5Backend from "react-dnd-html5-backend"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { normalize, schema, denormalize } from 'normalizr';
|
import { normalize, schema, denormalize } from 'normalizr';
|
||||||
import { PageResponse } from '../api/PageApi';
|
import { PageResponse } from '../api/PageApi';
|
||||||
import { IContainerWidgetProps } from '../widgets/ContainerWidget';
|
import { ContainerWidgetProps } from '../widgets/ContainerWidget';
|
||||||
|
|
||||||
export const widgetSchema = new schema.Entity('canvasWidgets', { }, { idAttribute: "widgetId" });
|
export const widgetSchema = new schema.Entity('canvasWidgets', { }, { idAttribute: "widgetId" });
|
||||||
// const widgets = new schema.Array(widgetSchema);
|
// const widgets = new schema.Array(widgetSchema);
|
||||||
|
|
@ -12,7 +12,7 @@ class CanvasWidgetsNormalizer {
|
||||||
return normalize(pageResponse.pageWidget, widgetSchema)
|
return normalize(pageResponse.pageWidget, widgetSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
static denormalize(pageWidgetId: string, entities: any): IContainerWidgetProps<any> {
|
static denormalize(pageWidgetId: string, entities: any): ContainerWidgetProps<any> {
|
||||||
return denormalize(pageWidgetId, widgetSchema, entities)
|
return denormalize(pageWidgetId, widgetSchema, entities)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,83 @@
|
||||||
import React, { Props } from "react"
|
import React, { MutableRefObject, useLayoutEffect } from "react"
|
||||||
|
import styled from "styled-components"
|
||||||
import WidgetFactory from "../../utils/WidgetFactory"
|
import WidgetFactory from "../../utils/WidgetFactory"
|
||||||
import { WidgetTypes } from "../../constants/WidgetConstants"
|
import { WidgetTypes } from "../../constants/WidgetConstants"
|
||||||
import { DraggableWidget } from "../../widgets/BaseWidget"
|
import { DraggableWidget } from "../../widgets/BaseWidget"
|
||||||
import { useDrop } from 'react-dnd'
|
import { useDrop } from "react-dnd"
|
||||||
import { IContainerWidgetProps } from "../../widgets/ContainerWidget"
|
import { ContainerWidgetProps } from "../../widgets/ContainerWidget"
|
||||||
|
import EditorDragLayer from "./EditorDragLayer"
|
||||||
|
|
||||||
|
const ArtBoardBackgroundMask = styled.div`
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: -10;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ArtBoard = styled.div<ArtBoardProps>`
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position:relative;
|
||||||
|
overflow: auto;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent,
|
||||||
|
transparent 1px,
|
||||||
|
#ffffff 1px,
|
||||||
|
#ffffff 63px,
|
||||||
|
transparent 63px,
|
||||||
|
transparent 100%),
|
||||||
|
linear-gradient(
|
||||||
|
transparent,
|
||||||
|
transparent 1px,
|
||||||
|
#ffffff 1px,
|
||||||
|
#ffffff 63px,
|
||||||
|
transparent 63px,
|
||||||
|
transparent 100%), black;
|
||||||
|
background-size: 64px 64px;
|
||||||
|
background-position:0 0;
|
||||||
|
`;
|
||||||
|
|
||||||
interface CanvasProps {
|
interface CanvasProps {
|
||||||
pageWidget: IContainerWidgetProps<any>
|
pageWidget: ContainerWidgetProps<any>;
|
||||||
addWidget: Function
|
addWidget: Function;
|
||||||
removeWidget: Function
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Canvas : React.SFC<CanvasProps> = (props) => {
|
interface ArtBoardProps {
|
||||||
const [, drop] = useDrop({
|
cellSize: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Canvas = (props: CanvasProps) => {
|
||||||
|
const [width, setWidth] = React.useState(1)
|
||||||
|
const artBoardMask: MutableRefObject<HTMLDivElement | null> = React.useRef(null)
|
||||||
|
const [collectedProps, drop] = useDrop({
|
||||||
accept: Object.values(WidgetTypes),
|
accept: Object.values(WidgetTypes),
|
||||||
drop(item: DraggableWidget, monitor) {
|
drop(item: DraggableWidget, monitor) {
|
||||||
console.log("dropped")
|
console.log("dropped", collectedProps, item, monitor.didDrop())
|
||||||
props.addWidget(item.type);
|
props.addWidget(item.type, item.key);
|
||||||
return undefined
|
return undefined
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useLayoutEffect(()=> {
|
||||||
|
const el = artBoardMask.current
|
||||||
|
if (el) {
|
||||||
|
const rect = el.getBoundingClientRect()
|
||||||
|
setWidth(rect.width)
|
||||||
|
console.log(rect)
|
||||||
|
}
|
||||||
|
}, [setWidth])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={drop}>
|
<React.Fragment>
|
||||||
|
<EditorDragLayer />
|
||||||
|
<ArtBoard ref={drop} cellSize={(Math.floor(width / 16) - 1)+ "px"}>
|
||||||
|
<ArtBoardBackgroundMask ref={artBoardMask}></ArtBoardBackgroundMask>
|
||||||
{props.pageWidget && WidgetFactory.createWidget(props.pageWidget)}
|
{props.pageWidget && WidgetFactory.createWidget(props.pageWidget)}
|
||||||
</div>
|
</ArtBoard>
|
||||||
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,17 @@ import styled from 'styled-components'
|
||||||
import { XYCoord, useDragLayer } from 'react-dnd'
|
import { XYCoord, useDragLayer } from 'react-dnd'
|
||||||
import snapToGrid from './snapToGrid'
|
import snapToGrid from './snapToGrid'
|
||||||
import WidgetFactory from '../../utils/WidgetFactory';
|
import WidgetFactory from '../../utils/WidgetFactory';
|
||||||
import { RenderModes, WidgetTypes, WidgetType } from '../../constants/WidgetConstants';
|
import { RenderModes, WidgetType } from '../../constants/WidgetConstants';
|
||||||
|
|
||||||
const WrappedDragLayer = styled.div`
|
const WrappedDragLayer = styled.div`
|
||||||
position: fixed;
|
position: absolute;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border: 10px solid #000;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,7 +31,7 @@ function getItemStyles(
|
||||||
|
|
||||||
x -= initialOffset.x
|
x -= initialOffset.x
|
||||||
y -= initialOffset.y
|
y -= initialOffset.y
|
||||||
;[x, y] = snapToGrid(x, y)
|
;[x, y] = snapToGrid(64, x, y)
|
||||||
x += initialOffset.x
|
x += initialOffset.x
|
||||||
y += initialOffset.y
|
y += initialOffset.y
|
||||||
|
|
||||||
|
|
@ -57,10 +58,12 @@ const EditorDragLayer: React.FC = () => {
|
||||||
isDragging: monitor.isDragging(),
|
isDragging: monitor.isDragging(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// console.log("itemType", itemType, "isDragging", isDragging, "item", item, "initialOffset", initialOffset, "currentOffset", currentOffset);
|
||||||
|
|
||||||
function renderItem() {
|
function renderItem() {
|
||||||
return WidgetFactory.createWidget({
|
return WidgetFactory.createWidget({
|
||||||
widgetType: itemType as WidgetType,
|
widgetType: itemType as WidgetType,
|
||||||
widgetId: '2',
|
widgetId: item.key,
|
||||||
topRow: 10,
|
topRow: 10,
|
||||||
leftColumn: 10,
|
leftColumn: 10,
|
||||||
bottomRow: 14,
|
bottomRow: 14,
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ import React, { Component } from "react"
|
||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import { AppState } from "../../reducers"
|
import { AppState } from "../../reducers"
|
||||||
import WidgetFactory from "../../utils/WidgetFactory"
|
|
||||||
import { EditorHeaderReduxState } from "../../reducers/uiReducers/editorHeaderReducer";
|
import { EditorHeaderReduxState } from "../../reducers/uiReducers/editorHeaderReducer";
|
||||||
import { IWidgetProps } from "../../widgets/BaseWidget";
|
|
||||||
|
|
||||||
const Header = styled.header`
|
const Header = styled.header`
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,18 @@
|
||||||
import React from 'react';
|
import React, { useState, useLayoutEffect, MutableRefObject } from 'react';
|
||||||
import { useDrag, DragSourceMonitor } from 'react-dnd'
|
import { useDrag, DragSourceMonitor, DragPreviewImage } from 'react-dnd'
|
||||||
|
import blankImage from "../../assets/images/blank.png"
|
||||||
import { IWidgetCardProps } from '../../widgets/BaseWidget'
|
import { IWidgetCardProps } from '../../widgets/BaseWidget'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { Icon } from '@blueprintjs/core'
|
import { Icon } from '@blueprintjs/core'
|
||||||
import { IconNames } from '@blueprintjs/icons'
|
import { IconNames } from '@blueprintjs/icons'
|
||||||
|
import { generateReactKey } from "../../utils/generators"
|
||||||
|
|
||||||
interface WidgetCardProps {
|
|
||||||
details: IWidgetCardProps
|
type WidgetCardProps = {
|
||||||
|
details: IWidgetCardProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
export const Wrapper = styled.div`
|
||||||
display:flex;
|
display:flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
@ -25,7 +28,7 @@ const Wrapper = styled.div`
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
const IconLabel = styled.h5`
|
export const IconLabel = styled.h5`
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
@ -35,20 +38,39 @@ const IconLabel = styled.h5`
|
||||||
font-size: 0.5rem;
|
font-size: 0.5rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const WidgetCard: React.SFC<WidgetCardProps> = (props) => {
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
const [{ isDragging }, drag] = useDrag({
|
const WidgetCard = (props: WidgetCardProps) => {
|
||||||
item: { type: props.details.widgetType, widget: props.details },
|
const [initialOffset, setInitialOffset] = useState({ x: 0, y: 0})
|
||||||
|
|
||||||
|
const [{ isDragging }, drag, preview] = useDrag({
|
||||||
|
item: { type: props.details.widgetType, widget: props.details, key: generateReactKey(), initialOffset},
|
||||||
collect: (monitor: DragSourceMonitor) => ({
|
collect: (monitor: DragSourceMonitor) => ({
|
||||||
isDragging: monitor.isDragging(),
|
isDragging: monitor.isDragging(),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
const card: MutableRefObject<HTMLDivElement | null> = React.useRef(null)
|
||||||
|
useLayoutEffect(()=> {
|
||||||
|
const el = card.current
|
||||||
|
if (el) {
|
||||||
|
const rect = el.getBoundingClientRect()
|
||||||
|
setInitialOffset({
|
||||||
|
x: Math.ceil(rect.left),
|
||||||
|
y: Math.ceil(rect.top)
|
||||||
|
})
|
||||||
|
console.log(rect)
|
||||||
|
}
|
||||||
|
}, [setInitialOffset])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<React.Fragment >
|
||||||
|
<DragPreviewImage connect={preview} src={blankImage} />
|
||||||
<Wrapper ref={drag}>
|
<Wrapper ref={drag}>
|
||||||
<div>
|
<div ref={card}>
|
||||||
<Icon icon="segmented-control" iconSize={20} />
|
<Icon icon={IconNames.SEGMENTED_CONTROL} iconSize={20} />
|
||||||
<IconLabel>{props.details.label}</IconLabel>
|
<IconLabel>{props.details.label}</IconLabel>
|
||||||
</div>
|
</div>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import React, { Component } from "react"
|
import React from "react"
|
||||||
import WidgetCard from "./WidgetCard"
|
import WidgetCard from "./WidgetCard"
|
||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
import { IWidgetCardProps } from "../../widgets/BaseWidget"
|
import { IWidgetCardProps } from "../../widgets/BaseWidget"
|
||||||
|
|
||||||
interface WidgetCardPaneProps {
|
type WidgetCardPaneProps = {
|
||||||
cards: { [id: string]: IWidgetCardProps[]}
|
cards: { [id: string]: IWidgetCardProps[]};
|
||||||
}
|
}
|
||||||
|
|
||||||
const CardsPaneWrapper = styled.div`
|
const CardsPaneWrapper = styled.div`
|
||||||
|
|
@ -21,7 +21,7 @@ const CardsWrapper = styled.div`
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const WidgetCardsPane: React.SFC<WidgetCardPaneProps> = (props) => {
|
const WidgetCardsPane: React.SFC<WidgetCardPaneProps> = (props: WidgetCardPaneProps) => {
|
||||||
const groups = Object.keys(props.cards)
|
const groups = Object.keys(props.cards)
|
||||||
return (
|
return (
|
||||||
<CardsPaneWrapper>
|
<CardsPaneWrapper>
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ import EditorHeader from "./EditorHeader"
|
||||||
import { WidgetType } from "../../constants/WidgetConstants"
|
import { WidgetType } from "../../constants/WidgetConstants"
|
||||||
import CanvasWidgetsNormalizer from "../../normalizers/CanvasWidgetsNormalizer"
|
import CanvasWidgetsNormalizer from "../../normalizers/CanvasWidgetsNormalizer"
|
||||||
import { fetchWidgetCards } from "../../actions/widgetCardsPaneActions"
|
import { fetchWidgetCards } from "../../actions/widgetCardsPaneActions"
|
||||||
import { IContainerWidgetProps } from "../../widgets/ContainerWidget"
|
import { ContainerWidgetProps } from "../../widgets/ContainerWidget"
|
||||||
import { fetchPage, addWidget } from "../../actions/pageActions"
|
import { fetchPage, addWidget } from "../../actions/pageActions"
|
||||||
import { RenderModes } from "../../constants/WidgetConstants"
|
import { RenderModes } from "../../constants/WidgetConstants"
|
||||||
import EditorDragLayer from "./EditorDragLayer"
|
// import EditorDragLayer from "./EditorDragLayer"
|
||||||
|
|
||||||
const ArtBoard = styled.section`
|
const CanvasContainer = styled.section`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -41,21 +41,24 @@ const EditorWrapper = styled.div`
|
||||||
height: calc(100vh - 60px);
|
height: calc(100vh - 60px);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class Editor extends Component<{
|
type EditorProps = {
|
||||||
pageWidget: IContainerWidgetProps<any> | any
|
pageWidget: ContainerWidgetProps<any> | any;
|
||||||
fetchCanvasWidgets: Function
|
fetchCanvasWidgets: Function;
|
||||||
fetchWidgetCardsPane: Function
|
fetchWidgetCardsPane: Function;
|
||||||
cards: { [id: string] : IWidgetCardProps[] } | any
|
cards: { [id: string]: IWidgetCardProps[] } | any;
|
||||||
addPageWidget: Function
|
addPageWidget: Function;
|
||||||
}> {
|
}
|
||||||
|
|
||||||
|
class Editor extends Component<EditorProps> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchWidgetCardsPane()
|
this.props.fetchWidgetCardsPane()
|
||||||
this.props.fetchCanvasWidgets("1")
|
this.props.fetchCanvasWidgets("1")
|
||||||
}
|
}
|
||||||
|
|
||||||
addWidgetToCanvas = (widgetType: WidgetType) => {
|
addWidgetToCanvas = (widgetType: WidgetType, key: string): void => {
|
||||||
|
console.log(widgetType);
|
||||||
this.props.addPageWidget("1", {
|
this.props.addPageWidget("1", {
|
||||||
key: "12",
|
key: key,
|
||||||
bottomRow: 9,
|
bottomRow: 9,
|
||||||
leftColumn: 1,
|
leftColumn: 1,
|
||||||
parentColumnSpace: 90,
|
parentColumnSpace: 90,
|
||||||
|
|
@ -66,32 +69,31 @@ class Editor extends Component<{
|
||||||
snapRows: 20,
|
snapRows: 20,
|
||||||
children: [],
|
children: [],
|
||||||
topRow: 1,
|
topRow: 1,
|
||||||
widgetId: "2",
|
widgetId: key,
|
||||||
widgetType: widgetType
|
widgetType: widgetType
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
removeWidgetFromCanvas = (widgetId: string) => {
|
// removeWidgetFromCanvas = (widgetId: string): null => {
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<EditorHeader></EditorHeader>
|
<EditorHeader></EditorHeader>
|
||||||
<EditorWrapper>
|
<EditorWrapper>
|
||||||
<WidgetCardsPane cards={this.props.cards} />
|
<WidgetCardsPane cards={this.props.cards} />
|
||||||
<ArtBoard>
|
<CanvasContainer>
|
||||||
<Canvas pageWidget={this.props.pageWidget} addWidget={this.addWidgetToCanvas} removeWidget={this.removeWidgetFromCanvas} />
|
<Canvas pageWidget={this.props.pageWidget} addWidget={this.addWidgetToCanvas} />
|
||||||
<EditorDragLayer />
|
</CanvasContainer>
|
||||||
</ArtBoard>
|
|
||||||
</EditorWrapper>
|
</EditorWrapper>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: AppState, props: any): EditorReduxState => {
|
const mapStateToProps = (state: AppState, props: EditorProps): EditorReduxState => {
|
||||||
const pageWidget = CanvasWidgetsNormalizer.denormalize(
|
const pageWidget = CanvasWidgetsNormalizer.denormalize(
|
||||||
state.ui.canvas.pageWidgetId,
|
state.ui.canvas.pageWidgetId,
|
||||||
state.entities
|
state.entities
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export default function snapToGrid(x: number, y: number) {
|
export default function snapToGrid(cellSize: number, x: number, y: number) {
|
||||||
const snappedX = Math.round(x / 32) * 32
|
const snappedX = Math.round(x / cellSize) * cellSize
|
||||||
const snappedY = Math.round(y / 32) * 32
|
const snappedY = Math.round(y / cellSize) * cellSize
|
||||||
return [snappedX, snappedY]
|
return [snappedX, snappedY]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
|
|
||||||
import { NonIdealState, Button, Card, Elevation } from "@blueprintjs/core"
|
import { NonIdealState, Button, Card, Elevation } from "@blueprintjs/core"
|
||||||
import App from "../App";
|
|
||||||
import { RouterProps } from "react-router";
|
import { RouterProps } from "react-router";
|
||||||
|
|
||||||
class PageNotFound extends React.PureComponent<RouterProps> {
|
class PageNotFound extends React.PureComponent<RouterProps> {
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ import {
|
||||||
ReduxAction
|
ReduxAction
|
||||||
} from "../../constants/ActionConstants"
|
} from "../../constants/ActionConstants"
|
||||||
import { IWidgetProps } from "../../widgets/BaseWidget"
|
import { IWidgetProps } from "../../widgets/BaseWidget"
|
||||||
import CanvasWidgetsNormalizer, { widgetSchema } from "../../normalizers/CanvasWidgetsNormalizer";
|
import CanvasWidgetsNormalizer from "../../normalizers/CanvasWidgetsNormalizer";
|
||||||
|
|
||||||
const initialState: CanvasWidgetsReduxState = {}
|
const initialState: CanvasWidgetsReduxState = {}
|
||||||
|
|
||||||
|
|
||||||
export interface IFlattenedWidgetProps extends IWidgetProps {
|
export interface IFlattenedWidgetProps extends IWidgetProps {
|
||||||
children?: string[]
|
children?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const canvasWidgetsReducer = createReducer(initialState, {
|
const canvasWidgetsReducer = createReducer(initialState, {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ const canvasReducer = createReducer(initialState, {
|
||||||
state: CanvasReduxState,
|
state: CanvasReduxState,
|
||||||
action: ReduxAction<LoadCanvasPayload>
|
action: ReduxAction<LoadCanvasPayload>
|
||||||
) => {
|
) => {
|
||||||
console.log(action.payload);
|
|
||||||
return { pageWidgetId: action.payload.pageWidgetId }
|
return { pageWidgetId: action.payload.pageWidgetId }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
import { createReducer } from "../../utils/PicassoUtils"
|
import { createReducer } from "../../utils/PicassoUtils"
|
||||||
import {
|
|
||||||
ActionTypes,
|
|
||||||
ReduxAction
|
|
||||||
} from "../../constants/ActionConstants"
|
|
||||||
|
|
||||||
const initialState: EditorHeaderReduxState = {}
|
const initialState: EditorHeaderReduxState = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import {
|
||||||
LoadWidgetCardsPanePayload
|
LoadWidgetCardsPanePayload
|
||||||
} from "../../constants/ActionConstants"
|
} from "../../constants/ActionConstants"
|
||||||
import { IWidgetCardProps, IWidgetProps } from "../../widgets/BaseWidget"
|
import { IWidgetCardProps, IWidgetProps } from "../../widgets/BaseWidget"
|
||||||
import { IContainerWidgetProps } from "../../widgets/ContainerWidget"
|
import { ContainerWidgetProps } from "../../widgets/ContainerWidget"
|
||||||
|
|
||||||
const initialState: EditorReduxState = {}
|
const initialState: EditorReduxState = {}
|
||||||
|
|
||||||
|
|
@ -32,9 +32,9 @@ const editorReducer = createReducer(initialState, {
|
||||||
})
|
})
|
||||||
|
|
||||||
export interface EditorReduxState {
|
export interface EditorReduxState {
|
||||||
pageWidget?: IContainerWidgetProps<any>
|
pageWidget?: ContainerWidgetProps<any>;
|
||||||
cards?: {
|
cards?: {
|
||||||
[id: string]: IWidgetCardProps[]
|
[id: string]: IWidgetCardProps[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import CanvasWidgetsNormalizer from "../normalizers/CanvasWidgetsNormalizer"
|
import CanvasWidgetsNormalizer from "../normalizers/CanvasWidgetsNormalizer"
|
||||||
import { ActionTypes, ReduxAction } from "../constants/ActionConstants"
|
import { ActionTypes, ReduxAction } from "../constants/ActionConstants"
|
||||||
import PageApi, { PageResponse, PageRequest } from "../api/PageApi"
|
import PageApi, { PageResponse, PageRequest } from "../api/PageApi"
|
||||||
import { call, put, takeLeading, all, takeEvery } from "redux-saga/effects"
|
import { call, put, takeEvery } from "redux-saga/effects"
|
||||||
import { RenderModes } from "../constants/WidgetConstants"
|
import { RenderModes } from "../constants/WidgetConstants"
|
||||||
|
|
||||||
export function* fetchPageSaga(pageRequestAction: ReduxAction<PageRequest>) {
|
export function* fetchPageSaga(pageRequestAction: ReduxAction<PageRequest>) {
|
||||||
|
|
@ -10,7 +10,6 @@ export function* fetchPageSaga(pageRequestAction: ReduxAction<PageRequest>) {
|
||||||
const pageResponse: PageResponse = yield call(PageApi.fetchPage, pageRequest)
|
const pageResponse: PageResponse = yield call(PageApi.fetchPage, pageRequest)
|
||||||
if (pageRequest.renderMode === RenderModes.CANVAS) {
|
if (pageRequest.renderMode === RenderModes.CANVAS) {
|
||||||
const normalizedResponse = CanvasWidgetsNormalizer.normalize(pageResponse)
|
const normalizedResponse = CanvasWidgetsNormalizer.normalize(pageResponse)
|
||||||
console.log(normalizedResponse);
|
|
||||||
const payload = {
|
const payload = {
|
||||||
pageWidgetId: normalizedResponse.result,
|
pageWidgetId: normalizedResponse.result,
|
||||||
widgets: normalizedResponse.entities.canvasWidgets
|
widgets: normalizedResponse.entities.canvasWidgets
|
||||||
|
|
@ -20,7 +19,6 @@ export function* fetchPageSaga(pageRequestAction: ReduxAction<PageRequest>) {
|
||||||
} catch(err){
|
} catch(err){
|
||||||
//TODO(abhinav): REFACTOR THIS
|
//TODO(abhinav): REFACTOR THIS
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* watchFetchPage() {
|
export function* watchFetchPage() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import CanvasWidgetsNormalizer from "../normalizers/CanvasWidgetsNormalizer"
|
// import CanvasWidgetsNormalizer from "../normalizers/CanvasWidgetsNormalizer"
|
||||||
import { ActionTypes, ReduxAction } from "../constants/ActionConstants"
|
import { ActionTypes, ReduxAction } from "../constants/ActionConstants"
|
||||||
import WidgetCardsPaneApi, { WidgetCardsPaneResponse, WidgetCardsPaneRequest } from "../api/WidgetCardsPaneApi"
|
import WidgetCardsPaneApi, { WidgetCardsPaneResponse, WidgetCardsPaneRequest } from "../api/WidgetCardsPaneApi"
|
||||||
import { successFetchingWidgetCards } from "../actions/widgetCardsPaneActions"
|
import { successFetchingWidgetCards } from "../actions/widgetCardsPaneActions"
|
||||||
import { call, put, takeLeading, all, takeEvery, takeLatest } from "redux-saga/effects"
|
import { call, put, takeLatest } from "redux-saga/effects"
|
||||||
|
|
||||||
|
|
||||||
export function* fetchWidgetCards(widgetCardsRequestAction: ReduxAction<WidgetCardsPaneRequest>) {
|
export function* fetchWidgetCards(widgetCardsRequestAction: ReduxAction<WidgetCardsPaneRequest>) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class WidgetFactory {
|
||||||
if (widgetBuilder)
|
if (widgetBuilder)
|
||||||
return widgetBuilder.buildWidget(widgetData)
|
return widgetBuilder.buildWidget(widgetData)
|
||||||
else {
|
else {
|
||||||
const ex: IWidgetCreationException = {
|
const ex: WidgetCreationException = {
|
||||||
message: "Widget Builder not registered for widget type" + widgetData.widgetType
|
message: "Widget Builder not registered for widget type" + widgetData.widgetType
|
||||||
}
|
}
|
||||||
throw ex
|
throw ex
|
||||||
|
|
@ -28,8 +28,8 @@ class WidgetFactory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWidgetCreationException {
|
export interface WidgetCreationException {
|
||||||
message: string
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default WidgetFactory
|
export default WidgetFactory
|
||||||
|
|
@ -1,101 +1,101 @@
|
||||||
import BaseWidget, { IWidgetProps } from "../widgets/BaseWidget"
|
import { IWidgetProps } from "../widgets/BaseWidget"
|
||||||
import ContainerWidget, {
|
import ContainerWidget, {
|
||||||
IContainerWidgetProps
|
ContainerWidgetProps
|
||||||
} from "../widgets/ContainerWidget"
|
} from "../widgets/ContainerWidget"
|
||||||
import TextWidget, { ITextWidgetProps } from "../widgets/TextWidget"
|
import TextWidget, { TextWidgetProps } from "../widgets/TextWidget"
|
||||||
import InputGroupWidget, {
|
import InputGroupWidget, {
|
||||||
IInputGroupWidgetProps
|
InputGroupWidgetProps
|
||||||
} from "../widgets/InputGroupWidget"
|
} from "../widgets/InputGroupWidget"
|
||||||
import CalloutWidget, { ICalloutWidgetProps } from "../widgets/CalloutWidget"
|
import CalloutWidget, { CalloutWidgetProps } from "../widgets/CalloutWidget"
|
||||||
import IconWidget, { IIconWidgetProps } from "../widgets/IconWidget"
|
import IconWidget, { IconWidgetProps } from "../widgets/IconWidget"
|
||||||
import SpinnerWidget, { ISpinnerWidgetProps } from "../widgets/SpinnerWidget"
|
import SpinnerWidget, { SpinnerWidgetProps } from "../widgets/SpinnerWidget"
|
||||||
import BreadcrumbsWidget, {
|
import BreadcrumbsWidget, {
|
||||||
IBreadcrumbsWidgetProps
|
BreadcrumbsWidgetProps
|
||||||
} from "../widgets/BreadcrumbsWidget"
|
} from "../widgets/BreadcrumbsWidget"
|
||||||
import TagInputWidget, { ITagInputWidgetProps } from "../widgets/TagInputWidget"
|
import TagInputWidget, { TagInputWidgetProps } from "../widgets/TagInputWidget"
|
||||||
import NumericInputWidget, {
|
import NumericInputWidget, {
|
||||||
INumericInputWidgetProps
|
NumericInputWidgetProps
|
||||||
} from "../widgets/NumericInputWidget"
|
} from "../widgets/NumericInputWidget"
|
||||||
import CheckboxWidget, { ICheckboxWidgetProps } from "../widgets/CheckboxWidget"
|
import CheckboxWidget, { CheckboxWidgetProps } from "../widgets/CheckboxWidget"
|
||||||
import RadioGroupWidget, {
|
import RadioGroupWidget, {
|
||||||
IRadioGroupWidgetProps
|
RadioGroupWidgetProps
|
||||||
} from "../widgets/RadioGroupWidget"
|
} from "../widgets/RadioGroupWidget"
|
||||||
import WidgetFactory from "./WidgetFactory"
|
import WidgetFactory from "./WidgetFactory"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import ButtonWidget, { IButtonWidgetProps } from "../widgets/ButtonWidget"
|
import ButtonWidget, { ButtonWidgetProps } from "../widgets/ButtonWidget"
|
||||||
|
|
||||||
class WidgetBuilderRegistry {
|
class WidgetBuilderRegistry {
|
||||||
static registerWidgetBuilders() {
|
static registerWidgetBuilders() {
|
||||||
WidgetFactory.registerWidgetBuilder("CONTAINER_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("CONTAINER_WIDGET", {
|
||||||
buildWidget(
|
buildWidget(
|
||||||
widgetData: IContainerWidgetProps<IWidgetProps>
|
widgetData: ContainerWidgetProps<IWidgetProps>
|
||||||
): JSX.Element {
|
): JSX.Element {
|
||||||
return <ContainerWidget {...widgetData} />
|
return <ContainerWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("TEXT_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("TEXT_WIDGET", {
|
||||||
buildWidget(widgetData: ITextWidgetProps): JSX.Element {
|
buildWidget(widgetData: TextWidgetProps): JSX.Element {
|
||||||
return <TextWidget {...widgetData} />
|
return <TextWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("BUTTON_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("BUTTON_WIDGET", {
|
||||||
buildWidget(widgetData: IButtonWidgetProps): JSX.Element {
|
buildWidget(widgetData: ButtonWidgetProps): JSX.Element {
|
||||||
return <ButtonWidget {...widgetData} />
|
return <ButtonWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("CALLOUT_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("CALLOUT_WIDGET", {
|
||||||
buildWidget(widgetData: ICalloutWidgetProps): JSX.Element {
|
buildWidget(widgetData: CalloutWidgetProps): JSX.Element {
|
||||||
return <CalloutWidget {...widgetData} />
|
return <CalloutWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("ICON_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("ICON_WIDGET", {
|
||||||
buildWidget(widgetData: IIconWidgetProps): JSX.Element {
|
buildWidget(widgetData: IconWidgetProps): JSX.Element {
|
||||||
return <IconWidget {...widgetData} />
|
return <IconWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("SPINNER_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("SPINNER_WIDGET", {
|
||||||
buildWidget(widgetData: ISpinnerWidgetProps): JSX.Element {
|
buildWidget(widgetData: SpinnerWidgetProps): JSX.Element {
|
||||||
return <SpinnerWidget {...widgetData} />
|
return <SpinnerWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("INPUT_GROUP_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("INPUT_GROUP_WIDGET", {
|
||||||
buildWidget(widgetData: IInputGroupWidgetProps): JSX.Element {
|
buildWidget(widgetData: InputGroupWidgetProps): JSX.Element {
|
||||||
return <InputGroupWidget {...widgetData} />
|
return <InputGroupWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("BREADCRUMBS_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("BREADCRUMBS_WIDGET", {
|
||||||
buildWidget(widgetData: IBreadcrumbsWidgetProps): JSX.Element {
|
buildWidget(widgetData: BreadcrumbsWidgetProps): JSX.Element {
|
||||||
return <BreadcrumbsWidget {...widgetData} />
|
return <BreadcrumbsWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("TAG_INPUT_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("TAG_INPUT_WIDGET", {
|
||||||
buildWidget(widgetData: ITagInputWidgetProps): JSX.Element {
|
buildWidget(widgetData: TagInputWidgetProps): JSX.Element {
|
||||||
return <TagInputWidget {...widgetData} />
|
return <TagInputWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("NUMERIC_INPUT_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("NUMERIC_INPUT_WIDGET", {
|
||||||
buildWidget(widgetData: INumericInputWidgetProps): JSX.Element {
|
buildWidget(widgetData: NumericInputWidgetProps): JSX.Element {
|
||||||
return <NumericInputWidget {...widgetData} />
|
return <NumericInputWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("CHECKBOX_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("CHECKBOX_WIDGET", {
|
||||||
buildWidget(widgetData: ICheckboxWidgetProps): JSX.Element {
|
buildWidget(widgetData: CheckboxWidgetProps): JSX.Element {
|
||||||
return <CheckboxWidget {...widgetData} />
|
return <CheckboxWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
WidgetFactory.registerWidgetBuilder("RADIO_GROUP_WIDGET", {
|
WidgetFactory.registerWidgetBuilder("RADIO_GROUP_WIDGET", {
|
||||||
buildWidget(widgetData: IRadioGroupWidgetProps): JSX.Element {
|
buildWidget(widgetData: RadioGroupWidgetProps): JSX.Element {
|
||||||
return <RadioGroupWidget {...widgetData} />
|
return <RadioGroupWidget {...widgetData} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
11
app/client/src/utils/generators.tsx
Normal file
11
app/client/src/utils/generators.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import generate from 'nanoid/generate'
|
||||||
|
|
||||||
|
const ALPHABET = "1234567890abcdefghijklmnopqrstuvwxyz"
|
||||||
|
|
||||||
|
export const generateReactKey = ({prefix = ""}: {prefix?: string}={}): string => {
|
||||||
|
return prefix + generate(ALPHABET, 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
generateReactKey
|
||||||
|
}
|
||||||
|
|
@ -12,9 +12,7 @@ import {
|
||||||
import { Component } from "react"
|
import { Component } from "react"
|
||||||
import { BaseStyle } from "../editorComponents/BaseComponent"
|
import { BaseStyle } from "../editorComponents/BaseComponent"
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
import * as React from "react"
|
import React from "react"
|
||||||
import ContainerWidget from "./ContainerWidget"
|
|
||||||
import ContainerComponent from "../editorComponents/ContainerComponent"
|
|
||||||
import DraggableComponent from "../editorComponents/DraggableComponent"
|
import DraggableComponent from "../editorComponents/DraggableComponent"
|
||||||
|
|
||||||
abstract class BaseWidget<
|
abstract class BaseWidget<
|
||||||
|
|
@ -100,6 +98,7 @@ abstract class BaseWidget<
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponentPaneView(): JSX.Element {
|
getComponentPaneView(): JSX.Element {
|
||||||
|
console.log(this.props)
|
||||||
return (
|
return (
|
||||||
<DraggableComponent
|
<DraggableComponent
|
||||||
{...this.props}
|
{...this.props}
|
||||||
|
|
@ -131,46 +130,47 @@ abstract class BaseWidget<
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps: Partial<IWidgetProps> = {
|
static defaultProps: Partial<IWidgetProps> = {
|
||||||
parentRowSpace: 1,
|
parentRowSpace: 64,
|
||||||
parentColumnSpace: 1,
|
parentColumnSpace: 64,
|
||||||
topRow: 0,
|
topRow: 0,
|
||||||
leftColumn: 0
|
leftColumn: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWidgetState {
|
export interface IWidgetState {
|
||||||
height: number
|
height: number;
|
||||||
width: number
|
width: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DraggableWidget {
|
export interface DraggableWidget {
|
||||||
type: string,
|
type: string;
|
||||||
widget: IWidgetProps
|
widget: IWidgetProps;
|
||||||
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWidgetBuilder<T extends IWidgetProps> {
|
export interface IWidgetBuilder<T extends IWidgetProps> {
|
||||||
buildWidget(data: T): JSX.Element
|
buildWidget(data: T): JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWidgetProps {
|
export interface IWidgetProps {
|
||||||
widgetType: WidgetType
|
widgetType: WidgetType;
|
||||||
key?: string
|
key?: string;
|
||||||
widgetId: string
|
widgetId: string;
|
||||||
topRow: number
|
topRow: number;
|
||||||
leftColumn: number
|
leftColumn: number;
|
||||||
bottomRow: number
|
bottomRow: number;
|
||||||
rightColumn: number
|
rightColumn: number;
|
||||||
parentColumnSpace: number
|
parentColumnSpace: number;
|
||||||
parentRowSpace: number
|
parentRowSpace: number;
|
||||||
renderMode: RenderMode
|
renderMode: RenderMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWidgetCardProps {
|
export interface IWidgetCardProps {
|
||||||
widgetType: WidgetType
|
widgetType: WidgetType;
|
||||||
key?: string
|
key?: string;
|
||||||
label: string
|
label: string;
|
||||||
icon: string
|
icon: string;
|
||||||
groups: string[]
|
groups: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BaseWidget
|
export default BaseWidget
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
import * as React from "react"
|
import React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants"
|
import { WidgetType } from "../constants/WidgetConstants"
|
||||||
import { Boundary, IBreadcrumbProps } from "@blueprintjs/core"
|
import { Boundary, IBreadcrumbProps } from "@blueprintjs/core"
|
||||||
import BreadcrumbsComponent from "../editorComponents/BreadcrumbsComponent"
|
import BreadcrumbsComponent from "../editorComponents/BreadcrumbsComponent"
|
||||||
import _ from "lodash"
|
|
||||||
|
|
||||||
class BreadcrumbsWidget extends BaseWidget<
|
class BreadcrumbsWidget extends BaseWidget<
|
||||||
IBreadcrumbsWidgetProps,
|
BreadcrumbsWidgetProps,
|
||||||
IWidgetState
|
IWidgetState
|
||||||
> {
|
> {
|
||||||
constructor(widgetProps: IBreadcrumbsWidgetProps) {
|
|
||||||
super(widgetProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -32,12 +28,12 @@ class BreadcrumbsWidget extends BaseWidget<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBreadcrumbsWidgetProps extends IWidgetProps {
|
export interface BreadcrumbsWidgetProps extends IWidgetProps {
|
||||||
width?: number
|
width?: number;
|
||||||
collapseFrom?: Boundary
|
collapseFrom?: Boundary;
|
||||||
className?: string
|
className?: string;
|
||||||
minVisibleItems?: number
|
minVisibleItems?: number;
|
||||||
items?: IBreadcrumbProps[]
|
items?: IBreadcrumbProps[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BreadcrumbsWidget
|
export default BreadcrumbsWidget
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,9 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants"
|
import { WidgetType } from "../constants/WidgetConstants"
|
||||||
import ButtonComponent from "../editorComponents/ButtonComponent"
|
import ButtonComponent from "../editorComponents/ButtonComponent"
|
||||||
import _ from "lodash"
|
|
||||||
import WidgetFactory from "../utils/WidgetFactory";
|
|
||||||
|
|
||||||
class ButtonWidget extends BaseWidget<IButtonWidgetProps, IWidgetState> {
|
class ButtonWidget extends BaseWidget<ButtonWidgetProps, IWidgetState> {
|
||||||
constructor(widgetProps: IButtonWidgetProps) {
|
|
||||||
super(widgetProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -26,9 +21,9 @@ class ButtonWidget extends BaseWidget<IButtonWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IButtonWidgetProps extends IWidgetProps {
|
export interface ButtonWidgetProps extends IWidgetProps {
|
||||||
text?: string
|
text?: string;
|
||||||
ellipsize?: boolean
|
ellipsize?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ButtonWidget
|
export default ButtonWidget
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { Callout, Code, H5, Intent, Switch } from "@blueprintjs/core";
|
import { Intent } from "@blueprintjs/core";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import CalloutComponent from "../editorComponents/CalloutComponent";
|
import CalloutComponent from "../editorComponents/CalloutComponent";
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class CalloutWidget extends BaseWidget<ICalloutWidgetProps, IWidgetState> {
|
|
||||||
constructor(widgetProps: ICalloutWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class CalloutWidget extends BaseWidget<CalloutWidgetProps, IWidgetState> {
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
<CalloutComponent
|
<CalloutComponent
|
||||||
|
|
@ -29,7 +24,7 @@ class CalloutWidget extends BaseWidget<ICalloutWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICalloutWidgetProps extends IWidgetProps {
|
export interface CalloutWidgetProps extends IWidgetProps {
|
||||||
id?: string;
|
id?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,9 @@
|
||||||
import * as React from "react"
|
import React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants"
|
import { WidgetType } from "../constants/WidgetConstants"
|
||||||
import { Icon, Intent } from "@blueprintjs/core"
|
|
||||||
import { IconName } from "@blueprintjs/icons"
|
|
||||||
import CheckboxComponent from "../editorComponents/CheckboxComponent"
|
import CheckboxComponent from "../editorComponents/CheckboxComponent"
|
||||||
import _ from "lodash"
|
|
||||||
|
|
||||||
class CheckboxWidget extends BaseWidget<ICheckboxWidgetProps, IWidgetState> {
|
|
||||||
constructor(widgetProps: ICheckboxWidgetProps) {
|
|
||||||
super(widgetProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class CheckboxWidget extends BaseWidget<CheckboxWidgetProps, IWidgetState> {
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
<CheckboxComponent
|
<CheckboxComponent
|
||||||
|
|
@ -27,12 +20,12 @@ class CheckboxWidget extends BaseWidget<ICheckboxWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICheckboxWidgetProps extends IWidgetProps {
|
export interface CheckboxWidgetProps extends IWidgetProps {
|
||||||
items: Array<{
|
items: Array<{
|
||||||
label: string
|
label: string;
|
||||||
defaultIndeterminate: boolean
|
defaultIndeterminate: boolean;
|
||||||
value: number | string
|
value: number | string;
|
||||||
}>
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CheckboxWidget
|
export default CheckboxWidget
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,34 @@
|
||||||
|
import React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import ContainerComponent, {
|
import ContainerComponent from "../editorComponents/ContainerComponent"
|
||||||
IContainerProps
|
|
||||||
} from "../editorComponents/ContainerComponent"
|
|
||||||
import {
|
import {
|
||||||
ContainerOrientation,
|
ContainerOrientation,
|
||||||
WidgetType,
|
WidgetType,
|
||||||
CSSUnits
|
|
||||||
} from "../constants/WidgetConstants"
|
} from "../constants/WidgetConstants"
|
||||||
import WidgetFactory from "../utils/WidgetFactory"
|
import WidgetFactory from "../utils/WidgetFactory"
|
||||||
import React from "react"
|
|
||||||
import _ from "lodash"
|
import _ from "lodash"
|
||||||
import { Color } from "../constants/StyleConstants"
|
import { Color } from "../constants/StyleConstants"
|
||||||
import DroppableComponent from "../editorComponents/DroppableComponent"
|
import DroppableComponent from "../editorComponents/DroppableComponent"
|
||||||
|
|
||||||
const DEFAULT_NUM_COLS = 13
|
const DEFAULT_NUM_COLS = 16
|
||||||
const DEFAULT_NUM_ROWS = 13
|
const DEFAULT_NUM_ROWS = 16
|
||||||
|
|
||||||
class ContainerWidget extends BaseWidget<
|
class ContainerWidget extends BaseWidget<
|
||||||
IContainerWidgetProps<IWidgetProps>,
|
ContainerWidgetProps<IWidgetProps>,
|
||||||
IContainerWidgetState
|
ContainerWidgetState
|
||||||
> {
|
> {
|
||||||
constructor(props: IContainerWidgetProps<IWidgetProps>) {
|
constructor(props: ContainerWidgetProps<IWidgetProps>) {
|
||||||
super(props)
|
super(props)
|
||||||
this.renderChildWidget = this.renderChildWidget.bind(this)
|
this.renderChildWidget = this.renderChildWidget.bind(this)
|
||||||
this.state = {
|
this.state = {
|
||||||
width: 0,
|
width: 0,
|
||||||
height: 0,
|
height: 0,
|
||||||
snapColumnSpace: 1,
|
snapColumnSpace: DEFAULT_NUM_COLS,
|
||||||
snapRowSpace: 1
|
snapRowSpace: DEFAULT_NUM_ROWS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(previousProps: IContainerWidgetProps<IWidgetProps>) {
|
componentDidUpdate(previousProps: ContainerWidgetProps<IWidgetProps>) {
|
||||||
super.componentDidUpdate(previousProps)
|
super.componentDidUpdate(previousProps)
|
||||||
let snapColumnSpace = this.state.snapColumnSpace
|
let snapColumnSpace = this.state.snapColumnSpace
|
||||||
let snapRowSpace = this.state.snapRowSpace
|
let snapRowSpace = this.state.snapRowSpace
|
||||||
|
|
@ -91,18 +88,18 @@ class ContainerWidget extends BaseWidget<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContainerWidgetState extends IWidgetState {
|
export interface ContainerWidgetState extends IWidgetState {
|
||||||
snapColumnSpace: number
|
snapColumnSpace: number;
|
||||||
snapRowSpace: number
|
snapRowSpace: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContainerWidgetProps<T extends IWidgetProps>
|
export interface ContainerWidgetProps<T extends IWidgetProps>
|
||||||
extends IWidgetProps {
|
extends IWidgetProps {
|
||||||
children?: T[]
|
children?: T[];
|
||||||
snapColumns?: number
|
snapColumns?: number;
|
||||||
snapRows?: number
|
snapRows?: number;
|
||||||
orientation?: ContainerOrientation
|
orientation?: ContainerOrientation;
|
||||||
backgroundColor?: Color
|
backgroundColor?: Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ContainerWidget
|
export default ContainerWidget
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import { Icon, Intent } from "@blueprintjs/core";
|
import { Intent } from "@blueprintjs/core";
|
||||||
import { IconName } from "@blueprintjs/icons";
|
import { IconName } from "@blueprintjs/icons";
|
||||||
import IconComponent from "../editorComponents/IconComponent";
|
import IconComponent from "../editorComponents/IconComponent";
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class IconWidget extends BaseWidget<IIconWidgetProps, IWidgetState> {
|
|
||||||
constructor(widgetProps: IIconWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class IconWidget extends BaseWidget<IconWidgetProps, IWidgetState> {
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
<IconComponent
|
<IconComponent
|
||||||
|
|
@ -29,7 +24,7 @@ class IconWidget extends BaseWidget<IIconWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIconWidgetProps extends IWidgetProps {
|
export interface IconWidgetProps extends IWidgetProps {
|
||||||
icon?: IconName;
|
icon?: IconName;
|
||||||
iconSize?: number;
|
iconSize?: number;
|
||||||
ellipsize?: boolean;
|
ellipsize?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import InputGroupComponent from "../editorComponents/InputGroupComponent";
|
import InputGroupComponent from "../editorComponents/InputGroupComponent";
|
||||||
import { IconName, InputGroup, Intent } from "@blueprintjs/core";
|
import { IconName, Intent } from "@blueprintjs/core";
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class InputGroupWidget extends BaseWidget<
|
class InputGroupWidget extends BaseWidget<
|
||||||
IInputGroupWidgetProps,
|
InputGroupWidgetProps,
|
||||||
IWidgetState
|
IWidgetState
|
||||||
> {
|
> {
|
||||||
constructor(widgetProps: IInputGroupWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -40,7 +36,7 @@ class InputGroupWidget extends BaseWidget<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IInputGroupWidgetProps extends IWidgetProps {
|
export interface InputGroupWidgetProps extends IWidgetProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
large?: boolean;
|
large?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,11 @@ import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import { WidgetType } from "../constants/WidgetConstants"
|
import { WidgetType } from "../constants/WidgetConstants"
|
||||||
import NumericInputComponent from "../editorComponents/NumericInputComponent"
|
import NumericInputComponent from "../editorComponents/NumericInputComponent"
|
||||||
import { Intent, IconName } from "@blueprintjs/core"
|
import { Intent, IconName } from "@blueprintjs/core"
|
||||||
import _ from "lodash"
|
|
||||||
|
|
||||||
class NumericInputWidget extends BaseWidget<
|
class NumericInputWidget extends BaseWidget<
|
||||||
INumericInputWidgetProps,
|
NumericInputWidgetProps,
|
||||||
IWidgetState
|
IWidgetState
|
||||||
> {
|
> {
|
||||||
constructor(widgetProps: INumericInputWidgetProps) {
|
|
||||||
super(widgetProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -47,27 +43,27 @@ class NumericInputWidget extends BaseWidget<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INumericInputWidgetProps extends IWidgetProps {
|
export interface NumericInputWidgetProps extends IWidgetProps {
|
||||||
className?: string
|
className?: string;
|
||||||
disabled?: boolean
|
disabled?: boolean;
|
||||||
large?: boolean
|
large?: boolean;
|
||||||
intent?: Intent
|
intent?: Intent;
|
||||||
defaultValue?: string
|
defaultValue?: string;
|
||||||
leftIcon?: IconName
|
leftIcon?: IconName;
|
||||||
rightElement?: JSX.Element
|
rightElement?: JSX.Element;
|
||||||
allowNumericCharactersOnly?: boolean
|
allowNumericCharactersOnly?: boolean;
|
||||||
fill?: boolean
|
fill?: boolean;
|
||||||
majorStepSize?: number | null
|
majorStepSize?: number | null;
|
||||||
max?: number
|
max?: number;
|
||||||
min?: number
|
min?: number;
|
||||||
minorStepSize?: number | null
|
minorStepSize?: number | null;
|
||||||
onValueChange?: (valueAsNumber: number, valueAsString: string) => void
|
onValueChange?: (valueAsNumber: number, valueAsString: string) => void;
|
||||||
onButtonClick?: (valueAsNumber: number, valueAsString: string) => void
|
onButtonClick?: (valueAsNumber: number, valueAsString: string) => void;
|
||||||
inputRef?: (ref: HTMLInputElement | null) => any
|
inputRef?: (ref: HTMLInputElement | null) => any;
|
||||||
selectAllOnFocus?: boolean
|
selectAllOnFocus?: boolean;
|
||||||
selectAllOnIncrement?: boolean
|
selectAllOnIncrement?: boolean;
|
||||||
stepSize?: number
|
stepSize?: number;
|
||||||
placeholder?: string
|
placeholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NumericInputWidget
|
export default NumericInputWidget
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget"
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants"
|
import { WidgetType } from "../constants/WidgetConstants"
|
||||||
import RadioGroupComponent from "../editorComponents/RadioGroupComponent"
|
import RadioGroupComponent from "../editorComponents/RadioGroupComponent"
|
||||||
import { IOptionProps } from "@blueprintjs/core"
|
import { IOptionProps } from "@blueprintjs/core"
|
||||||
import _ from "lodash"
|
|
||||||
|
|
||||||
class RadioButtonWidget extends BaseWidget<
|
class RadioButtonWidget extends BaseWidget<
|
||||||
IRadioGroupWidgetProps,
|
RadioGroupWidgetProps,
|
||||||
IWidgetState
|
IWidgetState
|
||||||
> {
|
> {
|
||||||
constructor(widgetProps: IRadioGroupWidgetProps) {
|
|
||||||
super(widgetProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -37,19 +33,19 @@ class RadioButtonWidget extends BaseWidget<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRadioGroupWidgetProps extends IWidgetProps {
|
export interface RadioGroupWidgetProps extends IWidgetProps {
|
||||||
label: string
|
label: string;
|
||||||
inline: boolean
|
inline: boolean;
|
||||||
selectedValue: string | number
|
selectedValue: string | number;
|
||||||
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void
|
handleRadioChange: (event: React.FormEvent<HTMLInputElement>) => void;
|
||||||
disabled: boolean
|
disabled: boolean;
|
||||||
className: string
|
className: string;
|
||||||
name: string
|
name: string;
|
||||||
options: IOptionProps[]
|
options: IOptionProps[];
|
||||||
items: Array<{
|
items: Array<{
|
||||||
label: string
|
label: string;
|
||||||
value: number | string
|
value: number | string;
|
||||||
}>
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RadioButtonWidget
|
export default RadioButtonWidget
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import { Spinner, Intent } from "@blueprintjs/core";
|
import { Intent } from "@blueprintjs/core";
|
||||||
import SpinnerComponent from "../editorComponents/SpinnerComponent";
|
import SpinnerComponent from "../editorComponents/SpinnerComponent";
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class SpinnerWidget extends BaseWidget<ISpinnerWidgetProps, IWidgetState> {
|
class SpinnerWidget extends BaseWidget<SpinnerWidgetProps, IWidgetState> {
|
||||||
constructor(widgetProps: ISpinnerWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -28,7 +24,7 @@ class SpinnerWidget extends BaseWidget<ISpinnerWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISpinnerWidgetProps extends IWidgetProps {
|
export interface SpinnerWidgetProps extends IWidgetProps {
|
||||||
size?: number;
|
size?: number;
|
||||||
value?: number;
|
value?: number;
|
||||||
ellipsize?: boolean;
|
ellipsize?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import TagInputComponent from "../editorComponents/TagInputComponent";
|
import TagInputComponent from "../editorComponents/TagInputComponent";
|
||||||
import { Intent, ITagProps, TagInput, HTMLInputProps } from "@blueprintjs/core";
|
import { Intent, ITagProps, HTMLInputProps } from "@blueprintjs/core";
|
||||||
|
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class TagInputWidget extends BaseWidget<ITagInputWidgetProps, IWidgetState> {
|
class TagInputWidget extends BaseWidget<TagInputWidgetProps, IWidgetState> {
|
||||||
constructor(widgetProps: ITagInputWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -28,7 +24,7 @@ class TagInputWidget extends BaseWidget<ITagInputWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITagInputWidgetProps extends IWidgetProps {
|
export interface TagInputWidgetProps extends IWidgetProps {
|
||||||
addOnPaste?: boolean;
|
addOnPaste?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
import * as React from "react";
|
import React from "react";
|
||||||
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
import BaseWidget, { IWidgetProps, IWidgetState } from "./BaseWidget";
|
||||||
import { WidgetType, CSSUnits } from "../constants/WidgetConstants";
|
import { WidgetType } from "../constants/WidgetConstants";
|
||||||
import TextComponent from "../editorComponents/TextComponent";
|
import TextComponent from "../editorComponents/TextComponent";
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
class TextWidget extends BaseWidget<ITextWidgetProps, IWidgetState> {
|
class TextWidget extends BaseWidget<TextWidgetProps, IWidgetState> {
|
||||||
constructor(widgetProps: ITextWidgetProps) {
|
|
||||||
super(widgetProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageView() {
|
getPageView() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -26,7 +22,7 @@ class TextWidget extends BaseWidget<ITextWidgetProps, IWidgetState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITextWidgetProps extends IWidgetProps {
|
export interface TextWidgetProps extends IWidgetProps {
|
||||||
text?: string;
|
text?: string;
|
||||||
ellipsize?: boolean;
|
ellipsize?: boolean;
|
||||||
tagName?: keyof JSX.IntrinsicElements;
|
tagName?: keyof JSX.IntrinsicElements;
|
||||||
|
|
|
||||||
|
|
@ -5,26 +5,26 @@
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
"esnext",
|
"esnext",
|
||||||
// "es5",
|
"es5",
|
||||||
// "es2015.collection",
|
"es2015.collection",
|
||||||
// "es2015.iterable"
|
"es2015.iterable"
|
||||||
],
|
],
|
||||||
|
"strict": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react",
|
||||||
// "downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
// "importHelpers": true
|
"importHelpers": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"src/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8173
app/client/yarn.lock
Executable file → Normal file
8173
app/client/yarn.lock
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user