amis-core 2.0.2 → 2.2.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 +2 -2
- 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/_virtual/index2.js +1 -1
- package/esm/_virtual/react-is.development.js +1 -1
- package/esm/_virtual/react-is.production.min.js +1 -1
- package/esm/actions/Action.js +1 -1
- package/esm/actions/AjaxAction.js +39 -38
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +32 -6
- package/esm/actions/Decorators.js +1 -1
- package/esm/actions/DialogAction.js +1 -1
- 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/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +2 -0
- package/esm/components/Overlay.js +19 -2
- package/esm/components/PopOver.js +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +4 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +2 -2
- package/esm/index.js +107 -25
- package/esm/locale.js +3 -2
- 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/object-assign/index.js +1 -1
- package/esm/node_modules/prop-types/checkPropTypes.js +1 -1
- package/esm/node_modules/prop-types/factoryWithThrowingShims.js +1 -1
- package/esm/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
- package/esm/node_modules/prop-types/index.js +1 -1
- package/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -1
- package/esm/node_modules/prop-types/lib/has.js +1 -1
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -1
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +1 -1
- package/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- 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 -1
- package/esm/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
- package/esm/node_modules/warning/warning.js +1 -1
- package/esm/renderers/Form.d.ts +32 -2
- package/esm/renderers/Form.js +28 -10
- package/esm/renderers/Item.d.ts +127 -0
- package/esm/renderers/Item.js +8 -6
- package/esm/renderers/Options.d.ts +8 -0
- package/esm/renderers/Options.js +67 -39
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/wrapControl.js +11 -3
- package/esm/store/app.js +2 -2
- package/esm/store/combo.d.ts +24 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +1 -0
- package/esm/store/crud.js +35 -20
- package/esm/store/form.d.ts +10 -0
- package/esm/store/form.js +48 -22
- package/esm/store/formItem.d.ts +1 -0
- package/esm/store/formItem.js +12 -5
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.d.ts +2 -2
- package/esm/store/index.js +4 -4
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +11 -11
- package/esm/store/table.d.ts +30 -4
- package/esm/store/table.js +34 -25
- package/{lib/store/table-v2.d.ts → esm/store/table2.d.ts} +32 -32
- package/esm/store/{table-v2.js → table2.js} +17 -17
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +3 -2
- 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 +7 -0
- package/esm/utils/api.js +49 -7
- 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.d.ts +6 -0
- package/esm/utils/dataMapping.js +16 -2
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.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.d.ts +30 -4
- package/esm/utils/helper.js +45 -14
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -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.d.ts +1 -1
- package/esm/utils/position.js +9 -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.d.ts +1 -1
- package/esm/utils/resolveVariable.js +3 -3
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/scrollPosition.d.ts +1 -1
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +2 -2
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.d.ts +7 -0
- package/esm/utils/toNumber.js +18 -0
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.d.ts +2 -2
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +2 -2
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +1 -1
- package/esm/utils/validations.js +60 -3
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.js +2 -2
- 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/_virtual/index2.js +1 -1
- package/lib/_virtual/react-is.development.js +1 -1
- package/lib/_virtual/react-is.production.min.js +1 -1
- package/lib/actions/Action.js +1 -1
- package/lib/actions/AjaxAction.js +38 -37
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +32 -6
- package/lib/actions/Decorators.js +1 -1
- package/lib/actions/DialogAction.js +1 -1
- 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/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +2 -0
- package/lib/components/Overlay.js +19 -2
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +4 -1
- package/lib/factory.js +2 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +191 -113
- package/lib/locale.js +3 -2
- 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/object-assign/index.js +1 -1
- package/lib/node_modules/prop-types/checkPropTypes.js +1 -1
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js +1 -1
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
- package/lib/node_modules/prop-types/index.js +1 -1
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -1
- package/lib/node_modules/prop-types/lib/has.js +1 -1
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -1
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +1 -1
- package/lib/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- 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 -1
- package/lib/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
- package/lib/node_modules/warning/warning.js +1 -1
- package/lib/renderers/Form.d.ts +32 -2
- package/lib/renderers/Form.js +29 -10
- package/lib/renderers/Item.d.ts +127 -0
- package/lib/renderers/Item.js +7 -4
- package/lib/renderers/Options.d.ts +8 -0
- package/lib/renderers/Options.js +67 -40
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/wrapControl.js +11 -3
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +24 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +35 -20
- package/lib/store/form.d.ts +10 -0
- package/lib/store/form.js +49 -22
- package/lib/store/formItem.d.ts +1 -0
- package/lib/store/formItem.js +13 -6
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.d.ts +2 -2
- package/lib/store/index.js +4 -4
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +11 -11
- package/lib/store/table.d.ts +30 -4
- package/lib/store/table.js +33 -24
- package/{esm/store/table-v2.d.ts → lib/store/table2.d.ts} +32 -32
- package/lib/store/{table-v2.js → table2.js} +16 -16
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -2
- 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 +7 -0
- package/lib/utils/api.js +50 -6
- 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.d.ts +6 -0
- package/lib/utils/dataMapping.js +16 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +1 -1
- 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 +1 -1
- 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.d.ts +30 -4
- package/lib/utils/helper.js +44 -12
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -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.d.ts +1 -1
- package/lib/utils/position.js +9 -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.d.ts +1 -1
- package/lib/utils/resolveVariable.js +3 -3
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/scrollPosition.d.ts +1 -1
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +2 -2
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.d.ts +7 -0
- package/lib/utils/toNumber.js +22 -0
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.d.ts +2 -2
- 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.d.ts +1 -1
- package/lib/utils/validations.js +61 -3
- package/package.json +9 -8
- package/esm/index2.js +0 -134
- package/lib/index2.js +0 -330
package/esm/index.js
CHANGED
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0
|
|
2
|
+
* amis-core v2.2.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
6
|
+
import { __assign } from 'tslib';
|
|
7
|
+
import { stores, defaultOptions } from './factory.js';
|
|
8
|
+
export { Renderer, addSchemaFilter, clearStoresCache, extendDefaultEnv, filterSchema, getRendererByName, getRenderers, registerRenderer, resolveRenderer, unRegisterRenderer, updateEnv } from './factory.js';
|
|
9
|
+
import './renderers/builtin.js';
|
|
10
|
+
import { wrapFetcher } from './utils/api.js';
|
|
11
|
+
export { buildApi, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
|
|
9
12
|
export { attachmentAdpator } from './utils/attachmentAdpator.js';
|
|
10
13
|
export { autobindMethod, bind } from './utils/autobind.js';
|
|
11
14
|
export { ColorScale } from './utils/ColorScale.js';
|
|
12
15
|
export { columnsSplit } from './utils/columnsSplit.js';
|
|
13
|
-
export { dataMapping, resolveMapping } from './utils/dataMapping.js';
|
|
16
|
+
export { dataMapping, resolveMapping, resolveMappingObject } from './utils/dataMapping.js';
|
|
14
17
|
export { DataSchema } from './utils/DataSchema.js';
|
|
15
18
|
export { DataScope } from './utils/DataScope.js';
|
|
16
19
|
export { filterDate, parseDuration, relativeValueRe } from './utils/date.js';
|
|
20
|
+
import { enableDebug } from './utils/debug.js';
|
|
17
21
|
export { DebugWrapper, debug, enableDebug, warning } from './utils/debug.js';
|
|
18
22
|
export { calculatePosition, getContainer, getStyleNumber, ownerDocument } from './utils/dom.js';
|
|
19
23
|
export { ServerError } from './utils/errors.js';
|
|
20
24
|
export { escapeHtml } from './utils/escapeHtml.js';
|
|
21
25
|
export { getExprProperties } from './utils/filter-schema.js';
|
|
26
|
+
import './utils/filter.js';
|
|
22
27
|
export { formatDuration } from './utils/formatDuration.js';
|
|
23
28
|
export { FormulaExec, formulaExec, isExpression, isNeedFormula, registerFormulaExec, replaceExpression } from './utils/formula.js';
|
|
24
29
|
export { getVariable } from './utils/getVariable.js';
|
|
25
30
|
export { collectVariables } from './utils/grammar.js';
|
|
26
31
|
export { handleAction } from './utils/handleAction.js';
|
|
27
|
-
|
|
28
|
-
export { string2regExp } from './utils/string2regExp.js';
|
|
29
|
-
export { keyToPath } from './utils/keyToPath.js';
|
|
32
|
+
import { promisify } from './utils/helper.js';
|
|
30
33
|
import * as helper from './utils/helper.js';
|
|
31
34
|
export { helper as utils };
|
|
32
|
-
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, 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, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
35
|
+
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, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
|
|
33
36
|
export { highlight } from './utils/highlight.js';
|
|
34
37
|
export { generateIcon } from './utils/icon.js';
|
|
35
38
|
export { getImageDimensions, toDataURL } from './utils/image.js';
|
|
36
39
|
export { isPureVariable } from './utils/isPureVariable.js';
|
|
37
40
|
export { JSONSchme2AMisSchema } from './utils/json-schema-2-amis-schema.js';
|
|
41
|
+
export { keyToPath } from './utils/keyToPath.js';
|
|
38
42
|
export { makeSorter } from './utils/makeSorter.js';
|
|
39
43
|
export { normalizeLink } from './utils/normalizeLink.js';
|
|
40
44
|
export { normalizeOptions } from './utils/normalizeOptions.js';
|
|
45
|
+
export { cloneObject, createObject, deleteVariable, extendObject, isObject, pickValues, setVariable } from './utils/object.js';
|
|
41
46
|
export { offset } from './utils/offset.js';
|
|
42
47
|
export { offsetParent } from './utils/offsetParent.js';
|
|
43
48
|
export { matchOptionValue, optionValueCompare } from './utils/optionValueCompare.js';
|
|
44
49
|
export { position } from './utils/position.js';
|
|
45
50
|
export { prettyBytes } from './utils/prettyBytes.js';
|
|
46
51
|
export { bindEvent, createRendererEvent, dispatchEvent, getRendererEventListeners } from './utils/renderer-event.js';
|
|
52
|
+
import { replaceText } from './utils/replaceText.js';
|
|
47
53
|
export { replaceText } from './utils/replaceText.js';
|
|
48
54
|
export { getComputedStyle, resizeSensor } from './utils/resize-sensor.js';
|
|
49
55
|
export { resolveVariable } from './utils/resolveVariable.js';
|
|
@@ -51,39 +57,115 @@ export { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
|
|
|
51
57
|
export { RootClose } from './utils/RootClose.js';
|
|
52
58
|
export { scrollPosition } from './utils/scrollPosition.js';
|
|
53
59
|
export { SimpleMap } from './utils/SimpleMap.js';
|
|
60
|
+
export { string2regExp } from './utils/string2regExp.js';
|
|
54
61
|
export { buildStyle } from './utils/style.js';
|
|
55
62
|
export { tokenize } from './utils/tokenize.js';
|
|
56
|
-
export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
|
|
57
|
-
export { stripNumber } from './utils/stripNumber.js';
|
|
58
63
|
export { register } from './utils/tpl-builtin.js';
|
|
59
64
|
export { evalExpression, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
|
|
60
65
|
export { uncontrollable } from './utils/uncontrollable.js';
|
|
61
66
|
export { addRule, str2rules, validate, validateMessages, validateObject, validations } from './utils/validations.js';
|
|
67
|
+
export { toNumber } from './utils/toNumber.js';
|
|
62
68
|
export { default as animation } from './utils/Animation.js';
|
|
69
|
+
import { RendererStore } from './store/index.js';
|
|
63
70
|
export { RegisterStore, RendererStore } from './store/index.js';
|
|
71
|
+
import { getEnv } from 'mobx-state-tree';
|
|
72
|
+
import { getDefaultLocale, makeTranslator } from './locale.js';
|
|
73
|
+
export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, setDefaultLocale } from './locale.js';
|
|
74
|
+
export { HocScoped as Scoped, ScopedContext } from './Scoped.js';
|
|
75
|
+
import { getClassPrefix, getTheme } from './theme.js';
|
|
76
|
+
export { classnames, getClassPrefix, getTheme, makeClassnames, setDefaultTheme, theme, themeable } from './theme.js';
|
|
77
|
+
import './actions/LoopAction.js';
|
|
78
|
+
import './actions/BreakAction.js';
|
|
79
|
+
import './actions/ContinueAction.js';
|
|
80
|
+
import './actions/SwitchAction.js';
|
|
81
|
+
import './actions/ParallelAction.js';
|
|
82
|
+
import './actions/CustomAction.js';
|
|
83
|
+
import './actions/BroadcastAction.js';
|
|
84
|
+
import './actions/CmptAction.js';
|
|
85
|
+
import './actions/AjaxAction.js';
|
|
86
|
+
import './actions/CopyAction.js';
|
|
87
|
+
import './actions/DialogAction.js';
|
|
88
|
+
import './actions/DrawerAction.js';
|
|
89
|
+
import './actions/EmailAction.js';
|
|
90
|
+
import './actions/LinkAction.js';
|
|
91
|
+
import './actions/ToastAction.js';
|
|
92
|
+
import './actions/PageAction.js';
|
|
93
|
+
export { bindRendererEvent, rendererEventDispatcher } from './actions/Decorators.js';
|
|
94
|
+
export { LoopStatus, getActionByType, registerAction, runAction, runActions } from './actions/Action.js';
|
|
95
|
+
export { FormItem, FormItemWrap, getFormItemByName, registerFormItem } from './renderers/Item.js';
|
|
96
|
+
export { OptionsControl, registerOptionsControl } from './renderers/Options.js';
|
|
97
|
+
import ScopedRootRenderer from './Root.js';
|
|
98
|
+
export { addRootWrapper } from './Root.js';
|
|
99
|
+
import { envOverwrite } from './envOverwrite.js';
|
|
100
|
+
import { EnvContext } from './env.js';
|
|
101
|
+
export { EnvContext } from './env.js';
|
|
102
|
+
import React from 'react';
|
|
103
|
+
export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
|
|
104
|
+
export { default as LazyComponent } from './components/LazyComponent.js';
|
|
105
|
+
export { default as Overlay } from './components/Overlay.js';
|
|
106
|
+
export { default as PopOver } from './components/PopOver.js';
|
|
107
|
+
export { FormRenderer } from './renderers/Form.js';
|
|
108
|
+
export { stripNumber } from './utils/stripNumber.js';
|
|
64
109
|
export { iRendererStore } from './store/iRenderer.js';
|
|
65
110
|
export { ServiceStore } from './store/service.js';
|
|
66
111
|
export { FormStore } from './store/form.js';
|
|
67
112
|
export { ComboStore } from './store/combo.js';
|
|
68
113
|
export { CRUDStore } from './store/crud.js';
|
|
69
114
|
export { TableStore } from './store/table.js';
|
|
70
|
-
export {
|
|
115
|
+
export { TableStore2 } from './store/table2.js';
|
|
71
116
|
export { ListStore } from './store/list.js';
|
|
72
117
|
export { ModalStore } from './store/modal.js';
|
|
73
118
|
export { FormItemStore } from './store/formItem.js';
|
|
74
119
|
export { PaginationStore } from './store/pagination.js';
|
|
75
120
|
export { AppStore } from './store/app.js';
|
|
76
121
|
export { StoreNode } from './store/node.js';
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
122
|
+
|
|
123
|
+
var classPrefix = getClassPrefix();
|
|
124
|
+
function render(schema, props, options, pathPrefix) {
|
|
125
|
+
if (props === void 0) { props = {}; }
|
|
126
|
+
if (options === void 0) { options = {}; }
|
|
127
|
+
if (pathPrefix === void 0) { pathPrefix = ''; }
|
|
128
|
+
var locale = props.locale || getDefaultLocale();
|
|
129
|
+
// 兼容 locale 的不同写法
|
|
130
|
+
locale = locale.replace('_', '-');
|
|
131
|
+
locale = locale === 'en' ? 'en-US' : locale;
|
|
132
|
+
locale = locale === 'zh' ? 'zh-CN' : locale;
|
|
133
|
+
locale = locale === 'cn' ? 'zh-CN' : locale;
|
|
134
|
+
var translate = props.translate || makeTranslator(locale);
|
|
135
|
+
var store = stores[options.session || 'global'];
|
|
136
|
+
// 根据环境覆盖 schema,这个要在最前面做,不然就无法覆盖 validations
|
|
137
|
+
envOverwrite(schema, locale);
|
|
138
|
+
if (!store) {
|
|
139
|
+
options = __assign(__assign(__assign({}, defaultOptions), options), { fetcher: options.fetcher
|
|
140
|
+
? wrapFetcher(options.fetcher, options.tracker)
|
|
141
|
+
: defaultOptions.fetcher, confirm: promisify(options.confirm || defaultOptions.confirm || window.confirm), locale: locale, translate: translate });
|
|
142
|
+
if (options.enableAMISDebug) {
|
|
143
|
+
// 因为里面还有 render
|
|
144
|
+
setTimeout(function () {
|
|
145
|
+
enableDebug();
|
|
146
|
+
}, 10);
|
|
147
|
+
}
|
|
148
|
+
store = RendererStore.create({}, options);
|
|
149
|
+
stores[options.session || 'global'] = store;
|
|
150
|
+
}
|
|
151
|
+
window.amisStore = store; // 为了方便 debug.
|
|
152
|
+
var env = getEnv(store);
|
|
153
|
+
var theme = props.theme || options.theme || 'cxd';
|
|
154
|
+
if (theme === 'default') {
|
|
155
|
+
theme = 'cxd';
|
|
156
|
+
}
|
|
157
|
+
env.theme = getTheme(theme);
|
|
158
|
+
if (props.locale !== undefined) {
|
|
159
|
+
env.translate = translate;
|
|
160
|
+
env.locale = locale;
|
|
161
|
+
}
|
|
162
|
+
// 默认将开启移动端原生 UI
|
|
163
|
+
if (typeof options.useMobileUI) {
|
|
164
|
+
props.useMobileUI = true;
|
|
165
|
+
}
|
|
166
|
+
replaceText(schema, env.replaceText, env.replaceTextIgnoreKeys);
|
|
167
|
+
return (React.createElement(EnvContext.Provider, { value: env },
|
|
168
|
+
React.createElement(ScopedRootRenderer, __assign({}, props, { schema: schema, pathPrefix: pathPrefix, rootStore: store, env: env, theme: theme, locale: locale, translate: translate }))));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { classPrefix, render };
|
package/esm/locale.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0
|
|
2
|
+
* amis-core v2.2.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -15,7 +15,8 @@ import './utils/filter.js';
|
|
|
15
15
|
var defaultLocale = 'zh-CN';
|
|
16
16
|
var locales = {};
|
|
17
17
|
function register(name, config) {
|
|
18
|
-
|
|
18
|
+
// 修改为扩展,防止已注册的语料被覆盖
|
|
19
|
+
extendLocale(name, config);
|
|
19
20
|
}
|
|
20
21
|
function extendLocale(name, config) {
|
|
21
22
|
locales[name] = __assign(__assign({}, (locales[name] || {})), config);
|
package/esm/renderers/Form.d.ts
CHANGED
|
@@ -40,6 +40,35 @@ export interface FormSchemaBase {
|
|
|
40
40
|
* 是否开启调试,开启后会在顶部实时显示表单项数据。
|
|
41
41
|
*/
|
|
42
42
|
debug?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Debug面板配置
|
|
45
|
+
*/
|
|
46
|
+
debugConfig?: {
|
|
47
|
+
/**
|
|
48
|
+
* 默认展开的级别
|
|
49
|
+
*/
|
|
50
|
+
levelExpand?: number;
|
|
51
|
+
/**
|
|
52
|
+
* 是否可复制
|
|
53
|
+
*/
|
|
54
|
+
enableClipboard?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 图标风格
|
|
57
|
+
*/
|
|
58
|
+
iconStyle?: 'square' | 'circle' | 'triangle';
|
|
59
|
+
/**
|
|
60
|
+
* 是否显示键的引号
|
|
61
|
+
*/
|
|
62
|
+
quotesOnKeys?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 是否为键排序
|
|
65
|
+
*/
|
|
66
|
+
sortKeys?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 设置字符串的最大展示长度,超出长度阈值的字符串将被截断,点击value可切换字符串展示方式,默认为120
|
|
69
|
+
*/
|
|
70
|
+
ellipsisThreshold?: number | false;
|
|
71
|
+
};
|
|
43
72
|
/**
|
|
44
73
|
* 用来初始化表单数据
|
|
45
74
|
*/
|
|
@@ -220,7 +249,7 @@ export interface FormProps extends RendererProps, Omit<FormSchemaBase, 'mode' |
|
|
|
220
249
|
lazyLoad?: boolean;
|
|
221
250
|
simpleMode?: boolean;
|
|
222
251
|
onInit?: (values: object, props: any) => any;
|
|
223
|
-
onReset?: (values: object) => void;
|
|
252
|
+
onReset?: (values: object, action?: any) => void;
|
|
224
253
|
onSubmit?: (values: object, action: any) => any;
|
|
225
254
|
onChange?: (values: object, diff: object, props: any) => any;
|
|
226
255
|
onFailed?: (reason: string, errors: any) => any;
|
|
@@ -304,7 +333,8 @@ export default class Form extends React.Component<FormProps, object> {
|
|
|
304
333
|
formItemDispatchEvent(dispatchEvent: any): (type: string, data: any) => void;
|
|
305
334
|
emitChange(submit: boolean): Promise<void>;
|
|
306
335
|
handleBulkChange(values: Object, submit: boolean): void;
|
|
307
|
-
handleFormSubmit(e: React.UIEvent<any>):
|
|
336
|
+
handleFormSubmit(e: React.UIEvent<any>): any;
|
|
337
|
+
handleReset(action: any): (data: any) => void;
|
|
308
338
|
handleAction(e: React.UIEvent<any> | void, action: ActionObject, data: object, throwErrors?: boolean, delegate?: IScopedContext): Promise<any>;
|
|
309
339
|
handleQuery(query: any): void;
|
|
310
340
|
handleDialogConfirm(values: object[], action: ActionObject, ctx: any, targets: Array<any>): void;
|
package/esm/renderers/Form.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0
|
|
2
|
+
* amis-core v2.2.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __awaiter, __generator, __assign, __decorate, __metadata } from 'tslib';
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import extend from 'lodash/extend';
|
|
8
9
|
import { Renderer } from '../factory.js';
|
|
9
10
|
import { FormStore } from '../store/form.js';
|
|
10
11
|
import { evalExpression, filter } from '../utils/tpl.js';
|
|
@@ -414,14 +415,23 @@ var Form = /** @class */ (function (_super) {
|
|
|
414
415
|
(formLazyChange === false ? this.emitChange : this.lazyEmitChange)(submit);
|
|
415
416
|
};
|
|
416
417
|
Form.prototype.handleFormSubmit = function (e) {
|
|
417
|
-
var
|
|
418
|
+
var _a = this.props, preventEnterSubmit = _a.preventEnterSubmit, onActionSensor = _a.onActionSensor;
|
|
418
419
|
e.preventDefault();
|
|
419
420
|
if (preventEnterSubmit) {
|
|
420
421
|
return false;
|
|
421
422
|
}
|
|
422
|
-
|
|
423
|
+
var sensor = this.handleAction(e, {
|
|
423
424
|
type: 'submit'
|
|
424
425
|
}, this.props.store.data);
|
|
426
|
+
// 让外层可以监控这个动作执行结果
|
|
427
|
+
onActionSensor === null || onActionSensor === void 0 ? void 0 : onActionSensor(sensor);
|
|
428
|
+
return sensor;
|
|
429
|
+
};
|
|
430
|
+
Form.prototype.handleReset = function (action) {
|
|
431
|
+
var onReset = this.props.onReset;
|
|
432
|
+
return function (data) {
|
|
433
|
+
onReset && onReset(data, action);
|
|
434
|
+
};
|
|
425
435
|
};
|
|
426
436
|
Form.prototype.handleAction = function (e, action, data, throwErrors, delegate) {
|
|
427
437
|
if (throwErrors === void 0) { throwErrors = false; }
|
|
@@ -472,10 +482,10 @@ var Form = /** @class */ (function (_super) {
|
|
|
472
482
|
action.actionType === 'clear-and-submit') {
|
|
473
483
|
store.setCurrentAction(action);
|
|
474
484
|
if (action.actionType === 'reset-and-submit') {
|
|
475
|
-
store.reset(
|
|
485
|
+
store.reset(this.handleReset(action));
|
|
476
486
|
}
|
|
477
487
|
else if (action.actionType === 'clear-and-submit') {
|
|
478
|
-
store.clear(
|
|
488
|
+
store.clear(this.handleReset(action));
|
|
479
489
|
}
|
|
480
490
|
return [2 /*return*/, this.submit(function (values) {
|
|
481
491
|
var _a;
|
|
@@ -582,8 +592,8 @@ var Form = /** @class */ (function (_super) {
|
|
|
582
592
|
if (onFinished && onFinished(values, action) === false) {
|
|
583
593
|
return values;
|
|
584
594
|
}
|
|
585
|
-
resetAfterSubmit && store.reset(
|
|
586
|
-
clearAfterSubmit && store.clear(
|
|
595
|
+
resetAfterSubmit && store.reset(_this.handleReset(action));
|
|
596
|
+
clearAfterSubmit && store.clear(_this.handleReset(action));
|
|
587
597
|
clearPersistDataAfterSubmit && store.clearLocalPersistData();
|
|
588
598
|
if (action.redirect || redirect) {
|
|
589
599
|
var finalRedirect = filter(action.redirect || redirect, store.data);
|
|
@@ -880,7 +890,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
880
890
|
return render("".concat(region ? "".concat(region, "/") : '').concat(key), subSchema, subProps);
|
|
881
891
|
};
|
|
882
892
|
Form.prototype.renderBody = function () {
|
|
883
|
-
var _a = this.props, body = _a.body, mode = _a.mode, className = _a.className, cx = _a.classnames, debug = _a.debug, $path = _a.$path, store = _a.store, columnCount = _a.columnCount, render = _a.render;
|
|
893
|
+
var _a = this.props, body = _a.body, mode = _a.mode, className = _a.className, cx = _a.classnames, debug = _a.debug, debugConfig = _a.debugConfig, $path = _a.$path, store = _a.store, columnCount = _a.columnCount, render = _a.render;
|
|
884
894
|
var restError = store.restError;
|
|
885
895
|
var WrapperComponent = this.props.wrapperComponent ||
|
|
886
896
|
(/(?:\/|^)form\//.test($path) ? 'div' : 'form');
|
|
@@ -889,8 +899,16 @@ var Form = /** @class */ (function (_super) {
|
|
|
889
899
|
: 0, function (index) { return (React.createElement("div", { className: cx("Form-item Form-item--".concat(mode, " is-placeholder")), key: index })); });
|
|
890
900
|
return (React.createElement(WrapperComponent, { className: cx("Form", "Form--".concat(mode || 'normal'), columnCount ? "Form--column Form--column-".concat(columnCount) : null, className), onSubmit: this.handleFormSubmit, noValidate: true },
|
|
891
901
|
React.createElement("input", { type: "submit", style: { display: 'none' } }),
|
|
892
|
-
debug
|
|
893
|
-
|
|
902
|
+
debug
|
|
903
|
+
? render('form-debug-json', extend({
|
|
904
|
+
type: 'json',
|
|
905
|
+
value: store.data,
|
|
906
|
+
ellipsisThreshold: 120,
|
|
907
|
+
className: cx('Form--debug')
|
|
908
|
+
},
|
|
909
|
+
/** 定制debug输出格式 */
|
|
910
|
+
isObject(debugConfig) ? debugConfig : {}))
|
|
911
|
+
: null,
|
|
894
912
|
render('spinner', { type: 'spinner' }, {
|
|
895
913
|
overlay: true,
|
|
896
914
|
show: store.loading
|