amis 1.4.0 → 1.4.1-echarts-5.3.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/lib/components/Badge.d.ts +2 -1
- package/lib/components/Badge.js +33 -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/RichText.d.ts +6 -1
- package/lib/components/RichText.js +243 -8
- package/lib/components/RichText.js.map +2 -2
- package/lib/components/calendar/DaysView.js +2 -2
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/icons/loading-outline.js +7 -0
- package/lib/index.js +1 -1
- package/lib/renderers/Action.d.ts +9 -1
- package/lib/renderers/Action.js +5 -5
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +4 -0
- package/lib/renderers/DropDownButton.js +5 -3
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Nav.d.ts +52 -22
- package/lib/renderers/Nav.js +100 -15
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +1 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/themes/ang-ie11.css +350 -54
- package/lib/themes/ang.css +350 -54
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +350 -54
- package/lib/themes/antd.css +350 -54
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +458 -174
- package/lib/themes/cxd.css +458 -174
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +350 -54
- package/lib/themes/dark.css +350 -54
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +458 -174
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/helper.js.map +2 -2
- package/package.json +46 -39
- package/schema.json +200 -15
- package/scss/_mixins.scss +29 -0
- package/scss/_properties.scss +23 -11
- package/scss/components/_badge.scss +52 -1
- package/scss/components/_button.scss +35 -3
- package/scss/components/_image-gallery.scss +1 -1
- package/scss/components/_nav.scss +109 -35
- package/scss/themes/_cxd-variables.scss +20 -20
- package/sdk/ang-ie11.css +449 -56
- package/sdk/ang.css +459 -56
- package/sdk/antd-ie11.css +439 -48
- package/sdk/antd.css +459 -56
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +69 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +908 -517
- package/sdk/cxd.css +567 -176
- package/sdk/dark-ie11.css +449 -56
- package/sdk/dark.css +459 -56
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- 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 -28
- package/sdk/rich-text.js +62 -64
- package/sdk/sdk-ie11.css +908 -517
- package/sdk/sdk.css +567 -176
- package/sdk/sdk.js +1145 -1141
- 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/sdk.zip +0 -0
- package/src/components/Badge.tsx +78 -22
- package/src/components/Button.tsx +23 -7
- package/src/components/RichText.tsx +284 -3
- package/src/components/calendar/DaysView.tsx +2 -2
- package/src/components/icons.tsx +2 -0
- package/src/icons/loading-outline.svg +4 -0
- package/src/renderers/Action.tsx +66 -13
- package/src/renderers/DropDownButton.tsx +13 -4
- package/src/renderers/Nav.tsx +165 -36
- package/src/renderers/Page.tsx +1 -1
- package/src/utils/helper.ts +1 -0
package/sdk.zip
ADDED
Binary file
|
package/src/components/Badge.tsx
CHANGED
@@ -27,13 +27,13 @@ export interface BadgeSchema extends BaseSchema {
|
|
27
27
|
/**
|
28
28
|
* 角标类型
|
29
29
|
*/
|
30
|
-
mode?: 'text' | 'dot';
|
30
|
+
mode?: 'text' | 'dot' | 'ribbon';
|
31
31
|
|
32
32
|
/**
|
33
33
|
* 角标位置,优先级大于position
|
34
34
|
*/
|
35
35
|
offset?: [number | string, number | string];
|
36
|
-
|
36
|
+
|
37
37
|
/**
|
38
38
|
* 角标位置
|
39
39
|
*/
|
@@ -80,6 +80,62 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
80
80
|
super(props);
|
81
81
|
}
|
82
82
|
|
83
|
+
renderBadge(
|
84
|
+
text: any,
|
85
|
+
size: number,
|
86
|
+
position: any,
|
87
|
+
offsetStyle: any,
|
88
|
+
sizeStyle: any,
|
89
|
+
animationElement: any
|
90
|
+
) {
|
91
|
+
const {classnames: cx, badge} = this.props;
|
92
|
+
const {
|
93
|
+
mode = 'dot',
|
94
|
+
level = 'danger',
|
95
|
+
style
|
96
|
+
} = badge as BadgeSchema;
|
97
|
+
switch(mode) {
|
98
|
+
case 'dot':
|
99
|
+
return (
|
100
|
+
<span
|
101
|
+
className={cx('Badge-dot', `Badge--${position}`, `Badge--${level}`)}
|
102
|
+
style={{...offsetStyle, ...sizeStyle, ...style}}
|
103
|
+
>
|
104
|
+
{animationElement}
|
105
|
+
</span>
|
106
|
+
);
|
107
|
+
case 'text':
|
108
|
+
return (
|
109
|
+
<span
|
110
|
+
className={cx('Badge-text', `Badge--${position}`, `Badge--${level}`)}
|
111
|
+
style={{...offsetStyle, ...sizeStyle, ...style}}
|
112
|
+
>
|
113
|
+
{text}
|
114
|
+
{animationElement}
|
115
|
+
</span>
|
116
|
+
);
|
117
|
+
case 'ribbon':
|
118
|
+
const outSize = size * Math.sqrt(2) + 5;
|
119
|
+
return (
|
120
|
+
<div
|
121
|
+
className={cx('Badge-ribbon-out', `Badge-ribbon-out--${position}`)}
|
122
|
+
style={{width: outSize, height: outSize}}
|
123
|
+
>
|
124
|
+
<span
|
125
|
+
className={cx('Badge-ribbon', `Badge-ribbon--${position}`, `Badge--${level}`)}
|
126
|
+
style={{...sizeStyle, ...style}}
|
127
|
+
>
|
128
|
+
{text}
|
129
|
+
{animationElement}
|
130
|
+
</span>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
);
|
134
|
+
default:
|
135
|
+
return null;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
83
139
|
render() {
|
84
140
|
const badge = this.props.badge;
|
85
141
|
if (!badge) {
|
@@ -101,8 +157,7 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
101
157
|
overflowCount = 99,
|
102
158
|
visibleOn,
|
103
159
|
className,
|
104
|
-
animation
|
105
|
-
level = 'danger'
|
160
|
+
animation
|
106
161
|
} = badge;
|
107
162
|
|
108
163
|
if (visibleOn) {
|
@@ -117,6 +172,8 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
117
172
|
if (typeof size === 'undefined') {
|
118
173
|
if (mode === 'dot') {
|
119
174
|
size = 6;
|
175
|
+
} else if (mode === 'ribbon'){
|
176
|
+
size = 12;
|
120
177
|
} else {
|
121
178
|
size = 16;
|
122
179
|
}
|
@@ -145,6 +202,14 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
145
202
|
sizeStyle = {width: size, height: size};
|
146
203
|
}
|
147
204
|
|
205
|
+
if (mode === 'ribbon') {
|
206
|
+
sizeStyle = {
|
207
|
+
height: size,
|
208
|
+
lineHeight: size + 'px',
|
209
|
+
fontSize: size
|
210
|
+
};
|
211
|
+
}
|
212
|
+
|
148
213
|
let offsetStyle = {};
|
149
214
|
// 如果设置了offset属性,offset在position为'top-right'的基础上进行translate定位
|
150
215
|
if (offset && offset.length) {
|
@@ -180,24 +245,15 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
180
245
|
return (
|
181
246
|
<div className={cx('Badge', className)}>
|
182
247
|
{children}
|
183
|
-
{isDisplay ?
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
) :
|
192
|
-
<span
|
193
|
-
className={cx('Badge-text', `Badge--${position}`, `Badge--${level}`)}
|
194
|
-
style={{...offsetStyle, ...sizeStyle, ...style}}
|
195
|
-
>
|
196
|
-
{text}
|
197
|
-
{animationElement}
|
198
|
-
</span>
|
199
|
-
)
|
200
|
-
) : null}
|
248
|
+
{isDisplay ?
|
249
|
+
this.renderBadge(
|
250
|
+
text,
|
251
|
+
size,
|
252
|
+
position,
|
253
|
+
offsetStyle,
|
254
|
+
sizeStyle,
|
255
|
+
animationElement
|
256
|
+
) : null}
|
201
257
|
</div>
|
202
258
|
);
|
203
259
|
}
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
7
7
|
import TooltipWrapper, {TooltipObject, Trigger} from './TooltipWrapper';
|
8
8
|
import {pickEventsProps} from '../utils/helper';
|
9
9
|
import {ClassNamesFn, themeable} from '../theme';
|
10
|
-
|
10
|
+
import {Icon} from './icons';
|
11
11
|
interface ButtonProps extends React.DOMAttributes<HTMLButtonElement> {
|
12
12
|
id?: string;
|
13
13
|
className?: string;
|
@@ -16,7 +16,7 @@ interface ButtonProps extends React.DOMAttributes<HTMLButtonElement> {
|
|
16
16
|
type: 'button' | 'reset' | 'submit';
|
17
17
|
level: string; // 'link' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'default';
|
18
18
|
tooltip?: string | TooltipObject;
|
19
|
-
|
19
|
+
tooltipPlacement: 'top' | 'right' | 'bottom' | 'left';
|
20
20
|
tooltipContainer?: any;
|
21
21
|
tooltipTrigger: Trigger | Array<Trigger>;
|
22
22
|
tooltipRootClose: boolean;
|
@@ -29,6 +29,8 @@ interface ButtonProps extends React.DOMAttributes<HTMLButtonElement> {
|
|
29
29
|
classnames: ClassNamesFn;
|
30
30
|
componentClass: React.ReactType;
|
31
31
|
overrideClassName?: boolean;
|
32
|
+
loading?: boolean;
|
33
|
+
loadingClassName?: string;
|
32
34
|
}
|
33
35
|
|
34
36
|
export class Button extends React.Component<ButtonProps> {
|
@@ -37,14 +39,14 @@ export class Button extends React.Component<ButtonProps> {
|
|
37
39
|
| 'componentClass'
|
38
40
|
| 'level'
|
39
41
|
| 'type'
|
40
|
-
| '
|
42
|
+
| 'tooltipPlacement'
|
41
43
|
| 'tooltipTrigger'
|
42
44
|
| 'tooltipRootClose'
|
43
45
|
> = {
|
44
46
|
componentClass: 'button',
|
45
47
|
level: 'default',
|
46
48
|
type: 'button',
|
47
|
-
|
49
|
+
tooltipPlacement: 'top',
|
48
50
|
tooltipTrigger: ['hover', 'focus'],
|
49
51
|
tooltipRootClose: false
|
50
52
|
};
|
@@ -64,13 +66,15 @@ export class Button extends React.Component<ButtonProps> {
|
|
64
66
|
active,
|
65
67
|
iconOnly,
|
66
68
|
href,
|
69
|
+
loading,
|
70
|
+
loadingClassName,
|
67
71
|
overrideClassName,
|
68
72
|
...rest
|
69
73
|
} = this.props;
|
70
74
|
|
71
75
|
if (href) {
|
72
76
|
Comp = 'a';
|
73
|
-
} else if (Comp === 'button' && disabled) {
|
77
|
+
} else if ((Comp === 'button' && disabled) || loading) {
|
74
78
|
Comp = 'div';
|
75
79
|
}
|
76
80
|
|
@@ -95,6 +99,18 @@ export class Button extends React.Component<ButtonProps> {
|
|
95
99
|
)}
|
96
100
|
disabled={disabled}
|
97
101
|
>
|
102
|
+
{loading && !disabled ? (
|
103
|
+
<span
|
104
|
+
className={cx(
|
105
|
+
overrideClassName
|
106
|
+
? ''
|
107
|
+
: {[`Button--loading Button--loading--${level}`]: level},
|
108
|
+
loadingClassName
|
109
|
+
)}
|
110
|
+
>
|
111
|
+
<Icon icon="loading-outline" className="icon" />
|
112
|
+
</span>
|
113
|
+
) : null}
|
98
114
|
{children}
|
99
115
|
</Comp>
|
100
116
|
);
|
@@ -103,7 +119,7 @@ export class Button extends React.Component<ButtonProps> {
|
|
103
119
|
render() {
|
104
120
|
const {
|
105
121
|
tooltip,
|
106
|
-
|
122
|
+
tooltipPlacement,
|
107
123
|
tooltipContainer,
|
108
124
|
tooltipTrigger,
|
109
125
|
tooltipRootClose,
|
@@ -114,7 +130,7 @@ export class Button extends React.Component<ButtonProps> {
|
|
114
130
|
|
115
131
|
return (
|
116
132
|
<TooltipWrapper
|
117
|
-
placement={
|
133
|
+
placement={tooltipPlacement}
|
118
134
|
tooltip={disabled ? disabledTip : tooltip}
|
119
135
|
container={tooltipContainer}
|
120
136
|
trigger={tooltipTrigger}
|
@@ -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,289 @@ 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
|
+
hasSpecialTag: any;
|
65
|
+
oldModel: any;
|
66
|
+
el: any;
|
67
|
+
_initEvents: any;
|
68
|
+
|
69
|
+
constructor(props: FroalaEditorComponentProps) {
|
70
|
+
super(props);
|
71
|
+
|
72
|
+
this.listeningEvents = [];
|
73
|
+
this.element = null;
|
74
|
+
this.editor = null;
|
75
|
+
this.config = {
|
76
|
+
immediateReactModelUpdate: false,
|
77
|
+
reactIgnoreAttrs: null
|
78
|
+
};
|
79
|
+
|
80
|
+
this.editorInitialized = false;
|
81
|
+
this.INNER_HTML_ATTR = 'innerHTML';
|
82
|
+
|
83
|
+
this.oldModel = null;
|
84
|
+
}
|
85
|
+
|
86
|
+
// After first time render.
|
87
|
+
componentDidMount() {
|
88
|
+
this.createEditor();
|
89
|
+
}
|
90
|
+
|
91
|
+
componentWillUnmount() {
|
92
|
+
this.destroyEditor();
|
93
|
+
}
|
94
|
+
|
95
|
+
componentDidUpdate() {
|
96
|
+
if (JSON.stringify(this.oldModel) == JSON.stringify(this.props.model)) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
|
100
|
+
this.setContent();
|
101
|
+
}
|
102
|
+
|
103
|
+
// Return cloned object
|
104
|
+
clone(item: any) {
|
105
|
+
const me = this;
|
106
|
+
if (!item) {
|
107
|
+
return item;
|
108
|
+
} // null, undefined values check
|
109
|
+
|
110
|
+
let types = [Number, String, Boolean],
|
111
|
+
result: any;
|
112
|
+
|
113
|
+
// normalizing primitives if someone did new String('aaa'), or new Number('444');
|
114
|
+
types.forEach(function (type) {
|
115
|
+
if (item instanceof type) {
|
116
|
+
result = type(item);
|
117
|
+
}
|
118
|
+
});
|
119
|
+
|
120
|
+
if (typeof result == 'undefined') {
|
121
|
+
if (Object.prototype.toString.call(item) === '[object Array]') {
|
122
|
+
result = [];
|
123
|
+
item.forEach(function (child: any, index: number, array: Array<any>) {
|
124
|
+
result[index] = me.clone(child);
|
125
|
+
});
|
126
|
+
} else if (typeof item == 'object') {
|
127
|
+
// testing that this is DOM
|
128
|
+
if (item.nodeType && typeof item.cloneNode == 'function') {
|
129
|
+
result = item.cloneNode(true);
|
130
|
+
} else if (!item.prototype) {
|
131
|
+
// check that this is a literal
|
132
|
+
if (item instanceof Date) {
|
133
|
+
result = new Date(item);
|
134
|
+
} else {
|
135
|
+
// it is an object literal
|
136
|
+
result = {};
|
137
|
+
for (var i in item) {
|
138
|
+
result[i] = me.clone(item[i]);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
} else {
|
142
|
+
if (false && item.constructor) {
|
143
|
+
result = new item.constructor();
|
144
|
+
} else {
|
145
|
+
result = item;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
} else {
|
149
|
+
result = item;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
return result;
|
153
|
+
}
|
154
|
+
|
155
|
+
createEditor() {
|
156
|
+
if (this.editorInitialized) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
|
160
|
+
this.config = this.clone(this.props.config || this.config);
|
161
|
+
this.config = {...this.config};
|
162
|
+
|
163
|
+
this.element = this.el;
|
164
|
+
|
165
|
+
if (this.props.model) {
|
166
|
+
this.element.innerHTML = this.props.model;
|
167
|
+
}
|
168
|
+
|
169
|
+
this.setContent(true);
|
170
|
+
|
171
|
+
// Default initialized.
|
172
|
+
this.registerEvent(
|
173
|
+
'initialized',
|
174
|
+
this.config.events && this.config.events.initialized
|
175
|
+
);
|
176
|
+
|
177
|
+
// Check if events are set.
|
178
|
+
if (!this.config.events) this.config.events = {};
|
179
|
+
this.config.events.initialized = () => this.initListeners();
|
180
|
+
|
181
|
+
this.editor = new FroalaEditor(this.element, this.config);
|
182
|
+
}
|
183
|
+
|
184
|
+
setContent(firstTime?: boolean) {
|
185
|
+
if (this.props.model || this.props.model == '') {
|
186
|
+
this.oldModel = this.props.model;
|
187
|
+
|
188
|
+
if (this.editorInitialized) {
|
189
|
+
this.setNormalTagContent(firstTime);
|
190
|
+
} else {
|
191
|
+
if (!this._initEvents) this._initEvents = [];
|
192
|
+
this._initEvents.push(() => this.setNormalTagContent());
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
setNormalTagContent(firstTime?: boolean) {
|
198
|
+
let self = this;
|
199
|
+
|
200
|
+
function htmlSet() {
|
201
|
+
self.editor.html && self.editor.html.set(self.props.model || '');
|
202
|
+
if (self.editorInitialized && self.editor.undo) {
|
203
|
+
//This will reset the undo stack everytime the model changes externally. Can we fix this?
|
204
|
+
self.editor.undo.reset();
|
205
|
+
self.editor.undo.saveStep();
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
if (firstTime) {
|
210
|
+
if (this.config.initOnClick) {
|
211
|
+
this.registerEvent('initializationDelayed', () => {
|
212
|
+
htmlSet();
|
213
|
+
});
|
214
|
+
|
215
|
+
this.registerEvent('initialized', () => {
|
216
|
+
this.editorInitialized = true;
|
217
|
+
});
|
218
|
+
} else {
|
219
|
+
this.registerEvent('initialized', () => {
|
220
|
+
this.editorInitialized = true;
|
221
|
+
htmlSet();
|
222
|
+
});
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
htmlSet();
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
destroyEditor() {
|
230
|
+
if (this.element) {
|
231
|
+
this.editor.destroy && this.editor.destroy();
|
232
|
+
this.listeningEvents.length = 0;
|
233
|
+
this.element = null;
|
234
|
+
this.editorInitialized = false;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
getEditor() {
|
239
|
+
if (this.element) {
|
240
|
+
return this.editor;
|
241
|
+
}
|
242
|
+
|
243
|
+
return null;
|
244
|
+
}
|
245
|
+
|
246
|
+
updateModel() {
|
247
|
+
if (!this.props.onModelChange) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
|
251
|
+
let modelContent = '';
|
252
|
+
|
253
|
+
if (this.hasSpecialTag) {
|
254
|
+
let attributeNodes = this.element.attributes;
|
255
|
+
let attrs: any = {};
|
256
|
+
|
257
|
+
for (let i = 0; i < attributeNodes.length; i++) {
|
258
|
+
let attrName = attributeNodes[i].name;
|
259
|
+
if (
|
260
|
+
this.config.reactIgnoreAttrs &&
|
261
|
+
this.config.reactIgnoreAttrs.indexOf(attrName) != -1
|
262
|
+
) {
|
263
|
+
continue;
|
264
|
+
}
|
265
|
+
attrs[attrName] = attributeNodes[i].value;
|
266
|
+
}
|
267
|
+
|
268
|
+
if (this.element.innerHTML) {
|
269
|
+
attrs[this.INNER_HTML_ATTR] = this.element.innerHTML;
|
270
|
+
}
|
271
|
+
|
272
|
+
modelContent = attrs;
|
273
|
+
} else {
|
274
|
+
let returnedHtml = this.editor.html.get();
|
275
|
+
if (typeof returnedHtml === 'string') {
|
276
|
+
modelContent = returnedHtml;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
this.oldModel = modelContent;
|
281
|
+
this.props.onModelChange(modelContent);
|
282
|
+
}
|
283
|
+
|
284
|
+
initListeners() {
|
285
|
+
let self = this;
|
286
|
+
|
287
|
+
// bind contentChange and keyup event to froalaModel
|
288
|
+
this.editor.events.on('contentChanged', function () {
|
289
|
+
self.updateModel();
|
290
|
+
});
|
291
|
+
if (this.config.immediateReactModelUpdate) {
|
292
|
+
this.editor.events.on('keyup', function () {
|
293
|
+
self.updateModel();
|
294
|
+
});
|
295
|
+
}
|
296
|
+
|
297
|
+
// Call init events.
|
298
|
+
if (this._initEvents) {
|
299
|
+
for (let i = 0; i < this._initEvents.length; i++) {
|
300
|
+
this._initEvents[i].call(this.editor);
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
// register event on jquery editor element
|
306
|
+
registerEvent(eventName: string, callback: Function) {
|
307
|
+
if (!eventName || !callback) {
|
308
|
+
return;
|
309
|
+
}
|
310
|
+
|
311
|
+
if (eventName == 'initialized') {
|
312
|
+
if (!this._initEvents) this._initEvents = [];
|
313
|
+
this._initEvents.push(callback);
|
314
|
+
} else {
|
315
|
+
if (!this.config.events) {
|
316
|
+
this.config.events = {};
|
317
|
+
}
|
318
|
+
|
319
|
+
this.config.events[eventName] = callback;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
render() {
|
324
|
+
return (
|
325
|
+
<textarea ref={el => (this.el = el)}>{this.props.children}</textarea>
|
326
|
+
);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
export default class extends React.Component<any, any> {
|
49
331
|
constructor(props: any) {
|
50
332
|
super(props);
|
51
333
|
Froala.VIDEO_PROVIDERS = [
|
@@ -61,7 +343,6 @@ export default class FroalaEditor extends React.Component<any, any> {
|
|
61
343
|
render() {
|
62
344
|
return (
|
63
345
|
<FroalaEditorComponent
|
64
|
-
tag="textarea"
|
65
346
|
config={this.props.config}
|
66
347
|
model={this.props.model}
|
67
348
|
onModelChange={this.props.onModelChange}
|
@@ -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
|
|
package/src/components/icons.tsx
CHANGED
@@ -61,6 +61,7 @@ import EllipsisVIcon from '../icons/ellipsis-v.svg';
|
|
61
61
|
import ExpandAltIcon from '../icons/expand-alt.svg';
|
62
62
|
import CompressAltIcon from '../icons/compress-alt.svg';
|
63
63
|
import TransparentIcon from '../icons/transparent.svg';
|
64
|
+
import LoadingOutline from '../icons/loading-outline.svg';
|
64
65
|
|
65
66
|
// 兼容原来的用法,后续不直接试用。
|
66
67
|
|
@@ -149,6 +150,7 @@ registerIcon('ellipsis-v', EllipsisVIcon);
|
|
149
150
|
registerIcon('expand-alt', ExpandAltIcon);
|
150
151
|
registerIcon('compress-alt', CompressAltIcon);
|
151
152
|
registerIcon('transparent', TransparentIcon);
|
153
|
+
registerIcon('loading-outline', LoadingOutline);
|
152
154
|
|
153
155
|
export function Icon({
|
154
156
|
icon,
|
@@ -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>
|