amis 1.3.5-beta.6 → 1.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/Schema.d.ts +17 -0
- package/lib/Schema.js.map +1 -1
- package/lib/components/Alert.js +3 -1
- package/lib/components/Alert.js.map +2 -2
- package/lib/components/Badge.d.ts +16 -3
- package/lib/components/Badge.js +53 -4
- package/lib/components/Badge.js.map +2 -2
- package/lib/components/Button.d.ts +24 -22
- package/lib/components/Button.js +13 -7
- package/lib/components/Button.js.map +2 -2
- package/lib/components/Checkbox.d.ts +1 -1
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/Collapse.js +1 -1
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/DatePicker.js +1 -1
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.js +1 -1
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Drawer.js +1 -1
- package/lib/components/Drawer.js.map +2 -2
- package/lib/components/InputBox.js +1 -1
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/Link.d.ts +91 -0
- package/lib/components/Link.js +44 -0
- package/lib/components/Link.js.map +13 -0
- package/lib/components/Modal.js +1 -1
- package/lib/components/Modal.js.map +2 -2
- package/lib/components/MonthRangePicker.js +1 -1
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/RichText.d.ts +6 -1
- package/lib/components/RichText.js +207 -8
- package/lib/components/RichText.js.map +2 -2
- package/lib/components/Select.d.ts +7 -0
- package/lib/components/Select.js +3 -0
- package/lib/components/Select.js.map +2 -2
- package/lib/components/SparkLine.d.ts +85 -84
- package/lib/components/SparkLine.js +2 -2
- package/lib/components/SparkLine.js.map +2 -2
- package/lib/components/Steps.d.ts +3 -3
- package/lib/components/Steps.js.map +1 -1
- package/lib/components/Toast.js +2 -2
- package/lib/components/Toast.js.map +2 -2
- package/lib/components/Tree.js +5 -3
- package/lib/components/Tree.js.map +2 -2
- package/lib/components/WithRemoteConfig.d.ts +8 -0
- package/lib/components/WithRemoteConfig.js +28 -2
- package/lib/components/WithRemoteConfig.js.map +2 -2
- package/lib/components/calendar/DaysView.js +2 -2
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/condition-builder/Field.js +0 -1
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Value.js +2 -1
- package/lib/components/condition-builder/Value.js.map +2 -2
- package/lib/components/condition-builder/types.d.ts +5 -0
- package/lib/components/condition-builder/types.js.map +1 -1
- package/lib/components/icons.js +14 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/factory.d.ts +5 -1
- package/lib/factory.js +9 -4
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/icons/clock.js +10 -0
- package/lib/icons/loading-outline.js +7 -0
- package/lib/icons/status-close.js +11 -0
- package/lib/icons/status-fail.js +11 -0
- package/lib/icons/status-info.js +10 -0
- package/lib/icons/status-success.js +11 -0
- package/lib/icons/status-warning.js +10 -0
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +3 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +4 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +5 -2
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +16 -1
- package/lib/renderers/Action.js +5 -5
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/CRUD.d.ts +2 -2
- package/lib/renderers/CRUD.js +32 -26
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Collapse.d.ts +1 -1
- package/lib/renderers/Collapse.js +7 -3
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/Dialog.d.ts +0 -252
- package/lib/renderers/Dialog.js +1 -4
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/Drawer.js +0 -3
- package/lib/renderers/Drawer.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +13 -1
- package/lib/renderers/DropDownButton.js +9 -5
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/ButtonGroupSelect.js +3 -0
- package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
- package/lib/renderers/Form/Checkbox.d.ts +5 -0
- package/lib/renderers/Form/Checkbox.js +4 -0
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Combo.js +2 -2
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +0 -2
- package/lib/renderers/Form/Editor.d.ts +0 -2
- package/lib/renderers/Form/Editor.js +1 -1
- package/lib/renderers/Form/Editor.js.map +2 -2
- package/lib/renderers/Form/InputExcel.d.ts +5 -0
- package/lib/renderers/Form/InputExcel.js +24 -3
- package/lib/renderers/Form/InputExcel.js.map +2 -2
- package/lib/renderers/Form/InputFile.js +2 -2
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputImage.d.ts +8 -0
- package/lib/renderers/Form/InputImage.js +7 -4
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/InputTable.d.ts +23 -5
- package/lib/renderers/Form/InputTable.js +32 -3
- package/lib/renderers/Form/InputTable.js.map +2 -2
- package/lib/renderers/Form/Options.js +6 -3
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Picker.js +2 -2
- package/lib/renderers/Form/Picker.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +2 -2
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/IFrame.js +2 -2
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Image.d.ts +1 -0
- package/lib/renderers/Image.js +15 -1
- package/lib/renderers/Image.js.map +2 -2
- package/lib/renderers/Json.js +5 -1
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Link.d.ts +16 -3
- package/lib/renderers/Link.js +16 -13
- package/lib/renderers/Link.js.map +2 -2
- package/lib/renderers/Log.d.ts +2 -2
- package/lib/renderers/Log.js +7 -1
- package/lib/renderers/Log.js.map +2 -2
- package/lib/renderers/Nav.d.ts +81 -25
- package/lib/renderers/Nav.js +272 -29
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +4 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Service.d.ts +10 -1
- package/lib/renderers/Service.js +85 -3
- package/lib/renderers/Service.js.map +2 -2
- package/lib/renderers/SparkLine.d.ts +4 -0
- package/lib/renderers/SparkLine.js.map +2 -2
- package/lib/renderers/Steps.d.ts +4 -4
- package/lib/renderers/Steps.js +5 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/ColumnToggler.d.ts +113 -0
- package/lib/renderers/Table/ColumnToggler.js +216 -0
- package/lib/renderers/Table/ColumnToggler.js.map +13 -0
- package/lib/renderers/Table/ItemActionsWrapper.d.ts +11 -0
- package/lib/renderers/Table/ItemActionsWrapper.js +31 -0
- package/lib/renderers/Table/ItemActionsWrapper.js.map +13 -0
- package/lib/renderers/Table/TableBody.d.ts +5 -1
- package/lib/renderers/Table/TableBody.js +5 -1
- package/lib/renderers/Table/TableBody.js.map +2 -2
- package/lib/renderers/Table/TableCell.js +3 -1
- package/lib/renderers/Table/TableCell.js.map +2 -2
- package/lib/renderers/Table/TableContent.d.ts +1 -1
- package/lib/renderers/Table/TableContent.js +4 -0
- package/lib/renderers/Table/TableContent.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +22 -4
- package/lib/renderers/Table/index.js +196 -81
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/store/app.d.ts +0 -1
- package/lib/store/combo.d.ts +0 -2
- package/lib/store/crud.d.ts +3 -3
- package/lib/store/crud.js +41 -36
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +0 -1
- package/lib/store/modal.d.ts +1 -1
- package/lib/store/modal.js +4 -0
- package/lib/store/modal.js.map +2 -2
- package/lib/store/root.d.ts +0 -1
- package/lib/store/service.d.ts +0 -1
- package/lib/store/service.js +0 -13
- package/lib/store/service.js.map +2 -2
- package/lib/store/table.d.ts +258 -3
- package/lib/store/table.js +83 -7
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +941 -98
- package/lib/themes/ang.css +941 -98
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +941 -98
- package/lib/themes/antd.css +941 -98
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1580 -411
- package/lib/themes/cxd.css +1580 -411
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +941 -98
- package/lib/themes/dark.css +941 -98
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +1580 -411
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +16 -4
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/attachmentAdpator.d.ts +7 -0
- package/lib/utils/attachmentAdpator.js +82 -0
- package/lib/utils/attachmentAdpator.js.map +13 -0
- package/lib/utils/handleAction.d.ts +7 -0
- package/lib/utils/handleAction.js +30 -0
- package/lib/utils/handleAction.js.map +13 -0
- package/lib/utils/helper.d.ts +1 -1
- package/lib/utils/helper.js +3 -3
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/tpl-builtin.d.ts +1 -1
- package/lib/utils/tpl-builtin.js +25 -15
- package/lib/utils/tpl-builtin.js.map +2 -2
- package/lib/utils/validations.js +62 -5
- package/lib/utils/validations.js.map +2 -2
- package/package.json +1 -2
- package/schema.json +633 -273
- package/scss/_mixins.scss +29 -0
- package/scss/_properties.scss +64 -13
- package/scss/_utilities.scss +4 -0
- package/scss/components/_badge.scss +67 -2
- package/scss/components/_button.scss +34 -3
- package/scss/components/_collapse.scss +26 -8
- package/scss/components/_column-toggler.scss +234 -0
- package/scss/components/_dropdown.scss +2 -1
- package/scss/components/_image-gallery.scss +1 -1
- package/scss/components/_images.scss +2 -1
- package/scss/components/_link.scss +6 -0
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_nav.scss +236 -154
- package/scss/components/_page.scss +5 -4
- package/scss/components/_progress.scss +2 -0
- package/scss/components/_spinner.scss +6 -2
- package/scss/components/_steps.scss +1 -1
- package/scss/components/_table.scss +25 -1
- package/scss/components/form/_color.scss +1 -0
- package/scss/components/form/_date-range.scss +2 -0
- package/scss/components/form/_date.scss +2 -0
- package/scss/components/form/_fieldset.scss +1 -2
- package/scss/components/form/_file.scss +5 -4
- package/scss/components/form/_group.scss +4 -0
- package/scss/components/form/_image.scss +7 -2
- package/scss/components/form/_list.scss +1 -0
- package/scss/components/form/_location.scss +1 -1
- package/scss/components/form/_text.scss +13 -0
- package/scss/components/form/_textarea.scss +10 -0
- package/scss/components/form/_transfer.scss +2 -0
- package/scss/themes/_common.scss +3 -0
- package/scss/themes/_cxd-colors.scss +56 -0
- package/scss/themes/_cxd-variables.scss +217 -92
- package/scss/themes/cxd.scss +366 -0
- package/sdk/ang-ie11.css +1192 -176
- package/sdk/ang.css +1175 -118
- package/sdk/antd-ie11.css +1177 -163
- package/sdk/antd.css +1175 -118
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +67 -67
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +2538 -1222
- package/sdk/cxd.css +1825 -401
- package/sdk/dark-ie11.css +1192 -176
- package/sdk/dark.css +1175 -118
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/ie11-patch.css +1 -0
- package/sdk/locale/de-DE.js +3 -0
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +22 -24
- package/sdk/rich-text.js +62 -64
- package/sdk/sdk-ie11.css +2538 -1222
- package/sdk/sdk.css +1825 -401
- package/sdk/sdk.js +1139 -1113
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/Schema.ts +18 -0
- package/src/components/Alert.tsx +3 -1
- package/src/components/Badge.tsx +124 -21
- package/src/components/Button.tsx +23 -7
- package/src/components/Checkbox.tsx +5 -2
- package/src/components/Collapse.tsx +14 -9
- package/src/components/DatePicker.tsx +1 -1
- package/src/components/DateRangePicker.tsx +23 -11
- package/src/components/Drawer.tsx +3 -2
- package/src/components/InputBox.tsx +1 -1
- package/src/components/Link.tsx +94 -0
- package/src/components/Modal.tsx +3 -2
- package/src/components/MonthRangePicker.tsx +10 -2
- package/src/components/RichText.tsx +244 -3
- package/src/components/Select.tsx +4 -0
- package/src/components/SparkLine.tsx +4 -1
- package/src/components/Steps.tsx +3 -3
- package/src/components/Toast.tsx +5 -5
- package/src/components/Tree.tsx +6 -8
- package/src/components/WithRemoteConfig.tsx +37 -2
- package/src/components/calendar/DaysView.tsx +2 -2
- package/src/components/condition-builder/Field.tsx +1 -2
- package/src/components/condition-builder/Value.tsx +3 -0
- package/src/components/condition-builder/types.ts +6 -0
- package/src/components/icons.tsx +15 -0
- package/src/factory.tsx +13 -3
- package/src/icons/clock.svg +1 -0
- package/src/icons/loading-outline.svg +4 -0
- package/src/icons/status-close.svg +10 -0
- package/src/icons/status-fail.svg +10 -0
- package/src/icons/status-info.svg +8 -0
- package/src/icons/status-success.svg +10 -0
- package/src/icons/status-warning.svg +8 -0
- package/src/locale/de-DE.ts +3 -0
- package/src/locale/en-US.ts +4 -1
- package/src/locale/zh-CN.ts +5 -2
- package/src/renderers/Action.tsx +71 -13
- package/src/renderers/CRUD.tsx +44 -59
- package/src/renderers/Collapse.tsx +6 -2
- package/src/renderers/Dialog.tsx +1 -5
- package/src/renderers/Drawer.tsx +0 -4
- package/src/renderers/DropDownButton.tsx +34 -12
- package/src/renderers/Form/ButtonGroupSelect.tsx +3 -0
- package/src/renderers/Form/Checkbox.tsx +8 -0
- package/src/renderers/Form/Combo.tsx +2 -3
- package/src/renderers/Form/Editor.tsx +19 -20
- package/src/renderers/Form/InputExcel.tsx +28 -3
- package/src/renderers/Form/InputFile.tsx +2 -1
- package/src/renderers/Form/InputImage.tsx +28 -10
- package/src/renderers/Form/InputTable.tsx +88 -9
- package/src/renderers/Form/Options.tsx +16 -5
- package/src/renderers/Form/Picker.tsx +3 -2
- package/src/renderers/Form/wrapControl.tsx +2 -2
- package/src/renderers/IFrame.tsx +2 -1
- package/src/renderers/Image.tsx +10 -0
- package/src/renderers/Json.tsx +10 -1
- package/src/renderers/Link.tsx +36 -11
- package/src/renderers/Log.tsx +16 -3
- package/src/renderers/Nav.tsx +340 -56
- package/src/renderers/Page.tsx +3 -1
- package/src/renderers/Service.tsx +101 -3
- package/src/renderers/SparkLine.tsx +5 -0
- package/src/renderers/Steps.tsx +12 -9
- package/src/renderers/Table/ColumnToggler.tsx +544 -0
- package/src/renderers/Table/ItemActionsWrapper.tsx +44 -0
- package/src/renderers/Table/TableBody.tsx +3 -2
- package/src/renderers/Table/TableCell.tsx +16 -1
- package/src/renderers/Table/TableContent.tsx +3 -1
- package/src/renderers/Table/index.tsx +240 -60
- package/src/store/crud.ts +34 -38
- package/src/store/modal.ts +4 -0
- package/src/store/service.ts +0 -19
- package/src/store/table.ts +103 -4
- package/src/utils/api.ts +24 -4
- package/src/utils/attachmentAdpator.ts +90 -0
- package/src/utils/handleAction.ts +41 -0
- package/src/utils/helper.ts +4 -3
- package/src/utils/tpl-builtin.ts +48 -17
- package/src/utils/validations.ts +80 -12
@@ -7,7 +7,7 @@
|
|
7
7
|
import React from 'react';
|
8
8
|
|
9
9
|
// @ts-ignore
|
10
|
-
import
|
10
|
+
import FroalaEditor from 'froala-editor';
|
11
11
|
// @ts-ignore
|
12
12
|
import Froala from 'froala-editor/js/froala_editor.min.js';
|
13
13
|
import 'froala-editor/js/plugins/align.min';
|
@@ -45,7 +45,249 @@ import 'froala-editor/js/languages/zh_cn.js';
|
|
45
45
|
import 'froala-editor/css/froala_style.min.css';
|
46
46
|
import 'froala-editor/css/froala_editor.pkgd.min.css';
|
47
47
|
|
48
|
-
export
|
48
|
+
export interface FroalaEditorComponentProps {
|
49
|
+
config: any;
|
50
|
+
model: string;
|
51
|
+
onModelChange: (value: string) => void;
|
52
|
+
}
|
53
|
+
|
54
|
+
// 代码来源于:https://github.com/froala/react-froala-wysiwyg/blob/master/lib/FroalaEditorFunctionality.jsx
|
55
|
+
// 改动原因是model 同步有些问题,有时候不更新,所以基于官方代码改造一下。
|
56
|
+
// 目前发现的问题是,如果 model 数据修改,如果此时 editor 还没有初始化完成则不会同步成功
|
57
|
+
class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps> {
|
58
|
+
listeningEvents: any;
|
59
|
+
element: any;
|
60
|
+
editor: any;
|
61
|
+
config: any;
|
62
|
+
editorInitialized: any;
|
63
|
+
INNER_HTML_ATTR: any;
|
64
|
+
oldModel: any;
|
65
|
+
el: any;
|
66
|
+
_initEvents: any;
|
67
|
+
|
68
|
+
constructor(props: FroalaEditorComponentProps) {
|
69
|
+
super(props);
|
70
|
+
|
71
|
+
this.listeningEvents = [];
|
72
|
+
this.element = null;
|
73
|
+
this.editor = null;
|
74
|
+
this.config = {
|
75
|
+
immediateReactModelUpdate: false,
|
76
|
+
reactIgnoreAttrs: null
|
77
|
+
};
|
78
|
+
|
79
|
+
this.editorInitialized = false;
|
80
|
+
this.INNER_HTML_ATTR = 'innerHTML';
|
81
|
+
|
82
|
+
this.oldModel = null;
|
83
|
+
}
|
84
|
+
|
85
|
+
// After first time render.
|
86
|
+
componentDidMount() {
|
87
|
+
this.createEditor();
|
88
|
+
}
|
89
|
+
|
90
|
+
componentWillUnmount() {
|
91
|
+
this.destroyEditor();
|
92
|
+
}
|
93
|
+
|
94
|
+
componentDidUpdate() {
|
95
|
+
if (JSON.stringify(this.oldModel) == JSON.stringify(this.props.model)) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
|
99
|
+
this.setContent();
|
100
|
+
}
|
101
|
+
|
102
|
+
// Return cloned object
|
103
|
+
clone(item: any) {
|
104
|
+
const me = this;
|
105
|
+
if (!item) {
|
106
|
+
return item;
|
107
|
+
} // null, undefined values check
|
108
|
+
|
109
|
+
let types = [Number, String, Boolean],
|
110
|
+
result: any;
|
111
|
+
|
112
|
+
// normalizing primitives if someone did new String('aaa'), or new Number('444');
|
113
|
+
types.forEach(function (type) {
|
114
|
+
if (item instanceof type) {
|
115
|
+
result = type(item);
|
116
|
+
}
|
117
|
+
});
|
118
|
+
|
119
|
+
if (typeof result == 'undefined') {
|
120
|
+
if (Object.prototype.toString.call(item) === '[object Array]') {
|
121
|
+
result = [];
|
122
|
+
item.forEach(function (child: any, index: number, array: Array<any>) {
|
123
|
+
result[index] = me.clone(child);
|
124
|
+
});
|
125
|
+
} else if (typeof item == 'object') {
|
126
|
+
// testing that this is DOM
|
127
|
+
if (item.nodeType && typeof item.cloneNode == 'function') {
|
128
|
+
result = item.cloneNode(true);
|
129
|
+
} else if (!item.prototype) {
|
130
|
+
// check that this is a literal
|
131
|
+
if (item instanceof Date) {
|
132
|
+
result = new Date(item);
|
133
|
+
} else {
|
134
|
+
// it is an object literal
|
135
|
+
result = {};
|
136
|
+
for (var i in item) {
|
137
|
+
result[i] = me.clone(item[i]);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
} else {
|
141
|
+
if (false && item.constructor) {
|
142
|
+
result = new item.constructor();
|
143
|
+
} else {
|
144
|
+
result = item;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
} else {
|
148
|
+
result = item;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
return result;
|
152
|
+
}
|
153
|
+
|
154
|
+
createEditor() {
|
155
|
+
if (this.editorInitialized) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
|
159
|
+
this.config = this.clone(this.props.config || this.config);
|
160
|
+
this.config = {...this.config};
|
161
|
+
|
162
|
+
this.element = this.el;
|
163
|
+
|
164
|
+
if (this.props.model) {
|
165
|
+
this.element.innerHTML = this.props.model;
|
166
|
+
}
|
167
|
+
|
168
|
+
this.setContent();
|
169
|
+
|
170
|
+
// Default initialized.
|
171
|
+
this.registerEvent(
|
172
|
+
'initialized',
|
173
|
+
this.config.events && this.config.events.initialized
|
174
|
+
);
|
175
|
+
|
176
|
+
// Check if events are set.
|
177
|
+
if (!this.config.events) this.config.events = {};
|
178
|
+
this.config.events.initialized = () => {
|
179
|
+
this.editorInitialized = true;
|
180
|
+
this.initListeners();
|
181
|
+
};
|
182
|
+
|
183
|
+
this.editor = new FroalaEditor(this.element, this.config);
|
184
|
+
}
|
185
|
+
|
186
|
+
setContent() {
|
187
|
+
if (this.props.model || this.props.model == '') {
|
188
|
+
this.oldModel = this.props.model;
|
189
|
+
|
190
|
+
if (this.editorInitialized) {
|
191
|
+
this.setNormalTagContent();
|
192
|
+
} else {
|
193
|
+
if (!this._initEvents) this._initEvents = [];
|
194
|
+
this._initEvents.push(() => this.setNormalTagContent());
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
setNormalTagContent() {
|
200
|
+
let self = this;
|
201
|
+
|
202
|
+
self.editor.html && self.editor.html.set(self.props.model || '');
|
203
|
+
if (self.editorInitialized && self.editor.undo) {
|
204
|
+
//This will reset the undo stack everytime the model changes externally. Can we fix this?
|
205
|
+
self.editor.undo.reset();
|
206
|
+
self.editor.undo.saveStep();
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
destroyEditor() {
|
211
|
+
if (this.element) {
|
212
|
+
this.editor.destroy && this.editor.destroy();
|
213
|
+
this.listeningEvents.length = 0;
|
214
|
+
this.element = null;
|
215
|
+
this.editorInitialized = false;
|
216
|
+
this._initEvents = [];
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
getEditor() {
|
221
|
+
if (this.element) {
|
222
|
+
return this.editor;
|
223
|
+
}
|
224
|
+
|
225
|
+
return null;
|
226
|
+
}
|
227
|
+
|
228
|
+
updateModel() {
|
229
|
+
if (!this.props.onModelChange) {
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
|
233
|
+
let modelContent = '';
|
234
|
+
|
235
|
+
let returnedHtml = this.editor.html.get();
|
236
|
+
if (typeof returnedHtml === 'string') {
|
237
|
+
modelContent = returnedHtml;
|
238
|
+
}
|
239
|
+
|
240
|
+
this.oldModel = modelContent;
|
241
|
+
this.props.onModelChange(modelContent);
|
242
|
+
}
|
243
|
+
|
244
|
+
initListeners() {
|
245
|
+
let self = this;
|
246
|
+
|
247
|
+
// bind contentChange and keyup event to froalaModel
|
248
|
+
this.editor.events.on('contentChanged', function () {
|
249
|
+
self.updateModel();
|
250
|
+
});
|
251
|
+
if (this.config.immediateReactModelUpdate) {
|
252
|
+
this.editor.events.on('keyup', function () {
|
253
|
+
self.updateModel();
|
254
|
+
});
|
255
|
+
}
|
256
|
+
|
257
|
+
// Call init events.
|
258
|
+
if (this._initEvents) {
|
259
|
+
for (let i = 0; i < this._initEvents.length; i++) {
|
260
|
+
this._initEvents[i].call(this.editor);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
// register event on jquery editor element
|
266
|
+
registerEvent(eventName: string, callback: Function) {
|
267
|
+
if (!eventName || !callback) {
|
268
|
+
return;
|
269
|
+
}
|
270
|
+
|
271
|
+
if (eventName == 'initialized') {
|
272
|
+
if (!this._initEvents) this._initEvents = [];
|
273
|
+
this._initEvents.push(callback);
|
274
|
+
} else {
|
275
|
+
if (!this.config.events) {
|
276
|
+
this.config.events = {};
|
277
|
+
}
|
278
|
+
|
279
|
+
this.config.events[eventName] = callback;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
render() {
|
284
|
+
return (
|
285
|
+
<textarea ref={el => (this.el = el)}>{this.props.children}</textarea>
|
286
|
+
);
|
287
|
+
}
|
288
|
+
}
|
289
|
+
|
290
|
+
export default class extends React.Component<any, any> {
|
49
291
|
constructor(props: any) {
|
50
292
|
super(props);
|
51
293
|
Froala.VIDEO_PROVIDERS = [
|
@@ -61,7 +303,6 @@ export default class FroalaEditor extends React.Component<any, any> {
|
|
61
303
|
render() {
|
62
304
|
return (
|
63
305
|
<FroalaEditorComponent
|
64
|
-
tag="textarea"
|
65
306
|
config={this.props.config}
|
66
307
|
model={this.props.model}
|
67
308
|
onModelChange={this.props.onModelChange}
|
@@ -770,6 +770,9 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
770
770
|
// 渲染单个选项
|
771
771
|
const renderItem = ({index, style}: {index: number; style?: object}) => {
|
772
772
|
const item = filtedOptions[index];
|
773
|
+
if (!item) {
|
774
|
+
return null;
|
775
|
+
}
|
773
776
|
const checked =
|
774
777
|
selectedItem === item || !!~selectionValues.indexOf(item[valueField]);
|
775
778
|
if (hideSelected && checked) {
|
@@ -1107,6 +1110,7 @@ export const SelectWithRemoteOptions = withRemoteConfig<Array<Options>>({
|
|
1107
1110
|
> {
|
1108
1111
|
render() {
|
1109
1112
|
const {loading, config, deferLoad, updateConfig, ...rest} = this.props;
|
1113
|
+
|
1110
1114
|
return (
|
1111
1115
|
<EnhancedSelect
|
1112
1116
|
{...rest}
|
@@ -14,6 +14,7 @@ export interface SparkLineProps extends ThemeProps, LocaleProps {
|
|
14
14
|
label?: string;
|
15
15
|
}
|
16
16
|
>;
|
17
|
+
placeholder?: string;
|
17
18
|
onClick?: (e: React.MouseEvent, value?: PlainObject) => void;
|
18
19
|
}
|
19
20
|
|
@@ -76,6 +77,8 @@ export class SparkLine extends React.Component<SparkLineProps> {
|
|
76
77
|
value,
|
77
78
|
width,
|
78
79
|
height,
|
80
|
+
placeholder,
|
81
|
+
translate: __,
|
79
82
|
onClick
|
80
83
|
} = this.props;
|
81
84
|
|
@@ -98,7 +101,7 @@ export class SparkLine extends React.Component<SparkLineProps> {
|
|
98
101
|
{this.renderLines()}
|
99
102
|
</svg>
|
100
103
|
) : (
|
101
|
-
|
104
|
+
placeholder ?? __('placeholder.empty')
|
102
105
|
)}
|
103
106
|
</div>
|
104
107
|
);
|
package/src/components/Steps.tsx
CHANGED
@@ -14,12 +14,12 @@ export type StepSchema = {
|
|
14
14
|
/**
|
15
15
|
* 标题
|
16
16
|
*/
|
17
|
-
title
|
17
|
+
title?: string | JSX.Element;
|
18
18
|
|
19
19
|
/**
|
20
20
|
* 子标题
|
21
21
|
*/
|
22
|
-
subTitle?: string;
|
22
|
+
subTitle?: string | JSX.Element;
|
23
23
|
|
24
24
|
/**
|
25
25
|
* 图标
|
@@ -31,7 +31,7 @@ export type StepSchema = {
|
|
31
31
|
/**
|
32
32
|
* 描述
|
33
33
|
*/
|
34
|
-
description?: string;
|
34
|
+
description?: string | JSX.Element;
|
35
35
|
|
36
36
|
status?: StepStatus;
|
37
37
|
} & Omit<BaseSchema, 'type'>;
|
package/src/components/Toast.tsx
CHANGED
@@ -311,13 +311,13 @@ export class ToastMessage extends React.Component<
|
|
311
311
|
{showIcon === false ? null : (
|
312
312
|
<div className={cx('Toast-icon')}>
|
313
313
|
{level === 'success' ? (
|
314
|
-
<Icon icon="success" className="icon" />
|
314
|
+
<Icon icon="status-success" className="icon" />
|
315
315
|
) : level == 'error' ? (
|
316
|
-
<Icon icon="fail" className="icon" />
|
316
|
+
<Icon icon="status-fail" className="icon" />
|
317
317
|
) : level == 'info' ? (
|
318
|
-
<Icon icon="info
|
318
|
+
<Icon icon="status-info" className="icon" />
|
319
319
|
) : level == 'warning' ? (
|
320
|
-
<Icon icon="warning" className="icon" />
|
320
|
+
<Icon icon="status-warning" className="icon" />
|
321
321
|
) : null}
|
322
322
|
</div>
|
323
323
|
)}
|
@@ -327,7 +327,7 @@ export class ToastMessage extends React.Component<
|
|
327
327
|
|
328
328
|
{closeButton ? (
|
329
329
|
<a onClick={this.close} className={cx(`Toast-close`)}>
|
330
|
-
<Icon icon="close" className="icon" />
|
330
|
+
<Icon icon="status-close" className="icon" />
|
331
331
|
</a>
|
332
332
|
) : null}
|
333
333
|
</div>
|
package/src/components/Tree.tsx
CHANGED
@@ -19,7 +19,7 @@ import {
|
|
19
19
|
import {Option, Options, value2array} from './Select';
|
20
20
|
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
21
21
|
import {highlight} from '../renderers/Form/Options';
|
22
|
-
import {Icon} from './icons';
|
22
|
+
import {Icon, getIcon} from './icons';
|
23
23
|
import Checkbox from './Checkbox';
|
24
24
|
import {LocaleProps, localeable} from '../locale';
|
25
25
|
import Spinner from './Spinner';
|
@@ -710,6 +710,8 @@ export class TreeSelector extends React.Component<
|
|
710
710
|
const isLeaf =
|
711
711
|
(!item.children || !item.children.length) && !item.placeholder;
|
712
712
|
|
713
|
+
const iconValue = item[iconField] || (childrenItems ? 'folder' : 'file');
|
714
|
+
|
713
715
|
return (
|
714
716
|
<li
|
715
717
|
key={key}
|
@@ -754,7 +756,6 @@ export class TreeSelector extends React.Component<
|
|
754
756
|
<i
|
755
757
|
className={cx(
|
756
758
|
`Tree-itemIcon ${
|
757
|
-
item[iconField] ||
|
758
759
|
(childrenItems ? 'Tree-folderIcon' : 'Tree-leafIcon')
|
759
760
|
}`
|
760
761
|
)}
|
@@ -765,12 +766,9 @@ export class TreeSelector extends React.Component<
|
|
765
766
|
: this.handleSelect(item))
|
766
767
|
}
|
767
768
|
>
|
768
|
-
{
|
769
|
-
<Icon
|
770
|
-
|
771
|
-
className="icon"
|
772
|
-
/>
|
773
|
-
)}
|
769
|
+
{getIcon(iconValue)
|
770
|
+
? <Icon icon={iconValue} className="icon"/>
|
771
|
+
: <i className={iconValue}></i>}
|
774
772
|
</i>
|
775
773
|
) : null}
|
776
774
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
import React from 'react';
|
6
6
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
7
|
+
import debounce from 'lodash/debounce';
|
7
8
|
import {Api, Payload} from '../types';
|
8
9
|
import {SchemaApi, SchemaTokenizeableString} from '../Schema';
|
9
10
|
import {withStore} from './WithStore';
|
@@ -97,6 +98,7 @@ export interface OutterProps {
|
|
97
98
|
env?: RendererEnv;
|
98
99
|
data: any;
|
99
100
|
source?: SchemaApi | SchemaTokenizeableString;
|
101
|
+
autoComplete?: SchemaApi | SchemaTokenizeableString;
|
100
102
|
deferApi?: SchemaApi;
|
101
103
|
remoteConfigRef?: (
|
102
104
|
instance:
|
@@ -182,10 +184,16 @@ export function withRemoteConfig<P = any>(
|
|
182
184
|
static displayName = `WithRemoteConfig(${
|
183
185
|
ComposedComponent.displayName || ComposedComponent.name
|
184
186
|
})`;
|
185
|
-
static ComposedComponent =
|
187
|
+
static ComposedComponent =
|
188
|
+
ComposedComponent as React.ComponentType<T>;
|
186
189
|
static contextType = EnvContext;
|
187
190
|
toDispose: Array<() => void> = [];
|
188
191
|
|
192
|
+
loadOptions = debounce(this.loadAutoComplete.bind(this), 250, {
|
193
|
+
trailing: true,
|
194
|
+
leading: false
|
195
|
+
});
|
196
|
+
|
189
197
|
constructor(
|
190
198
|
props: FinalOutterProps & {
|
191
199
|
store: IStore;
|
@@ -250,6 +258,7 @@ export function withRemoteConfig<P = any>(
|
|
250
258
|
this.toDispose = [];
|
251
259
|
|
252
260
|
this.props.remoteConfigRef?.(undefined);
|
261
|
+
this.loadOptions.cancel();
|
253
262
|
}
|
254
263
|
|
255
264
|
async loadConfig(ctx = this.props.data) {
|
@@ -261,6 +270,28 @@ export function withRemoteConfig<P = any>(
|
|
261
270
|
}
|
262
271
|
}
|
263
272
|
|
273
|
+
loadAutoComplete(input: string) {
|
274
|
+
const env: RendererEnv = this.props.env || this.context;
|
275
|
+
const {autoComplete, data, store} = this.props;
|
276
|
+
|
277
|
+
if (!env || !env.fetcher) {
|
278
|
+
throw new Error('fetcher is required');
|
279
|
+
}
|
280
|
+
|
281
|
+
const ctx = createObject(data, {
|
282
|
+
term: input,
|
283
|
+
value: input
|
284
|
+
});
|
285
|
+
|
286
|
+
if (!isEffectiveApi(autoComplete, ctx)) {
|
287
|
+
return Promise.resolve({
|
288
|
+
options: []
|
289
|
+
});
|
290
|
+
}
|
291
|
+
|
292
|
+
return store.load(env, autoComplete, ctx, config);
|
293
|
+
}
|
294
|
+
|
264
295
|
setConfig(value: any, ctx?: any) {
|
265
296
|
const {store} = this.props;
|
266
297
|
store.setConfig(value, config, ctx);
|
@@ -321,13 +352,14 @@ export function withRemoteConfig<P = any>(
|
|
321
352
|
|
322
353
|
render() {
|
323
354
|
const store = this.props.store;
|
355
|
+
const env: RendererEnv = this.props.env || this.context;
|
324
356
|
const injectedProps: RemoteOptionsProps<P> = {
|
325
357
|
config: store.config,
|
326
358
|
loading: store.fetching,
|
327
359
|
deferLoad: this.deferLoadConfig,
|
328
360
|
updateConfig: this.setConfig
|
329
361
|
};
|
330
|
-
const {remoteConfigRef, ...rest} = this.props;
|
362
|
+
const {remoteConfigRef, autoComplete, ...rest} = this.props;
|
331
363
|
|
332
364
|
return (
|
333
365
|
<ComposedComponent
|
@@ -335,6 +367,9 @@ export function withRemoteConfig<P = any>(
|
|
335
367
|
T,
|
336
368
|
React.ComponentProps<T>
|
337
369
|
>)}
|
370
|
+
{...(env && isEffectiveApi(autoComplete) && this.loadOptions
|
371
|
+
? {loadOptions: this.loadOptions}
|
372
|
+
: {})}
|
338
373
|
{...injectedProps}
|
339
374
|
/>
|
340
375
|
);
|
@@ -100,8 +100,8 @@ export class CustomDaysView extends DaysView {
|
|
100
100
|
confirm = () => {
|
101
101
|
let date = (this.props.selectedDate || this.props.viewDate).clone();
|
102
102
|
|
103
|
-
// 如果 minDate
|
104
|
-
if (this.props.minDate?.isValid() && this.props.minDate?.
|
103
|
+
// 如果 minDate 是可用的,且比当前日期晚,则用 minDate
|
104
|
+
if (this.props.minDate?.isValid() && this.props.minDate?.isAfter(date)) {
|
105
105
|
date = this.props.minDate.clone();
|
106
106
|
}
|
107
107
|
|
@@ -33,7 +33,6 @@ export class ConditionField extends React.Component<
|
|
33
33
|
options: props.options
|
34
34
|
};
|
35
35
|
this.onSearch = this.onSearch.bind(this);
|
36
|
-
this.onSearch = this.onSearch.bind(this);
|
37
36
|
}
|
38
37
|
|
39
38
|
onSearch(text: string) {
|
@@ -51,7 +50,7 @@ export class ConditionField extends React.Component<
|
|
51
50
|
});
|
52
51
|
return children.length > 0
|
53
52
|
? Object.assign({}, item, {children}) // 需要copy一份,防止覆盖原始数据
|
54
|
-
: false;
|
53
|
+
: false;
|
55
54
|
} else {
|
56
55
|
return item.name.toLowerCase().includes(txt) ||
|
57
56
|
item.label.toLowerCase().includes(txt)
|
@@ -92,11 +92,14 @@ export class Value extends React.Component<ValueProps> {
|
|
92
92
|
/>
|
93
93
|
);
|
94
94
|
} else if (field.type === 'select') {
|
95
|
+
const autoComplete = field.autoComplete;
|
96
|
+
|
95
97
|
input = (
|
96
98
|
<Select
|
97
99
|
simpleValue
|
98
100
|
options={field.options!}
|
99
101
|
source={field.source}
|
102
|
+
autoComplete={autoComplete}
|
100
103
|
searchable={field.searchable}
|
101
104
|
value={value ?? field.defaultValue ?? ''}
|
102
105
|
data={data}
|
@@ -145,6 +145,12 @@ interface SelectField extends BaseField {
|
|
145
145
|
options?: Array<any>;
|
146
146
|
source?: SchemaApi;
|
147
147
|
searchable?: boolean;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* 自动完成 API,当输入部分文字的时候,会将这些文字通过 ${term} 可以取到,发送给接口。
|
151
|
+
* 接口可以返回匹配到的选项,帮助用户输入。
|
152
|
+
*/
|
153
|
+
autoComplete?: SchemaApi;
|
148
154
|
}
|
149
155
|
|
150
156
|
interface BooleanField extends BaseField {
|
package/src/components/icons.tsx
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
import React from 'react';
|
7
7
|
|
8
8
|
import CloseIcon from '../icons/close.svg';
|
9
|
+
import StatusCloseIcon from '../icons/status-close.svg';
|
9
10
|
import UnDoIcon from '../icons/undo.svg';
|
10
11
|
import ReDoIcon from '../icons/redo.svg';
|
11
12
|
import EnterIcon from '../icons/enter.svg';
|
@@ -24,6 +25,10 @@ import RemoveIcon from '../icons/remove.svg';
|
|
24
25
|
import RetryIcon from '../icons/retry.svg';
|
25
26
|
import UploadIcon from '../icons/upload.svg';
|
26
27
|
import FileIcon from '../icons/file.svg';
|
28
|
+
import StatusSuccessIcon from '../icons/status-success.svg';
|
29
|
+
import StatusFailIcon from '../icons/status-fail.svg';
|
30
|
+
import StatusInfoIcon from '../icons/status-info.svg';
|
31
|
+
import StatusWarningIcon from '../icons/status-warning.svg';
|
27
32
|
import SuccessIcon from '../icons/success.svg';
|
28
33
|
import FailIcon from '../icons/fail.svg';
|
29
34
|
import SearchIcon from '../icons/search.svg';
|
@@ -36,6 +41,8 @@ import ReloadIcon from '../icons/reload.svg';
|
|
36
41
|
import ExchangeIcon from '../icons/exchange.svg';
|
37
42
|
import ColmunsIcon from '../icons/columns.svg';
|
38
43
|
import CalendarIcon from '../icons/calendar.svg';
|
44
|
+
import ClockIcon from '../icons/clock.svg';
|
45
|
+
|
39
46
|
import CopyIcon from '../icons/copy.svg';
|
40
47
|
import FilterIcon from '../icons/filter.svg';
|
41
48
|
import CaretIcon from '../icons/caret.svg';
|
@@ -61,6 +68,7 @@ import EllipsisVIcon from '../icons/ellipsis-v.svg';
|
|
61
68
|
import ExpandAltIcon from '../icons/expand-alt.svg';
|
62
69
|
import CompressAltIcon from '../icons/compress-alt.svg';
|
63
70
|
import TransparentIcon from '../icons/transparent.svg';
|
71
|
+
import LoadingOutline from '../icons/loading-outline.svg';
|
64
72
|
|
65
73
|
// 兼容原来的用法,后续不直接试用。
|
66
74
|
|
@@ -91,6 +99,7 @@ export function registerIcon(key: string, component: React.ReactType<{}>) {
|
|
91
99
|
}
|
92
100
|
|
93
101
|
registerIcon('close', CloseIcon);
|
102
|
+
registerIcon('status-close', StatusCloseIcon);
|
94
103
|
registerIcon('undo', UnDoIcon);
|
95
104
|
registerIcon('redo', ReDoIcon);
|
96
105
|
registerIcon('enter', EnterIcon);
|
@@ -112,6 +121,10 @@ registerIcon('remove', RemoveIcon);
|
|
112
121
|
registerIcon('retry', RetryIcon);
|
113
122
|
registerIcon('upload', UploadIcon);
|
114
123
|
registerIcon('file', FileIcon);
|
124
|
+
registerIcon('status-success', StatusSuccessIcon);
|
125
|
+
registerIcon('status-fail', StatusFailIcon);
|
126
|
+
registerIcon('status-info', StatusInfoIcon);
|
127
|
+
registerIcon('status-warning', StatusWarningIcon);
|
115
128
|
registerIcon('success', SuccessIcon);
|
116
129
|
registerIcon('fail', FailIcon);
|
117
130
|
registerIcon('warning', WarningIcon);
|
@@ -127,6 +140,7 @@ registerIcon('reload', ReloadIcon);
|
|
127
140
|
registerIcon('exchange', ExchangeIcon);
|
128
141
|
registerIcon('columns', ColmunsIcon);
|
129
142
|
registerIcon('calendar', CalendarIcon);
|
143
|
+
registerIcon('clock', ClockIcon);
|
130
144
|
registerIcon('copy', CopyIcon);
|
131
145
|
registerIcon('filter', FilterIcon);
|
132
146
|
registerIcon('column-filter', ColumnFilterIcon);
|
@@ -149,6 +163,7 @@ registerIcon('ellipsis-v', EllipsisVIcon);
|
|
149
163
|
registerIcon('expand-alt', ExpandAltIcon);
|
150
164
|
registerIcon('compress-alt', CompressAltIcon);
|
151
165
|
registerIcon('transparent', TransparentIcon);
|
166
|
+
registerIcon('loading-outline', LoadingOutline);
|
152
167
|
|
153
168
|
export function Icon({
|
154
169
|
icon,
|
package/src/factory.tsx
CHANGED
@@ -74,11 +74,16 @@ export interface RenderSchemaFilter {
|
|
74
74
|
(schema: Schema, renderer: RendererConfig, props?: any): Schema;
|
75
75
|
}
|
76
76
|
|
77
|
+
export interface wsObject {
|
78
|
+
url: string;
|
79
|
+
body?: any;
|
80
|
+
}
|
81
|
+
|
77
82
|
export interface RenderOptions {
|
78
83
|
session?: string;
|
79
84
|
fetcher?: (config: fetcherConfig) => Promise<fetcherResult>;
|
80
85
|
wsFetcher?: (
|
81
|
-
ws:
|
86
|
+
ws: wsObject,
|
82
87
|
onMessage: (data: any) => void,
|
83
88
|
onError: (error: any) => void
|
84
89
|
) => void;
|
@@ -234,8 +239,13 @@ const defaultOptions: RenderOptions = {
|
|
234
239
|
// 使用 WebSocket 来实时获取数据
|
235
240
|
wsFetcher(ws, onMessage, onError) {
|
236
241
|
if (ws) {
|
237
|
-
const socket = new WebSocket(ws);
|
238
|
-
socket.
|
242
|
+
const socket = new WebSocket(ws.url);
|
243
|
+
socket.onopen = event => {
|
244
|
+
if (ws.body) {
|
245
|
+
socket.send(JSON.stringify(ws.body));
|
246
|
+
}
|
247
|
+
};
|
248
|
+
socket.onmessage = event => {
|
239
249
|
if (event.data) {
|
240
250
|
onMessage(JSON.parse(event.data));
|
241
251
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg width="24px" height="24px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>ic_时间</title><g id="ic_时间" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><circle id="1-FL" stroke="#000" cx="8" cy="8" r="6.5" stroke-width="1px" fill="none" stroke-linecap="butt" stroke-linejoin="round"/><polyline id="2-FLW" stroke="#000" points="7.87443646 5.5 7.87443646 8.53778873 5.5 9.28133409" stroke-width="1px" fill="none" stroke-linecap="butt" stroke-linejoin="round"/></g></svg>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true">
|
2
|
+
<path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z">
|
3
|
+
</path>
|
4
|
+
</svg>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
+
<title>关闭</title>
|
4
|
+
<g id="关闭" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5
|
+
<g id="图标-关闭">
|
6
|
+
<rect id="矩形" stroke="#979797" fill="#D8D8D8" opacity="0" x="0.5" y="0.5" width="15" height="15"></rect>
|
7
|
+
<path d="M12.549,2.65 L13.256,3.357 L8.659,7.952 L13.2563,12.549 L12.5493,13.257 L7.953,8.659 L3.357,13.257 L2.65,12.549 L7.246,7.952 L2.6503,3.357 L3.3573,2.65 L7.953,7.245 L12.549,2.65 Z" id="图标-填色" fill="#080E1A" opacity="0.5"></path>
|
8
|
+
</g>
|
9
|
+
</g>
|
10
|
+
</svg>
|