amis-core 3.2.0 → 3.3.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/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +3 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +4 -1
- package/esm/Scoped.js +8 -5
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +62 -37
- package/esm/actions/AjaxAction.d.ts +6 -8
- package/esm/actions/AjaxAction.js +20 -18
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.d.ts +1 -2
- package/esm/actions/CmptAction.js +46 -31
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -2
- package/esm/actions/DialogAction.js +5 -6
- package/esm/actions/DrawerAction.js +4 -4
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/StatusAction.d.ts +15 -0
- package/esm/actions/StatusAction.js +49 -0
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/index.d.ts +1 -0
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -2
- package/esm/components/PopOver.js +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +13 -13
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +6 -6
- package/esm/renderers/Form.js +168 -124
- package/esm/renderers/Item.d.ts +42 -66
- package/esm/renderers/Item.js +11 -41
- package/esm/renderers/Options.js +1 -2
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +1 -1
- package/esm/renderers/wrapControl.js +101 -47
- package/esm/store/app.js +8 -4
- package/esm/store/combo.d.ts +444 -1912
- package/esm/store/combo.js +9 -2
- package/esm/store/crud.d.ts +1 -0
- package/esm/store/crud.js +11 -5
- package/esm/store/form.d.ts +132 -892
- package/esm/store/form.js +83 -81
- package/esm/store/formItem.d.ts +5 -2
- package/esm/store/formItem.js +13 -2
- package/esm/store/iRenderer.js +2 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +2 -2
- package/esm/store/service.js +4 -4
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +503 -2040
- package/esm/store/table.js +79 -55
- package/esm/store/table2.d.ts +49 -0
- package/esm/store/table2.js +37 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +17 -3
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.d.ts +2 -2
- package/esm/utils/api.js +113 -81
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +4 -2
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +2 -0
- package/esm/utils/debug.js +34 -7
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.d.ts +0 -1
- package/esm/utils/formula.js +6 -9
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +11 -1
- package/esm/utils/helper.js +14 -2
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +4 -2
- package/esm/utils/icon.js +3 -2
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.d.ts +3 -0
- package/esm/utils/math.js +52 -0
- package/esm/utils/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.d.ts +7 -0
- package/esm/utils/object.js +13 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.d.ts +1 -1
- package/esm/utils/renderer-event.js +14 -6
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.js +1 -1
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +10 -7
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +11 -8
- package/lib/SchemaRenderer.js +12 -6
- package/lib/Scoped.d.ts +4 -1
- package/lib/Scoped.js +18 -13
- package/lib/StatusScoped.js +5 -2
- package/lib/WithRootStore.js +5 -2
- package/lib/WithStore.js +5 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +62 -37
- package/lib/actions/AjaxAction.d.ts +6 -8
- package/lib/actions/AjaxAction.js +20 -18
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.d.ts +1 -2
- package/lib/actions/CmptAction.js +46 -31
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +8 -5
- package/lib/actions/DialogAction.js +5 -6
- package/lib/actions/DrawerAction.js +4 -4
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/StatusAction.d.ts +15 -0
- package/lib/actions/StatusAction.js +53 -0
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/LazyComponent.js +12 -14
- package/lib/components/Overlay.js +14 -14
- package/lib/components/PopOver.js +11 -10
- package/lib/env.js +4 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +11 -9
- package/lib/index.d.ts +2 -1
- package/lib/index.js +21 -19
- package/lib/locale.js +6 -3
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +6 -6
- package/lib/renderers/Form.js +180 -131
- package/lib/renderers/Item.d.ts +42 -66
- package/lib/renderers/Item.js +51 -75
- package/lib/renderers/Options.js +10 -5
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.js +1 -1
- package/lib/renderers/wrapControl.js +104 -47
- package/lib/store/app.js +14 -7
- package/lib/store/combo.d.ts +444 -1912
- package/lib/store/combo.js +9 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +11 -5
- package/lib/store/form.d.ts +132 -892
- package/lib/store/form.js +81 -79
- package/lib/store/formItem.d.ts +5 -2
- package/lib/store/formItem.js +13 -2
- package/lib/store/iRenderer.js +8 -5
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +8 -5
- package/lib/store/service.js +4 -4
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +503 -2040
- package/lib/store/table.js +79 -55
- package/lib/store/table2.d.ts +49 -0
- package/lib/store/table2.js +36 -3
- package/lib/theme.js +6 -3
- package/lib/types.d.ts +17 -3
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.d.ts +2 -2
- package/lib/utils/api.js +113 -81
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +8 -6
- package/lib/utils/dataMapping.js +4 -2
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +2 -0
- package/lib/utils/debug.js +61 -33
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +7 -5
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.d.ts +0 -1
- package/lib/utils/formula.js +6 -10
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +11 -1
- package/lib/utils/helper.js +14 -1
- package/lib/utils/highlight.js +8 -9
- package/lib/utils/icon.d.ts +4 -2
- package/lib/utils/icon.js +12 -10
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.d.ts +3 -0
- package/lib/utils/math.js +58 -0
- package/lib/utils/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.d.ts +7 -0
- package/lib/utils/object.js +13 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +7 -3
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.d.ts +1 -1
- package/lib/utils/renderer-event.js +13 -5
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.js +1 -1
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
package/lib/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ var debounce = require('lodash/debounce');
|
|
|
21
21
|
var api = require('../utils/api.js');
|
|
22
22
|
var ReactDOM = require('react-dom');
|
|
23
23
|
require('../utils/ColorScale.js');
|
|
24
|
-
require('
|
|
24
|
+
require('../utils/columnsSplit.js');
|
|
25
25
|
var dataMapping = require('../utils/dataMapping.js');
|
|
26
26
|
require('../utils/DataSchema.js');
|
|
27
27
|
require('../utils/DataScope.js');
|
|
@@ -29,6 +29,7 @@ require('moment');
|
|
|
29
29
|
var object = require('../utils/object.js');
|
|
30
30
|
require('amis-formula');
|
|
31
31
|
require('../utils/debug.js');
|
|
32
|
+
require('../utils/dom.js');
|
|
32
33
|
require('../utils/errors.js');
|
|
33
34
|
require('lodash/isPlainObject');
|
|
34
35
|
require('classnames');
|
|
@@ -37,8 +38,10 @@ require('lodash/isObject');
|
|
|
37
38
|
require('lodash/isString');
|
|
38
39
|
require('lodash/isBoolean');
|
|
39
40
|
var getVariable = require('../utils/getVariable.js');
|
|
40
|
-
require('
|
|
41
|
+
require('../utils/highlight.js');
|
|
42
|
+
require('../utils/icon.js');
|
|
41
43
|
require('../utils/image.js');
|
|
44
|
+
require('lodash/isEqual');
|
|
42
45
|
require('../actions/Action.js');
|
|
43
46
|
require('lodash/cloneDeep');
|
|
44
47
|
require('../utils/resize-sensor.js');
|
|
@@ -60,6 +63,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
60
63
|
var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
|
|
61
64
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
62
65
|
|
|
66
|
+
var __react_jsx__ = require('react');
|
|
67
|
+
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
68
|
+
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
63
69
|
var getItemLabelClassName = function (props) {
|
|
64
70
|
var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName;
|
|
65
71
|
return props.static && staticLabelClassName
|
|
@@ -279,8 +285,8 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
279
285
|
]
|
|
280
286
|
};
|
|
281
287
|
if (mode === 'popOver') {
|
|
282
|
-
return (
|
|
283
|
-
|
|
288
|
+
return (_J$X_(Overlay["default"], { container: popOverContainer || this.target, target: function () { return _this.target; }, placement: position || 'left-bottom-left-top', show: true },
|
|
289
|
+
_J$X_(PopOver["default"], { classPrefix: ns, className: cx("".concat(ns, "auto-fill-popOver"), popOverClassName), style: {
|
|
284
290
|
minWidth: this.target ? this.target.offsetWidth : undefined
|
|
285
291
|
}, offset: offset, onHide: this.handleClose, overlay: true }, render('popOver-auto-fill-form', form, {
|
|
286
292
|
onAction: this.handleAction,
|
|
@@ -369,7 +375,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
369
375
|
}
|
|
370
376
|
var renderLayout = FormItemWrap.layoutRenderers[mode] ||
|
|
371
377
|
FormItemWrap.layoutRenderers['normal'];
|
|
372
|
-
return (
|
|
378
|
+
return (_J$X_(React__default["default"].Fragment, null,
|
|
373
379
|
renderLayout(this.props, this.renderControl.bind(this)),
|
|
374
380
|
model
|
|
375
381
|
? render('modal', tslib.__assign({ type: 'dialog' }, model.dialogSchema), {
|
|
@@ -380,7 +386,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
380
386
|
formStore: undefined
|
|
381
387
|
})
|
|
382
388
|
: null,
|
|
383
|
-
|
|
389
|
+
_J$X_(CustomStyle["default"], { config: {
|
|
384
390
|
themeCss: themeCss || css,
|
|
385
391
|
classNames: [
|
|
386
392
|
{
|
|
@@ -390,7 +396,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
390
396
|
],
|
|
391
397
|
id: id + '-label'
|
|
392
398
|
}, env: env }),
|
|
393
|
-
|
|
399
|
+
_J$X_(CustomStyle["default"], { config: {
|
|
394
400
|
themeCss: themeCss || css,
|
|
395
401
|
classNames: [
|
|
396
402
|
{
|
|
@@ -418,24 +424,24 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
418
424
|
var right = helper.getWidthRate(horizontal.right);
|
|
419
425
|
var labelAlign = props.labelAlign || props.formLabelAlign;
|
|
420
426
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
421
|
-
return (
|
|
427
|
+
return (_J$X_("div", { "data-role": "form-item", className: cx("Form-item Form-item--horizontal", isStatic && staticClassName ? staticClassName : className, (_a = {
|
|
422
428
|
'Form-item--horizontal-justify': horizontal.justify
|
|
423
429
|
},
|
|
424
430
|
_a["is-error"] = model && !model.valid,
|
|
425
431
|
_a["is-required"] = required,
|
|
426
432
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
|
|
427
|
-
label !== false ? (
|
|
433
|
+
label !== false ? (_J$X_("label", { className: cx("Form-label", (_b = {},
|
|
428
434
|
_b["Form-itemColumn--".concat(typeof horizontal.leftFixed === 'string'
|
|
429
435
|
? horizontal.leftFixed
|
|
430
436
|
: 'normal')] = horizontal.leftFixed,
|
|
431
437
|
_b["Form-itemColumn--".concat(left)] = !horizontal.leftFixed,
|
|
432
438
|
_b['Form-label--left'] = labelAlign === 'left',
|
|
433
439
|
_b), getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
434
|
-
|
|
440
|
+
_J$X_("span", null,
|
|
435
441
|
label
|
|
436
442
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
437
443
|
: null,
|
|
438
|
-
required && (label || labelRemark) ? (
|
|
444
|
+
required && (label || labelRemark) ? (_J$X_("span", { className: cx("Form-star") }, "*")) : null,
|
|
439
445
|
labelRemark
|
|
440
446
|
? render('label-remark', {
|
|
441
447
|
type: 'remark',
|
|
@@ -443,14 +449,10 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
443
449
|
tooltip: labelRemark,
|
|
444
450
|
useMobileUI: useMobileUI,
|
|
445
451
|
className: cx("Form-labelRemark"),
|
|
446
|
-
container: props.popOverContainer
|
|
447
|
-
? props.popOverContainer
|
|
448
|
-
: env && env.getModalContainer
|
|
449
|
-
? env.getModalContainer
|
|
450
|
-
: undefined
|
|
452
|
+
container: props.popOverContainer || env.getModalContainer
|
|
451
453
|
})
|
|
452
454
|
: null))) : null,
|
|
453
|
-
|
|
455
|
+
_J$X_("div", { className: cx("Form-value", (_c = {},
|
|
454
456
|
// [`Form-itemColumn--offset${getWidthRate(horizontal.offset)}`]: !label && label !== false,
|
|
455
457
|
_c["Form-itemColumn--".concat(right)] = !horizontal.leftFixed && !!right && right !== 12 - left,
|
|
456
458
|
_c)) },
|
|
@@ -467,11 +469,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
467
469
|
tooltip: remark,
|
|
468
470
|
className: cx("Form-remark"),
|
|
469
471
|
useMobileUI: useMobileUI,
|
|
470
|
-
container: props.popOverContainer
|
|
471
|
-
? props.popOverContainer
|
|
472
|
-
: env && env.getModalContainer
|
|
473
|
-
? env.getModalContainer
|
|
474
|
-
: undefined
|
|
472
|
+
container: props.popOverContainer || env.getModalContainer
|
|
475
473
|
})
|
|
476
474
|
: null,
|
|
477
475
|
hint && model && model.isFocused
|
|
@@ -482,7 +480,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
482
480
|
model &&
|
|
483
481
|
!model.valid &&
|
|
484
482
|
showErrorMsg !== false &&
|
|
485
|
-
Array.isArray(model.errors) ? (
|
|
483
|
+
Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
|
|
486
484
|
renderDescription !== false && description
|
|
487
485
|
? render('description', description, {
|
|
488
486
|
className: cx("Form-description", descriptionClassName)
|
|
@@ -494,17 +492,17 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
494
492
|
var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
|
|
495
493
|
var mobileUI = useMobileUI && helper.isMobile();
|
|
496
494
|
description = description || desc;
|
|
497
|
-
return (
|
|
495
|
+
return (_J$X_("div", { "data-role": "form-item", className: cx("Form-item Form-item--normal", isStatic && staticClassName ? staticClassName : className, (_a = {
|
|
498
496
|
'is-error': model && !model.valid
|
|
499
497
|
},
|
|
500
498
|
_a["is-required"] = required,
|
|
501
499
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
|
|
502
|
-
label && renderLabel !== false ? (
|
|
503
|
-
|
|
500
|
+
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)) },
|
|
501
|
+
_J$X_("span", null,
|
|
504
502
|
label
|
|
505
503
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
506
504
|
: null,
|
|
507
|
-
required && (label || labelRemark) ? (
|
|
505
|
+
required && (label || labelRemark) ? (_J$X_("span", { className: cx("Form-star") }, "*")) : null,
|
|
508
506
|
labelRemark
|
|
509
507
|
? render('label-remark', {
|
|
510
508
|
type: 'remark',
|
|
@@ -512,14 +510,10 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
512
510
|
tooltip: labelRemark,
|
|
513
511
|
className: cx("Form-lableRemark"),
|
|
514
512
|
useMobileUI: useMobileUI,
|
|
515
|
-
container: props.popOverContainer
|
|
516
|
-
? props.popOverContainer
|
|
517
|
-
: env && env.getModalContainer
|
|
518
|
-
? env.getModalContainer
|
|
519
|
-
: undefined
|
|
513
|
+
container: props.popOverContainer || env.getModalContainer
|
|
520
514
|
})
|
|
521
515
|
: null))) : null,
|
|
522
|
-
mobileUI ? (
|
|
516
|
+
mobileUI ? (_J$X_("div", { className: cx('Form-item-controlBox') },
|
|
523
517
|
renderControl(),
|
|
524
518
|
caption
|
|
525
519
|
? render('caption', caption, {
|
|
@@ -533,9 +527,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
533
527
|
className: cx("Form-remark"),
|
|
534
528
|
tooltip: remark,
|
|
535
529
|
useMobileUI: useMobileUI,
|
|
536
|
-
container:
|
|
537
|
-
? env.getModalContainer
|
|
538
|
-
: undefined
|
|
530
|
+
container: props.popOverContainer || env.getModalContainer
|
|
539
531
|
})
|
|
540
532
|
: null,
|
|
541
533
|
hint && model && model.isFocused
|
|
@@ -546,12 +538,12 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
546
538
|
model &&
|
|
547
539
|
!model.valid &&
|
|
548
540
|
showErrorMsg !== false &&
|
|
549
|
-
Array.isArray(model.errors) ? (
|
|
541
|
+
Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
|
|
550
542
|
renderDescription !== false && description
|
|
551
543
|
? render('description', description, {
|
|
552
544
|
className: cx("Form-description", descriptionClassName)
|
|
553
545
|
})
|
|
554
|
-
: null)) : (
|
|
546
|
+
: null)) : (_J$X_(React__default["default"].Fragment, null,
|
|
555
547
|
renderControl(),
|
|
556
548
|
caption
|
|
557
549
|
? render('caption', caption, {
|
|
@@ -565,9 +557,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
565
557
|
className: cx("Form-remark"),
|
|
566
558
|
tooltip: remark,
|
|
567
559
|
useMobileUI: useMobileUI,
|
|
568
|
-
container:
|
|
569
|
-
? env.getModalContainer
|
|
570
|
-
: undefined
|
|
560
|
+
container: props.popOverContainer || env.getModalContainer
|
|
571
561
|
})
|
|
572
562
|
: null,
|
|
573
563
|
hint && model && model.isFocused
|
|
@@ -578,7 +568,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
578
568
|
model &&
|
|
579
569
|
!model.valid &&
|
|
580
570
|
showErrorMsg !== false &&
|
|
581
|
-
Array.isArray(model.errors) ? (
|
|
571
|
+
Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
|
|
582
572
|
renderDescription !== false && description
|
|
583
573
|
? render('description', description, {
|
|
584
574
|
className: cx("Form-description", descriptionClassName)
|
|
@@ -590,17 +580,17 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
590
580
|
var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, remark = props.remark, labelRemark = props.labelRemark, env = props.env, hint = props.hint, renderLabel = props.renderLabel, renderDescription = props.renderDescription, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
|
|
591
581
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
592
582
|
description = description || desc;
|
|
593
|
-
return (
|
|
583
|
+
return (_J$X_("div", { "data-role": "form-item", className: cx("Form-item Form-item--inline", isStatic && staticClassName ? staticClassName : className, (_a = {
|
|
594
584
|
'is-error': model && !model.valid
|
|
595
585
|
},
|
|
596
586
|
_a["is-required"] = required,
|
|
597
587
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
|
|
598
|
-
label && renderLabel !== false ? (
|
|
599
|
-
|
|
588
|
+
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
589
|
+
_J$X_("span", null,
|
|
600
590
|
label
|
|
601
591
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
602
592
|
: label,
|
|
603
|
-
required && (label || labelRemark) ? (
|
|
593
|
+
required && (label || labelRemark) ? (_J$X_("span", { className: cx("Form-star") }, "*")) : null,
|
|
604
594
|
labelRemark
|
|
605
595
|
? render('label-remark', {
|
|
606
596
|
type: 'remark',
|
|
@@ -608,14 +598,10 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
608
598
|
tooltip: labelRemark,
|
|
609
599
|
className: cx("Form-lableRemark"),
|
|
610
600
|
useMobileUI: useMobileUI,
|
|
611
|
-
container: props.popOverContainer
|
|
612
|
-
? props.popOverContainer
|
|
613
|
-
: env && env.getModalContainer
|
|
614
|
-
? env.getModalContainer
|
|
615
|
-
: undefined
|
|
601
|
+
container: props.popOverContainer || env.getModalContainer
|
|
616
602
|
})
|
|
617
603
|
: null))) : null,
|
|
618
|
-
|
|
604
|
+
_J$X_("div", { className: cx("Form-value") },
|
|
619
605
|
renderControl(),
|
|
620
606
|
caption
|
|
621
607
|
? render('caption', caption, {
|
|
@@ -629,11 +615,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
629
615
|
className: cx("Form-remark"),
|
|
630
616
|
tooltip: remark,
|
|
631
617
|
useMobileUI: useMobileUI,
|
|
632
|
-
container: props.popOverContainer
|
|
633
|
-
? props.popOverContainer
|
|
634
|
-
: env && env.getModalContainer
|
|
635
|
-
? env.getModalContainer
|
|
636
|
-
: undefined
|
|
618
|
+
container: props.popOverContainer || env.getModalContainer
|
|
637
619
|
})
|
|
638
620
|
: null,
|
|
639
621
|
hint && model && model.isFocused
|
|
@@ -644,7 +626,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
644
626
|
model &&
|
|
645
627
|
!model.valid &&
|
|
646
628
|
showErrorMsg !== false &&
|
|
647
|
-
Array.isArray(model.errors) ? (
|
|
629
|
+
Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
|
|
648
630
|
renderDescription !== false && description
|
|
649
631
|
? render('description', description, {
|
|
650
632
|
className: cx("Form-description", descriptionClassName)
|
|
@@ -656,16 +638,16 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
656
638
|
var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
|
|
657
639
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
658
640
|
description = description || desc;
|
|
659
|
-
return (
|
|
641
|
+
return (_J$X_("div", { "data-role": "form-item", className: cx("Form-item Form-item--row", isStatic && staticClassName ? staticClassName : className, (_a = {
|
|
660
642
|
'is-error': model && !model.valid
|
|
661
643
|
},
|
|
662
644
|
_a["is-required"] = required,
|
|
663
645
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
|
|
664
|
-
|
|
665
|
-
label && renderLabel !== false ? (
|
|
666
|
-
|
|
646
|
+
_J$X_("div", { className: cx('Form-rowInner') },
|
|
647
|
+
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
648
|
+
_J$X_("span", null,
|
|
667
649
|
render('label', typeof label === 'string' ? tpl.filter(label, data) : label),
|
|
668
|
-
required && (label || labelRemark) ? (
|
|
650
|
+
required && (label || labelRemark) ? (_J$X_("span", { className: cx("Form-star") }, "*")) : null,
|
|
669
651
|
labelRemark
|
|
670
652
|
? render('label-remark', {
|
|
671
653
|
type: 'remark',
|
|
@@ -673,11 +655,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
673
655
|
tooltip: labelRemark,
|
|
674
656
|
className: cx("Form-lableRemark"),
|
|
675
657
|
useMobileUI: useMobileUI,
|
|
676
|
-
container: props.popOverContainer
|
|
677
|
-
? props.popOverContainer
|
|
678
|
-
: env && env.getModalContainer
|
|
679
|
-
? env.getModalContainer
|
|
680
|
-
: undefined
|
|
658
|
+
container: props.popOverContainer || env.getModalContainer
|
|
681
659
|
})
|
|
682
660
|
: null))) : null,
|
|
683
661
|
renderControl(),
|
|
@@ -692,9 +670,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
692
670
|
icon: remark.icon || 'warning-mark',
|
|
693
671
|
className: cx("Form-remark"),
|
|
694
672
|
tooltip: remark,
|
|
695
|
-
container:
|
|
696
|
-
? env.getModalContainer
|
|
697
|
-
: undefined
|
|
673
|
+
container: props.popOverContainer || env.getModalContainer
|
|
698
674
|
})
|
|
699
675
|
: null),
|
|
700
676
|
hint && model && model.isFocused
|
|
@@ -705,7 +681,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
705
681
|
model &&
|
|
706
682
|
!model.valid &&
|
|
707
683
|
showErrorMsg !== false &&
|
|
708
|
-
Array.isArray(model.errors) ? (
|
|
684
|
+
Array.isArray(model.errors) ? (_J$X_("ul", { className: cx('Form-feedback') }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
|
|
709
685
|
description && renderDescription !== false
|
|
710
686
|
? render('description', description, {
|
|
711
687
|
className: cx("Form-description", descriptionClassName)
|
|
@@ -901,8 +877,8 @@ function asFormItem(config) {
|
|
|
901
877
|
var mobileUI = useMobileUI && helper.isMobile();
|
|
902
878
|
//@ts-ignore
|
|
903
879
|
var isOpened = this.state.isOpened;
|
|
904
|
-
return (
|
|
905
|
-
|
|
880
|
+
return (_J$X_(React__default["default"].Fragment, null,
|
|
881
|
+
_J$X_(Control, tslib.__assign({}, rest, { useMobileUI: useMobileUI, onOpenDialog: this.handleOpenDialog, size: config.sizeMutable !== false ? undefined : size, onFocus: this.handleFocus, onBlur: this.handleBlur, type: type, classnames: cx, ref: isSFC ? undefined : this.refFn, forwardedRef: isSFC ? this.refFn : undefined, formItem: model, className: cx("Form-control", (_a = {
|
|
906
882
|
'is-inline': !!rest.inline && !mobileUI,
|
|
907
883
|
'is-error': model && !model.valid,
|
|
908
884
|
'is-full': size === 'full'
|
package/lib/renderers/Options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -28,23 +28,25 @@ var isPlainObject = require('lodash/isPlainObject');
|
|
|
28
28
|
var normalizeOptions = require('../utils/normalizeOptions.js');
|
|
29
29
|
var optionValueCompare = require('../utils/optionValueCompare.js');
|
|
30
30
|
require('../utils/ColorScale.js');
|
|
31
|
-
require('
|
|
31
|
+
require('../utils/columnsSplit.js');
|
|
32
32
|
require('../utils/DataSchema.js');
|
|
33
33
|
require('../utils/DataScope.js');
|
|
34
34
|
require('../utils/debug.js');
|
|
35
|
-
require('
|
|
35
|
+
require('../utils/dom.js');
|
|
36
36
|
require('../utils/errors.js');
|
|
37
37
|
require('classnames');
|
|
38
38
|
require('lodash/isObject');
|
|
39
39
|
require('lodash/isString');
|
|
40
40
|
require('lodash/isBoolean');
|
|
41
|
-
require('
|
|
41
|
+
require('../utils/highlight.js');
|
|
42
|
+
require('../utils/icon.js');
|
|
42
43
|
require('../utils/image.js');
|
|
43
44
|
var keyToPath = require('../utils/keyToPath.js');
|
|
44
45
|
var rendererEvent = require('../utils/renderer-event.js');
|
|
45
46
|
require('lodash/cloneDeep');
|
|
46
47
|
require('../utils/resize-sensor.js');
|
|
47
48
|
require('react-overlays/useRootClose');
|
|
49
|
+
require('react-dom');
|
|
48
50
|
require('../utils/SimpleMap.js');
|
|
49
51
|
require('lodash/mapValues');
|
|
50
52
|
require('lodash/camelCase');
|
|
@@ -60,6 +62,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
60
62
|
var findIndex__default = /*#__PURE__*/_interopDefaultLegacy(findIndex);
|
|
61
63
|
var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
|
|
62
64
|
|
|
65
|
+
var __react_jsx__ = require('react');
|
|
66
|
+
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
67
|
+
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
63
68
|
var detectProps = Item.detectProps.concat([
|
|
64
69
|
'value',
|
|
65
70
|
'options',
|
|
@@ -807,7 +812,7 @@ function registerOptionsControl(config) {
|
|
|
807
812
|
FormOptionsItem.prototype.render = function () {
|
|
808
813
|
var _a = this.props, value = _a.value, formItem = _a.formItem, addApi = _a.addApi, editApi = _a.editApi, deleteApi = _a.deleteApi, creatable = _a.creatable, editable = _a.editable, removable = _a.removable, enableNodePath = _a.enableNodePath, pathSeparator = _a.pathSeparator, _b = _a.delimiter, delimiter = _b === void 0 ? ',' : _b, _c = _a.labelField, labelField = _c === void 0 ? 'label' : _c, _d = _a.valueField, valueField = _d === void 0 ? 'value' : _d, __ = _a.translate;
|
|
809
814
|
var _e = helper.normalizeNodePath(value, enableNodePath, labelField, valueField, pathSeparator, delimiter), nodePathArray = _e.nodePathArray, nodeValueArray = _e.nodeValueArray;
|
|
810
|
-
return (
|
|
815
|
+
return (_J$X_(Control, tslib.__assign({}, this.props, { placeholder: __(this.props.placeholder), ref: this.inputRef, options: formItem ? formItem.filteredOptions : [], onToggle: this.handleToggle, onToggleAll: this.handleToggleAll, selectedOptions: formItem
|
|
811
816
|
? formItem.getSelectedOptions(value, enableNodePath ? nodeValueArray : undefined)
|
|
812
817
|
: [], nodePath: nodePathArray, loading: formItem ? formItem.loading : false, setLoading: this.setLoading, setOptions: this.setOptions, syncOptions: this.syncOptions, reloadOptions: this.reload, deferLoad: this.deferLoad, leftDeferLoad: this.leftDeferLoad, expandTreeOptions: this.expandTreeOptions, creatable: creatable !== false && api.isEffectiveApi(addApi) ? true : creatable, editable: editable || (editable !== false && api.isEffectiveApi(editApi)), removable: removable || (removable !== false && api.isEffectiveApi(deleteApi)), onAdd: this.handleOptionAdd, onEdit: this.handleOptionEdit, onDelete: this.handleOptionDelete })));
|
|
813
818
|
};
|
package/lib/renderers/builtin.js
CHANGED