Skip to content

Commit

Permalink
bump dependencies, switch to parcel 2
Browse files Browse the repository at this point in the history
  • Loading branch information
rinick committed Jul 7, 2020
1 parent e6515de commit 6a1c38c
Show file tree
Hide file tree
Showing 11 changed files with 2,400 additions and 1,533 deletions.
15 changes: 0 additions & 15 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
/playground
/.idea
/.cache
/.parcel-cache
build
/dist
/src/**/*.js
Expand Down
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MPL-2.0",
"dependencies": {
"denque": "^1.4.1",
"i18next": "^19.5.1",
"i18next": "^19.5.4",
"jsonesc": "^0.4.11",
"lodash": "^4.17.15",
"moment": "^2.27.0",
Expand All @@ -22,35 +22,34 @@
},
"devDependencies": {
"@ant-design/icons": "^4.2.1",
"@babel/core": "^7.10.3",
"@babel/plugin-proposal-optional-chaining": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@babel/core": "^7.10.4",
"@babel/plugin-proposal-optional-chaining": "^7.10.4",
"@types/body-parser": "^1.19.0",
"@types/chai": "^4.2.11",
"@types/codemirror": "^0.0.96",
"@types/dompurify": "^2.0.2",
"@types/express": "^4.17.6",
"@types/express": "^4.17.7",
"@types/express-ws": "^3.0.0",
"@types/glob": "^7.1.2",
"@types/glob": "^7.1.3",
"@types/karma": "^5.0.0",
"@types/marked": "^0.7.4",
"@types/marked": "^1.1.0",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.13",
"@types/node": "^14.0.18",
"@types/qs": "^6.9.3",
"@types/react": "^16.9.38",
"@types/react-color": "^3.0.2",
"@types/react": "^16.9.41",
"@types/react-color": "^3.0.4",
"@types/react-dom": "^16.9.8",
"@types/shelljs": "^0.8.8",
"@types/tinycolor2": "^1.4.2",
"@types/ws": "^7.2.5",
"antd": "4.3.5",
"@types/ws": "^7.2.6",
"antd": "4.4.1",
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"chai": "^4.2.0",
"codemirror": "^5.55.0",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"dompurify": "^2.0.11",
"dompurify": "^2.0.12",
"express": "^4.17.1",
"express-ws": "^4.0.0",
"glob": "^7.1.6",
Expand All @@ -63,7 +62,7 @@
"marked": "^1.1.0",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"parcel-bundler": "^1.12.4",
"parcel": "^2.0.0-beta.1",
"prettier": "^2.0.5",
"rc-dock": "^2.6.0",
"rc-trigger": "^4.3.0",
Expand All @@ -78,8 +77,8 @@
"ts-node": "^8.10.2",
"tslint": "^6.1.2",
"tslint-react": "^5.0.0",
"typescript": "^3.9.5",
"ws": "^7.3.0",
"typescript": "^3.9.6",
"ws": "^7.3.1",
"yaml": "^1.10.0"
},
"resolutions": {
Expand All @@ -95,9 +94,9 @@
"build-package": "ts-node tool/build-package.ts",
"test": "cross-env NODE_ENV=TEST mocha 'src/core/**/*.spec.ts' 'src/node/**/*.spec.ts'",
"express-server": "node -r ts-node/register example/server/express-server",
"editor": "parcel example/simple-editor/editor-browser.html --open --out-dir temp --no-source-maps",
"server-and-editor-browser": "parcel example/simple-editor/server-and-editor-browser.html --open --out-dir temp --no-source-maps",
"browser-server": "parcel example/simple-editor/server.html example/simple-editor/editor-browser.html --open --out-dir temp --no-source-maps",
"editor": "parcel serve example/simple-editor/editor-browser.html --open --dist-dir temp --no-source-maps",
"server-and-editor-browser": "parcel serve example/simple-editor/server-and-editor-browser.html --open --dist-dir temp --no-source-maps",
"browser-server": "parcel serve example/simple-editor/server.html example/simple-editor/editor-browser.html --open --dist-dir temp --no-source-maps",
"prettier-check": "prettier --check \"(src|tool|example)/**/*.+(ts|tsx|less)\"",
"prettier-write": "prettier --write \"(src|tool|example)/**/*.+(ts|tsx|less)\""
}
Expand Down
3 changes: 0 additions & 3 deletions src/editor/dock/node-tree/AddNewFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ export class AddNewFlow extends LazyUpdateComponent<Props, State> {
};

onClose = () => {
let {name, data} = this.formItems;
name.setError(null);
data.setError(null);
this.setState({visible: false});
};

Expand Down
3 changes: 1 addition & 2 deletions src/editor/dock/node-tree/NodeTreePane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ReloadIcon from '@ant-design/icons/ReloadOutlined';
import {AddNewFlow} from './AddNewFlow';
import {DragDropDiv, DragState} from 'rc-dock/lib';
import {NodeTreeItem} from '../../node-tree/NodeRenderer';
import {ClickParam} from 'antd/lib/menu';
import {t} from '../../component/LocalizedLabel';
import {showModal} from '../../popup/ShowModal';

Expand Down Expand Up @@ -52,7 +51,7 @@ export class NodeTreePane extends React.PureComponent<Props, State> {
this._nodeTree?.reload();
};

onAddNewFlowClick = (param: ClickParam) => {
onAddNewFlowClick = (param: any) => {
let {conn} = this.props;
let path = param.item.props.defaultValue;
showModal(<AddNewFlow conn={conn} basePath={`${path}.`} />, this.context.showModal);
Expand Down
5 changes: 2 additions & 3 deletions src/editor/dock/text-editor/TextEditorPane.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {ClientConn, decode, encode, DataMap, isDataTruncated} from '../../../../src/core/editor';
import {Menu, Dropdown, Button, Spin} from 'antd';
import {ClickParam} from 'antd/lib/menu';
import {UnControlled as CodeMirror} from 'react-codemirror2';
import {Editor, EditorChange} from 'codemirror';

Expand Down Expand Up @@ -211,8 +210,8 @@ export class TextEditorPane extends React.PureComponent<Props, State> {
}
};

onReloadClick = (e: ClickParam) => {
this.loadData(e.key);
onReloadClick = (e: {key: React.Key}) => {
this.loadData(e.key as string);
};

onApply = () => {
Expand Down
22 changes: 18 additions & 4 deletions src/editor/popup/ShowModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,38 @@ import * as ReactDOM from 'react-dom';

let key = 0;
let div: HTMLDivElement;
let lastOverrideFunction: (modal: React.ReactElement) => void;
function getDiv() {
if (!div) {
div = document.createElement('div');
}
return div;
}

export function showModal(component: React.ReactElement, override: (modal: React.ReactElement) => void) {
export function showModal(component: React.ReactElement, overrideFunction: (modal: React.ReactElement) => void) {
if (component) {
// rotate the key
key = (key + 1) % 4;
key = (key + 1) % Number.MAX_SAFE_INTEGER;
React.cloneElement(component, {key: `modal-${key}`});
}

if (override) {
override(component);
if (overrideFunction !== lastOverrideFunction) {
if (lastOverrideFunction) {
lastOverrideFunction(null);
} else if (div) {
ReactDOM.unmountComponentAtNode(div);
div = null;
}
}

if (overrideFunction) {
overrideFunction(component);
} else if (component) {
ReactDOM.render(component, getDiv());
} else if (div) {
ReactDOM.unmountComponentAtNode(div);
} else if (lastOverrideFunction) {
lastOverrideFunction(null);
}
lastOverrideFunction = overrideFunction;
}
67 changes: 17 additions & 50 deletions src/editor/property/PropertyEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,24 @@ import {
getOutputDesc,
ValueState,
ValueUpdate,
blankPropDesc,
FunctionDesc,
getDefaultFuncData,
PropDesc,
PropGroupDesc,
arrayEqual,
deepEqual,
stopPropagation,
getTailingNumber,
Logger,
ValueSubscriber,
DataMap,
isBindable,
getSubBlockFuncData,
blankFuncDesc,
} from '../../../src/core/editor';
import {MultiSelectComponent, MultiSelectLoader} from './MultiSelectComponent';
import {StringEditor} from './value/StringEditor';
import {SelectEditor, MultiSelectEditor} from './value/SelectEditor';
import {RadioButtonEditor} from './value/RadioButtonEditor';
import {DragDropDiv, DragState} from 'rc-dock';
import {PasswordEditor} from './value/PasswordEditor';
import {ExpandIcon} from '../component/Tree';
import {PropertyList} from './PropertyList';
import {FunctionEditor} from './value/FunctionEditor';
import {FunctionSelect} from '../function-selector/FunctionSelector';
import {CheckboxChangeEvent} from 'antd/lib/checkbox';
import {AddCustomPropertyMenu} from './AddCustomProperty';
import {Popup, Menu, SubMenuItem} from '../component/ClickPopup';
import {ServiceEditor} from './value/ServiceEditor';
import {WorkerEditor} from './value/WorkerEditor';
import {DynamicEditor, dynamicEditorMap} from './value/DynamicEditor';
import {ReadonlyEditor} from './value/ReadonlyEditor';
import {ComboEditor} from './value/ComboEditor';
import {LocalizedPropertyName, t} from '../component/LocalizedLabel';
import {PropertyDropdown} from '../popup/PropertyDropdown';

const typeEditorMap: {[key: string]: any} = {
...dynamicEditorMap,
'select': SelectEditor,
'multi-select': MultiSelectEditor,
'combo-box': ComboEditor,
'password': PasswordEditor,
'radio-button': RadioButtonEditor,
'type': FunctionEditor,
'worker': WorkerEditor,
'none': ReadonlyEditor,
'any': DynamicEditor,
};
import {typeEditorMap} from './value';

class PropertyLoader extends MultiSelectLoader<PropertyEditor> {
name: string;
Expand Down Expand Up @@ -456,25 +425,23 @@ export class PropertyEditor extends MultiSelectComponent<PropertyEditorProps, St
if (!EditorClass) {
EditorClass = ReadonlyEditor;
}
if (EditorClass) {
let editorValue = value;
if (value === undefined && propDesc.default != null) {
editorValue = propDesc.default;
}
editor = (
<EditorClass
conn={conn}
keys={paths}
value={editorValue}
funcDesc={funcDesc}
desc={propDesc}
name={name}
locked={locked && !unlocked}
onChange={onChange}
addSubBlock={this.onAddSubBlock}
/>
);
let editorValue = value;
if (value === undefined && propDesc.default != null) {
editorValue = propDesc.default;
}
editor = (
<EditorClass
conn={conn}
keys={paths}
value={editorValue}
funcDesc={funcDesc}
desc={propDesc}
name={name}
locked={locked && !unlocked}
onChange={onChange}
addSubBlock={this.onAddSubBlock}
/>
);
}

let nameClass = `ticl-property-name${propDesc.readonly ? ' ticl-property-readonly' : ''}${
Expand Down
3 changes: 1 addition & 2 deletions src/editor/property/value/DynamicEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {ToggleEditor} from './ToggleEditor';
import {ColorEditor} from './ColorEditor';
import {DateEditor} from './DateEditor';
import {DateRangeEditor} from './DateRangeEditor';
import {ClickParam} from 'antd/lib/menu';
import {ReadonlyEditor} from './ReadonlyEditor';
import {ObjectEditor} from './ObjectEditor';
import {SelectEditor} from './SelectEditor';
Expand Down Expand Up @@ -102,7 +101,7 @@ export class DynamicEditor extends React.PureComponent<ValueEditorProps, State>
onChange(value);
};

onMenuClick = (param: ClickParam) => {
onMenuClick = (param: {key: React.Key}) => {
this.setState({currentType: param.key as ValueType});
};

Expand Down
21 changes: 21 additions & 0 deletions src/editor/property/value/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {DynamicEditor, dynamicEditorMap} from './DynamicEditor';
import {MultiSelectEditor, SelectEditor} from './SelectEditor';
import {ComboEditor} from './ComboEditor';
import {PasswordEditor} from './PasswordEditor';
import {RadioButtonEditor} from './RadioButtonEditor';
import {FunctionEditor} from './FunctionEditor';
import {WorkerEditor} from './WorkerEditor';
import {ReadonlyEditor} from './ReadonlyEditor';

export const typeEditorMap: {[key: string]: any} = {
...dynamicEditorMap,
'select': SelectEditor,
'multi-select': MultiSelectEditor,
'combo-box': ComboEditor,
'password': PasswordEditor,
'radio-button': RadioButtonEditor,
'type': FunctionEditor,
'worker': WorkerEditor,
'none': ReadonlyEditor,
'any': DynamicEditor,
};
Loading

0 comments on commit 6a1c38c

Please sign in to comment.