amis 1.4.1 → 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 +2 -2
- package/lib/components/Badge.js +12 -6
- package/lib/components/Badge.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/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/MonthRangePicker.js +1 -1
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/RichText.js +17 -53
- package/lib/components/RichText.js.map +2 -2
- 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/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/icons.js +12 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/icons/clock.js +10 -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 +2 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +2 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +3 -1
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +7 -0
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/CRUD.js +21 -6
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Collapse.js +2 -2
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/Dialog.js +0 -3
- 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 +5 -1
- package/lib/renderers/DropDownButton.js +8 -6
- package/lib/renderers/DropDownButton.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/InputFile.js +2 -2
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputImage.js +5 -3
- package/lib/renderers/Form/InputImage.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/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 +62 -36
- package/lib/renderers/Nav.js +248 -90
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/SparkLine.d.ts +4 -0
- package/lib/renderers/SparkLine.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 +4 -0
- package/lib/renderers/Table/TableCell.js +3 -1
- package/lib/renderers/Table/TableCell.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +14 -1
- package/lib/renderers/Table/index.js +116 -36
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/store/table.d.ts +257 -1
- package/lib/store/table.js +41 -6
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +393 -90
- package/lib/themes/ang.css +393 -90
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +393 -90
- package/lib/themes/antd.css +393 -90
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +904 -263
- package/lib/themes/cxd.css +904 -263
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +393 -90
- package/lib/themes/dark.css +393 -90
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +904 -263
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +4 -4
- package/lib/utils/api.js.map +2 -2
- 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/package.json +1 -1
- package/schema.json +322 -261
- package/scss/_properties.scss +39 -4
- package/scss/_utilities.scss +4 -0
- package/scss/components/_button.scss +4 -5
- 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/_images.scss +2 -1
- package/scss/components/_link.scss +6 -0
- package/scss/components/_nav.scss +231 -223
- package/scss/components/_page.scss +5 -4
- package/scss/components/_progress.scss +2 -0
- 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/_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 +2 -0
- package/scss/themes/_cxd-colors.scss +56 -0
- package/scss/themes/_cxd-variables.scss +215 -90
- package/scss/themes/cxd.scss +366 -0
- package/sdk/ang-ie11.css +569 -235
- package/sdk/ang.css +512 -151
- package/sdk/antd-ie11.css +558 -224
- package/sdk/antd.css +512 -151
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +67 -67
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +1506 -870
- package/sdk/cxd.css +1064 -324
- package/sdk/dark-ie11.css +569 -235
- package/sdk/dark.css +512 -151
- package/sdk/exceljs.js +1 -1
- package/sdk/ie11-patch.css +1 -0
- package/sdk/locale/de-DE.js +2 -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 -22
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +1506 -870
- package/sdk/sdk.css +1064 -324
- package/sdk/sdk.js +1138 -1118
- 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 +36 -24
- package/src/components/Collapse.tsx +14 -9
- package/src/components/DatePicker.tsx +1 -1
- package/src/components/DateRangePicker.tsx +23 -11
- package/src/components/InputBox.tsx +1 -1
- package/src/components/Link.tsx +94 -0
- package/src/components/MonthRangePicker.tsx +10 -2
- package/src/components/RichText.tsx +17 -57
- package/src/components/Select.tsx +3 -0
- package/src/components/SparkLine.tsx +4 -1
- package/src/components/Toast.tsx +5 -5
- package/src/components/Tree.tsx +6 -8
- package/src/components/icons.tsx +13 -0
- package/src/icons/clock.svg +1 -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 +2 -0
- package/src/locale/en-US.ts +2 -0
- package/src/locale/zh-CN.ts +3 -1
- package/src/renderers/Action.tsx +5 -0
- package/src/renderers/CRUD.tsx +31 -26
- package/src/renderers/Collapse.tsx +1 -1
- package/src/renderers/Dialog.tsx +0 -4
- package/src/renderers/Drawer.tsx +0 -4
- package/src/renderers/DropDownButton.tsx +19 -14
- package/src/renderers/Form/Checkbox.tsx +8 -0
- package/src/renderers/Form/Combo.tsx +2 -3
- package/src/renderers/Form/InputFile.tsx +2 -1
- package/src/renderers/Form/InputImage.tsx +5 -2
- 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/Link.tsx +36 -11
- package/src/renderers/Log.tsx +16 -3
- package/src/renderers/Nav.tsx +255 -100
- package/src/renderers/SparkLine.tsx +5 -0
- package/src/renderers/Table/ColumnToggler.tsx +544 -0
- package/src/renderers/Table/ItemActionsWrapper.tsx +44 -0
- package/src/renderers/Table/TableCell.tsx +16 -1
- package/src/renderers/Table/index.tsx +179 -47
- package/src/store/table.ts +57 -6
- package/src/utils/api.ts +13 -4
- package/src/utils/handleAction.ts +41 -0
- package/src/utils/helper.ts +4 -4
- package/src/utils/tpl-builtin.ts +48 -17
- package/sdk.zip +0 -0
package/src/Schema.ts
CHANGED
@@ -492,6 +492,24 @@ export interface SchemaApiObject {
|
|
492
492
|
[propName: string]: any;
|
493
493
|
};
|
494
494
|
|
495
|
+
/**
|
496
|
+
* 默认数据映射中的key如果带点,或者带大括号,会转成对象比如:
|
497
|
+
*
|
498
|
+
* {
|
499
|
+
* 'a.b': '123'
|
500
|
+
* }
|
501
|
+
*
|
502
|
+
* 经过数据映射后变成
|
503
|
+
* {
|
504
|
+
* a: {
|
505
|
+
* b: '123
|
506
|
+
* }
|
507
|
+
* }
|
508
|
+
*
|
509
|
+
* 如果想要关闭此功能,请设置 convertKeyToPath 为 false
|
510
|
+
*/
|
511
|
+
convertKeyToPath?: boolean;
|
512
|
+
|
495
513
|
/**
|
496
514
|
* 用来做接口返回的数据映射。
|
497
515
|
*/
|
package/src/components/Alert.tsx
CHANGED
@@ -113,7 +113,9 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
|
113
113
|
|
114
114
|
this.setState(
|
115
115
|
{
|
116
|
-
show: false
|
116
|
+
show: false,
|
117
|
+
prompt: false,
|
118
|
+
confirm: false
|
117
119
|
},
|
118
120
|
isConfirm ? () => this._resolve(confirmed) /*this._reject()*/ : undefined
|
119
121
|
);
|
package/src/components/Badge.tsx
CHANGED
@@ -13,7 +13,7 @@ import {ClassNamesFn} from '../theme';
|
|
13
13
|
* Badge 角标。
|
14
14
|
* 文档:https://baidu.gitee.io/amis/docs/components/badge
|
15
15
|
*/
|
16
|
-
export interface BadgeSchema extends BaseSchema {
|
16
|
+
export interface BadgeSchema extends Omit<BaseSchema, 'type'> {
|
17
17
|
/**
|
18
18
|
* 文本内容
|
19
19
|
*/
|
@@ -64,7 +64,7 @@ export interface BadgeSchema extends BaseSchema {
|
|
64
64
|
/**
|
65
65
|
* 提示类型
|
66
66
|
*/
|
67
|
-
level?: 'info' | 'warning' | 'success' | 'danger';
|
67
|
+
level?: 'info' | 'warning' | 'success' | 'danger' | SchemaExpression;
|
68
68
|
}
|
69
69
|
|
70
70
|
export interface BadgeProps {
|
@@ -88,13 +88,14 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
88
88
|
sizeStyle: any,
|
89
89
|
animationElement: any
|
90
90
|
) {
|
91
|
-
const {classnames: cx, badge} = this.props;
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
97
|
-
|
91
|
+
const {classnames: cx, badge, data} = this.props;
|
92
|
+
let {mode = 'dot', level = 'danger', style} = badge as BadgeSchema;
|
93
|
+
|
94
|
+
if (typeof level === 'string' && level[0] === '$') {
|
95
|
+
level = resolveVariable(level, data);
|
96
|
+
}
|
97
|
+
|
98
|
+
switch (mode) {
|
98
99
|
case 'dot':
|
99
100
|
return (
|
100
101
|
<span
|
@@ -107,7 +108,11 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
107
108
|
case 'text':
|
108
109
|
return (
|
109
110
|
<span
|
110
|
-
className={cx(
|
111
|
+
className={cx(
|
112
|
+
'Badge-text',
|
113
|
+
`Badge--${position}`,
|
114
|
+
`Badge--${level}`
|
115
|
+
)}
|
111
116
|
style={{...offsetStyle, ...sizeStyle, ...style}}
|
112
117
|
>
|
113
118
|
{text}
|
@@ -122,14 +127,17 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
122
127
|
style={{width: outSize, height: outSize}}
|
123
128
|
>
|
124
129
|
<span
|
125
|
-
className={cx(
|
130
|
+
className={cx(
|
131
|
+
'Badge-ribbon',
|
132
|
+
`Badge-ribbon--${position}`,
|
133
|
+
`Badge--${level}`
|
134
|
+
)}
|
126
135
|
style={{...sizeStyle, ...style}}
|
127
136
|
>
|
128
137
|
{text}
|
129
138
|
{animationElement}
|
130
139
|
</span>
|
131
140
|
</div>
|
132
|
-
|
133
141
|
);
|
134
142
|
default:
|
135
143
|
return null;
|
@@ -150,6 +158,7 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
150
158
|
let {
|
151
159
|
mode = 'dot',
|
152
160
|
text,
|
161
|
+
level,
|
153
162
|
size,
|
154
163
|
style,
|
155
164
|
offset,
|
@@ -172,7 +181,7 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
172
181
|
if (typeof size === 'undefined') {
|
173
182
|
if (mode === 'dot') {
|
174
183
|
size = 6;
|
175
|
-
} else if (mode === 'ribbon'){
|
184
|
+
} else if (mode === 'ribbon') {
|
176
185
|
size = 12;
|
177
186
|
} else {
|
178
187
|
size = 16;
|
@@ -189,7 +198,9 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
189
198
|
// 当text、overflowCount都为number类型时,进行封顶值处理
|
190
199
|
if (typeof text === 'number' && typeof overflowCount === 'number') {
|
191
200
|
text = (
|
192
|
-
(text as number) > (overflowCount as number)
|
201
|
+
(text as number) > (overflowCount as number)
|
202
|
+
? `${overflowCount}+`
|
203
|
+
: text
|
193
204
|
) as string | number;
|
194
205
|
}
|
195
206
|
|
@@ -217,7 +228,7 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
217
228
|
const left = `calc(50% + ${parseInt(offset[0] as string, 10)}px)`;
|
218
229
|
const right = `calc(-50% + ${parseInt(offset[1] as string, 10)}px)`;
|
219
230
|
offsetStyle = {
|
220
|
-
transform: `translate(${left}, ${right})
|
231
|
+
transform: `translate(${left}, ${right})`
|
221
232
|
};
|
222
233
|
}
|
223
234
|
|
@@ -245,15 +256,16 @@ export class Badge extends React.Component<BadgeProps, object> {
|
|
245
256
|
return (
|
246
257
|
<div className={cx('Badge', className)}>
|
247
258
|
{children}
|
248
|
-
{isDisplay
|
249
|
-
this.renderBadge(
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
259
|
+
{isDisplay
|
260
|
+
? this.renderBadge(
|
261
|
+
text,
|
262
|
+
size,
|
263
|
+
position,
|
264
|
+
offsetStyle,
|
265
|
+
sizeStyle,
|
266
|
+
animationElement
|
267
|
+
)
|
268
|
+
: null}
|
257
269
|
</div>
|
258
270
|
);
|
259
271
|
}
|
@@ -100,15 +100,20 @@ export class Collapse extends React.Component<CollapseProps, any> {
|
|
100
100
|
if (status === ENTERING) {
|
101
101
|
this.contentDom.offsetWidth;
|
102
102
|
}
|
103
|
-
return
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
(children as
|
109
|
-
|
110
|
-
|
111
|
-
|
103
|
+
return (
|
104
|
+
<div
|
105
|
+
className={cx('Collapse-contentWrapper', collapseStyles[status])}
|
106
|
+
ref={this.contentRef}
|
107
|
+
>
|
108
|
+
{React.cloneElement(children as any, {
|
109
|
+
...(children as React.ReactElement).props,
|
110
|
+
className: cx(
|
111
|
+
'Collapse-content',
|
112
|
+
(children as React.ReactElement).props.className
|
113
|
+
)
|
114
|
+
})}
|
115
|
+
</div>
|
116
|
+
);
|
112
117
|
}}
|
113
118
|
</Transition>
|
114
119
|
);
|
@@ -618,7 +618,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
618
618
|
) : null}
|
619
619
|
|
620
620
|
<a className={cx(`DatePicker-toggler`)}>
|
621
|
-
<Icon icon="
|
621
|
+
<Icon icon="clock" className="icon" />
|
622
622
|
</a>
|
623
623
|
|
624
624
|
{isOpened ? (
|
@@ -438,12 +438,17 @@ export class DateRangePicker extends React.Component<
|
|
438
438
|
}
|
439
439
|
|
440
440
|
if (minDate && newValue && newValue.isBefore(minDate, 'second')) {
|
441
|
-
newValue = minDate
|
441
|
+
newValue = minDate;
|
442
442
|
}
|
443
443
|
|
444
444
|
this.setState(
|
445
445
|
{
|
446
|
-
startDate: this.filterDate(
|
446
|
+
startDate: this.filterDate(
|
447
|
+
newValue,
|
448
|
+
startDate || minDate,
|
449
|
+
timeFormat,
|
450
|
+
'start'
|
451
|
+
)
|
447
452
|
},
|
448
453
|
() => {
|
449
454
|
embed && this.confirm();
|
@@ -479,7 +484,12 @@ export class DateRangePicker extends React.Component<
|
|
479
484
|
|
480
485
|
this.setState(
|
481
486
|
{
|
482
|
-
endDate: this.filterDate(
|
487
|
+
endDate: this.filterDate(
|
488
|
+
newValue,
|
489
|
+
endDate || maxDate,
|
490
|
+
timeFormat,
|
491
|
+
'end'
|
492
|
+
)
|
483
493
|
},
|
484
494
|
() => {
|
485
495
|
embed && this.confirm();
|
@@ -492,12 +502,14 @@ export class DateRangePicker extends React.Component<
|
|
492
502
|
const now = moment();
|
493
503
|
this.setState(
|
494
504
|
{
|
495
|
-
startDate:
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
505
|
+
startDate:
|
506
|
+
minDate && minDate.isValid()
|
507
|
+
? moment.max(range.startDate(now.clone()), minDate)
|
508
|
+
: range.startDate(now.clone()),
|
509
|
+
endDate:
|
510
|
+
maxDate && maxDate.isValid()
|
511
|
+
? moment.min(maxDate, range.endDate(now.clone()))
|
512
|
+
: range.endDate(now.clone())
|
501
513
|
},
|
502
514
|
closeOnSelect ? this.confirm : noop
|
503
515
|
);
|
@@ -797,7 +809,7 @@ export class DateRangePicker extends React.Component<
|
|
797
809
|
{
|
798
810
|
'is-disabled': disabled,
|
799
811
|
'is-focused': isFocused,
|
800
|
-
[`${ns}DateRangePicker--border${ucFirst(borderMode)}`]: borderMode
|
812
|
+
[`${ns}DateRangePicker--border${ucFirst(borderMode)}`]: borderMode
|
801
813
|
},
|
802
814
|
className
|
803
815
|
)}
|
@@ -821,7 +833,7 @@ export class DateRangePicker extends React.Component<
|
|
821
833
|
) : null}
|
822
834
|
|
823
835
|
<a className={`${ns}DateRangePicker-toggler`}>
|
824
|
-
<Icon icon="
|
836
|
+
<Icon icon="clock" className="icon" />
|
825
837
|
</a>
|
826
838
|
|
827
839
|
{isOpened ? (
|
@@ -37,7 +37,7 @@ export class InputBox extends React.Component<InputBoxProps, InputBoxState> {
|
|
37
37
|
clearValue(e: any) {
|
38
38
|
e.preventDefault();
|
39
39
|
|
40
|
-
const onClear = this.props.
|
40
|
+
const onClear = this.props.onClear;
|
41
41
|
const onChange = this.props.onChange;
|
42
42
|
onClear?.(e);
|
43
43
|
onChange?.('');
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {RendererProps} from '../factory';
|
3
|
+
import {BaseSchema, SchemaTpl} from '../Schema';
|
4
|
+
import {getPropValue} from '../utils/helper';
|
5
|
+
import {filter} from '../utils/tpl';
|
6
|
+
import {themeable} from '../theme';
|
7
|
+
import {autobind} from '../utils/helper';
|
8
|
+
|
9
|
+
export interface LinkSchema extends BaseSchema {
|
10
|
+
/**
|
11
|
+
* 是否新窗口打开。
|
12
|
+
*/
|
13
|
+
blank?: boolean;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* 链接内容,如果不配置将显示链接地址。
|
17
|
+
*/
|
18
|
+
body?: SchemaTpl;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* 禁用
|
22
|
+
*/
|
23
|
+
disabled?: boolean;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* 图标
|
27
|
+
*/
|
28
|
+
icon?: string;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* 图标位置
|
32
|
+
*/
|
33
|
+
position?: string;
|
34
|
+
}
|
35
|
+
|
36
|
+
export interface LinkProps
|
37
|
+
extends RendererProps,
|
38
|
+
Omit<LinkSchema, 'type' | 'className'> {}
|
39
|
+
|
40
|
+
export class Link extends React.Component<LinkProps, object> {
|
41
|
+
constructor(props: LinkProps) {
|
42
|
+
super(props);
|
43
|
+
}
|
44
|
+
|
45
|
+
@autobind
|
46
|
+
aClick(e: React.MouseEvent<any>) {
|
47
|
+
const {disabled} = this.props;
|
48
|
+
if (disabled) {
|
49
|
+
e.preventDefault();
|
50
|
+
e.stopPropagation();
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
render() {
|
55
|
+
const {
|
56
|
+
className,
|
57
|
+
body,
|
58
|
+
href,
|
59
|
+
classnames: cx,
|
60
|
+
blank,
|
61
|
+
disabled,
|
62
|
+
htmlTarget,
|
63
|
+
data,
|
64
|
+
title,
|
65
|
+
icon,
|
66
|
+
position
|
67
|
+
} = this.props;
|
68
|
+
|
69
|
+
let value = getPropValue(this.props);
|
70
|
+
const finnalHref = href ? filter(href, data, '| raw') : '';
|
71
|
+
|
72
|
+
return (
|
73
|
+
<a
|
74
|
+
href={finnalHref || value}
|
75
|
+
target={htmlTarget || (blank ? '_blank' : '_self')}
|
76
|
+
className={cx(
|
77
|
+
`Link`,
|
78
|
+
{
|
79
|
+
'is-disabled': disabled
|
80
|
+
},
|
81
|
+
className
|
82
|
+
)}
|
83
|
+
title={title}
|
84
|
+
onClick={this.aClick}
|
85
|
+
>
|
86
|
+
<i className={icon} style={{display: position !== 'right' ? 'inline-block' : 'none' }} />
|
87
|
+
{body}
|
88
|
+
<i className={icon} style={{display: position !== 'right' ? 'none' : 'inline-block' }} />
|
89
|
+
</a>
|
90
|
+
);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
export default themeable(Link);
|
@@ -440,7 +440,15 @@ export class MonthRangePicker extends React.Component<
|
|
440
440
|
}
|
441
441
|
|
442
442
|
renderCalendar() {
|
443
|
-
const {
|
443
|
+
const {
|
444
|
+
classPrefix: ns,
|
445
|
+
classnames: cx,
|
446
|
+
locale,
|
447
|
+
embed,
|
448
|
+
ranges,
|
449
|
+
inputFormat,
|
450
|
+
timeFormat
|
451
|
+
} = this.props;
|
444
452
|
const __ = this.props.translate;
|
445
453
|
const viewMode: 'months' = 'months';
|
446
454
|
const dateFormat = 'YYYY-MM';
|
@@ -592,7 +600,7 @@ export class MonthRangePicker extends React.Component<
|
|
592
600
|
) : null}
|
593
601
|
|
594
602
|
<a className={`${ns}DateRangePicker-toggler`}>
|
595
|
-
<Icon icon="
|
603
|
+
<Icon icon="clock" className="icon" />
|
596
604
|
</a>
|
597
605
|
|
598
606
|
{isOpened ? (
|
@@ -61,7 +61,6 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
61
61
|
config: any;
|
62
62
|
editorInitialized: any;
|
63
63
|
INNER_HTML_ATTR: any;
|
64
|
-
hasSpecialTag: any;
|
65
64
|
oldModel: any;
|
66
65
|
el: any;
|
67
66
|
_initEvents: any;
|
@@ -166,7 +165,7 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
166
165
|
this.element.innerHTML = this.props.model;
|
167
166
|
}
|
168
167
|
|
169
|
-
this.setContent(
|
168
|
+
this.setContent();
|
170
169
|
|
171
170
|
// Default initialized.
|
172
171
|
this.registerEvent(
|
@@ -176,17 +175,20 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
176
175
|
|
177
176
|
// Check if events are set.
|
178
177
|
if (!this.config.events) this.config.events = {};
|
179
|
-
this.config.events.initialized = () =>
|
178
|
+
this.config.events.initialized = () => {
|
179
|
+
this.editorInitialized = true;
|
180
|
+
this.initListeners();
|
181
|
+
};
|
180
182
|
|
181
183
|
this.editor = new FroalaEditor(this.element, this.config);
|
182
184
|
}
|
183
185
|
|
184
|
-
setContent(
|
186
|
+
setContent() {
|
185
187
|
if (this.props.model || this.props.model == '') {
|
186
188
|
this.oldModel = this.props.model;
|
187
189
|
|
188
190
|
if (this.editorInitialized) {
|
189
|
-
this.setNormalTagContent(
|
191
|
+
this.setNormalTagContent();
|
190
192
|
} else {
|
191
193
|
if (!this._initEvents) this._initEvents = [];
|
192
194
|
this._initEvents.push(() => this.setNormalTagContent());
|
@@ -194,35 +196,14 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
194
196
|
}
|
195
197
|
}
|
196
198
|
|
197
|
-
setNormalTagContent(
|
199
|
+
setNormalTagContent() {
|
198
200
|
let self = this;
|
199
201
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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();
|
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();
|
226
207
|
}
|
227
208
|
}
|
228
209
|
|
@@ -232,6 +213,7 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
232
213
|
this.listeningEvents.length = 0;
|
233
214
|
this.element = null;
|
234
215
|
this.editorInitialized = false;
|
216
|
+
this._initEvents = [];
|
235
217
|
}
|
236
218
|
}
|
237
219
|
|
@@ -250,31 +232,9 @@ class FroalaEditorComponent extends React.Component<FroalaEditorComponentProps>
|
|
250
232
|
|
251
233
|
let modelContent = '';
|
252
234
|
|
253
|
-
|
254
|
-
|
255
|
-
|
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
|
-
}
|
235
|
+
let returnedHtml = this.editor.html.get();
|
236
|
+
if (typeof returnedHtml === 'string') {
|
237
|
+
modelContent = returnedHtml;
|
278
238
|
}
|
279
239
|
|
280
240
|
this.oldModel = modelContent;
|
@@ -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) {
|
@@ -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/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
|
|