amis 1.9.1-beta.21 → 1.10.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/ResultBox.js +3 -1
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/Select.js +1 -1
- package/lib/components/Select.js.map +2 -2
- package/lib/components/formula/Editor.js +3 -2
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/Picker.js +2 -2
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/components/formula/VariableList.js +2 -2
- package/lib/components/formula/VariableList.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/renderers/Form/ConditionBuilder.js +8 -1
- package/lib/renderers/Form/ConditionBuilder.js.map +2 -2
- package/lib/renderers/Form/InputTag.d.ts +1 -1
- package/lib/renderers/Form/InputTag.js.map +1 -1
- package/lib/renderers/Form/Select.d.ts +6 -1
- package/lib/renderers/Form/Select.js +3 -1
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +1 -0
- package/lib/renderers/Table/index.js +18 -0
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tpl.d.ts +4 -0
- package/lib/renderers/Tpl.js +6 -3
- package/lib/renderers/Tpl.js.map +2 -2
- package/lib/themes/ang-ie11.css +13 -1
- package/lib/themes/ang.css +13 -1
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +13 -1
- package/lib/themes/antd.css +13 -1
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +13 -1
- package/lib/themes/cxd.css +13 -1
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +13 -1
- package/lib/themes/dark.css +13 -1
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +13 -1
- package/lib/themes/default.css +13 -1
- package/lib/themes/default.css.map +1 -1
- package/package.json +1 -1
- package/schema.json +22 -16
- package/scss/components/_formula.scss +4 -1
- package/scss/components/form/_select.scss +10 -0
- package/sdk/ang-ie11.css +14 -1
- package/sdk/ang.css +14 -1
- package/sdk/antd-ie11.css +14 -1
- package/sdk/antd.css +14 -1
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +14 -1
- package/sdk/cxd.css +14 -1
- package/sdk/dark-ie11.css +14 -1
- package/sdk/dark.css +14 -1
- package/sdk/exceljs.js +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 +16 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +14 -1
- package/sdk/sdk.css +14 -1
- package/sdk/sdk.js +1333 -1333
- 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/components/ResultBox.tsx +3 -1
- package/src/components/Select.tsx +6 -1
- package/src/components/formula/Editor.tsx +3 -2
- package/src/components/formula/Picker.tsx +2 -2
- package/src/components/formula/VariableList.tsx +2 -2
- package/src/renderers/Form/ConditionBuilder.tsx +16 -0
- package/src/renderers/Form/InputTag.tsx +1 -1
- package/src/renderers/Form/Select.tsx +10 -2
- package/src/renderers/Table/index.tsx +21 -1
- package/src/renderers/Tpl.tsx +11 -1
@@ -215,6 +215,8 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
215
215
|
} = this.props;
|
216
216
|
const isFocused = this.state.isFocused;
|
217
217
|
const mobileUI = useMobileUI && isMobile();
|
218
|
+
/** 不需要透传给Input的属性 */
|
219
|
+
const omitPropsList = ['maxTagCount', 'overflowTagPopover'];
|
218
220
|
|
219
221
|
return (
|
220
222
|
<div
|
@@ -248,7 +250,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
248
250
|
|
249
251
|
{allowInput && !disabled ? (
|
250
252
|
<Input
|
251
|
-
{...rest}
|
253
|
+
{...omit(rest, omitPropsList)}
|
252
254
|
onKeyPress={onKeyPress}
|
253
255
|
ref={this.inputRef}
|
254
256
|
value={value || ''}
|
@@ -1076,7 +1076,12 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
1076
1076
|
{item.tip}
|
1077
1077
|
</Checkbox>
|
1078
1078
|
) : (
|
1079
|
-
<span
|
1079
|
+
<span
|
1080
|
+
className={cx('Select-option-content')}
|
1081
|
+
title={
|
1082
|
+
typeof item[labelField] === 'string' ? item[labelField] : ''
|
1083
|
+
}
|
1084
|
+
>
|
1080
1085
|
{item.disabled
|
1081
1086
|
? item[labelField]
|
1082
1087
|
: highlight(
|
@@ -167,7 +167,8 @@ export class FormulaEditor extends React.Component<
|
|
167
167
|
let from = 0;
|
168
168
|
let idx = -1;
|
169
169
|
while (~(idx = content.indexOf(v, from))) {
|
170
|
-
|
170
|
+
const curNameEg = new RegExp(`\\b${v}\\b`, 'g'); // 避免变量识别冲突,比如:name、me 被识别成 na「me」
|
171
|
+
html = html.replace(curNameEg, `<span class="c-field">${varMap[v]}</span>`);
|
171
172
|
from = idx + v.length;
|
172
173
|
}
|
173
174
|
});
|
@@ -229,7 +230,7 @@ export class FormulaEditor extends React.Component<
|
|
229
230
|
handleVariableSelect(item: VariableItem) {
|
230
231
|
const {evalMode, selfVariableName} = this.props;
|
231
232
|
|
232
|
-
if (item && item.
|
233
|
+
if (item && item.value && selfVariableName === item.value) {
|
233
234
|
toast.warning('不能使用当前变量[self],避免循环引用。');
|
234
235
|
return;
|
235
236
|
}
|
@@ -268,13 +268,13 @@ export class FormulaPicker extends React.Component<
|
|
268
268
|
classnames: cx,
|
269
269
|
translate: __,
|
270
270
|
disabled,
|
271
|
-
allowInput,
|
271
|
+
allowInput = true,
|
272
272
|
className,
|
273
273
|
onChange,
|
274
274
|
size,
|
275
275
|
borderMode,
|
276
276
|
placeholder,
|
277
|
-
mode,
|
277
|
+
mode = 'input-button',
|
278
278
|
btnLabel,
|
279
279
|
level,
|
280
280
|
btnSize,
|
@@ -48,7 +48,7 @@ function VariableList(props: VariableListProps) {
|
|
48
48
|
return (
|
49
49
|
<span className={cx(`${classPrefix}-item`, itemClassName)}>
|
50
50
|
{
|
51
|
-
option.label && option.
|
51
|
+
option.label && option.value === selfVariableName && (
|
52
52
|
<Badge
|
53
53
|
classnames={cx}
|
54
54
|
badge={{
|
@@ -67,7 +67,7 @@ function VariableList(props: VariableListProps) {
|
|
67
67
|
)
|
68
68
|
}
|
69
69
|
{
|
70
|
-
option.label && option.
|
70
|
+
option.label && option.value !== selfVariableName && (
|
71
71
|
<label>
|
72
72
|
{option.label}
|
73
73
|
</label>
|
@@ -11,6 +11,10 @@ import {
|
|
11
11
|
} from '../../components/WithRemoteConfig';
|
12
12
|
import {Schema} from '../../types';
|
13
13
|
import {autobind} from '../../utils/helper';
|
14
|
+
import {
|
15
|
+
isPureVariable,
|
16
|
+
resolveVariableAndFilter
|
17
|
+
} from '../../utils/tpl-builtin';
|
14
18
|
|
15
19
|
/**
|
16
20
|
* 条件组合控件
|
@@ -72,11 +76,23 @@ export default class ConditionBuilderControl extends React.PureComponent<Conditi
|
|
72
76
|
render() {
|
73
77
|
const {className, classnames: cx, ...rest} = this.props;
|
74
78
|
|
79
|
+
// 处理一下formula类型值的变量列表
|
80
|
+
let formula = this.props.formula ? {...this.props.formula} : undefined;
|
81
|
+
if (formula && formula.variables && isPureVariable(formula.variables)) {
|
82
|
+
// 如果 variables 是 ${xxx} 这种形式,将其处理成实际的值
|
83
|
+
formula.variables = resolveVariableAndFilter(
|
84
|
+
formula.variables,
|
85
|
+
this.props.data,
|
86
|
+
'| raw'
|
87
|
+
);
|
88
|
+
}
|
89
|
+
|
75
90
|
return (
|
76
91
|
<div className={cx(`ConditionBuilderControl`, className)}>
|
77
92
|
<ConditionBuilderWithRemoteOptions
|
78
93
|
renderEtrValue={this.renderEtrValue}
|
79
94
|
{...rest}
|
95
|
+
formula={formula}
|
80
96
|
/>
|
81
97
|
</div>
|
82
98
|
);
|
@@ -19,6 +19,7 @@ import {BaseTransferRenderer, TransferControlSchema} from './Transfer';
|
|
19
19
|
import TransferDropDown from '../../components/TransferDropDown';
|
20
20
|
|
21
21
|
import type {TooltipObject} from '../../components/TooltipWrapper';
|
22
|
+
import type {SchemaClassName} from '../../Schema';
|
22
23
|
|
23
24
|
/**
|
24
25
|
* Select 下拉选择框。
|
@@ -121,7 +122,12 @@ export interface SelectControlSchema extends FormOptionsControl {
|
|
121
122
|
/**
|
122
123
|
* 收纳标签的Popover配置
|
123
124
|
*/
|
124
|
-
overflowTagPopover
|
125
|
+
overflowTagPopover?: object;
|
126
|
+
|
127
|
+
/**
|
128
|
+
* 选项的自定义CSS类名
|
129
|
+
*/
|
130
|
+
optionClassName?: SchemaClassName;
|
125
131
|
}
|
126
132
|
|
127
133
|
export interface SelectProps extends OptionsControlProps {
|
@@ -349,9 +355,11 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
|
349
355
|
|
350
356
|
@autobind
|
351
357
|
renderMenu(option: Option, state: any) {
|
352
|
-
const {menuTpl, render, data} = this.props;
|
358
|
+
const {menuTpl, render, data, optionClassName} = this.props;
|
353
359
|
|
354
360
|
return render(`menu/${state.index}`, menuTpl, {
|
361
|
+
showNativeTitle: true,
|
362
|
+
className: cx('Select-option-content', optionClassName),
|
355
363
|
data: createObject(createObject(data, state), option)
|
356
364
|
});
|
357
365
|
}
|
@@ -2797,6 +2797,26 @@ export default class Table extends React.Component<TableProps, object> {
|
|
2797
2797
|
storeType: TableStore.name,
|
2798
2798
|
name: 'table'
|
2799
2799
|
})
|
2800
|
-
export class TableRenderer extends Table {
|
2800
|
+
export class TableRenderer extends Table {
|
2801
|
+
receive(values: any, subPath?: string) {
|
2802
|
+
const scoped = this.context as IScopedContext;
|
2803
|
+
const parents = scoped?.parent?.getComponents();
|
2804
|
+
|
2805
|
+
/**
|
2806
|
+
* 因为Table在scope上注册,导致getComponentByName查询组件时会优先找到Table,和CRUD联动的动作都会失效
|
2807
|
+
* 这里先做兼容处理,把动作交给上层的CRUD处理
|
2808
|
+
*/
|
2809
|
+
if (Array.isArray(parents) && parents.length) {
|
2810
|
+
// CRUD的name会透传给Table,这样可以保证找到CRUD
|
2811
|
+
const crud = parents.find(cmpt => cmpt?.props?.name === this.props?.name);
|
2812
|
+
|
2813
|
+
return crud?.receive?.(values, subPath);
|
2814
|
+
}
|
2815
|
+
|
2816
|
+
if (subPath) {
|
2817
|
+
return scoped.send(subPath, values);
|
2818
|
+
}
|
2819
|
+
}
|
2820
|
+
}
|
2801
2821
|
|
2802
2822
|
export {TableCell};
|
package/src/renderers/Tpl.tsx
CHANGED
@@ -40,6 +40,11 @@ export interface TplSchema extends BaseSchema {
|
|
40
40
|
* 角标
|
41
41
|
*/
|
42
42
|
badge?: BadgeSchema;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* 是否设置外层DOM节点的title属性为文本内容
|
46
|
+
*/
|
47
|
+
showNativeTitle?: boolean;
|
43
48
|
}
|
44
49
|
|
45
50
|
export interface TplProps extends RendererProps, TplSchema {
|
@@ -117,17 +122,22 @@ export class Tpl extends React.Component<TplProps, object> {
|
|
117
122
|
inline,
|
118
123
|
classnames: cx,
|
119
124
|
style,
|
125
|
+
showNativeTitle,
|
120
126
|
data
|
121
127
|
} = this.props;
|
122
128
|
const Component = wrapperComponent || (inline ? 'span' : 'div');
|
129
|
+
const content = this.getContent();
|
123
130
|
|
124
131
|
return (
|
125
132
|
<Component
|
126
133
|
ref={this.htmlRef}
|
127
134
|
className={cx('TplField', className)}
|
128
135
|
style={buildStyle(style, data)}
|
136
|
+
{...(showNativeTitle
|
137
|
+
? {title: typeof content === 'string' ? content : ''}
|
138
|
+
: {})}
|
129
139
|
>
|
130
|
-
<span>{
|
140
|
+
<span>{content}</span>
|
131
141
|
</Component>
|
132
142
|
);
|
133
143
|
}
|