amis 1.5.8-beta.2 → 1.6.0
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/CalendarMobile.js +5 -5
- package/lib/components/CalendarMobile.js.map +2 -2
- package/lib/components/Card.d.ts +20 -20
- package/lib/components/Cascader.d.ts +123 -0
- package/lib/components/Cascader.js +487 -0
- package/lib/components/Cascader.js.map +13 -0
- package/lib/components/CityArea.d.ts +527 -0
- package/lib/components/CityArea.js +177 -0
- package/lib/components/CityArea.js.map +13 -0
- package/lib/components/ColorPicker.js +4 -3
- package/lib/components/ColorPicker.js.map +2 -2
- package/lib/components/DatePicker.d.ts +85 -84
- package/lib/components/DatePicker.js +7 -6
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.js +8 -11
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/MonthRangePicker.js +5 -8
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/Picker.d.ts +1 -0
- package/lib/components/Picker.js +10 -6
- package/lib/components/Picker.js.map +2 -2
- package/lib/components/PickerColumn.d.ts +1 -0
- package/lib/components/PickerColumn.js +21 -17
- package/lib/components/PickerColumn.js.map +2 -2
- package/lib/components/PopOverContainer.d.ts +1 -0
- package/lib/components/PopOverContainer.js +5 -3
- package/lib/components/PopOverContainer.js.map +2 -2
- package/lib/components/PopUp.d.ts +1040 -28
- package/lib/components/PopUp.js +32 -8
- package/lib/components/PopUp.js.map +2 -2
- package/lib/components/ResultBox.d.ts +85 -84
- package/lib/components/ResultBox.js +7 -3
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/Select.js +9 -6
- package/lib/components/Select.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +85 -84
- package/lib/components/TransferDropDown.js +9 -6
- package/lib/components/TransferDropDown.js.map +2 -2
- package/lib/components/calendar/Calendar.d.ts +14 -0
- package/lib/components/calendar/Calendar.js +62 -5
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/calendar/DaysView.d.ts +20 -0
- package/lib/components/calendar/DaysView.js +51 -4
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/calendar/MonthsView.d.ts +7 -1
- package/lib/components/calendar/MonthsView.js +41 -52
- package/lib/components/calendar/MonthsView.js.map +2 -2
- package/lib/components/calendar/TimeView.d.ts +27 -20
- package/lib/components/calendar/TimeView.js +40 -4
- package/lib/components/calendar/TimeView.js.map +2 -2
- package/lib/components/calendar/YearsView.d.ts +6 -0
- package/lib/components/calendar/YearsView.js +15 -6
- package/lib/components/calendar/YearsView.js.map +2 -2
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +4 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +4 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +4 -0
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +11 -2
- package/lib/renderers/DropDownButton.js +30 -12
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/CityDB.js +526 -2
- package/lib/renderers/Form/CityDB.js.map +2 -2
- package/lib/renderers/Form/InputCity.d.ts +85 -84
- package/lib/renderers/Form/InputCity.js +4 -2
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputColor.js +6 -2
- package/lib/renderers/Form/InputColor.js.map +2 -2
- package/lib/renderers/Form/InputDate.js +5 -2
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.js +6 -2
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +10 -14
- package/lib/renderers/Form/Item.js +7 -5
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/NestedSelect.d.ts +1 -0
- package/lib/renderers/Form/NestedSelect.js +7 -3
- package/lib/renderers/Form/NestedSelect.js.map +2 -2
- package/lib/renderers/Form/Select.d.ts +2 -0
- package/lib/renderers/Form/Select.js +7 -4
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.js +4 -4
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Remark.js +2 -1
- package/lib/renderers/Remark.js.map +2 -2
- package/lib/schemaExtend.js +23 -9
- package/lib/schemaExtend.js.map +2 -2
- package/lib/themes/ang-ie11.css +312 -29
- package/lib/themes/ang.css +312 -29
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +312 -29
- package/lib/themes/antd.css +312 -29
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +315 -41
- package/lib/themes/cxd.css +315 -41
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +312 -29
- package/lib/themes/dark.css +312 -29
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +315 -41
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/helper.d.ts +1 -6
- package/lib/utils/helper.js +6 -17
- package/lib/utils/helper.js.map +2 -2
- package/package.json +1 -2
- package/schema.json +2192 -20
- package/scss/_properties.scss +10 -6
- package/scss/components/_calendar.scss +9 -2
- package/scss/components/_cascader.scss +102 -0
- package/scss/components/_city-area.scss +27 -0
- package/scss/components/_dropdown.scss +39 -9
- package/scss/components/_picker-columns.scss +15 -5
- package/scss/components/_popup.scss +35 -12
- package/scss/components/_result-box.scss +31 -0
- package/scss/components/form/_checks.scss +2 -0
- package/scss/components/form/_color.scss +2 -2
- package/scss/components/form/_date-range.scss +1 -1
- package/scss/components/form/_date.scss +46 -1
- package/scss/components/form/_nested-select.scss +3 -0
- package/scss/components/form/_select.scss +32 -3
- package/scss/components/form/_transfer.scss +3 -0
- package/scss/components/form/_tree-select.scss +1 -1
- package/scss/themes/_common.scss +2 -0
- package/scss/themes/_cxd-variables.scss +3 -3
- package/scss/themes/cxd.scss +0 -12
- package/sdk/ang-ie11.css +368 -29
- package/sdk/ang.css +367 -30
- package/sdk/antd-ie11.css +368 -29
- package/sdk/antd.css +367 -30
- package/sdk/charts.js +18 -18
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +3 -3
- package/sdk/cxd-ie11.css +370 -42
- package/sdk/cxd.css +370 -44
- package/sdk/dark-ie11.css +368 -29
- package/sdk/dark.css +367 -30
- package/sdk/exceljs.js +1 -1
- package/sdk/locale/de-DE.js +4 -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 +18 -18
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +370 -42
- package/sdk/sdk.css +370 -44
- package/sdk/sdk.js +1309 -1227
- package/sdk/thirds/hls.js/hls.js +18 -18
- package/sdk/thirds/mpegts.js/mpegts.js +2 -2
- package/sdk/tinymce.js +57 -57
- package/src/components/CalendarMobile.tsx +5 -5
- package/src/components/Cascader.tsx +564 -0
- package/src/components/CityArea.tsx +315 -0
- package/src/components/ColorPicker.tsx +5 -2
- package/src/components/DatePicker.tsx +15 -5
- package/src/components/DateRangePicker.tsx +52 -43
- package/src/components/MonthRangePicker.tsx +44 -38
- package/src/components/Picker.tsx +27 -12
- package/src/components/PickerColumn.tsx +28 -18
- package/src/components/PopOverContainer.tsx +31 -17
- package/src/components/PopUp.tsx +55 -13
- package/src/components/ResultBox.tsx +10 -1
- package/src/components/Select.tsx +20 -23
- package/src/components/TransferDropDown.tsx +19 -5
- package/src/components/calendar/Calendar.tsx +86 -9
- package/src/components/calendar/DaysView.tsx +86 -2
- package/src/components/calendar/MonthsView.tsx +56 -63
- package/src/components/calendar/TimeView.tsx +82 -29
- package/src/components/calendar/YearsView.tsx +25 -6
- package/src/locale/de-DE.ts +4 -0
- package/src/locale/en-US.ts +4 -0
- package/src/locale/zh-CN.ts +4 -0
- package/src/renderers/DropDownButton.tsx +69 -35
- package/src/renderers/Form/CityDB.ts +526 -2
- package/src/renderers/Form/InputCity.tsx +23 -3
- package/src/renderers/Form/InputColor.tsx +21 -2
- package/src/renderers/Form/InputDate.tsx +10 -1
- package/src/renderers/Form/InputDateRange.tsx +9 -1
- package/src/renderers/Form/Item.tsx +14 -4
- package/src/renderers/Form/NestedSelect.tsx +31 -3
- package/src/renderers/Form/Select.tsx +15 -2
- package/src/renderers/Form/TreeSelect.tsx +10 -6
- package/src/renderers/Remark.tsx +2 -1
- package/src/schemaExtend.ts +22 -10
- package/src/utils/helper.ts +6 -16
@@ -6,6 +6,7 @@ import 'moment/locale/zh-cn';
|
|
6
6
|
import DateRangePicker, {
|
7
7
|
DateRangePicker as BaseDateRangePicker
|
8
8
|
} from '../../components/DateRangePicker';
|
9
|
+
import {isMobile} from '../../utils/helper';
|
9
10
|
|
10
11
|
/**
|
11
12
|
* DateRange 日期范围控件
|
@@ -173,14 +174,21 @@ export default class DateRangeControl extends React.Component<DateRangeProps> {
|
|
173
174
|
data,
|
174
175
|
format,
|
175
176
|
env,
|
177
|
+
useMobileUI,
|
176
178
|
...rest
|
177
179
|
} = this.props;
|
178
|
-
|
180
|
+
const mobileUI = useMobileUI && isMobile();
|
179
181
|
return (
|
180
182
|
<div className={cx(`${ns}DateRangeControl`, className)}>
|
181
183
|
<DateRangePicker
|
182
184
|
{...rest}
|
185
|
+
useMobileUI={useMobileUI}
|
183
186
|
classPrefix={ns}
|
187
|
+
popOverContainer={
|
188
|
+
mobileUI && env && env.getModalContainer
|
189
|
+
? env.getModalContainer
|
190
|
+
: undefined
|
191
|
+
}
|
184
192
|
data={data}
|
185
193
|
format={format}
|
186
194
|
minDate={minDate ? filterDate(minDate, data, format) : undefined}
|
@@ -9,7 +9,13 @@ import {
|
|
9
9
|
TestFunc,
|
10
10
|
RendererConfig
|
11
11
|
} from '../../factory';
|
12
|
-
import {
|
12
|
+
import {
|
13
|
+
anyChanged,
|
14
|
+
ucFirst,
|
15
|
+
getWidthRate,
|
16
|
+
autobind,
|
17
|
+
isMobile
|
18
|
+
} from '../../utils/helper';
|
13
19
|
import {observer} from 'mobx-react';
|
14
20
|
import {FormHorizontal, FormSchema, FormSchemaHorizontal} from '.';
|
15
21
|
import {Api, Schema} from '../../types';
|
@@ -456,9 +462,11 @@ export class FormItemWrap extends React.Component<FormItemProps> {
|
|
456
462
|
sizeMutable,
|
457
463
|
size,
|
458
464
|
defaultSize,
|
465
|
+
useMobileUI,
|
459
466
|
...rest
|
460
467
|
} = this.props;
|
461
468
|
|
469
|
+
const mobileUI = useMobileUI && isMobile();
|
462
470
|
if (renderControl) {
|
463
471
|
const controlSize = size || defaultSize;
|
464
472
|
return renderControl({
|
@@ -470,7 +478,7 @@ export class FormItemWrap extends React.Component<FormItemProps> {
|
|
470
478
|
className: cx(
|
471
479
|
`Form-control`,
|
472
480
|
{
|
473
|
-
'is-inline': !!rest.inline,
|
481
|
+
'is-inline': !!rest.inline && !mobileUI,
|
474
482
|
'is-error': model && !model.valid,
|
475
483
|
[`Form-control--withSize Form-control--size${ucFirst(
|
476
484
|
controlSize
|
@@ -1205,14 +1213,16 @@ export function asFormItem(config: Omit<FormItemConfig, 'component'>) {
|
|
1205
1213
|
type,
|
1206
1214
|
size,
|
1207
1215
|
defaultSize,
|
1216
|
+
useMobileUI,
|
1208
1217
|
...rest
|
1209
1218
|
} = this.props;
|
1210
1219
|
|
1211
1220
|
const controlSize = size || defaultSize;
|
1212
|
-
|
1221
|
+
const mobileUI = useMobileUI && isMobile();
|
1213
1222
|
return (
|
1214
1223
|
<Control
|
1215
1224
|
{...rest}
|
1225
|
+
useMobileUI={useMobileUI}
|
1216
1226
|
onOpenDialog={this.handleOpenDialog}
|
1217
1227
|
size={config.sizeMutable !== false ? undefined : size}
|
1218
1228
|
onFocus={this.handleFocus}
|
@@ -1225,7 +1235,7 @@ export function asFormItem(config: Omit<FormItemConfig, 'component'>) {
|
|
1225
1235
|
className={cx(
|
1226
1236
|
`Form-control`,
|
1227
1237
|
{
|
1228
|
-
'is-inline': !!rest.inline,
|
1238
|
+
'is-inline': !!rest.inline && !mobileUI,
|
1229
1239
|
'is-error': model && !model.valid,
|
1230
1240
|
[`Form-control--withSize Form-control--size${ucFirst(
|
1231
1241
|
controlSize
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import Overlay from '../../components/Overlay';
|
3
3
|
import Checkbox from '../../components/Checkbox';
|
4
4
|
import PopOver from '../../components/PopOver';
|
5
|
+
import PopUp from '../../components/PopUp';
|
5
6
|
import {Icon} from '../../components/icons';
|
6
7
|
import {
|
7
8
|
autobind,
|
@@ -10,7 +11,8 @@ import {
|
|
10
11
|
string2regExp,
|
11
12
|
getTreeAncestors,
|
12
13
|
getTreeParent,
|
13
|
-
ucFirst
|
14
|
+
ucFirst,
|
15
|
+
isMobile
|
14
16
|
} from '../../utils/helper';
|
15
17
|
import {
|
16
18
|
FormOptionsControl,
|
@@ -24,6 +26,7 @@ import xor from 'lodash/xor';
|
|
24
26
|
import union from 'lodash/union';
|
25
27
|
import compact from 'lodash/compact';
|
26
28
|
import {RootClose} from '../../utils/RootClose';
|
29
|
+
import Cascader from '../../components/Cascader';
|
27
30
|
|
28
31
|
/**
|
29
32
|
* Nested Select
|
@@ -68,6 +71,7 @@ export interface NestedSelectProps extends OptionsControlProps {
|
|
68
71
|
withChildren?: boolean;
|
69
72
|
onlyChildren?: boolean;
|
70
73
|
hideNodePathLabel?: boolean;
|
74
|
+
useMobileUI?: boolean;
|
71
75
|
}
|
72
76
|
|
73
77
|
export interface NestedSelectState {
|
@@ -625,12 +629,16 @@ export default class NestedSelectControl extends React.Component<
|
|
625
629
|
selectedOptions,
|
626
630
|
clearable,
|
627
631
|
loading,
|
628
|
-
borderMode
|
632
|
+
borderMode,
|
633
|
+
useMobileUI,
|
634
|
+
env
|
629
635
|
} = this.props;
|
630
636
|
|
637
|
+
const mobileUI = useMobileUI && isMobile();
|
631
638
|
return (
|
632
639
|
<div className={cx('NestedSelectControl', className)}>
|
633
640
|
<ResultBox
|
641
|
+
useMobileUI={useMobileUI}
|
634
642
|
disabled={disabled}
|
635
643
|
ref={this.domRef}
|
636
644
|
placeholder={__(placeholder || '空')}
|
@@ -665,7 +673,27 @@ export default class NestedSelectControl extends React.Component<
|
|
665
673
|
>
|
666
674
|
{loading ? <Spinner size="sm" /> : undefined}
|
667
675
|
</ResultBox>
|
668
|
-
{
|
676
|
+
{mobileUI ? (
|
677
|
+
<PopUp
|
678
|
+
className={cx(`NestedSelect-popup`)}
|
679
|
+
container={
|
680
|
+
env && env.getModalContainer ? env.getModalContainer : undefined
|
681
|
+
}
|
682
|
+
isShow={this.state.isOpened}
|
683
|
+
onHide={this.close}
|
684
|
+
showConfirm={false}
|
685
|
+
showClose={false}
|
686
|
+
>
|
687
|
+
<Cascader
|
688
|
+
onClose={this.close}
|
689
|
+
{...this.props}
|
690
|
+
options={this.props.options.slice()}
|
691
|
+
value={selectedOptions}
|
692
|
+
/>
|
693
|
+
</PopUp>
|
694
|
+
) : this.state.isOpened ? (
|
695
|
+
this.renderOuter()
|
696
|
+
) : null}
|
669
697
|
</div>
|
670
698
|
);
|
671
699
|
}
|
@@ -11,7 +11,7 @@ import find from 'lodash/find';
|
|
11
11
|
import debouce from 'lodash/debounce';
|
12
12
|
import {Api} from '../../types';
|
13
13
|
import {isEffectiveApi} from '../../utils/api';
|
14
|
-
import {isEmpty, createObject, autobind} from '../../utils/helper';
|
14
|
+
import {isEmpty, createObject, autobind, isMobile} from '../../utils/helper';
|
15
15
|
import {dataMapping} from '../../utils/tpl-builtin';
|
16
16
|
import {SchemaApi} from '../../Schema';
|
17
17
|
import Spinner from '../../components/Spinner';
|
@@ -91,6 +91,7 @@ export interface SelectProps extends OptionsControlProps {
|
|
91
91
|
autoComplete?: Api;
|
92
92
|
searchable?: boolean;
|
93
93
|
defaultOpen?: boolean;
|
94
|
+
useMobileUI?: boolean;
|
94
95
|
}
|
95
96
|
|
96
97
|
export default class SelectControl extends React.Component<SelectProps, any> {
|
@@ -298,6 +299,7 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
|
298
299
|
borderMode,
|
299
300
|
selectMode,
|
300
301
|
env,
|
302
|
+
useMobileUI,
|
301
303
|
...rest
|
302
304
|
} = this.props;
|
303
305
|
|
@@ -305,6 +307,8 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
|
305
307
|
noResultsText = render('noResultText', noResultsText);
|
306
308
|
}
|
307
309
|
|
310
|
+
const mobileUI = useMobileUI && isMobile();
|
311
|
+
|
308
312
|
return (
|
309
313
|
<div className={cx(`${classPrefix}SelectControl`, className)}>
|
310
314
|
{['table', 'list', 'group', 'tree', 'chained', 'associated'].includes(
|
@@ -314,6 +318,12 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
|
314
318
|
) : (
|
315
319
|
<Select
|
316
320
|
{...rest}
|
321
|
+
useMobileUI={useMobileUI}
|
322
|
+
popOverContainer={
|
323
|
+
mobileUI && env && env.getModalContainer
|
324
|
+
? env.getModalContainer
|
325
|
+
: undefined
|
326
|
+
}
|
317
327
|
borderMode={borderMode}
|
318
328
|
placeholder={placeholder}
|
319
329
|
multiple={multiple || multi}
|
@@ -347,6 +357,7 @@ export interface TransferDropDownProps
|
|
347
357
|
| 'descriptionClassName'
|
348
358
|
> {
|
349
359
|
borderMode?: 'full' | 'half' | 'none';
|
360
|
+
useMobileUI?: boolean;
|
350
361
|
}
|
351
362
|
|
352
363
|
class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProps> {
|
@@ -367,7 +378,8 @@ class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProp
|
|
367
378
|
multiple,
|
368
379
|
columns,
|
369
380
|
leftMode,
|
370
|
-
borderMode
|
381
|
+
borderMode,
|
382
|
+
useMobileUI
|
371
383
|
} = this.props;
|
372
384
|
|
373
385
|
// 目前 LeftOptions 没有接口可以动态加载
|
@@ -407,6 +419,7 @@ class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProp
|
|
407
419
|
leftMode={leftMode}
|
408
420
|
leftOptions={leftOptions}
|
409
421
|
borderMode={borderMode}
|
422
|
+
useMobileUI={useMobileUI}
|
410
423
|
/>
|
411
424
|
|
412
425
|
<Spinner overlay key="info" show={loading} />
|
@@ -568,12 +568,13 @@ export default class TreeSelectControl extends React.Component<
|
|
568
568
|
selectedOptions,
|
569
569
|
placeholder,
|
570
570
|
popOverContainer,
|
571
|
-
|
572
|
-
translate: __
|
571
|
+
useMobileUI,
|
572
|
+
translate: __,
|
573
|
+
env
|
573
574
|
} = this.props;
|
574
575
|
|
575
576
|
const {isOpened} = this.state;
|
576
|
-
const
|
577
|
+
const mobileUI = useMobileUI && isMobile();
|
577
578
|
return (
|
578
579
|
<div ref={this.container} className={cx(`TreeSelectControl`, className)}>
|
579
580
|
<ResultBox
|
@@ -612,7 +613,7 @@ export default class TreeSelectControl extends React.Component<
|
|
612
613
|
>
|
613
614
|
{loading ? <Spinner size="sm" /> : undefined}
|
614
615
|
</ResultBox>
|
615
|
-
{!
|
616
|
+
{!mobileUI && isOpened ? (
|
616
617
|
<Overlay
|
617
618
|
container={popOverContainer || (() => this.container.current)}
|
618
619
|
target={() => this.target}
|
@@ -631,15 +632,18 @@ export default class TreeSelectControl extends React.Component<
|
|
631
632
|
</PopOver>
|
632
633
|
</Overlay>
|
633
634
|
) : null}
|
634
|
-
{
|
635
|
+
{mobileUI ? (
|
635
636
|
<PopUp
|
637
|
+
container={
|
638
|
+
env && env.getModalContainer ? env.getModalContainer : undefined
|
639
|
+
}
|
636
640
|
className={cx(`${ns}TreeSelect-popup`)}
|
637
641
|
isShow={isOpened}
|
638
642
|
onHide={this.close}
|
639
643
|
>
|
640
644
|
{this.renderOuter()}
|
641
645
|
</PopUp>
|
642
|
-
)}
|
646
|
+
) : null}
|
643
647
|
</div>
|
644
648
|
);
|
645
649
|
}
|
package/src/renderers/Remark.tsx
CHANGED
package/src/schemaExtend.ts
CHANGED
@@ -18,15 +18,22 @@ addSchemaFilter(function (schema: Schema, renderer, props?: any) {
|
|
18
18
|
const arr: Array<any> = [];
|
19
19
|
Object.keys(value).forEach(key => {
|
20
20
|
const valueType = typeof value[key];
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
if (key.endsWith('___tmp')) {
|
22
|
+
arr.push({
|
23
|
+
key: key.replace('___tmp', ''),
|
24
|
+
value: ''
|
25
|
+
});
|
26
|
+
} else {
|
27
|
+
arr.push({
|
28
|
+
key: key || '',
|
29
|
+
value:
|
30
|
+
valueType === 'string' ||
|
31
|
+
valueType === 'number' ||
|
32
|
+
valueType === 'boolean'
|
33
|
+
? value[key]
|
34
|
+
: JSON.stringify(value[key])
|
35
|
+
});
|
36
|
+
}
|
30
37
|
});
|
31
38
|
return arr;
|
32
39
|
},
|
@@ -41,7 +48,12 @@ addSchemaFilter(function (schema: Schema, renderer, props?: any) {
|
|
41
48
|
try {
|
42
49
|
value = JSON.parse(value);
|
43
50
|
} catch (e) {}
|
44
|
-
|
51
|
+
// 如果先输入了 a 作为 key,想输入 aa 的时候会先进入这里,导致无法输入 aa,因此当遇到 key 相同的时候加个 ___tmp 后缀
|
52
|
+
if (key in obj && typeof value === 'undefined') {
|
53
|
+
obj[key + '___tmp'] = '';
|
54
|
+
} else {
|
55
|
+
obj[key] = value;
|
56
|
+
}
|
45
57
|
});
|
46
58
|
return obj;
|
47
59
|
},
|
package/src/utils/helper.ts
CHANGED
@@ -1585,30 +1585,20 @@ export function JSONTraverse(
|
|
1585
1585
|
});
|
1586
1586
|
}
|
1587
1587
|
|
1588
|
-
export function
|
1588
|
+
export function convertArrayValueToMoment(
|
1589
1589
|
value: number[],
|
1590
1590
|
types: string[],
|
1591
|
-
|
1592
|
-
): moment.Moment
|
1593
|
-
if (value.length === 0) return
|
1591
|
+
mom: moment.Moment
|
1592
|
+
): moment.Moment {
|
1593
|
+
if (value.length === 0) return mom;
|
1594
1594
|
for (let i = 0; i < types.length; i++) {
|
1595
1595
|
const type = types[i];
|
1596
1596
|
// @ts-ignore
|
1597
|
-
|
1597
|
+
mom.set(type, value[i]);
|
1598
1598
|
}
|
1599
|
-
return
|
1599
|
+
return mom;
|
1600
1600
|
}
|
1601
1601
|
|
1602
|
-
export function convertDateToObject(value: moment.Moment) {
|
1603
|
-
if (value) {
|
1604
|
-
return {
|
1605
|
-
year: value.year(),
|
1606
|
-
month: parseInt(value.format('MM'), 10),
|
1607
|
-
day: parseInt(value.format('DD'), 10)
|
1608
|
-
};
|
1609
|
-
}
|
1610
|
-
return value;
|
1611
|
-
}
|
1612
1602
|
|
1613
1603
|
export function getRange(min: number, max: number, step: number = 1) {
|
1614
1604
|
const arr = [];
|