amis-core 2.3.2-beta.1 → 2.4.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.js +1 -1
- package/esm/SchemaRenderer.js +10 -3
- package/esm/Scoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/_virtual/index.js +1 -1
- package/esm/actions/Action.d.ts +2 -1
- package/esm/actions/Action.js +90 -15
- package/esm/actions/AjaxAction.js +2 -3
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.d.ts +4 -1
- package/esm/actions/BroadcastAction.js +8 -8
- package/esm/actions/CmptAction.d.ts +1 -1
- package/esm/actions/CmptAction.js +5 -2
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.d.ts +6 -1
- package/esm/actions/CustomAction.js +7 -7
- package/esm/actions/DialogAction.d.ts +4 -1
- package/esm/actions/DialogAction.js +9 -5
- package/esm/actions/DrawerAction.d.ts +4 -1
- package/esm/actions/DrawerAction.js +9 -5
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +5 -6
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +3 -2
- package/esm/components/PopOver.js +2 -3
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +20 -9
- package/esm/index.js +5 -2
- package/esm/locale.js +1 -1
- package/esm/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
- package/esm/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
- package/esm/node_modules/dom-helpers/esm/addEventListener.js +1 -1
- package/esm/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
- package/esm/node_modules/dom-helpers/esm/contains.js +1 -1
- package/esm/node_modules/dom-helpers/esm/listen.js +1 -1
- package/esm/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
- package/esm/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
- package/esm/node_modules/prop-types/factoryWithThrowingShims.js +51 -60
- package/esm/node_modules/prop-types/index.js +4 -13
- package/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js +4 -13
- package/esm/node_modules/react-overlays/esm/Portal.js +1 -1
- package/esm/node_modules/react-overlays/esm/ownerDocument.js +1 -1
- package/esm/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
- package/esm/node_modules/react-overlays/esm/useRootClose.js +1 -3
- package/esm/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
- package/esm/renderers/Form.d.ts +7 -1
- package/esm/renderers/Form.js +17 -6
- package/esm/renderers/Item.d.ts +6 -6
- package/esm/renderers/Item.js +24 -16
- package/esm/renderers/Options.d.ts +1 -1
- package/esm/renderers/Options.js +2 -2
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/wrapControl.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +1 -1
- package/esm/store/form.js +2 -2
- package/esm/store/formItem.js +1 -1
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.d.ts +26 -13
- package/esm/store/index.js +2 -2
- 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.d.ts +2 -0
- package/esm/store/root.js +10 -4
- package/esm/store/service.js +1 -1
- package/esm/store/table.js +1 -1
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +27 -0
- 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 +1 -1
- package/esm/utils/api.js +17 -5
- 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 +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +1 -1
- package/esm/utils/decodeEntity.d.ts +5 -0
- package/esm/utils/decodeEntity.js +16 -0
- 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 +7 -5
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +1 -1
- 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.js +6 -1
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +5 -1
- package/esm/utils/icon.js +11 -1
- 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/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +1 -1
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.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.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 +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.js +10 -3
- package/lib/Scoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/_virtual/index.js +1 -1
- package/lib/actions/Action.d.ts +2 -1
- package/lib/actions/Action.js +94 -15
- package/lib/actions/AjaxAction.js +2 -7
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.d.ts +4 -1
- package/lib/actions/BroadcastAction.js +8 -8
- package/lib/actions/CmptAction.d.ts +1 -1
- package/lib/actions/CmptAction.js +5 -2
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.d.ts +6 -1
- package/lib/actions/CustomAction.js +7 -7
- package/lib/actions/DialogAction.d.ts +4 -1
- package/lib/actions/DialogAction.js +9 -5
- package/lib/actions/DrawerAction.d.ts +4 -1
- package/lib/actions/DrawerAction.js +9 -5
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +5 -10
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +3 -2
- package/lib/components/PopOver.js +2 -3
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +1 -1
- package/lib/factory.js +2 -2
- package/lib/index.d.ts +20 -9
- package/lib/index.js +6 -1
- package/lib/locale.js +1 -1
- package/lib/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
- package/lib/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
- package/lib/node_modules/dom-helpers/esm/addEventListener.js +1 -1
- package/lib/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
- package/lib/node_modules/dom-helpers/esm/contains.js +1 -1
- package/lib/node_modules/dom-helpers/esm/listen.js +1 -1
- package/lib/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
- package/lib/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js +51 -60
- package/lib/node_modules/prop-types/index.js +3 -12
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +4 -13
- package/lib/node_modules/react-overlays/esm/Portal.js +1 -1
- package/lib/node_modules/react-overlays/esm/ownerDocument.js +1 -1
- package/lib/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
- package/lib/node_modules/react-overlays/esm/useRootClose.js +1 -3
- package/lib/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
- package/lib/renderers/Form.d.ts +7 -1
- package/lib/renderers/Form.js +17 -6
- package/lib/renderers/Item.d.ts +6 -6
- package/lib/renderers/Item.js +24 -16
- package/lib/renderers/Options.d.ts +1 -1
- package/lib/renderers/Options.js +2 -2
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/wrapControl.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +1 -1
- package/lib/store/form.js +2 -2
- package/lib/store/formItem.js +1 -1
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.d.ts +26 -13
- package/lib/store/index.js +2 -2
- 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.d.ts +2 -0
- package/lib/store/root.js +9 -3
- package/lib/store/service.js +1 -1
- package/lib/store/table.js +1 -1
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +27 -0
- 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 +1 -1
- package/lib/utils/api.js +16 -4
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +1 -1
- package/lib/utils/decodeEntity.d.ts +5 -0
- package/lib/utils/decodeEntity.js +20 -0
- package/lib/utils/dom.js +1 -1
- 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 +7 -5
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +1 -1
- 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.js +6 -1
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +5 -1
- package/lib/utils/icon.js +11 -1
- 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/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +1 -1
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.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.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 +4 -3
- package/esm/_virtual/index2.js +0 -8
- package/esm/_virtual/react-is.development.js +0 -8
- package/esm/_virtual/react-is.production.min.js +0 -8
- package/esm/node_modules/object-assign/index.js +0 -104
- package/esm/node_modules/prop-types/checkPropTypes.js +0 -120
- package/esm/node_modules/prop-types/factoryWithTypeCheckers.js +0 -630
- package/esm/node_modules/prop-types/lib/has.js +0 -16
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -195
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -31
- package/esm/node_modules/prop-types/node_modules/react-is/index.js +0 -26
- package/esm/node_modules/warning/warning.js +0 -67
- package/lib/_virtual/index2.js +0 -12
- package/lib/_virtual/react-is.development.js +0 -12
- package/lib/_virtual/react-is.production.min.js +0 -12
- package/lib/node_modules/object-assign/index.js +0 -108
- package/lib/node_modules/prop-types/checkPropTypes.js +0 -124
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +0 -634
- package/lib/node_modules/prop-types/lib/has.js +0 -20
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -199
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -35
- package/lib/node_modules/prop-types/node_modules/react-is/index.js +0 -30
- package/lib/node_modules/warning/warning.js +0 -71
package/lib/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -37,12 +37,11 @@ require('lodash/isObject');
|
|
|
37
37
|
require('lodash/isString');
|
|
38
38
|
require('lodash/isBoolean');
|
|
39
39
|
var getVariable = require('../utils/getVariable.js');
|
|
40
|
-
require('../utils/image.js');
|
|
41
40
|
require('lodash');
|
|
41
|
+
require('../utils/image.js');
|
|
42
42
|
require('../actions/Action.js');
|
|
43
43
|
require('../utils/resize-sensor.js');
|
|
44
44
|
require('../node_modules/dom-helpers/esm/addEventListener.js');
|
|
45
|
-
require('../node_modules/warning/warning.js');
|
|
46
45
|
require('../utils/SimpleMap.js');
|
|
47
46
|
require('lodash/mapValues');
|
|
48
47
|
require('lodash/camelCase');
|
|
@@ -58,6 +57,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
58
57
|
var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
|
|
59
58
|
var debouce__default = /*#__PURE__*/_interopDefaultLegacy(debouce);
|
|
60
59
|
|
|
60
|
+
var getItemLabelClassName = function (props) {
|
|
61
|
+
var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName;
|
|
62
|
+
return props.static && staticLabelClassName ? staticLabelClassName : labelClassName;
|
|
63
|
+
};
|
|
64
|
+
var getItemInputClassName = function (props) {
|
|
65
|
+
var staticInputClassName = props.staticInputClassName, inputClassName = props.inputClassName;
|
|
66
|
+
return props.static && staticInputClassName ? staticInputClassName : inputClassName;
|
|
67
|
+
};
|
|
61
68
|
var FormItemWrap = /** @class */ (function (_super) {
|
|
62
69
|
tslib.__extends(FormItemWrap, _super);
|
|
63
70
|
function FormItemWrap(props) {
|
|
@@ -320,7 +327,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
320
327
|
};
|
|
321
328
|
FormItemWrap.prototype.renderControl = function () {
|
|
322
329
|
var _a;
|
|
323
|
-
var _b = this.props,
|
|
330
|
+
var _b = this.props, model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, renderControl = _b.renderControl; _b.formItemConfig; var sizeMutable = _b.sizeMutable, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = tslib.__rest(_b, ["formItem", "classnames", "children", "type", "renderControl", "formItemConfig", "sizeMutable", "size", "defaultSize", "useMobileUI"]);
|
|
324
331
|
var mobileUI = useMobileUI && helper.isMobile();
|
|
325
332
|
if (renderControl) {
|
|
326
333
|
var controlSize = size || defaultSize;
|
|
@@ -332,7 +339,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
332
339
|
typeof controlSize === 'string' &&
|
|
333
340
|
!!controlSize &&
|
|
334
341
|
controlSize !== 'full',
|
|
335
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames,
|
|
342
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, getItemInputClassName(this.props)) }));
|
|
336
343
|
}
|
|
337
344
|
return null;
|
|
338
345
|
};
|
|
@@ -362,7 +369,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
362
369
|
FormItemWrap.layoutRenderers = {
|
|
363
370
|
horizontal: function (props, renderControl) {
|
|
364
371
|
var _a, _b, _c;
|
|
365
|
-
var className = props.className, cx = props.classnames, description = props.description, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, desc = props.desc, label = props.label,
|
|
372
|
+
var className = props.className, cx = props.classnames, description = props.description, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, desc = props.desc, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, 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;
|
|
366
373
|
// 强制不渲染 label 的话
|
|
367
374
|
if (renderLabel === false) {
|
|
368
375
|
label = label === false ? false : '';
|
|
@@ -373,7 +380,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
373
380
|
var right = helper.getWidthRate(horizontal.right);
|
|
374
381
|
var labelAlign = props.labelAlign || props.formLabelAlign;
|
|
375
382
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
376
|
-
return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--horizontal", className, (_a = {
|
|
383
|
+
return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--horizontal", isStatic && staticClassName ? staticClassName : className, (_a = {
|
|
377
384
|
'Form-item--horizontal-justify': horizontal.justify
|
|
378
385
|
},
|
|
379
386
|
_a["is-error"] = model && !model.valid,
|
|
@@ -385,7 +392,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
385
392
|
: 'normal')] = horizontal.leftFixed,
|
|
386
393
|
_b["Form-itemColumn--".concat(left)] = !horizontal.leftFixed,
|
|
387
394
|
_b['Form-label--left'] = labelAlign === 'left',
|
|
388
|
-
_b),
|
|
395
|
+
_b), getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
389
396
|
React__default["default"].createElement("span", null,
|
|
390
397
|
label
|
|
391
398
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
@@ -446,14 +453,14 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
446
453
|
},
|
|
447
454
|
normal: function (props, renderControl) {
|
|
448
455
|
var _a;
|
|
449
|
-
var className = props.className, cx = props.classnames, desc = props.desc, description = props.description, label = props.label,
|
|
456
|
+
var className = props.className, 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;
|
|
450
457
|
description = description || desc;
|
|
451
458
|
return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--normal", className, (_a = {
|
|
452
459
|
'is-error': model && !model.valid
|
|
453
460
|
},
|
|
454
461
|
_a["is-required"] = required,
|
|
455
462
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames) },
|
|
456
|
-
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label",
|
|
463
|
+
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)) },
|
|
457
464
|
React__default["default"].createElement("span", null,
|
|
458
465
|
label
|
|
459
466
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
@@ -508,7 +515,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
508
515
|
},
|
|
509
516
|
inline: function (props, renderControl) {
|
|
510
517
|
var _a;
|
|
511
|
-
var className = props.className, cx = props.classnames, desc = props.desc, description = props.description, label = props.label,
|
|
518
|
+
var className = props.className, 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;
|
|
512
519
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
513
520
|
description = description || desc;
|
|
514
521
|
return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--inline", className, (_a = {
|
|
@@ -516,7 +523,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
516
523
|
},
|
|
517
524
|
_a["is-required"] = required,
|
|
518
525
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames) },
|
|
519
|
-
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label",
|
|
526
|
+
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
520
527
|
React__default["default"].createElement("span", null,
|
|
521
528
|
label
|
|
522
529
|
? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
|
|
@@ -574,7 +581,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
574
581
|
},
|
|
575
582
|
row: function (props, renderControl) {
|
|
576
583
|
var _a;
|
|
577
|
-
var className = props.className, cx = props.classnames, desc = props.desc, description = props.description, label = props.label,
|
|
584
|
+
var className = props.className, 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;
|
|
578
585
|
var labelWidth = props.labelWidth || props.formLabelWidth;
|
|
579
586
|
description = description || desc;
|
|
580
587
|
return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--row", className, (_a = {
|
|
@@ -583,7 +590,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
583
590
|
_a["is-required"] = required,
|
|
584
591
|
_a), model === null || model === void 0 ? void 0 : model.errClassNames) },
|
|
585
592
|
React__default["default"].createElement("div", { className: cx('Form-rowInner') },
|
|
586
|
-
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label",
|
|
593
|
+
label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
587
594
|
React__default["default"].createElement("span", null,
|
|
588
595
|
render('label', typeof label === 'string' ? tpl.filter(label, data) : label),
|
|
589
596
|
required && (label || labelRemark) ? (React__default["default"].createElement("span", { className: cx("Form-star") }, "*")) : null,
|
|
@@ -698,6 +705,7 @@ var detectProps = [
|
|
|
698
705
|
'desc',
|
|
699
706
|
'description',
|
|
700
707
|
'disabled',
|
|
708
|
+
'static',
|
|
701
709
|
'draggable',
|
|
702
710
|
'editable',
|
|
703
711
|
'editButtonClassName',
|
|
@@ -802,7 +810,7 @@ function asFormItem(config) {
|
|
|
802
810
|
};
|
|
803
811
|
class_1.prototype.renderControl = function () {
|
|
804
812
|
var _a;
|
|
805
|
-
var _b = this.props,
|
|
813
|
+
var _b = this.props, model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = tslib.__rest(_b, ["formItem", "classnames", "children", "type", "size", "defaultSize", "useMobileUI"]);
|
|
806
814
|
var controlSize = size || defaultSize;
|
|
807
815
|
var mobileUI = useMobileUI && helper.isMobile();
|
|
808
816
|
//@ts-ignore
|
|
@@ -816,7 +824,7 @@ function asFormItem(config) {
|
|
|
816
824
|
typeof controlSize === 'string' &&
|
|
817
825
|
!!controlSize &&
|
|
818
826
|
controlSize !== 'full',
|
|
819
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames,
|
|
827
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, getItemInputClassName(this.props)) })),
|
|
820
828
|
isOpened ? this.buildSchema() : null));
|
|
821
829
|
};
|
|
822
830
|
return class_1;
|
|
@@ -6,7 +6,7 @@ import { Api, PlainObject, OptionProps, BaseApiObject } from '../types';
|
|
|
6
6
|
import { FormControlProps, FormItemBasicConfig, FormBaseControl } from './Item';
|
|
7
7
|
export declare type OptionsControlComponent = React.ComponentType<FormControlProps>;
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { Option } from '../types';
|
|
9
|
+
import type { Option } from '../types';
|
|
10
10
|
export { Option };
|
|
11
11
|
export interface FormOptionsControl extends FormBaseControl {
|
|
12
12
|
/**
|
package/lib/renderers/Options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -38,12 +38,12 @@ require('classnames');
|
|
|
38
38
|
require('lodash/isObject');
|
|
39
39
|
require('lodash/isString');
|
|
40
40
|
require('lodash/isBoolean');
|
|
41
|
+
require('lodash');
|
|
41
42
|
require('../utils/image.js');
|
|
42
43
|
var keyToPath = require('../utils/keyToPath.js');
|
|
43
44
|
var rendererEvent = require('../utils/renderer-event.js');
|
|
44
45
|
require('../utils/resize-sensor.js');
|
|
45
46
|
require('../node_modules/dom-helpers/esm/addEventListener.js');
|
|
46
|
-
require('../node_modules/warning/warning.js');
|
|
47
47
|
require('../utils/SimpleMap.js');
|
|
48
48
|
require('lodash/mapValues');
|
|
49
49
|
require('lodash/camelCase');
|
package/lib/renderers/builtin.js
CHANGED
package/lib/store/app.js
CHANGED
package/lib/store/combo.js
CHANGED
package/lib/store/crud.js
CHANGED
package/lib/store/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -86,7 +86,7 @@ var FormStore = service.ServiceStore.named('FormStore')
|
|
|
86
86
|
if (current.storeType === 'FormItemStore') {
|
|
87
87
|
formItems.push(current);
|
|
88
88
|
}
|
|
89
|
-
else if (current.storeType
|
|
89
|
+
else if (!['ComboStore', 'TableStore'].includes(current.storeType)) {
|
|
90
90
|
pool.push.apply(pool, current.children);
|
|
91
91
|
}
|
|
92
92
|
}
|
package/lib/store/formItem.js
CHANGED
package/lib/store/iRenderer.js
CHANGED
package/lib/store/index.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { Instance } from 'mobx-state-tree';
|
|
2
|
-
import { iRendererStore
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { iRendererStore } from './iRenderer';
|
|
3
|
+
import type { IIRendererStore } from './iRenderer';
|
|
4
|
+
import { ServiceStore } from './service';
|
|
5
|
+
import type { IServiceStore } from './service';
|
|
6
|
+
import { ComboStore } from './combo';
|
|
7
|
+
import type { IComboStore } from './combo';
|
|
8
|
+
import { FormStore } from './form';
|
|
9
|
+
import type { IFormStore } from './form';
|
|
10
|
+
import { CRUDStore } from './crud';
|
|
11
|
+
import type { ICRUDStore } from './crud';
|
|
12
|
+
import { TableStore } from './table';
|
|
13
|
+
import type { IColumn, IRow, ITableStore } from './table';
|
|
14
|
+
import { TableStore2 } from './table2';
|
|
15
|
+
import type { IColumn2, IRow2, ITableStore2 } from './table2';
|
|
16
|
+
import { ListStore } from './list';
|
|
17
|
+
import type { IListStore } from './list';
|
|
18
|
+
import { ModalStore } from './modal';
|
|
19
|
+
import type { IModalStore } from './modal';
|
|
11
20
|
import { TranslateFn } from '../locale';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
21
|
+
import { StoreNode } from './node';
|
|
22
|
+
import type { IStoreNode } from './node';
|
|
23
|
+
import { FormItemStore } from './formItem';
|
|
24
|
+
import type { IFormItemStore } from './formItem';
|
|
25
|
+
import { PaginationStore } from './pagination';
|
|
26
|
+
import type { IPaginationStore } from './pagination';
|
|
27
|
+
import { AppStore } from './app';
|
|
28
|
+
import type { IAppStore } from './app';
|
|
16
29
|
export declare const RendererStore: import("mobx-state-tree").IModelType<{
|
|
17
30
|
storeType: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
18
31
|
}, {
|
package/lib/store/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -29,7 +29,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
29
29
|
|
|
30
30
|
var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
|
|
31
31
|
|
|
32
|
-
mobxStateTree.setLivelinessChecking(
|
|
32
|
+
mobxStateTree.setLivelinessChecking('ignore' );
|
|
33
33
|
var allowedStoreList = [
|
|
34
34
|
service.ServiceStore,
|
|
35
35
|
form.FormStore,
|
package/lib/store/list.js
CHANGED
package/lib/store/manager.js
CHANGED
package/lib/store/modal.js
CHANGED
package/lib/store/node.js
CHANGED
package/lib/store/pagination.js
CHANGED
package/lib/store/root.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
33
33
|
query: import("mobx-state-tree").IType<any, any, any>;
|
|
34
34
|
visibleState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
35
35
|
disableState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
36
|
+
staticState: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<any, any, any>, [undefined]>;
|
|
36
37
|
}, {
|
|
37
38
|
readonly parentStore: any;
|
|
38
39
|
readonly __: any;
|
|
@@ -79,5 +80,6 @@ export declare const RootStore: import("mobx-state-tree").IModelType<{
|
|
|
79
80
|
updateLocation(location?: any): void;
|
|
80
81
|
setVisible(id: string, value: boolean): void;
|
|
81
82
|
setDisable(id: string, value: boolean): void;
|
|
83
|
+
setStatic(id: string, value: boolean): void;
|
|
82
84
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
83
85
|
export declare type IRootStore = Instance<typeof RootStore>;
|
package/lib/store/root.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -19,12 +19,13 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
19
19
|
runtimeErrorStack: mobxStateTree.types.frozen(),
|
|
20
20
|
query: mobxStateTree.types.frozen(),
|
|
21
21
|
visibleState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
22
|
-
disableState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {})
|
|
22
|
+
disableState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
23
|
+
staticState: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {})
|
|
23
24
|
})
|
|
24
25
|
.views(function (self) { return ({
|
|
25
26
|
get downStream() {
|
|
26
27
|
return self.query
|
|
27
|
-
? object.createObject(
|
|
28
|
+
? object.createObject(object.extendObject(self.data && self.data.__super ? self.data.__super : null, tslib.__assign(tslib.__assign({}, self.query), { __query: self.query })), self.data)
|
|
28
29
|
: self.data;
|
|
29
30
|
}
|
|
30
31
|
}); })
|
|
@@ -45,6 +46,11 @@ var RootStore = service.ServiceStore.named('RootStore')
|
|
|
45
46
|
var _a;
|
|
46
47
|
var state = tslib.__assign(tslib.__assign({}, self.disableState), (_a = {}, _a[id] = value, _a));
|
|
47
48
|
self.disableState = state;
|
|
49
|
+
},
|
|
50
|
+
setStatic: function (id, value) {
|
|
51
|
+
var _a;
|
|
52
|
+
var state = tslib.__assign(tslib.__assign({}, self.staticState), (_a = {}, _a[id] = value, _a));
|
|
53
|
+
self.staticState = state;
|
|
48
54
|
}
|
|
49
55
|
}); });
|
|
50
56
|
|
package/lib/store/service.js
CHANGED
package/lib/store/table.js
CHANGED
package/lib/store/table2.js
CHANGED
package/lib/theme.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -222,9 +222,11 @@ export interface Schema {
|
|
|
222
222
|
visibleOn?: string;
|
|
223
223
|
hiddenOn?: string;
|
|
224
224
|
disabledOn?: string;
|
|
225
|
+
staticOn?: string;
|
|
225
226
|
visible?: boolean;
|
|
226
227
|
hidden?: boolean;
|
|
227
228
|
disabled?: boolean;
|
|
229
|
+
static?: boolean;
|
|
228
230
|
children?: JSX.Element | ((props: any, schema?: any) => JSX.Element) | null;
|
|
229
231
|
definitions?: Definitions;
|
|
230
232
|
[propName: string]: any;
|
|
@@ -449,5 +451,30 @@ export interface BaseSchemaWithoutType {
|
|
|
449
451
|
actions: ListenerAction[];
|
|
450
452
|
};
|
|
451
453
|
};
|
|
454
|
+
/**
|
|
455
|
+
* 是否静态展示
|
|
456
|
+
*/
|
|
457
|
+
static?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* 是否静态展示表达式
|
|
460
|
+
*/
|
|
461
|
+
staticOn?: SchemaExpression;
|
|
462
|
+
/**
|
|
463
|
+
* 静态展示空值占位
|
|
464
|
+
*/
|
|
465
|
+
staticPlaceholder?: string;
|
|
466
|
+
/**
|
|
467
|
+
* 静态展示表单项类名
|
|
468
|
+
*/
|
|
469
|
+
staticClassName?: SchemaClassName;
|
|
470
|
+
/**
|
|
471
|
+
* 静态展示表单项Label类名
|
|
472
|
+
*/
|
|
473
|
+
staticLabelClassName?: SchemaClassName;
|
|
474
|
+
/**
|
|
475
|
+
* 静态展示表单项Value类名
|
|
476
|
+
*/
|
|
477
|
+
staticInputClassName?: SchemaClassName;
|
|
478
|
+
staticSchema?: any;
|
|
452
479
|
}
|
|
453
480
|
export {};
|
package/lib/utils/Animation.js
CHANGED
package/lib/utils/ColorScale.js
CHANGED
package/lib/utils/DataSchema.js
CHANGED
package/lib/utils/DataScope.js
CHANGED
package/lib/utils/RootClose.js
CHANGED
package/lib/utils/SimpleMap.js
CHANGED
package/lib/utils/api.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function buildApi(api: Api, data?: object, options?: {
|
|
|
13
13
|
export declare function str2function(contents: string, ...args: Array<string>): Function | null;
|
|
14
14
|
export declare function str2AsyncFunction(contents: string, ...args: Array<string>): Function | null;
|
|
15
15
|
export declare function responseAdaptor(ret: fetcherResult, api: ApiObject): Payload;
|
|
16
|
-
export declare function wrapFetcher(fn: (config: fetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void):
|
|
16
|
+
export declare function wrapFetcher(fn: (config: fetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void): any;
|
|
17
17
|
export declare function wrapAdaptor(promise: Promise<fetcherResult>, api: ApiObject): Promise<Payload>;
|
|
18
18
|
/**
|
|
19
19
|
* 请求远程 js 文件然后 new Function 执行,用于 schemaApi 支持 JavaScript
|
package/lib/utils/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.4.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -147,7 +147,10 @@ function buildApi(api, data, options) {
|
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
149
149
|
api.query = data;
|
|
150
|
-
|
|
150
|
+
var query = helper.qsstringify(data);
|
|
151
|
+
if (query) {
|
|
152
|
+
api.url = "".concat(api.url, "?").concat(query);
|
|
153
|
+
}
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
if (api.data && api.attachDataToQuery !== false) {
|
|
@@ -158,7 +161,10 @@ function buildApi(api, data, options) {
|
|
|
158
161
|
}
|
|
159
162
|
else {
|
|
160
163
|
api.query = api.data;
|
|
161
|
-
|
|
164
|
+
var query = helper.qsstringify(api.data);
|
|
165
|
+
if (query) {
|
|
166
|
+
api.url = "".concat(api.url, "?").concat(query);
|
|
167
|
+
}
|
|
162
168
|
}
|
|
163
169
|
delete api.data;
|
|
164
170
|
}
|
|
@@ -305,7 +311,11 @@ function responseAdaptor(ret, api) {
|
|
|
305
311
|
return payload;
|
|
306
312
|
}
|
|
307
313
|
function wrapFetcher(fn, tracker) {
|
|
308
|
-
|
|
314
|
+
// 避免重复处理
|
|
315
|
+
if (fn._wrappedFetcher) {
|
|
316
|
+
return fn;
|
|
317
|
+
}
|
|
318
|
+
var wrappedFetcher = function (api, data, options) {
|
|
309
319
|
var _a, _b, _c;
|
|
310
320
|
api = buildApi(api, data, options);
|
|
311
321
|
if (api.requestAdaptor) {
|
|
@@ -363,6 +373,8 @@ function wrapFetcher(fn, tracker) {
|
|
|
363
373
|
}
|
|
364
374
|
return wrapAdaptor(fn(api), api);
|
|
365
375
|
};
|
|
376
|
+
wrappedFetcher._wrappedFetcher = true;
|
|
377
|
+
return wrappedFetcher;
|
|
366
378
|
}
|
|
367
379
|
function wrapAdaptor(promise, api) {
|
|
368
380
|
var _this = this;
|
package/lib/utils/autobind.js
CHANGED