amis 1.3.5-beta.6 → 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 +15 -2
- package/lib/components/Badge.js +47 -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/Drawer.js +1 -1
- package/lib/components/Drawer.js.map +2 -2
- package/lib/components/Modal.js +1 -1
- package/lib/components/Modal.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/Select.d.ts +7 -0
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Steps.d.ts +3 -3
- package/lib/components/Steps.js.map +1 -1
- 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 +2 -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/loading-outline.js +7 -0
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +2 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +2 -1
- package/lib/locale/zh-CN.js.map +2 -2
- 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/CRUD.d.ts +2 -2
- package/lib/renderers/CRUD.js +11 -20
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Collapse.d.ts +1 -1
- package/lib/renderers/Collapse.js +5 -1
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/Dialog.d.ts +0 -252
- package/lib/renderers/Dialog.js +1 -1
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +8 -0
- package/lib/renderers/DropDownButton.js +6 -4
- 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/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/InputImage.d.ts +8 -0
- package/lib/renderers/Form/InputImage.js +2 -1
- 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/Json.js +5 -1
- package/lib/renderers/Json.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 +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/Steps.d.ts +4 -4
- package/lib/renderers/Steps.js +5 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/TableBody.d.ts +1 -1
- package/lib/renderers/Table/TableBody.js +5 -1
- package/lib/renderers/Table/TableBody.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 +8 -3
- package/lib/renderers/Table/index.js +80 -45
- 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 +1 -2
- package/lib/store/table.js +44 -3
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +597 -57
- package/lib/themes/ang.css +597 -57
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +597 -57
- package/lib/themes/antd.css +597 -57
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +705 -177
- package/lib/themes/cxd.css +705 -177
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +597 -57
- package/lib/themes/dark.css +597 -57
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +705 -177
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +12 -0
- 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/helper.js.map +2 -2
- package/lib/utils/validations.js +62 -5
- package/lib/utils/validations.js.map +2 -2
- package/package.json +46 -39
- package/schema.json +343 -44
- package/scss/_mixins.scss +29 -0
- package/scss/_properties.scss +27 -11
- package/scss/components/_badge.scss +67 -2
- package/scss/components/_button.scss +35 -3
- package/scss/components/_image-gallery.scss +1 -1
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_nav.scss +109 -35
- package/scss/components/_spinner.scss +6 -2
- package/scss/components/form/_group.scss +4 -0
- package/scss/themes/_common.scss +1 -0
- package/scss/themes/_cxd-variables.scss +20 -20
- package/sdk/ang-ie11.css +741 -59
- package/sdk/ang.css +755 -59
- package/sdk/antd-ie11.css +731 -51
- package/sdk/antd.css +755 -59
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +67 -67
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +1200 -520
- package/sdk/cxd.css +863 -179
- package/sdk/dark-ie11.css +741 -59
- package/sdk/dark.css +755 -59
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/locale/de-DE.js +1 -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 +1200 -520
- package/sdk/sdk.css +863 -179
- package/sdk/sdk.js +1118 -1112
- 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 +111 -20
- package/src/components/Button.tsx +23 -7
- package/src/components/Checkbox.tsx +5 -2
- package/src/components/Drawer.tsx +3 -2
- package/src/components/Modal.tsx +3 -2
- package/src/components/RichText.tsx +284 -3
- package/src/components/Select.tsx +1 -0
- package/src/components/Steps.tsx +3 -3
- 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 +2 -0
- package/src/factory.tsx +13 -3
- package/src/icons/loading-outline.svg +4 -0
- package/src/locale/de-DE.ts +1 -0
- package/src/locale/en-US.ts +2 -1
- package/src/locale/zh-CN.ts +2 -1
- package/src/renderers/Action.tsx +66 -13
- package/src/renderers/CRUD.tsx +13 -33
- package/src/renderers/Collapse.tsx +5 -1
- package/src/renderers/Dialog.tsx +1 -1
- package/src/renderers/DropDownButton.tsx +21 -4
- package/src/renderers/Form/ButtonGroupSelect.tsx +3 -0
- package/src/renderers/Form/Editor.tsx +19 -20
- package/src/renderers/Form/InputExcel.tsx +28 -3
- package/src/renderers/Form/InputImage.tsx +23 -8
- package/src/renderers/Form/InputTable.tsx +88 -9
- package/src/renderers/Json.tsx +10 -1
- package/src/renderers/Nav.tsx +165 -36
- package/src/renderers/Page.tsx +3 -1
- package/src/renderers/Service.tsx +101 -3
- package/src/renderers/Steps.tsx +12 -9
- package/src/renderers/Table/TableBody.tsx +3 -2
- package/src/renderers/Table/TableContent.tsx +3 -1
- package/src/renderers/Table/index.tsx +61 -13
- 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 +48 -0
- package/src/utils/api.ts +11 -0
- package/src/utils/attachmentAdpator.ts +90 -0
- package/src/utils/helper.ts +1 -0
- package/src/utils/validations.ts +80 -12
@@ -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
@@ -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,
|
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,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>
|
package/src/locale/de-DE.ts
CHANGED
@@ -158,6 +158,7 @@ register('de-DE', {
|
|
158
158
|
'System.requestError': 'Anfragefehler: ',
|
159
159
|
'System.requestErrorStatus': 'Anfragefehler, Statuscode:',
|
160
160
|
'Table.addRow': 'Zeile hinzufügen',
|
161
|
+
'Table.copyRow': 'Zeile kopieren',
|
161
162
|
'Table.columnsVisibility': 'Klicken, um die Sichtbarkeit der Spalten zu steuern',
|
162
163
|
'Table.deleteRow': 'Aktuele Zeile löschen',
|
163
164
|
'Table.discard': 'Verwerfen',
|
package/src/locale/en-US.ts
CHANGED
@@ -158,7 +158,8 @@ register('en-US', {
|
|
158
158
|
'System.copy': 'Content copied',
|
159
159
|
'System.requestError': 'Request error: ',
|
160
160
|
'System.requestErrorStatus': 'Request error, status code: ',
|
161
|
-
'Table.addRow': 'Add
|
161
|
+
'Table.addRow': 'Add row',
|
162
|
+
'Table.copyRow': 'Copy row',
|
162
163
|
'Table.columnsVisibility': 'Click to control columns visibility',
|
163
164
|
'Table.deleteRow': 'Delete current row',
|
164
165
|
'Table.discard': 'Discard',
|
package/src/locale/zh-CN.ts
CHANGED
@@ -83,7 +83,7 @@ register('zh-CN', {
|
|
83
83
|
'desc': '降序',
|
84
84
|
'Dialog.close': '关闭',
|
85
85
|
'Embed.invalidRoot': '选择器不对,页面上没有此元素',
|
86
|
-
'Embed.downloading': '
|
86
|
+
'Embed.downloading': '文件即将开始下载',
|
87
87
|
'Excel.placeholder': '拖拽 Excel 到这,或点击上传',
|
88
88
|
'fetchFailed': '初始化失败',
|
89
89
|
'File.continueAdd': '继续添加',
|
@@ -163,6 +163,7 @@ register('zh-CN', {
|
|
163
163
|
'System.requestError': '接口报错:',
|
164
164
|
'System.requestErrorStatus': '接口出错,状态码是:',
|
165
165
|
'Table.addRow': '新增一行',
|
166
|
+
'Table.copyRow': '复制一行',
|
166
167
|
'Table.columnsVisibility': '点击选择显示列',
|
167
168
|
'Table.deleteRow': '删除当前行',
|
168
169
|
'Table.discard': '放弃',
|
package/src/renderers/Action.tsx
CHANGED
@@ -35,6 +35,10 @@ export interface ButtonSchema extends BaseSchema {
|
|
35
35
|
* 右侧 icon 上的 css 类名
|
36
36
|
*/
|
37
37
|
rightIconClassName?: SchemaClassName;
|
38
|
+
/**
|
39
|
+
* loading 上的css 类名
|
40
|
+
*/
|
41
|
+
loadingClassName?: SchemaClassName;
|
38
42
|
|
39
43
|
/**
|
40
44
|
* 按钮文字
|
@@ -131,6 +135,10 @@ export interface ButtonSchema extends BaseSchema {
|
|
131
135
|
* 键盘快捷键
|
132
136
|
*/
|
133
137
|
hotKey?: string;
|
138
|
+
/**
|
139
|
+
* 是否显示loading效果
|
140
|
+
*/
|
141
|
+
loadingOn?: string;
|
134
142
|
}
|
135
143
|
|
136
144
|
export interface AjaxActionSchema extends ButtonSchema {
|
@@ -416,44 +424,80 @@ export const createSyntheticEvent = <T extends Element, E extends Event>(
|
|
416
424
|
export interface ActionProps
|
417
425
|
extends Omit<
|
418
426
|
ButtonSchema,
|
419
|
-
'className' | 'iconClassName' | 'rightIconClassName'
|
427
|
+
'className' | 'iconClassName' | 'rightIconClassName' | 'loadingClassName'
|
420
428
|
>,
|
421
429
|
ThemeProps,
|
422
430
|
Omit<
|
423
431
|
AjaxActionSchema,
|
424
|
-
|
432
|
+
| 'type'
|
433
|
+
| 'className'
|
434
|
+
| 'iconClassName'
|
435
|
+
| 'rightIconClassName'
|
436
|
+
| 'loadingClassName'
|
425
437
|
>,
|
426
438
|
Omit<
|
427
439
|
UrlActionSchema,
|
428
|
-
|
440
|
+
| 'type'
|
441
|
+
| 'className'
|
442
|
+
| 'iconClassName'
|
443
|
+
| 'rightIconClassName'
|
444
|
+
| 'loadingClassName'
|
429
445
|
>,
|
430
446
|
Omit<
|
431
447
|
LinkActionSchema,
|
432
|
-
|
448
|
+
| 'type'
|
449
|
+
| 'className'
|
450
|
+
| 'iconClassName'
|
451
|
+
| 'rightIconClassName'
|
452
|
+
| 'loadingClassName'
|
433
453
|
>,
|
434
454
|
Omit<
|
435
455
|
DialogActionSchema,
|
436
|
-
|
456
|
+
| 'type'
|
457
|
+
| 'className'
|
458
|
+
| 'iconClassName'
|
459
|
+
| 'rightIconClassName'
|
460
|
+
| 'loadingClassName'
|
437
461
|
>,
|
438
462
|
Omit<
|
439
463
|
DrawerActionSchema,
|
440
|
-
|
464
|
+
| 'type'
|
465
|
+
| 'className'
|
466
|
+
| 'iconClassName'
|
467
|
+
| 'rightIconClassName'
|
468
|
+
| 'loadingClassName'
|
441
469
|
>,
|
442
470
|
Omit<
|
443
471
|
CopyActionSchema,
|
444
|
-
|
472
|
+
| 'type'
|
473
|
+
| 'className'
|
474
|
+
| 'iconClassName'
|
475
|
+
| 'rightIconClassName'
|
476
|
+
| 'loadingClassName'
|
445
477
|
>,
|
446
478
|
Omit<
|
447
479
|
ReloadActionSchema,
|
448
|
-
|
480
|
+
| 'type'
|
481
|
+
| 'className'
|
482
|
+
| 'iconClassName'
|
483
|
+
| 'rightIconClassName'
|
484
|
+
| 'loadingClassName'
|
449
485
|
>,
|
450
486
|
Omit<
|
451
487
|
EmailActionSchema,
|
452
|
-
|
488
|
+
| 'type'
|
489
|
+
| 'className'
|
490
|
+
| 'iconClassName'
|
491
|
+
| 'rightIconClassName'
|
492
|
+
| 'loadingClassName'
|
453
493
|
>,
|
454
494
|
Omit<
|
455
495
|
OtherActionSchema,
|
456
|
-
|
496
|
+
| 'type'
|
497
|
+
| 'className'
|
498
|
+
| 'iconClassName'
|
499
|
+
| 'rightIconClassName'
|
500
|
+
| 'loadingClassName'
|
457
501
|
> {
|
458
502
|
actionType: any;
|
459
503
|
onAction?: (
|
@@ -619,6 +663,7 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
619
663
|
iconClassName,
|
620
664
|
rightIcon,
|
621
665
|
rightIconClassName,
|
666
|
+
loadingClassName,
|
622
667
|
primary,
|
623
668
|
size,
|
624
669
|
level,
|
@@ -638,7 +683,10 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
638
683
|
isMenuItem,
|
639
684
|
active,
|
640
685
|
activeLevel,
|
686
|
+
tooltipTrigger,
|
641
687
|
tooltipContainer,
|
688
|
+
tooltipRootClose,
|
689
|
+
loading,
|
642
690
|
classnames: cx
|
643
691
|
} = this.props;
|
644
692
|
|
@@ -678,6 +726,8 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
678
726
|
? activeLevel
|
679
727
|
: level || (primary ? 'primary' : undefined)
|
680
728
|
}
|
729
|
+
loadingClassName={loadingClassName}
|
730
|
+
loading={loading}
|
681
731
|
onClick={this.handleAction}
|
682
732
|
type={type && ~allowedType.indexOf(type) ? type : 'button'}
|
683
733
|
disabled={disabled}
|
@@ -685,12 +735,14 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
685
735
|
overrideClassName={isMenuItem}
|
686
736
|
tooltip={filterContents(tooltip, data)}
|
687
737
|
disabledTip={filterContents(disabledTip, data)}
|
688
|
-
|
738
|
+
tooltipPlacement={tooltipPlacement}
|
689
739
|
tooltipContainer={tooltipContainer}
|
740
|
+
tooltipTrigger={tooltipTrigger}
|
741
|
+
tooltipRootClose={tooltipRootClose}
|
690
742
|
block={block}
|
691
743
|
iconOnly={!!(icon && !label && level !== 'link')}
|
692
744
|
>
|
693
|
-
{iconElement}
|
745
|
+
{!loading ? iconElement : ''}
|
694
746
|
{label ? <span>{filter(String(label), data)}</span> : null}
|
695
747
|
{rightIconElement}
|
696
748
|
</Button>
|
@@ -736,13 +788,14 @@ export class ActionRenderer extends React.Component<
|
|
736
788
|
}
|
737
789
|
|
738
790
|
render() {
|
739
|
-
const {env, disabled, btnDisabled, ...rest} = this.props;
|
791
|
+
const {env, disabled, btnDisabled, loading, ...rest} = this.props;
|
740
792
|
|
741
793
|
return (
|
742
794
|
<Action
|
743
795
|
{...(rest as any)}
|
744
796
|
disabled={disabled || btnDisabled}
|
745
797
|
onAction={this.handleAction}
|
798
|
+
loading={loading}
|
746
799
|
isCurrentUrl={this.isCurrentAction}
|
747
800
|
tooltipContainer={
|
748
801
|
env.getModalContainer ? env.getModalContainer : undefined
|
package/src/renderers/CRUD.tsx
CHANGED
@@ -1057,7 +1057,10 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1057
1057
|
(!stopAutoRefreshWhen ||
|
1058
1058
|
!(
|
1059
1059
|
(stopAutoRefreshWhenModalIsOpen && store.hasModalOpened) ||
|
1060
|
-
evalExpression(
|
1060
|
+
evalExpression(
|
1061
|
+
stopAutoRefreshWhen,
|
1062
|
+
createObject(store.data, store.query)
|
1063
|
+
)
|
1061
1064
|
)) &&
|
1062
1065
|
(this.timer = setTimeout(
|
1063
1066
|
silentPolling
|
@@ -1497,15 +1500,11 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1497
1500
|
hasBulkActions() {
|
1498
1501
|
const {bulkActions, itemActions, store} = this.props;
|
1499
1502
|
|
1500
|
-
if (
|
1501
|
-
(!bulkActions || !bulkActions.length) &&
|
1502
|
-
(!itemActions || !itemActions.length)
|
1503
|
-
) {
|
1503
|
+
if (!bulkActions || !bulkActions.length) {
|
1504
1504
|
return false;
|
1505
1505
|
}
|
1506
1506
|
|
1507
1507
|
let bulkBtns: Array<ActionSchema> = [];
|
1508
|
-
let itemBtns: Array<ActionSchema> = [];
|
1509
1508
|
const ctx = store.mergedData;
|
1510
1509
|
|
1511
1510
|
if (bulkActions && bulkActions.length) {
|
@@ -1517,21 +1516,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1517
1516
|
.filter(item => !item.hidden && item.visible !== false);
|
1518
1517
|
}
|
1519
1518
|
|
1520
|
-
|
1521
|
-
store.data,
|
1522
|
-
store.selectedItems.length ? store.selectedItems[0] : {}
|
1523
|
-
);
|
1524
|
-
|
1525
|
-
if (itemActions && itemActions.length) {
|
1526
|
-
itemBtns = itemActions
|
1527
|
-
.map(item => ({
|
1528
|
-
...item,
|
1529
|
-
...getExprProperties(item as Schema, itemData)
|
1530
|
-
}))
|
1531
|
-
.filter(item => !item.hidden && item.visible !== false);
|
1532
|
-
}
|
1533
|
-
|
1534
|
-
return bulkBtns.length || itemBtns.length;
|
1519
|
+
return bulkBtns.length;
|
1535
1520
|
}
|
1536
1521
|
|
1537
1522
|
renderBulkActions(childProps: any) {
|
@@ -1539,11 +1524,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1539
1524
|
|
1540
1525
|
const items = childProps.items;
|
1541
1526
|
|
1542
|
-
if (
|
1543
|
-
!items.length ||
|
1544
|
-
((!bulkActions || !bulkActions.length) &&
|
1545
|
-
(!itemActions || !itemActions.length))
|
1546
|
-
) {
|
1527
|
+
if (!items.length || !bulkActions || !bulkActions.length) {
|
1547
1528
|
return null;
|
1548
1529
|
}
|
1549
1530
|
|
@@ -1595,7 +1576,6 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1595
1576
|
render(
|
1596
1577
|
`bulk-action/${index}`,
|
1597
1578
|
{
|
1598
|
-
size: 'sm',
|
1599
1579
|
...omit(btn, ['visibleOn', 'hiddenOn', 'disabledOn']),
|
1600
1580
|
type: 'button',
|
1601
1581
|
ignoreConfirm: true
|
@@ -1619,7 +1599,6 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1619
1599
|
render(
|
1620
1600
|
`bulk-action/${index}`,
|
1621
1601
|
{
|
1622
|
-
size: 'sm',
|
1623
1602
|
...omit(btn, ['visibleOn', 'hiddenOn', 'disabledOn']),
|
1624
1603
|
type: 'button'
|
1625
1604
|
},
|
@@ -1776,16 +1755,17 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1776
1755
|
);
|
1777
1756
|
}
|
1778
1757
|
|
1779
|
-
renderExportCSV() {
|
1758
|
+
renderExportCSV(toolbar: Schema) {
|
1780
1759
|
const {
|
1781
1760
|
store,
|
1782
1761
|
classPrefix: ns,
|
1783
1762
|
classnames: cx,
|
1784
1763
|
translate: __,
|
1785
|
-
loadDataOnce
|
1786
|
-
api
|
1764
|
+
loadDataOnce
|
1787
1765
|
} = this.props;
|
1788
1766
|
|
1767
|
+
const api = (toolbar as Schema).api;
|
1768
|
+
|
1789
1769
|
return (
|
1790
1770
|
<Button
|
1791
1771
|
classPrefix={ns}
|
@@ -1797,7 +1777,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1797
1777
|
}
|
1798
1778
|
size="sm"
|
1799
1779
|
>
|
1800
|
-
{__('CRUD.exportCSV')}
|
1780
|
+
{toolbar.label || __('CRUD.exportCSV')}
|
1801
1781
|
</Button>
|
1802
1782
|
);
|
1803
1783
|
}
|
@@ -1827,7 +1807,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1827
1807
|
} else if (type === 'filter-toggler') {
|
1828
1808
|
return this.renderFilterToggler();
|
1829
1809
|
} else if (type === 'export-csv') {
|
1830
|
-
return this.renderExportCSV();
|
1810
|
+
return this.renderExportCSV(toolbar as Schema);
|
1831
1811
|
} else if (Array.isArray(toolbar)) {
|
1832
1812
|
const children: Array<any> = toolbar
|
1833
1813
|
.map((toolbar, index) => ({
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
SchemaCollection,
|
8
8
|
SchemaTpl
|
9
9
|
} from '../Schema';
|
10
|
+
import {isClickOnInput} from '../utils/helper';
|
10
11
|
|
11
12
|
/**
|
12
13
|
* Collapse 折叠渲染器,格式说明。
|
@@ -134,7 +135,10 @@ export default class Collapse extends React.Component<
|
|
134
135
|
}
|
135
136
|
}
|
136
137
|
|
137
|
-
toggleCollapsed() {
|
138
|
+
toggleCollapsed(e: React.MouseEvent<HTMLElement>) {
|
139
|
+
if (isClickOnInput(e)) {
|
140
|
+
return;
|
141
|
+
}
|
138
142
|
this.props.collapsable !== false &&
|
139
143
|
this.setState({
|
140
144
|
collapsed: !this.state.collapsed
|
package/src/renderers/Dialog.tsx
CHANGED
@@ -318,7 +318,7 @@ export default class Dialog extends React.Component<DialogProps> {
|
|
318
318
|
handleExited() {
|
319
319
|
const {lazySchema, store} = this.props;
|
320
320
|
if (isAlive(store)) {
|
321
|
-
store.
|
321
|
+
store.reset();
|
322
322
|
store.setEntered(false);
|
323
323
|
if (typeof lazySchema === 'function') {
|
324
324
|
store.setSchema('');
|
@@ -76,6 +76,15 @@ export interface DropdownButtonSchema extends BaseSchema {
|
|
76
76
|
* 是否只显示图标。
|
77
77
|
*/
|
78
78
|
iconOnly?: boolean;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* 触发条件,默认是 click
|
82
|
+
*/
|
83
|
+
trigger?: 'click' | 'hover';
|
84
|
+
/**
|
85
|
+
* 是否显示下拉按钮
|
86
|
+
*/
|
87
|
+
hideCaret?: boolean;
|
79
88
|
}
|
80
89
|
|
81
90
|
export interface DropDownButtonProps
|
@@ -266,7 +275,9 @@ export default class DropDownButton extends React.Component<
|
|
266
275
|
iconOnly,
|
267
276
|
icon,
|
268
277
|
isActived,
|
269
|
-
|
278
|
+
trigger,
|
279
|
+
data,
|
280
|
+
hideCaret
|
270
281
|
} = this.props;
|
271
282
|
|
272
283
|
return (
|
@@ -281,6 +292,8 @@ export default class DropDownButton extends React.Component<
|
|
281
292
|
},
|
282
293
|
className
|
283
294
|
)}
|
295
|
+
onMouseEnter={trigger === 'hover' ? this.open : () => {}}
|
296
|
+
onMouseLeave={trigger === 'hover' ? this.close : () => {}}
|
284
297
|
ref={this.domRef}
|
285
298
|
>
|
286
299
|
<TooltipWrapper
|
@@ -317,9 +330,13 @@ export default class DropDownButton extends React.Component<
|
|
317
330
|
)
|
318
331
|
) : null}
|
319
332
|
{typeof label === 'string' ? filter(label, data) : label}
|
320
|
-
|
321
|
-
|
322
|
-
|
333
|
+
{
|
334
|
+
!hideCaret
|
335
|
+
? <span className={cx('DropDown-caret')} >
|
336
|
+
<Icon icon="caret" className="icon" />
|
337
|
+
</span>
|
338
|
+
: null
|
339
|
+
}
|
323
340
|
</button>
|
324
341
|
</TooltipWrapper>
|
325
342
|
{this.state.isOpened ? this.renderOuter() : null}
|
@@ -108,6 +108,9 @@ export default class ButtonGroupControl extends React.Component<
|
|
108
108
|
className: cx(option.className, btnClassName),
|
109
109
|
disabled: option.disabled || disabled,
|
110
110
|
onClick: (e: React.UIEvent<any>) => {
|
111
|
+
if (disabled) {
|
112
|
+
return;
|
113
|
+
}
|
111
114
|
this.handleToggle(option);
|
112
115
|
e.preventDefault(); // 禁止 onAction 触发
|
113
116
|
}
|