amis-core 2.9.0 → 3.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.d.ts +89 -4
- package/esm/Root.js +15 -4
- package/esm/RootRenderer.d.ts +3 -1
- package/esm/RootRenderer.js +9 -3
- package/esm/SchemaRenderer.d.ts +4 -2
- package/esm/SchemaRenderer.js +32 -24
- package/esm/Scoped.d.ts +8 -0
- package/esm/Scoped.js +20 -5
- package/esm/StatusScoped.d.ts +58 -0
- package/esm/StatusScoped.js +54 -0
- package/esm/WithRootStore.d.ts +2 -2
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +6 -2
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +19 -5
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +8 -7
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -4
- package/esm/actions/DialogAction.d.ts +16 -2
- package/esm/actions/DialogAction.js +23 -7
- package/esm/actions/DrawerAction.js +1 -1
- 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/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +13 -0
- package/esm/components/CustomStyle.js +18 -0
- package/esm/components/LazyComponent.d.ts +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +3 -3
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +2 -2
- package/esm/components/PopOver.js +1 -1
- package/esm/env.d.ts +10 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -5
- package/esm/factory.d.ts +5 -3
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +11 -4
- package/esm/index.js +55 -33
- package/esm/locale.d.ts +2 -2
- package/esm/locale.js +10 -3
- package/esm/renderers/Form.d.ts +3 -2
- package/esm/renderers/Form.js +216 -180
- package/esm/renderers/Item.d.ts +55 -41
- package/esm/renderers/Item.js +30 -19
- package/esm/renderers/Options.js +11 -4
- 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.d.ts +2 -2
- package/esm/renderers/wrapControl.js +13 -16
- package/esm/store/app.d.ts +1 -0
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +3 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +2 -0
- package/esm/store/crud.js +31 -9
- package/esm/store/form.d.ts +1 -0
- package/esm/store/form.js +10 -4
- package/esm/store/formItem.js +2 -2
- package/esm/store/iRenderer.d.ts +1 -0
- package/esm/store/iRenderer.js +54 -13
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +7 -3
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +1 -0
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +1 -0
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.d.ts +4 -6
- package/esm/store/root.js +53 -24
- package/esm/store/service.d.ts +1 -0
- package/esm/store/service.js +1 -1
- package/esm/store/status.d.ts +12 -0
- package/esm/store/status.js +38 -0
- package/esm/store/table.d.ts +28 -23
- package/esm/store/table.js +26 -5
- package/esm/store/table2.d.ts +7 -6
- package/esm/store/table2.js +27 -23
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/esm/utils/DataScope.js +88 -31
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +14 -5
- package/esm/utils/attachmentAdpator.js +2 -2
- 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.d.ts +7 -0
- package/esm/utils/date.js +34 -2
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +3 -0
- package/esm/utils/dom.js +47 -10
- 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.js +2 -2
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +3 -3
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +9 -2
- package/esm/utils/helper.js +52 -20
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +6 -1
- package/esm/utils/icon.js +6 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/esm/utils/memoryParse.js +26 -0
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +4 -2
- package/esm/utils/object.d.ts +2 -0
- package/esm/utils/object.js +27 -2
- 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 +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +1 -0
- package/esm/utils/resolveCondition.js +19 -4
- package/esm/utils/resolveVariable.js +4 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +23 -5
- 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.d.ts +12 -4
- package/esm/utils/style-helper.js +96 -19
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +19 -2
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +2 -0
- package/esm/utils/tpl.js +24 -2
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +4 -1
- package/esm/utils/validations.js +27 -12
- package/lib/Root.d.ts +89 -4
- package/lib/Root.js +15 -4
- package/lib/RootRenderer.d.ts +3 -1
- package/lib/RootRenderer.js +8 -2
- package/lib/SchemaRenderer.d.ts +4 -2
- package/lib/SchemaRenderer.js +32 -23
- package/lib/Scoped.d.ts +8 -0
- package/lib/Scoped.js +20 -4
- package/lib/StatusScoped.d.ts +58 -0
- package/lib/StatusScoped.js +63 -0
- package/lib/WithRootStore.d.ts +2 -2
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +6 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +19 -5
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +8 -7
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -4
- package/lib/actions/DialogAction.d.ts +16 -2
- package/lib/actions/DialogAction.js +23 -7
- package/lib/actions/DrawerAction.js +1 -1
- 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/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +13 -0
- package/lib/components/CustomStyle.js +22 -0
- package/lib/components/LazyComponent.d.ts +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +3 -3
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +2 -2
- package/lib/components/PopOver.js +1 -1
- package/lib/env.d.ts +10 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -5
- package/lib/factory.d.ts +5 -3
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +11 -4
- package/lib/index.js +61 -23
- package/lib/locale.d.ts +2 -2
- package/lib/locale.js +10 -3
- package/lib/renderers/Form.d.ts +3 -2
- package/lib/renderers/Form.js +215 -179
- package/lib/renderers/Item.d.ts +55 -41
- package/lib/renderers/Item.js +30 -19
- package/lib/renderers/Options.js +11 -4
- 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.d.ts +2 -2
- package/lib/renderers/wrapControl.js +12 -15
- package/lib/store/app.d.ts +1 -0
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +3 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +31 -9
- package/lib/store/form.d.ts +1 -0
- package/lib/store/form.js +10 -4
- package/lib/store/formItem.js +2 -2
- package/lib/store/iRenderer.d.ts +1 -0
- package/lib/store/iRenderer.js +53 -12
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +7 -3
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +1 -0
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +1 -0
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.d.ts +4 -6
- package/lib/store/root.js +52 -23
- package/lib/store/service.d.ts +1 -0
- package/lib/store/service.js +1 -1
- package/lib/store/status.d.ts +12 -0
- package/lib/store/status.js +42 -0
- package/lib/store/table.d.ts +28 -23
- package/lib/store/table.js +26 -5
- package/lib/store/table2.d.ts +7 -6
- package/lib/store/table2.js +27 -23
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -1
- 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.d.ts +3 -5
- package/lib/utils/DataScope.js +86 -29
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +13 -4
- package/lib/utils/attachmentAdpator.js +2 -2
- 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.d.ts +7 -0
- package/lib/utils/date.js +34 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +3 -0
- package/lib/utils/dom.js +48 -9
- 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.js +2 -2
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +3 -3
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +9 -2
- package/lib/utils/helper.js +53 -19
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +6 -1
- package/lib/utils/icon.js +6 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +3 -3
- 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/memoryParse.d.ts +17 -0
- package/lib/utils/memoryParse.js +30 -0
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +4 -2
- package/lib/utils/object.d.ts +2 -0
- package/lib/utils/object.js +28 -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 +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +1 -0
- package/lib/utils/resolveCondition.js +19 -3
- package/lib/utils/resolveVariable.js +3 -2
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +22 -3
- 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.d.ts +12 -4
- package/lib/utils/style-helper.js +101 -18
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +19 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +2 -0
- package/lib/utils/tpl.js +24 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.d.ts +4 -1
- package/lib/utils/validations.js +27 -12
- package/package.json +3 -3
package/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __assign } from 'tslib';
|
|
6
|
+
import { __assign, __rest } from 'tslib';
|
|
7
7
|
import { stores, defaultOptions } from './factory.js';
|
|
8
8
|
export { Renderer, addSchemaFilter, clearStoresCache, extendDefaultEnv, filterSchema, getRendererByName, getRenderers, registerRenderer, resolveRenderer, unRegisterRenderer, updateEnv } from './factory.js';
|
|
9
9
|
import './renderers/builtin.js';
|
|
@@ -17,10 +17,10 @@ export { columnsSplit } from './utils/columnsSplit.js';
|
|
|
17
17
|
export { dataMapping, resolveMapping, resolveMappingObject } from './utils/dataMapping.js';
|
|
18
18
|
export { DataSchema } from './utils/DataSchema.js';
|
|
19
19
|
export { DataScope } from './utils/DataScope.js';
|
|
20
|
-
export { filterDate, parseDuration, relativeValueRe } from './utils/date.js';
|
|
20
|
+
export { filterDate, normalizeDate, parseDuration, relativeValueRe } from './utils/date.js';
|
|
21
21
|
import { enableDebug } from './utils/debug.js';
|
|
22
22
|
export { DebugWrapper, debug, enableDebug, warning } from './utils/debug.js';
|
|
23
|
-
export { calculatePosition, getContainer, getStyleNumber, ownerDocument } from './utils/dom.js';
|
|
23
|
+
export { calculatePosition, getContainer, getStyleNumber, ownerDocument, renderTextByKeyword } from './utils/dom.js';
|
|
24
24
|
export { ServerError } from './utils/errors.js';
|
|
25
25
|
export { escapeHtml } from './utils/escapeHtml.js';
|
|
26
26
|
export { getExprProperties } from './utils/filter-schema.js';
|
|
@@ -33,7 +33,7 @@ export { handleAction } from './utils/handleAction.js';
|
|
|
33
33
|
import { promisify } from './utils/helper.js';
|
|
34
34
|
import * as helper from './utils/helper.js';
|
|
35
35
|
export { helper as utils };
|
|
36
|
-
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
36
|
+
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeAll, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, loadStyle, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
37
37
|
export { highlight } from './utils/highlight.js';
|
|
38
38
|
export { generateIcon } from './utils/icon.js';
|
|
39
39
|
export { getImageDimensions, toDataURL } from './utils/image.js';
|
|
@@ -43,7 +43,7 @@ export { keyToPath } from './utils/keyToPath.js';
|
|
|
43
43
|
export { makeSorter } from './utils/makeSorter.js';
|
|
44
44
|
export { normalizeLink } from './utils/normalizeLink.js';
|
|
45
45
|
export { normalizeOptions } from './utils/normalizeOptions.js';
|
|
46
|
-
export { cloneObject, createObject, deleteVariable, extendObject, isObject, pickValues, setVariable } from './utils/object.js';
|
|
46
|
+
export { cloneObject, createObject, createObjectFromChain, deleteVariable, extendObject, extractObjectChain, isObject, pickValues, setVariable } from './utils/object.js';
|
|
47
47
|
export { offset } from './utils/offset.js';
|
|
48
48
|
export { offsetParent } from './utils/offsetParent.js';
|
|
49
49
|
export { matchOptionValue, optionValueCompare } from './utils/optionValueCompare.js';
|
|
@@ -55,7 +55,7 @@ export { replaceText } from './utils/replaceText.js';
|
|
|
55
55
|
export { getComputedStyle, resizeSensor } from './utils/resize-sensor.js';
|
|
56
56
|
export { resolveVariable } from './utils/resolveVariable.js';
|
|
57
57
|
export { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
|
|
58
|
-
export { resolveVariableAndFilterForAsync } from './utils/resolveVariableAndFilterForAsync.js';
|
|
58
|
+
export { resolveVariableAndFilterForAsync, setFormulaEvalErrorHandler } from './utils/resolveVariableAndFilterForAsync.js';
|
|
59
59
|
export { RootClose } from './utils/RootClose.js';
|
|
60
60
|
export { scrollPosition } from './utils/scrollPosition.js';
|
|
61
61
|
export { SimpleMap } from './utils/SimpleMap.js';
|
|
@@ -63,20 +63,20 @@ export { string2regExp } from './utils/string2regExp.js';
|
|
|
63
63
|
export { buildStyle } from './utils/style.js';
|
|
64
64
|
export { tokenize } from './utils/tokenize.js';
|
|
65
65
|
export { register } from './utils/tpl-builtin.js';
|
|
66
|
-
export { evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
|
|
66
|
+
export { asyncFilter, evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
|
|
67
67
|
export { uncontrollable } from './utils/uncontrollable.js';
|
|
68
68
|
export { addRule, str2rules, validate, validateMessages, validateObject, validations } from './utils/validations.js';
|
|
69
69
|
export { toNumber } from './utils/toNumber.js';
|
|
70
70
|
export { decodeEntity } from './utils/decodeEntity.js';
|
|
71
|
-
export { addStyle, findOrCreactStyle, formatStyle, insertCustomStyle, insertStyle, valueMap } from './utils/style-helper.js';
|
|
72
|
-
export { getConditionComputers, registerConditionComputer, resolveCondition } from './utils/resolveCondition.js';
|
|
71
|
+
export { addStyle, findOrCreactStyle, formatStyle, getValueByPath, inheritValueMap, insertCustomStyle, insertStyle, valueMap as styleMap, valueMap } from './utils/style-helper.js';
|
|
72
|
+
export { getConditionComputers, registerConditionComputer, resolveCondition, setConditionComputeErrorHandler } from './utils/resolveCondition.js';
|
|
73
73
|
export { default as animation } from './utils/Animation.js';
|
|
74
74
|
import { RendererStore } from './store/index.js';
|
|
75
75
|
export { RegisterStore, RendererStore } from './store/index.js';
|
|
76
76
|
import { getEnv } from 'mobx-state-tree';
|
|
77
77
|
import { getDefaultLocale, makeTranslator } from './locale.js';
|
|
78
78
|
export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, removeLocaleData, setDefaultLocale } from './locale.js';
|
|
79
|
-
export { HocScoped as Scoped, ScopedContext } from './Scoped.js';
|
|
79
|
+
export { HocScoped as Scoped, ScopedContext, filterTarget } from './Scoped.js';
|
|
80
80
|
import { getClassPrefix, getTheme } from './theme.js';
|
|
81
81
|
export { classnames, getClassPrefix, getTheme, makeClassnames, setDefaultTheme, theme, themeable } from './theme.js';
|
|
82
82
|
import './actions/LoopAction.js';
|
|
@@ -109,6 +109,9 @@ export { default as LazyComponent } from './components/LazyComponent.js';
|
|
|
109
109
|
export { default as Overlay } from './components/Overlay.js';
|
|
110
110
|
export { default as PopOver } from './components/PopOver.js';
|
|
111
111
|
export { FormRenderer } from './renderers/Form.js';
|
|
112
|
+
export { RENDERER_TRANSMISSION_OMIT_PROPS } from './SchemaRenderer.js';
|
|
113
|
+
export { default as CustomStyle } from './components/CustomStyle.js';
|
|
114
|
+
export { StatusScoped } from './StatusScoped.js';
|
|
112
115
|
export { stripNumber } from './utils/stripNumber.js';
|
|
113
116
|
export { iRendererStore } from './store/iRenderer.js';
|
|
114
117
|
export { ServiceStore } from './store/service.js';
|
|
@@ -133,35 +136,52 @@ export { StoreNode } from './store/node.js';
|
|
|
133
136
|
*/
|
|
134
137
|
var classPrefix = getClassPrefix();
|
|
135
138
|
// @ts-ignore
|
|
136
|
-
var version = '
|
|
139
|
+
var version = '3.1.0';
|
|
137
140
|
function render(schema, props, options, pathPrefix) {
|
|
138
141
|
if (props === void 0) { props = {}; }
|
|
139
142
|
if (options === void 0) { options = {}; }
|
|
140
143
|
if (pathPrefix === void 0) { pathPrefix = ''; }
|
|
144
|
+
return (React.createElement(AMISRenderer, __assign({}, props, { schema: schema, pathPrefix: pathPrefix, options: options })));
|
|
145
|
+
}
|
|
146
|
+
function AMISRenderer(_a) {
|
|
147
|
+
var schema = _a.schema, options = _a.options, pathPrefix = _a.pathPrefix, props = __rest(_a, ["schema", "options", "pathPrefix"]);
|
|
141
148
|
var locale = props.locale || getDefaultLocale();
|
|
142
149
|
// 兼容 locale 的不同写法
|
|
143
|
-
locale =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
150
|
+
locale =
|
|
151
|
+
locale === 'en'
|
|
152
|
+
? 'en-US'
|
|
153
|
+
: locale === 'zh' || locale === 'cn'
|
|
154
|
+
? 'zh-CN'
|
|
155
|
+
: locale.replace('_', '-');
|
|
156
|
+
var translate = React.useCallback(function () {
|
|
157
|
+
var fn = props.translate || makeTranslator(locale);
|
|
158
|
+
return fn.apply(null, arguments);
|
|
159
|
+
}, [locale, props.translate]);
|
|
160
|
+
var store = React.useMemo(function () {
|
|
161
|
+
var store = stores[options.session || 'global'];
|
|
162
|
+
if (!store) {
|
|
163
|
+
options = __assign(__assign(__assign({}, defaultOptions), options), { fetcher: options.fetcher
|
|
164
|
+
? wrapFetcher(options.fetcher, options.tracker)
|
|
165
|
+
: defaultOptions.fetcher, confirm: promisify(options.confirm || defaultOptions.confirm || window.confirm), locale: locale, translate: translate });
|
|
166
|
+
if (options.enableAMISDebug) {
|
|
167
|
+
// 因为里面还有 render
|
|
168
|
+
setTimeout(function () {
|
|
169
|
+
enableDebug();
|
|
170
|
+
}, 10);
|
|
171
|
+
}
|
|
172
|
+
store = RendererStore.create({}, options);
|
|
173
|
+
stores[options.session || 'global'] = store;
|
|
160
174
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
175
|
+
else {
|
|
176
|
+
// 更新 env
|
|
177
|
+
var env_1 = getEnv(store);
|
|
178
|
+
Object.assign(env_1, __assign(__assign({}, options), { fetcher: options.fetcher
|
|
179
|
+
? wrapFetcher(options.fetcher, options.tracker)
|
|
180
|
+
: env_1.fetcher, confirm: options.confirm ? promisify(options.confirm) : env_1.confirm, locale: locale, translate: translate }));
|
|
181
|
+
}
|
|
182
|
+
window.amisStore = store; // 为了方便 debug.
|
|
183
|
+
return store;
|
|
184
|
+
}, Object.keys(options).concat(Object.values(options)).concat(locale));
|
|
165
185
|
var env = getEnv(store);
|
|
166
186
|
var theme = props.theme || options.theme || 'cxd';
|
|
167
187
|
if (theme === 'default') {
|
|
@@ -176,6 +196,8 @@ function render(schema, props, options, pathPrefix) {
|
|
|
176
196
|
if (options.useMobileUI !== false) {
|
|
177
197
|
props.useMobileUI = true;
|
|
178
198
|
}
|
|
199
|
+
// 根据环境覆盖 schema,这个要在最前面做,不然就无法覆盖 validations
|
|
200
|
+
envOverwrite(schema, locale);
|
|
179
201
|
schema = replaceText(schema, options.replaceText, env.replaceTextIgnoreKeys);
|
|
180
202
|
return (React.createElement(EnvContext.Provider, { value: env },
|
|
181
203
|
React.createElement(ScopedRootRenderer, __assign({}, props, { schema: schema, pathPrefix: pathPrefix, rootStore: store, env: env, theme: theme, locale: locale, translate: translate }))));
|
package/esm/locale.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface LocaleConfig {
|
|
|
5
5
|
[propsName: string]: string;
|
|
6
6
|
}
|
|
7
7
|
export declare function register(name: string, config: LocaleConfig): void;
|
|
8
|
-
export declare function extendLocale(name: string, config: LocaleConfig): void;
|
|
8
|
+
export declare function extendLocale(name: string, config: LocaleConfig, cover?: boolean): void;
|
|
9
9
|
/** 删除语料数据 */
|
|
10
10
|
export declare function removeLocaleData(name: string, key: Array<string> | string): void;
|
|
11
11
|
export declare function makeTranslator(locale?: string): TranslateFn;
|
|
@@ -24,7 +24,7 @@ export declare function localeable<T extends React.ComponentType<React.Component
|
|
|
24
24
|
ref: any;
|
|
25
25
|
childRef(ref: any): void;
|
|
26
26
|
getWrappedInstance(): any;
|
|
27
|
-
render(): JSX.Element;
|
|
27
|
+
render(): React.JSX.Element;
|
|
28
28
|
context: unknown;
|
|
29
29
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof LocaleProps>> & {
|
|
30
30
|
locale?: string | undefined;
|
package/esm/locale.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.1.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -18,8 +18,15 @@ function register(name, config) {
|
|
|
18
18
|
// 修改为扩展,防止已注册的语料被覆盖
|
|
19
19
|
extendLocale(name, config);
|
|
20
20
|
}
|
|
21
|
-
function extendLocale(name, config) {
|
|
22
|
-
|
|
21
|
+
function extendLocale(name, config, cover) {
|
|
22
|
+
if (cover === void 0) { cover = true; }
|
|
23
|
+
if (cover) {
|
|
24
|
+
// 覆盖式扩展语料
|
|
25
|
+
locales[name] = __assign(__assign({}, (locales[name] || {})), config);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
locales[name] = __assign(__assign({}, config), (locales[name] || {}));
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
/** 删除语料数据 */
|
|
25
32
|
function removeLocaleData(name, key) {
|
package/esm/renderers/Form.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export interface FormSchemaBase {
|
|
|
120
120
|
/**
|
|
121
121
|
* Form 用来保存数据的 api。
|
|
122
122
|
*
|
|
123
|
-
* 详情:https://baidu.
|
|
123
|
+
* 详情:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/index#%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4
|
|
124
124
|
*/
|
|
125
125
|
api?: string | BaseApiObject;
|
|
126
126
|
/**
|
|
@@ -326,6 +326,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|
|
326
326
|
componentDidMount(): void;
|
|
327
327
|
componentDidUpdate(prevProps: FormProps): void;
|
|
328
328
|
componentWillUnmount(): void;
|
|
329
|
+
dispatchInited(value: any): Promise<any>;
|
|
329
330
|
blockRouting(): any;
|
|
330
331
|
beforePageUnload(e: any): any;
|
|
331
332
|
onInit(): Promise<void>;
|
|
@@ -368,7 +369,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|
|
368
369
|
}, region?: string, otherProps?: Partial<FormProps>): React.ReactNode;
|
|
369
370
|
renderChildren(children: Array<any>, region: string, otherProps?: Partial<FormProps>): React.ReactNode;
|
|
370
371
|
renderChild(control: SchemaNode, key?: any, otherProps?: Partial<FormProps>, region?: string): React.ReactNode;
|
|
371
|
-
renderBody(): JSX.Element;
|
|
372
|
+
renderBody(): React.JSX.Element;
|
|
372
373
|
render(): JSX.Element;
|
|
373
374
|
}
|
|
374
375
|
export declare class FormRenderer extends Form {
|