amis-core 6.0.0 → 6.1.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 +2 -2
- package/esm/RootRenderer.js +4 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +6 -0
- package/esm/Scoped.js +45 -8
- package/esm/StatusScoped.js +2 -2
- package/esm/WithRootStore.js +2 -2
- package/esm/WithStore.js +4 -6
- package/esm/actions/Action.js +2 -2
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +2 -2
- package/esm/actions/BroadcastAction.js +2 -2
- package/esm/actions/CmptAction.js +2 -2
- package/esm/actions/ContinueAction.js +2 -2
- package/esm/actions/CopyAction.js +2 -2
- package/esm/actions/CustomAction.js +3 -3
- package/esm/actions/DialogAction.js +2 -2
- package/esm/actions/DrawerAction.js +2 -2
- package/esm/actions/EmailAction.js +2 -2
- package/esm/actions/LinkAction.js +10 -5
- package/esm/actions/LoopAction.js +2 -2
- package/esm/actions/PageAction.js +2 -2
- package/esm/actions/ParallelAction.js +2 -2
- package/esm/actions/StatusAction.js +2 -2
- package/esm/actions/SwitchAction.js +2 -2
- package/esm/actions/ToastAction.js +2 -2
- package/esm/components/CustomStyle.d.ts +1 -2
- package/esm/components/CustomStyle.js +20 -7
- package/esm/components/ErrorBoundary.js +2 -2
- package/esm/components/LazyComponent.js +2 -2
- package/esm/components/Overlay.js +11 -9
- package/esm/components/PopOver.js +7 -5
- package/esm/env.d.ts +4 -0
- package/esm/env.js +2 -2
- package/esm/envOverwrite.js +2 -2
- package/esm/factory.js +15 -2
- package/esm/index.d.ts +2 -2
- package/esm/index.js +13 -8
- package/esm/locale.js +2 -2
- package/esm/polyfills.js +2 -2
- package/esm/renderers/Form.d.ts +4 -3
- package/esm/renderers/Form.js +94 -42
- package/esm/renderers/Item.d.ts +1 -0
- package/esm/renderers/Item.js +15 -16
- package/esm/renderers/Options.d.ts +5 -0
- package/esm/renderers/Options.js +27 -10
- package/esm/renderers/Placeholder.js +2 -2
- package/esm/renderers/builtin.js +2 -2
- package/esm/renderers/register.js +2 -2
- package/esm/renderers/wrapControl.js +37 -29
- package/esm/store/app.js +3 -3
- package/esm/store/combo.d.ts +48 -24
- package/esm/store/combo.js +2 -2
- package/esm/store/crud.js +2 -2
- package/esm/store/form.d.ts +20 -10
- package/esm/store/form.js +2 -2
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +4 -3
- package/esm/store/iRenderer.js +5 -3
- package/esm/store/index.js +2 -2
- package/esm/store/list.js +2 -2
- package/esm/store/manager.js +2 -2
- package/esm/store/modal.js +2 -2
- package/esm/store/node.js +2 -2
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.js +3 -3
- package/esm/store/service.js +2 -2
- package/esm/store/status.js +2 -2
- package/esm/store/table.d.ts +42 -20
- package/esm/store/table.js +33 -19
- package/esm/store/table2.js +2 -2
- package/esm/theme.js +2 -2
- package/esm/utils/Animation.js +2 -2
- package/esm/utils/ColorScale.js +2 -2
- package/esm/utils/DataSchema.js +2 -2
- package/esm/utils/DataScope.js +2 -2
- package/esm/utils/RootClose.js +2 -2
- package/esm/utils/SimpleMap.js +2 -2
- package/esm/utils/api.js +2 -2
- package/esm/utils/arraySlice.js +2 -2
- package/esm/utils/attachmentAdpator.js +2 -2
- package/esm/utils/autobind.js +2 -2
- package/esm/utils/browser.js +2 -2
- package/esm/utils/columnsSplit.js +2 -2
- package/esm/utils/concatData.js +2 -2
- package/esm/utils/dataMapping.js +2 -2
- package/esm/utils/date.js +2 -2
- package/esm/utils/debug.js +2 -2
- package/esm/utils/decodeEntity.js +2 -2
- package/esm/utils/dom.js +2 -2
- package/esm/utils/errors.js +2 -2
- package/esm/utils/escapeHtml.js +2 -2
- package/esm/utils/filter-schema.js +2 -2
- package/esm/utils/filter.js +2 -2
- package/esm/utils/formatDuration.js +2 -2
- package/esm/utils/formula.js +2 -2
- package/esm/utils/getVariable.js +2 -2
- package/esm/utils/grammar.js +2 -2
- package/esm/utils/handleAction.js +2 -2
- package/esm/utils/helper.d.ts +8 -1
- package/esm/utils/helper.js +28 -10
- package/esm/utils/highlight.js +4 -3
- package/esm/utils/icon.js +2 -2
- package/esm/utils/image.js +2 -2
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +2 -2
- package/esm/utils/json-schema-2-amis-schema.js +2 -2
- package/esm/utils/keyToPath.js +2 -2
- package/esm/utils/labelToString.d.ts +1 -0
- package/esm/utils/labelToString.js +38 -0
- package/esm/utils/makeSorter.js +2 -2
- package/esm/utils/math.js +2 -2
- package/esm/utils/memoryParse.js +2 -2
- package/esm/utils/normalizeLink.js +2 -2
- package/esm/utils/normalizeOptions.js +2 -2
- package/esm/utils/object.js +2 -2
- package/esm/utils/offset.js +2 -2
- package/esm/utils/offsetParent.js +2 -2
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +2 -2
- package/esm/utils/prettyBytes.js +2 -2
- package/esm/utils/renderer-event.js +2 -2
- package/esm/utils/replaceText.js +10 -12
- package/esm/utils/resize-sensor.js +2 -2
- package/esm/utils/resolveCondition.js +2 -2
- package/esm/utils/resolveVariable.js +2 -2
- package/esm/utils/resolveVariableAndFilter.js +2 -2
- package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/esm/utils/scrollPosition.js +2 -2
- package/esm/utils/string2regExp.d.ts +1 -1
- package/esm/utils/string2regExp.js +5 -4
- package/esm/utils/stripNumber.js +2 -2
- package/esm/utils/style-helper.d.ts +24 -5
- package/esm/utils/style-helper.js +47 -17
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +2 -2
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +11 -4
- package/esm/utils/tpl-builtin.js +2 -2
- package/esm/utils/tpl-lodash.js +2 -2
- package/esm/utils/tpl.js +7 -9
- package/esm/utils/uncontrollable.js +2 -2
- package/esm/utils/validateId.d.ts +16 -0
- package/esm/utils/validateId.js +154 -0
- package/esm/utils/validations.js +17 -9
- package/lib/Root.js +2 -2
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +4 -3
- package/lib/SchemaRenderer.js +5 -2
- package/lib/Scoped.d.ts +6 -0
- package/lib/Scoped.js +45 -7
- package/lib/StatusScoped.js +2 -2
- package/lib/WithRootStore.js +2 -2
- package/lib/WithStore.js +4 -6
- package/lib/actions/Action.js +2 -2
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +2 -2
- package/lib/actions/BroadcastAction.js +2 -2
- package/lib/actions/CmptAction.js +2 -2
- package/lib/actions/ContinueAction.js +2 -2
- package/lib/actions/CopyAction.js +2 -2
- package/lib/actions/CustomAction.js +3 -3
- package/lib/actions/DialogAction.js +2 -2
- package/lib/actions/DrawerAction.js +2 -2
- package/lib/actions/EmailAction.js +2 -2
- package/lib/actions/LinkAction.js +10 -5
- package/lib/actions/LoopAction.js +2 -2
- package/lib/actions/PageAction.js +2 -2
- package/lib/actions/ParallelAction.js +2 -2
- package/lib/actions/StatusAction.js +2 -2
- package/lib/actions/SwitchAction.js +2 -2
- package/lib/actions/ToastAction.js +2 -2
- package/lib/components/CustomStyle.d.ts +1 -2
- package/lib/components/CustomStyle.js +20 -7
- package/lib/components/ErrorBoundary.js +2 -2
- package/lib/components/LazyComponent.js +2 -2
- package/lib/components/Overlay.js +10 -8
- package/lib/components/PopOver.js +7 -5
- package/lib/env.d.ts +4 -0
- package/lib/env.js +2 -2
- package/lib/envOverwrite.js +2 -2
- package/lib/factory.js +15 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +16 -5
- package/lib/locale.js +2 -2
- package/lib/polyfills.js +2 -2
- package/lib/renderers/Form.d.ts +4 -3
- package/lib/renderers/Form.js +94 -42
- package/lib/renderers/Item.d.ts +1 -0
- package/lib/renderers/Item.js +15 -16
- package/lib/renderers/Options.d.ts +5 -0
- package/lib/renderers/Options.js +27 -10
- package/lib/renderers/Placeholder.js +2 -2
- package/lib/renderers/builtin.js +2 -2
- package/lib/renderers/register.js +2 -2
- package/lib/renderers/wrapControl.js +36 -28
- package/lib/store/app.js +3 -3
- package/lib/store/combo.d.ts +72 -49
- package/lib/store/combo.js +2 -2
- package/lib/store/crud.js +2 -2
- package/lib/store/form.d.ts +30 -21
- package/lib/store/form.js +2 -2
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +4 -3
- package/lib/store/iRenderer.js +5 -3
- package/lib/store/index.js +2 -2
- package/lib/store/list.js +2 -2
- package/lib/store/manager.js +2 -2
- package/lib/store/modal.js +2 -2
- package/lib/store/node.js +2 -2
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.js +3 -3
- package/lib/store/service.js +2 -2
- package/lib/store/status.js +2 -2
- package/lib/store/table.d.ts +62 -41
- package/lib/store/table.js +33 -19
- package/lib/store/table2.js +2 -2
- package/lib/theme.js +2 -2
- package/lib/utils/Animation.js +2 -2
- package/lib/utils/ColorScale.js +2 -2
- package/lib/utils/DataSchema.js +2 -2
- package/lib/utils/DataScope.js +2 -2
- package/lib/utils/RootClose.js +2 -2
- package/lib/utils/SimpleMap.js +2 -2
- package/lib/utils/api.js +2 -2
- package/lib/utils/arraySlice.js +2 -2
- package/lib/utils/attachmentAdpator.js +2 -2
- package/lib/utils/autobind.js +2 -2
- package/lib/utils/browser.js +2 -2
- package/lib/utils/columnsSplit.js +2 -2
- package/lib/utils/concatData.js +2 -2
- package/lib/utils/dataMapping.js +2 -2
- package/lib/utils/date.js +2 -2
- package/lib/utils/debug.js +2 -2
- package/lib/utils/decodeEntity.js +2 -2
- package/lib/utils/dom.js +2 -2
- package/lib/utils/errors.js +2 -2
- package/lib/utils/escapeHtml.js +2 -2
- package/lib/utils/filter-schema.js +2 -2
- package/lib/utils/filter.js +2 -2
- package/lib/utils/formatDuration.js +2 -2
- package/lib/utils/formula.js +2 -2
- package/lib/utils/getVariable.js +2 -2
- package/lib/utils/grammar.js +2 -2
- package/lib/utils/handleAction.js +2 -2
- package/lib/utils/helper.d.ts +8 -1
- package/lib/utils/helper.js +29 -8
- package/lib/utils/highlight.js +4 -3
- package/lib/utils/icon.js +2 -2
- package/lib/utils/image.js +2 -2
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +2 -2
- package/lib/utils/json-schema-2-amis-schema.js +2 -2
- package/lib/utils/keyToPath.js +2 -2
- package/lib/utils/labelToString.d.ts +1 -0
- package/lib/utils/labelToString.js +46 -0
- package/lib/utils/makeSorter.js +2 -2
- package/lib/utils/math.js +2 -2
- package/lib/utils/memoryParse.js +2 -2
- package/lib/utils/normalizeLink.js +2 -2
- package/lib/utils/normalizeOptions.js +2 -2
- package/lib/utils/object.js +2 -2
- package/lib/utils/offset.js +2 -2
- package/lib/utils/offsetParent.js +2 -2
- package/lib/utils/optionValueCompare.js +2 -2
- package/lib/utils/position.js +2 -2
- package/lib/utils/prettyBytes.js +2 -2
- package/lib/utils/renderer-event.js +2 -2
- package/lib/utils/replaceText.js +9 -15
- package/lib/utils/resize-sensor.js +2 -2
- package/lib/utils/resolveCondition.js +2 -2
- package/lib/utils/resolveVariable.js +2 -2
- package/lib/utils/resolveVariableAndFilter.js +2 -2
- package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/lib/utils/scrollPosition.js +2 -2
- package/lib/utils/string2regExp.d.ts +1 -1
- package/lib/utils/string2regExp.js +5 -4
- package/lib/utils/stripNumber.js +2 -2
- package/lib/utils/style-helper.d.ts +24 -5
- package/lib/utils/style-helper.js +47 -17
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +2 -2
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +11 -3
- package/lib/utils/tpl-builtin.js +2 -2
- package/lib/utils/tpl-lodash.js +2 -2
- package/lib/utils/tpl.js +6 -8
- package/lib/utils/uncontrollable.js +2 -2
- package/lib/utils/validateId.d.ts +16 -0
- package/lib/utils/validateId.js +160 -0
- package/lib/utils/validations.js +17 -9
- package/package.json +3 -3
- package/LICENSE +0 -201
package/lib/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { RegisterStore } from './store';
|
|
|
19
19
|
import type { IColumn, IColumn2, IRow, IRow2 } from './store';
|
|
20
20
|
import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, removeLocaleData, localeable } from './locale';
|
|
21
21
|
import type { LocaleProps, TranslateFn } from './locale';
|
|
22
|
-
import Scoped, { ScopedContext, filterTarget } from './Scoped';
|
|
22
|
+
import Scoped, { ScopedContext, filterTarget, splitTarget } from './Scoped';
|
|
23
23
|
import type { ScopedComponentType, IScopedContext } from './Scoped';
|
|
24
24
|
import { classnames, getClassPrefix, setDefaultTheme, theme, getTheme, themeable, makeClassnames } from './theme';
|
|
25
25
|
import type { ClassNamesFn, ThemeProps } from './theme';
|
|
@@ -50,5 +50,5 @@ import type { IItem } from './store/list';
|
|
|
50
50
|
import CustomStyle from './components/CustomStyle';
|
|
51
51
|
import { StatusScoped } from './StatusScoped';
|
|
52
52
|
export declare const version = "__buildVersion";
|
|
53
|
-
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, StatusScoped, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, ErrorBoundary, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig, styleMap, RENDERER_TRANSMISSION_OMIT_PROPS, ScopedComponentType, IItem, IColumn, IRow, IColumn2, IRow2, OnEventProps, FormSchemaBase, filterTarget, CustomStyle, enableDebug, disableDebug };
|
|
53
|
+
export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, StatusScoped, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, ErrorBoundary, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig, styleMap, RENDERER_TRANSMISSION_OMIT_PROPS, ScopedComponentType, IItem, IColumn, IRow, IColumn2, IRow2, OnEventProps, FormSchemaBase, filterTarget, splitTarget, CustomStyle, enableDebug, disableDebug };
|
|
54
54
|
export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -41,6 +41,7 @@ var image = require('./utils/image.js');
|
|
|
41
41
|
var isPureVariable = require('./utils/isPureVariable.js');
|
|
42
42
|
var jsonSchema2AmisSchema = require('./utils/json-schema-2-amis-schema.js');
|
|
43
43
|
var keyToPath = require('./utils/keyToPath.js');
|
|
44
|
+
var labelToString = require('./utils/labelToString.js');
|
|
44
45
|
var makeSorter = require('./utils/makeSorter.js');
|
|
45
46
|
var normalizeLink = require('./utils/normalizeLink.js');
|
|
46
47
|
var normalizeOptions = require('./utils/normalizeOptions.js');
|
|
@@ -135,7 +136,7 @@ var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
|
135
136
|
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
136
137
|
var classPrefix = theme.getClassPrefix();
|
|
137
138
|
// @ts-ignore
|
|
138
|
-
var version = '6.
|
|
139
|
+
var version = '6.1.0';
|
|
139
140
|
function render(schema, props, options, pathPrefix) {
|
|
140
141
|
if (props === void 0) { props = {}; }
|
|
141
142
|
if (options === void 0) { options = {}; }
|
|
@@ -194,8 +195,12 @@ function AMISRenderer(_a) {
|
|
|
194
195
|
props.mobileUI = env$1.isMobile();
|
|
195
196
|
}
|
|
196
197
|
// 根据环境覆盖 schema,这个要在最前面做,不然就无法覆盖 validations
|
|
197
|
-
schema =
|
|
198
|
-
|
|
198
|
+
schema = React__default["default"].useMemo(function () {
|
|
199
|
+
schema = envOverwrite.envOverwrite(schema, locale$1);
|
|
200
|
+
// todo 和 envOverwrite 一起处理,减少循环次数
|
|
201
|
+
schema = replaceText.replaceText(schema, options.replaceText, env$1.replaceTextIgnoreKeys);
|
|
202
|
+
return schema;
|
|
203
|
+
}, [schema, locale$1]);
|
|
199
204
|
return (_J$X_(env.EnvContext.Provider, { value: env$1 },
|
|
200
205
|
_J$X_(Root["default"], tslib.__assign({}, props, { schema: schema, pathPrefix: pathPrefix, rootStore: store, env: env$1, theme: theme$1, locale: locale$1, translate: translate }))));
|
|
201
206
|
}
|
|
@@ -277,10 +282,12 @@ exports.handleAction = handleAction.handleAction;
|
|
|
277
282
|
exports.JSONTraverse = helper.JSONTraverse;
|
|
278
283
|
exports.JSONValueMap = helper.JSONValueMap;
|
|
279
284
|
exports.SkipOperation = helper.SkipOperation;
|
|
285
|
+
exports.TEST_ID_KEY = helper.TEST_ID_KEY;
|
|
280
286
|
exports.ValidateError = helper.ValidateError;
|
|
281
287
|
exports.__uri = helper.__uri;
|
|
282
288
|
exports.anyChanged = helper.anyChanged;
|
|
283
289
|
exports.autobind = helper.autobind;
|
|
290
|
+
exports.buildTestId = helper.buildTestId;
|
|
284
291
|
exports.buildTrackExpression = helper.buildTrackExpression;
|
|
285
292
|
exports.bulkBindFunctions = helper.bulkBindFunctions;
|
|
286
293
|
exports.camel = helper.camel;
|
|
@@ -308,6 +315,7 @@ exports.getPropValue = helper.getPropValue;
|
|
|
308
315
|
exports.getRange = helper.getRange;
|
|
309
316
|
exports.getScrollParent = helper.getScrollParent;
|
|
310
317
|
exports.getScrollbarWidth = helper.getScrollbarWidth;
|
|
318
|
+
exports.getTestId = helper.getTestId;
|
|
311
319
|
exports.getTree = helper.getTree;
|
|
312
320
|
exports.getTreeAncestors = helper.getTreeAncestors;
|
|
313
321
|
exports.getTreeDepth = helper.getTreeDepth;
|
|
@@ -374,6 +382,7 @@ exports.toDataURL = image.toDataURL;
|
|
|
374
382
|
exports.isPureVariable = isPureVariable.isPureVariable;
|
|
375
383
|
exports.JSONSchme2AMisSchema = jsonSchema2AmisSchema.JSONSchme2AMisSchema;
|
|
376
384
|
exports.keyToPath = keyToPath.keyToPath;
|
|
385
|
+
exports.labelToString = labelToString.labelToString;
|
|
377
386
|
exports.makeSorter = makeSorter.makeSorter;
|
|
378
387
|
exports.normalizeLink = normalizeLink.normalizeLink;
|
|
379
388
|
exports.normalizeOptions = normalizeOptions.normalizeOptions;
|
|
@@ -412,6 +421,7 @@ exports.scrollPosition = scrollPosition.scrollPosition;
|
|
|
412
421
|
exports.SimpleMap = SimpleMap.SimpleMap;
|
|
413
422
|
exports.string2regExp = string2regExp.string2regExp;
|
|
414
423
|
exports.buildStyle = style.buildStyle;
|
|
424
|
+
exports.memoParse = tokenize.memoParse;
|
|
415
425
|
exports.tokenize = tokenize.tokenize;
|
|
416
426
|
exports.register = tplBuiltin.register;
|
|
417
427
|
exports.asyncFilter = tpl.asyncFilter;
|
|
@@ -466,6 +476,7 @@ exports.setDefaultLocale = locale.setDefaultLocale;
|
|
|
466
476
|
exports.Scoped = Scoped.HocScoped;
|
|
467
477
|
exports.ScopedContext = Scoped.ScopedContext;
|
|
468
478
|
exports.filterTarget = Scoped.filterTarget;
|
|
479
|
+
exports.splitTarget = Scoped.splitTarget;
|
|
469
480
|
exports.classnames = theme.classnames;
|
|
470
481
|
exports.getClassPrefix = theme.getClassPrefix;
|
|
471
482
|
exports.getTheme = theme.getTheme;
|
package/lib/locale.js
CHANGED
package/lib/polyfills.js
CHANGED
package/lib/renderers/Form.d.ts
CHANGED
|
@@ -341,15 +341,16 @@ export default class Form extends React.Component<FormProps, object> {
|
|
|
341
341
|
silentReload(target?: string, query?: any): void;
|
|
342
342
|
initInterval(value: any): any;
|
|
343
343
|
isValidated(): boolean;
|
|
344
|
-
validate(forceValidate?: boolean, throwErrors?: boolean, toastErrors?: boolean): Promise<boolean>;
|
|
344
|
+
validate(forceValidate?: boolean, throwErrors?: boolean, toastErrors?: boolean, skipFlush?: boolean): Promise<boolean>;
|
|
345
345
|
setErrors(errors: {
|
|
346
346
|
[propName: string]: string;
|
|
347
347
|
}, tag?: string): void;
|
|
348
348
|
clearErrors(): void;
|
|
349
349
|
getValues(): any;
|
|
350
350
|
setValues(value: any, replace?: boolean): void;
|
|
351
|
-
submit(fn?: (values: object) => Promise<any>, throwErrors?: boolean): Promise<any>;
|
|
352
|
-
|
|
351
|
+
submit(fn?: (values: object) => Promise<any>, throwErrors?: boolean, skipFlush?: boolean): Promise<any>;
|
|
352
|
+
flushing: boolean;
|
|
353
|
+
flush(): Promise<void>;
|
|
353
354
|
reset(): void;
|
|
354
355
|
addHook(fn: () => any, type?: 'validate' | 'init' | 'flush'): () => void;
|
|
355
356
|
removeHook(fn: () => any, type?: string): void;
|
package/lib/renderers/Form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -43,13 +43,13 @@ require('../utils/image.js');
|
|
|
43
43
|
require('lodash/isPlainObject');
|
|
44
44
|
require('lodash/isEqual');
|
|
45
45
|
require('../actions/Action.js');
|
|
46
|
-
require('lodash/cloneDeep');
|
|
47
46
|
require('../utils/resize-sensor.js');
|
|
48
47
|
require('react-overlays/useRootClose');
|
|
49
48
|
require('react-dom');
|
|
50
49
|
require('../utils/SimpleMap.js');
|
|
51
50
|
require('lodash/mapValues');
|
|
52
51
|
require('lodash/camelCase');
|
|
52
|
+
require('lodash/cloneDeep');
|
|
53
53
|
require('lodash/map');
|
|
54
54
|
require('lodash/isEmpty');
|
|
55
55
|
require('lodash/kebabCase');
|
|
@@ -81,6 +81,8 @@ var Form = /** @class */ (function (_super) {
|
|
|
81
81
|
trailing: true,
|
|
82
82
|
leading: false
|
|
83
83
|
});
|
|
84
|
+
// 如果开启了 lazyChange,需要一个 flush 方法把队列中值应用上。
|
|
85
|
+
_this.flushing = false;
|
|
84
86
|
_this.onInit = _this.onInit.bind(_this);
|
|
85
87
|
_this.handleAction = _this.handleAction.bind(_this);
|
|
86
88
|
_this.handleQuery = _this.handleQuery.bind(_this);
|
|
@@ -393,22 +395,27 @@ var Form = /** @class */ (function (_super) {
|
|
|
393
395
|
Form.prototype.isValidated = function () {
|
|
394
396
|
return this.props.store.validated;
|
|
395
397
|
};
|
|
396
|
-
Form.prototype.validate = function (forceValidate, throwErrors, toastErrors) {
|
|
398
|
+
Form.prototype.validate = function (forceValidate, throwErrors, toastErrors, skipFlush) {
|
|
397
399
|
if (throwErrors === void 0) { throwErrors = false; }
|
|
398
400
|
if (toastErrors === void 0) { toastErrors = true; }
|
|
401
|
+
if (skipFlush === void 0) { skipFlush = false; }
|
|
399
402
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
400
403
|
var _a, store, dispatchEvent, data, messages, __, result;
|
|
401
404
|
return tslib.__generator(this, function (_b) {
|
|
402
405
|
switch (_b.label) {
|
|
403
406
|
case 0:
|
|
404
407
|
_a = this.props, store = _a.store, dispatchEvent = _a.dispatchEvent, data = _a.data, messages = _a.messages, __ = _a.translate;
|
|
405
|
-
|
|
406
|
-
return [4 /*yield*/,
|
|
407
|
-
? ''
|
|
408
|
-
: typeof (messages === null || messages === void 0 ? void 0 : messages.validateFailed) === 'string'
|
|
409
|
-
? __(tpl.filter(messages.validateFailed, store.data))
|
|
410
|
-
: undefined)];
|
|
408
|
+
if (!!skipFlush) return [3 /*break*/, 2];
|
|
409
|
+
return [4 /*yield*/, this.flush()];
|
|
411
410
|
case 1:
|
|
411
|
+
_b.sent();
|
|
412
|
+
_b.label = 2;
|
|
413
|
+
case 2: return [4 /*yield*/, store.validate(this.hooks['validate'] || [], forceValidate, throwErrors, toastErrors === false
|
|
414
|
+
? ''
|
|
415
|
+
: typeof (messages === null || messages === void 0 ? void 0 : messages.validateFailed) === 'string'
|
|
416
|
+
? __(tpl.filter(messages.validateFailed, store.data))
|
|
417
|
+
: undefined)];
|
|
418
|
+
case 3:
|
|
412
419
|
result = _b.sent();
|
|
413
420
|
dispatchEvent(result ? 'validateSucc' : 'validateError', data);
|
|
414
421
|
return [2 /*return*/, result];
|
|
@@ -435,20 +442,55 @@ var Form = /** @class */ (function (_super) {
|
|
|
435
442
|
this.flush();
|
|
436
443
|
store.setValues(value, undefined, replace);
|
|
437
444
|
};
|
|
438
|
-
Form.prototype.submit = function (fn, throwErrors) {
|
|
445
|
+
Form.prototype.submit = function (fn, throwErrors, skipFlush) {
|
|
439
446
|
if (throwErrors === void 0) { throwErrors = false; }
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
447
|
+
if (skipFlush === void 0) { skipFlush = false; }
|
|
448
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
449
|
+
var _a, store, messages, __, dispatchEvent, data, validateErrCb;
|
|
450
|
+
return tslib.__generator(this, function (_b) {
|
|
451
|
+
switch (_b.label) {
|
|
452
|
+
case 0:
|
|
453
|
+
_a = this.props, store = _a.store, messages = _a.messages, __ = _a.translate, dispatchEvent = _a.dispatchEvent, data = _a.data;
|
|
454
|
+
if (!!skipFlush) return [3 /*break*/, 2];
|
|
455
|
+
return [4 /*yield*/, this.flush()];
|
|
456
|
+
case 1:
|
|
457
|
+
_b.sent();
|
|
458
|
+
_b.label = 2;
|
|
459
|
+
case 2:
|
|
460
|
+
validateErrCb = function () { return dispatchEvent('validateError', data); };
|
|
461
|
+
return [2 /*return*/, store.submit(fn, this.hooks['validate'] || [], typeof (messages === null || messages === void 0 ? void 0 : messages.validateFailed) === 'string'
|
|
462
|
+
? __(tpl.filter(messages.validateFailed, store.data))
|
|
463
|
+
: undefined, validateErrCb, throwErrors)];
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
446
467
|
};
|
|
447
|
-
// 如果开启了 lazyChange,需要一个 flush 方法把队列中值应用上。
|
|
448
468
|
Form.prototype.flush = function () {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
469
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
470
|
+
var hooks;
|
|
471
|
+
return tslib.__generator(this, function (_a) {
|
|
472
|
+
switch (_a.label) {
|
|
473
|
+
case 0:
|
|
474
|
+
_a.trys.push([0, , 3, 4]);
|
|
475
|
+
if (this.flushing) {
|
|
476
|
+
return [2 /*return*/];
|
|
477
|
+
}
|
|
478
|
+
this.flushing = true;
|
|
479
|
+
hooks = this.hooks['flush'] || [];
|
|
480
|
+
return [4 /*yield*/, Promise.all(hooks.map(function (fn) { return fn(); }))];
|
|
481
|
+
case 1:
|
|
482
|
+
_a.sent();
|
|
483
|
+
return [4 /*yield*/, this.lazyEmitChange.flush()];
|
|
484
|
+
case 2:
|
|
485
|
+
_a.sent();
|
|
486
|
+
return [3 /*break*/, 4];
|
|
487
|
+
case 3:
|
|
488
|
+
this.flushing = false;
|
|
489
|
+
return [7 /*endfinally*/];
|
|
490
|
+
case 4: return [2 /*return*/];
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
});
|
|
452
494
|
};
|
|
453
495
|
Form.prototype.reset = function () {
|
|
454
496
|
var _a = this.props, store = _a.store, onReset = _a.onReset;
|
|
@@ -520,11 +562,17 @@ var Form = /** @class */ (function (_super) {
|
|
|
520
562
|
onChange && onChange.apply(null, changeProps);
|
|
521
563
|
}
|
|
522
564
|
store.clearRestError();
|
|
523
|
-
(submit || (submitOnChange && store.inited))
|
|
524
|
-
|
|
525
|
-
type: 'submit'
|
|
526
|
-
|
|
527
|
-
|
|
565
|
+
if (!(submit || (submitOnChange && store.inited))) return [3 /*break*/, 3];
|
|
566
|
+
return [4 /*yield*/, this.handleAction(undefined, {
|
|
567
|
+
type: 'submit',
|
|
568
|
+
// 如果这里不跳过,会相互依赖死循环,flush 会 让 emiteChange 立即执行
|
|
569
|
+
// handleAction 里面又会调用 flush
|
|
570
|
+
skipFormFlush: true
|
|
571
|
+
}, store.data)];
|
|
572
|
+
case 2:
|
|
573
|
+
_b.sent();
|
|
574
|
+
_b.label = 3;
|
|
575
|
+
case 3: return [2 /*return*/];
|
|
528
576
|
}
|
|
529
577
|
});
|
|
530
578
|
});
|
|
@@ -575,8 +623,12 @@ var Form = /** @class */ (function (_super) {
|
|
|
575
623
|
switch (_f.label) {
|
|
576
624
|
case 0:
|
|
577
625
|
_c = this.props, store = _c.store, onSubmit = _c.onSubmit, api$1 = _c.api, asyncApi = _c.asyncApi, finishedField = _c.finishedField, checkInterval = _c.checkInterval, _d = _c.messages, saveSuccess = _d.saveSuccess, saveFailed = _d.saveFailed, resetAfterSubmit = _c.resetAfterSubmit, clearAfterSubmit = _c.clearAfterSubmit, onAction = _c.onAction, onSaved = _c.onSaved, onReset = _c.onReset, onFinished = _c.onFinished, onFailed = _c.onFailed, redirect = _c.redirect, reload = _c.reload, target = _c.target, env = _c.env, onChange = _c.onChange, clearPersistDataAfterSubmit = _c.clearPersistDataAfterSubmit, trimValues = _c.trimValues, dispatchEvent = _c.dispatchEvent, __ = _c.translate;
|
|
578
|
-
|
|
579
|
-
this.flush();
|
|
626
|
+
if (!!action.skipFormFlush) return [3 /*break*/, 2];
|
|
627
|
+
return [4 /*yield*/, this.flush()];
|
|
628
|
+
case 1:
|
|
629
|
+
_f.sent();
|
|
630
|
+
_f.label = 2;
|
|
631
|
+
case 2:
|
|
580
632
|
if (trimValues) {
|
|
581
633
|
store.trimValues();
|
|
582
634
|
}
|
|
@@ -584,7 +636,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
584
636
|
if (data === this.props.data) {
|
|
585
637
|
data = store.data;
|
|
586
638
|
}
|
|
587
|
-
if (!(Array.isArray(action.required) && action.required.length)) return [3 /*break*/,
|
|
639
|
+
if (!(Array.isArray(action.required) && action.required.length)) return [3 /*break*/, 6];
|
|
588
640
|
/** 如果是按钮指定了required,则校验前先清空一下遗留的校验报错 */
|
|
589
641
|
store.clearErrors();
|
|
590
642
|
fields = action.required.map(function (item) { return ({
|
|
@@ -592,31 +644,31 @@ var Form = /** @class */ (function (_super) {
|
|
|
592
644
|
rules: { isRequired: true }
|
|
593
645
|
}); });
|
|
594
646
|
return [4 /*yield*/, store.validateFields(fields)];
|
|
595
|
-
case
|
|
647
|
+
case 3:
|
|
596
648
|
validationRes = _f.sent();
|
|
597
|
-
if (!!validationRes) return [3 /*break*/,
|
|
649
|
+
if (!!validationRes) return [3 /*break*/, 5];
|
|
598
650
|
return [4 /*yield*/, dispatchEvent('validateError', this.props.data)];
|
|
599
|
-
case
|
|
651
|
+
case 4:
|
|
600
652
|
dispatcher = _f.sent();
|
|
601
653
|
if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
|
|
602
654
|
env.notify('error', __('Form.validateFailed'));
|
|
603
655
|
}
|
|
604
656
|
/** 抛异常是为了在dialog中catch这个错误,避免弹窗直接关闭 */
|
|
605
657
|
return [2 /*return*/, Promise.reject(__('Form.validateFailed'))];
|
|
606
|
-
case
|
|
658
|
+
case 5:
|
|
607
659
|
/** 重置validated状态,保证submit时触发表单中的校验项 */
|
|
608
660
|
store.clearErrors();
|
|
609
|
-
_f.label =
|
|
610
|
-
case
|
|
661
|
+
_f.label = 6;
|
|
662
|
+
case 6:
|
|
611
663
|
if (!(action.type === 'submit' ||
|
|
612
664
|
action.actionType === 'submit' ||
|
|
613
665
|
action.actionType === 'confirm' ||
|
|
614
666
|
action.actionType === 'reset-and-submit' ||
|
|
615
|
-
action.actionType === 'clear-and-submit')) return [3 /*break*/,
|
|
667
|
+
action.actionType === 'clear-and-submit')) return [3 /*break*/, 8];
|
|
616
668
|
_e = this.props, dispatchEvent_1 = _e.dispatchEvent, onEvent = _e.onEvent;
|
|
617
669
|
submitEvent = (_b = (_a = onEvent === null || onEvent === void 0 ? void 0 : onEvent.submit) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.length;
|
|
618
670
|
return [4 /*yield*/, dispatchEvent_1('submit', this.props.data)];
|
|
619
|
-
case
|
|
671
|
+
case 7:
|
|
620
672
|
dispatcher = _f.sent();
|
|
621
673
|
if ((dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented) || submitEvent) {
|
|
622
674
|
return [2 /*return*/];
|
|
@@ -753,7 +805,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
753
805
|
return [2 /*return*/, Promise.resolve(null)];
|
|
754
806
|
}
|
|
755
807
|
});
|
|
756
|
-
}); }, throwErrors)
|
|
808
|
+
}); }, throwErrors, true)
|
|
757
809
|
.then(function (values) {
|
|
758
810
|
// 有可能 onSubmit return false 了,那么后面的就不应该再执行了。
|
|
759
811
|
if (values === false) {
|
|
@@ -781,7 +833,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
781
833
|
throw reason;
|
|
782
834
|
}
|
|
783
835
|
})];
|
|
784
|
-
case
|
|
836
|
+
case 8:
|
|
785
837
|
if (action.type === 'reset' || action.actionType === 'reset') {
|
|
786
838
|
store.setCurrentAction(action);
|
|
787
839
|
store.reset(onReset);
|
|
@@ -792,7 +844,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
792
844
|
}
|
|
793
845
|
else if (action.actionType === 'validate') {
|
|
794
846
|
store.setCurrentAction(action);
|
|
795
|
-
return [2 /*return*/, this.validate(true, throwErrors)];
|
|
847
|
+
return [2 /*return*/, this.validate(true, throwErrors, true, true)];
|
|
796
848
|
}
|
|
797
849
|
else if (action.actionType === 'dialog') {
|
|
798
850
|
store.setCurrentAction(action);
|
|
@@ -868,8 +920,8 @@ var Form = /** @class */ (function (_super) {
|
|
|
868
920
|
// 不识别的丢给上层去处理。
|
|
869
921
|
return [2 /*return*/, onAction(e, action, data, throwErrors, delegate || this.context)];
|
|
870
922
|
}
|
|
871
|
-
_f.label =
|
|
872
|
-
case
|
|
923
|
+
_f.label = 9;
|
|
924
|
+
case 9: return [2 /*return*/];
|
|
873
925
|
}
|
|
874
926
|
});
|
|
875
927
|
});
|
package/lib/renderers/Item.d.ts
CHANGED
package/lib/renderers/Item.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
'use strict';
|
|
@@ -43,7 +43,6 @@ require('../utils/icon.js');
|
|
|
43
43
|
require('../utils/image.js');
|
|
44
44
|
require('lodash/isEqual');
|
|
45
45
|
require('../actions/Action.js');
|
|
46
|
-
require('lodash/cloneDeep');
|
|
47
46
|
require('../utils/resize-sensor.js');
|
|
48
47
|
require('react-overlays/useRootClose');
|
|
49
48
|
require('../utils/SimpleMap.js');
|
|
@@ -73,7 +72,7 @@ var getItemLabelClassName = function (props) {
|
|
|
73
72
|
var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName, id = props.id, themeCss = props.themeCss;
|
|
74
73
|
return props.static && staticLabelClassName
|
|
75
74
|
? staticLabelClassName
|
|
76
|
-
: cx__default["default"](labelClassName, styleHelper.setThemeClassName('labelClassName', id, themeCss, 'item'));
|
|
75
|
+
: cx__default["default"](labelClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'labelClassName', id: id, themeCss: themeCss, extra: 'item' })));
|
|
77
76
|
};
|
|
78
77
|
var getItemInputClassName = function (props) {
|
|
79
78
|
var staticInputClassName = props.staticInputClassName, inputClassName = props.inputClassName;
|
|
@@ -365,7 +364,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
365
364
|
typeof controlSize === 'string' &&
|
|
366
365
|
!!controlSize &&
|
|
367
366
|
controlSize !== 'full',
|
|
368
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', rest.id, rest.wrapperCustomStyle, 'item'), getItemInputClassName(this.props)) }));
|
|
367
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, this.props), { name: 'wrapperCustomStyle', id: rest.id, themeCss: rest.wrapperCustomStyle, extra: 'item' })), getItemInputClassName(this.props)) }));
|
|
369
368
|
}
|
|
370
369
|
return null;
|
|
371
370
|
};
|
|
@@ -388,7 +387,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
388
387
|
formStore: undefined
|
|
389
388
|
})
|
|
390
389
|
: null,
|
|
391
|
-
_J$X_(CustomStyle["default"], { config: {
|
|
390
|
+
_J$X_(CustomStyle["default"], tslib.__assign({}, this.props, { config: {
|
|
392
391
|
themeCss: themeCss || css,
|
|
393
392
|
classNames: [
|
|
394
393
|
{
|
|
@@ -400,7 +399,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
400
399
|
],
|
|
401
400
|
wrapperCustomStyle: wrapperCustomStyle,
|
|
402
401
|
id: id && id + '-item'
|
|
403
|
-
}, env: env })));
|
|
402
|
+
}, env: env }))));
|
|
404
403
|
};
|
|
405
404
|
/**
|
|
406
405
|
* 布局扩充点,可以自己扩充表单项的布局方式
|
|
@@ -424,7 +423,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
424
423
|
},
|
|
425
424
|
_a["is-error"] = model && !model.valid,
|
|
426
425
|
_a["is-required"] = required,
|
|
427
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
|
|
426
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
|
|
428
427
|
label !== false ? (_J$X_("label", { className: cx("Form-label", (_b = {},
|
|
429
428
|
_b["Form-itemColumn--".concat(typeof horizontal.leftFixed === 'string'
|
|
430
429
|
? horizontal.leftFixed
|
|
@@ -477,7 +476,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
477
476
|
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,
|
|
478
477
|
renderDescription !== false && description
|
|
479
478
|
? render('description', description, {
|
|
480
|
-
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
|
|
479
|
+
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
|
|
481
480
|
})
|
|
482
481
|
: null)));
|
|
483
482
|
},
|
|
@@ -489,7 +488,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
489
488
|
'is-error': model && !model.valid
|
|
490
489
|
},
|
|
491
490
|
_a["is-required"] = required,
|
|
492
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
|
|
491
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
|
|
493
492
|
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)) },
|
|
494
493
|
_J$X_("span", null,
|
|
495
494
|
label ? render('label', label) : null,
|
|
@@ -532,7 +531,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
532
531
|
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,
|
|
533
532
|
renderDescription !== false && description
|
|
534
533
|
? render('description', description, {
|
|
535
|
-
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
|
|
534
|
+
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
|
|
536
535
|
})
|
|
537
536
|
: null)) : (_J$X_(React__default["default"].Fragment, null,
|
|
538
537
|
renderControl(),
|
|
@@ -562,7 +561,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
562
561
|
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,
|
|
563
562
|
renderDescription !== false && description
|
|
564
563
|
? render('description', description, {
|
|
565
|
-
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
|
|
564
|
+
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
|
|
566
565
|
})
|
|
567
566
|
: null))));
|
|
568
567
|
},
|
|
@@ -575,7 +574,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
575
574
|
'is-error': model && !model.valid
|
|
576
575
|
},
|
|
577
576
|
_a["is-required"] = required,
|
|
578
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
|
|
577
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
|
|
579
578
|
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
580
579
|
_J$X_("span", null,
|
|
581
580
|
label ? render('label', label) : label,
|
|
@@ -618,7 +617,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
618
617
|
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,
|
|
619
618
|
renderDescription !== false && description
|
|
620
619
|
? render('description', description, {
|
|
621
|
-
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
|
|
620
|
+
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
|
|
622
621
|
})
|
|
623
622
|
: null)));
|
|
624
623
|
},
|
|
@@ -631,7 +630,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
631
630
|
'is-error': model && !model.valid
|
|
632
631
|
},
|
|
633
632
|
_a["is-required"] = required,
|
|
634
|
-
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
|
|
633
|
+
_a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
|
|
635
634
|
_J$X_("div", { className: cx('Form-rowInner') },
|
|
636
635
|
label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
|
|
637
636
|
_J$X_("span", null,
|
|
@@ -673,7 +672,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
673
672
|
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,
|
|
674
673
|
description && renderDescription !== false
|
|
675
674
|
? render('description', description, {
|
|
676
|
-
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
|
|
675
|
+
className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
|
|
677
676
|
})
|
|
678
677
|
: null));
|
|
679
678
|
}
|
|
@@ -126,6 +126,11 @@ export interface FormOptionsControl extends FormBaseControl {
|
|
|
126
126
|
autoFill?: {
|
|
127
127
|
[propName: string]: string;
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* @default fillIfNotSet
|
|
131
|
+
* 初始化时是否把其他字段同步到表单内部。
|
|
132
|
+
*/
|
|
133
|
+
initAutoFill?: boolean | 'fillIfNotSet';
|
|
129
134
|
}
|
|
130
135
|
export interface OptionsBasicConfig extends FormItemBasicConfig {
|
|
131
136
|
autoLoadOptionsFromSource?: boolean;
|