amis-core 2.6.0 → 2.7.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/package.json +2 -2
- package/esm/Root.d.ts +0 -46
- package/esm/Root.js +0 -89
- package/esm/RootRenderer.d.ts +0 -27
- package/esm/RootRenderer.js +0 -279
- package/esm/SchemaRenderer.d.ts +0 -37
- package/esm/SchemaRenderer.js +0 -332
- package/esm/Scoped.d.ts +0 -38
- package/esm/Scoped.js +0 -262
- package/esm/WithRootStore.d.ts +0 -719
- package/esm/WithRootStore.js +0 -34
- package/esm/WithStore.d.ts +0 -5
- package/esm/WithStore.js +0 -181
- package/esm/actions/Action.d.ts +0 -40
- package/esm/actions/Action.js +0 -186
- package/esm/actions/AjaxAction.d.ts +0 -27
- package/esm/actions/AjaxAction.js +0 -96
- package/esm/actions/BreakAction.d.ts +0 -15
- package/esm/actions/BreakAction.js +0 -31
- package/esm/actions/BroadcastAction.d.ts +0 -19
- package/esm/actions/BroadcastAction.js +0 -46
- package/esm/actions/CmptAction.d.ts +0 -21
- package/esm/actions/CmptAction.js +0 -66
- package/esm/actions/ContinueAction.d.ts +0 -15
- package/esm/actions/ContinueAction.js +0 -31
- package/esm/actions/CopyAction.d.ts +0 -20
- package/esm/actions/CopyAction.js +0 -39
- package/esm/actions/CustomAction.d.ts +0 -22
- package/esm/actions/CustomAction.js +0 -74
- package/esm/actions/DialogAction.d.ts +0 -60
- package/esm/actions/DialogAction.js +0 -101
- package/esm/actions/DrawerAction.d.ts +0 -33
- package/esm/actions/DrawerAction.js +0 -65
- package/esm/actions/EmailAction.d.ts +0 -23
- package/esm/actions/EmailAction.js +0 -39
- package/esm/actions/LinkAction.d.ts +0 -24
- package/esm/actions/LinkAction.js +0 -43
- package/esm/actions/LoopAction.d.ts +0 -19
- package/esm/actions/LoopAction.js +0 -103
- package/esm/actions/PageAction.d.ts +0 -39
- package/esm/actions/PageAction.js +0 -74
- package/esm/actions/ParallelAction.d.ts +0 -8
- package/esm/actions/ParallelAction.js +0 -36
- package/esm/actions/SwitchAction.d.ts +0 -11
- package/esm/actions/SwitchAction.js +0 -48
- package/esm/actions/ToastAction.d.ts +0 -19
- package/esm/actions/ToastAction.js +0 -31
- package/esm/actions/index.d.ts +0 -20
- package/esm/components/LazyComponent.d.ts +0 -32
- package/esm/components/LazyComponent.js +0 -90
- package/esm/components/Overlay.d.ts +0 -44
- package/esm/components/Overlay.js +0 -255
- package/esm/components/PopOver.d.ts +0 -90
- package/esm/components/PopOver.js +0 -120
- package/esm/env.d.ts +0 -176
- package/esm/env.js +0 -12
- package/esm/envOverwrite.d.ts +0 -4
- package/esm/envOverwrite.js +0 -39
- package/esm/factory.d.ts +0 -85
- package/esm/factory.js +0 -301
- package/esm/index.d.ts +0 -44
- package/esm/index.js +0 -174
- package/esm/locale.d.ts +0 -84
- package/esm/locale.js +0 -117
- package/esm/renderers/Form.d.ts +0 -389
- package/esm/renderers/Form.js +0 -1221
- package/esm/renderers/Item.d.ts +0 -906
- package/esm/renderers/Item.js +0 -863
- package/esm/renderers/Options.d.ts +0 -158
- package/esm/renderers/Options.js +0 -908
- package/esm/renderers/Placeholder.d.ts +0 -6
- package/esm/renderers/Placeholder.js +0 -23
- package/esm/renderers/builtin.d.ts +0 -1
- package/esm/renderers/builtin.js +0 -25
- package/esm/renderers/register.d.ts +0 -6
- package/esm/renderers/register.js +0 -79
- package/esm/renderers/wrapControl.d.ts +0 -437
- package/esm/renderers/wrapControl.js +0 -509
- package/esm/store/app.d.ts +0 -92
- package/esm/store/app.js +0 -189
- package/esm/store/combo.d.ts +0 -10223
- package/esm/store/combo.js +0 -149
- package/esm/store/crud.d.ts +0 -128
- package/esm/store/crud.js +0 -447
- package/esm/store/form.d.ts +0 -4252
- package/esm/store/form.js +0 -650
- package/esm/store/formItem.d.ts +0 -133
- package/esm/store/formItem.js +0 -847
- package/esm/store/iRenderer.d.ts +0 -46
- package/esm/store/iRenderer.js +0 -185
- package/esm/store/index.d.ts +0 -125
- package/esm/store/index.js +0 -90
- package/esm/store/list.d.ts +0 -272
- package/esm/store/list.js +0 -246
- package/esm/store/manager.d.ts +0 -115
- package/esm/store/manager.js +0 -49
- package/esm/store/modal.d.ts +0 -84
- package/esm/store/modal.js +0 -50
- package/esm/store/node.d.ts +0 -22
- package/esm/store/node.js +0 -89
- package/esm/store/pagination.d.ts +0 -58
- package/esm/store/pagination.js +0 -56
- package/esm/store/root.d.ts +0 -85
- package/esm/store/root.js +0 -53
- package/esm/store/service.d.ts +0 -71
- package/esm/store/service.js +0 -411
- package/esm/store/table.d.ts +0 -10085
- package/esm/store/table.js +0 -1136
- package/esm/store/table2.d.ts +0 -474
- package/esm/store/table2.js +0 -560
- package/esm/theme.d.ts +0 -89
- package/esm/theme.js +0 -127
- package/esm/types.d.ts +0 -489
- package/esm/utils/Animation.d.ts +0 -22
- package/esm/utils/Animation.js +0 -285
- package/esm/utils/ColorScale.d.ts +0 -19
- package/esm/utils/ColorScale.js +0 -100
- package/esm/utils/DataSchema.d.ts +0 -25
- package/esm/utils/DataSchema.js +0 -112
- package/esm/utils/DataScope.d.ts +0 -26
- package/esm/utils/DataScope.js +0 -158
- package/esm/utils/RootClose.d.ts +0 -4
- package/esm/utils/RootClose.js +0 -22
- package/esm/utils/SimpleMap.d.ts +0 -8
- package/esm/utils/SimpleMap.js +0 -37
- package/esm/utils/api.d.ts +0 -34
- package/esm/utils/api.js +0 -595
- package/esm/utils/attachmentAdpator.d.ts +0 -8
- package/esm/utils/attachmentAdpator.js +0 -86
- package/esm/utils/autobind.d.ts +0 -7
- package/esm/utils/autobind.js +0 -89
- package/esm/utils/columnsSplit.d.ts +0 -1
- package/esm/utils/columnsSplit.js +0 -42
- package/esm/utils/dataMapping.d.ts +0 -9
- package/esm/utils/dataMapping.js +0 -141
- package/esm/utils/date.d.ts +0 -4
- package/esm/utils/date.js +0 -80
- package/esm/utils/debug.d.ts +0 -29
- package/esm/utils/debug.js +0 -379
- package/esm/utils/decodeEntity.d.ts +0 -5
- package/esm/utils/decodeEntity.js +0 -16
- package/esm/utils/dom.d.ts +0 -13
- package/esm/utils/dom.js +0 -188
- package/esm/utils/errors.d.ts +0 -6
- package/esm/utils/errors.js +0 -19
- package/esm/utils/escapeHtml.d.ts +0 -1
- package/esm/utils/escapeHtml.js +0 -20
- package/esm/utils/filter-schema.d.ts +0 -13
- package/esm/utils/filter-schema.js +0 -68
- package/esm/utils/filter.d.ts +0 -1
- package/esm/utils/filter.js +0 -493
- package/esm/utils/formatDuration.d.ts +0 -1
- package/esm/utils/formatDuration.js +0 -23
- package/esm/utils/formula.d.ts +0 -16
- package/esm/utils/formula.js +0 -219
- package/esm/utils/getVariable.d.ts +0 -3
- package/esm/utils/getVariable.js +0 -25
- package/esm/utils/grammar.d.ts +0 -4
- package/esm/utils/grammar.js +0 -50
- package/esm/utils/handleAction.d.ts +0 -7
- package/esm/utils/handleAction.js +0 -34
- package/esm/utils/helper.d.ts +0 -323
- package/esm/utils/helper.js +0 -1261
- package/esm/utils/highlight.d.ts +0 -1
- package/esm/utils/highlight.js +0 -44
- package/esm/utils/icon.d.ts +0 -16
- package/esm/utils/icon.js +0 -35
- package/esm/utils/image.d.ts +0 -18
- package/esm/utils/image.js +0 -47
- package/esm/utils/index.d.ts +0 -55
- package/esm/utils/isPureVariable.d.ts +0 -1
- package/esm/utils/isPureVariable.js +0 -22
- package/esm/utils/json-schema-2-amis-schema.d.ts +0 -6
- package/esm/utils/json-schema-2-amis-schema.js +0 -56
- package/esm/utils/keyToPath.d.ts +0 -6
- package/esm/utils/keyToPath.js +0 -30
- package/esm/utils/makeSorter.d.ts +0 -1
- package/esm/utils/makeSorter.js +0 -26
- package/esm/utils/normalizeLink.d.ts +0 -1
- package/esm/utils/normalizeLink.js +0 -43
- package/esm/utils/normalizeOptions.d.ts +0 -7
- package/esm/utils/normalizeOptions.js +0 -84
- package/esm/utils/object.d.ts +0 -15
- package/esm/utils/object.js +0 -142
- package/esm/utils/offset.d.ts +0 -15
- package/esm/utils/offset.js +0 -32
- package/esm/utils/offsetParent.d.ts +0 -5
- package/esm/utils/offsetParent.js +0 -23
- package/esm/utils/optionValueCompare.d.ts +0 -3
- package/esm/utils/optionValueCompare.js +0 -25
- package/esm/utils/position.d.ts +0 -26
- package/esm/utils/position.js +0 -54
- package/esm/utils/prettyBytes.d.ts +0 -1
- package/esm/utils/prettyBytes.js +0 -25
- package/esm/utils/renderer-event.d.ts +0 -62
- package/esm/utils/renderer-event.js +0 -206
- package/esm/utils/replaceText.d.ts +0 -3
- package/esm/utils/replaceText.js +0 -38
- package/esm/utils/resize-sensor.d.ts +0 -6
- package/esm/utils/resize-sensor.js +0 -172
- package/esm/utils/resolveVariable.d.ts +0 -1
- package/esm/utils/resolveVariable.js +0 -35
- package/esm/utils/resolveVariableAndFilter.d.ts +0 -1
- package/esm/utils/resolveVariableAndFilter.js +0 -33
- package/esm/utils/scrollPosition.d.ts +0 -16
- package/esm/utils/scrollPosition.js +0 -33
- package/esm/utils/string2regExp.d.ts +0 -1
- package/esm/utils/string2regExp.js +0 -14
- package/esm/utils/stripNumber.d.ts +0 -1
- package/esm/utils/stripNumber.js +0 -16
- package/esm/utils/style.d.ts +0 -10
- package/esm/utils/style.js +0 -58
- package/esm/utils/toNumber.d.ts +0 -7
- package/esm/utils/toNumber.js +0 -18
- package/esm/utils/tokenize.d.ts +0 -1
- package/esm/utils/tokenize.js +0 -29
- package/esm/utils/tpl-builtin.d.ts +0 -18
- package/esm/utils/tpl-builtin.js +0 -59
- package/esm/utils/tpl-lodash.d.ts +0 -4
- package/esm/utils/tpl-lodash.js +0 -62
- package/esm/utils/tpl.d.ts +0 -11
- package/esm/utils/tpl.js +0 -131
- package/esm/utils/uncontrollable.d.ts +0 -4
- package/esm/utils/uncontrollable.js +0 -14
- package/esm/utils/validations.d.ts +0 -39
- package/esm/utils/validations.js +0 -440
- package/lib/Root.d.ts +0 -46
- package/lib/Root.js +0 -102
- package/lib/RootRenderer.d.ts +0 -27
- package/lib/RootRenderer.js +0 -290
- package/lib/SchemaRenderer.d.ts +0 -37
- package/lib/SchemaRenderer.js +0 -342
- package/lib/Scoped.d.ts +0 -38
- package/lib/Scoped.js +0 -274
- package/lib/WithRootStore.d.ts +0 -719
- package/lib/WithRootStore.js +0 -44
- package/lib/WithStore.d.ts +0 -5
- package/lib/WithStore.js +0 -190
- package/lib/actions/Action.d.ts +0 -40
- package/lib/actions/Action.js +0 -197
- package/lib/actions/AjaxAction.d.ts +0 -27
- package/lib/actions/AjaxAction.js +0 -100
- package/lib/actions/BreakAction.d.ts +0 -15
- package/lib/actions/BreakAction.js +0 -35
- package/lib/actions/BroadcastAction.d.ts +0 -19
- package/lib/actions/BroadcastAction.js +0 -50
- package/lib/actions/CmptAction.d.ts +0 -21
- package/lib/actions/CmptAction.js +0 -70
- package/lib/actions/ContinueAction.d.ts +0 -15
- package/lib/actions/ContinueAction.js +0 -35
- package/lib/actions/CopyAction.d.ts +0 -20
- package/lib/actions/CopyAction.js +0 -43
- package/lib/actions/CustomAction.d.ts +0 -22
- package/lib/actions/CustomAction.js +0 -78
- package/lib/actions/DialogAction.d.ts +0 -60
- package/lib/actions/DialogAction.js +0 -108
- package/lib/actions/DrawerAction.d.ts +0 -33
- package/lib/actions/DrawerAction.js +0 -70
- package/lib/actions/EmailAction.d.ts +0 -23
- package/lib/actions/EmailAction.js +0 -48
- package/lib/actions/LinkAction.d.ts +0 -24
- package/lib/actions/LinkAction.js +0 -47
- package/lib/actions/LoopAction.d.ts +0 -19
- package/lib/actions/LoopAction.js +0 -107
- package/lib/actions/PageAction.d.ts +0 -39
- package/lib/actions/PageAction.js +0 -80
- package/lib/actions/ParallelAction.d.ts +0 -8
- package/lib/actions/ParallelAction.js +0 -40
- package/lib/actions/SwitchAction.d.ts +0 -11
- package/lib/actions/SwitchAction.js +0 -52
- package/lib/actions/ToastAction.d.ts +0 -19
- package/lib/actions/ToastAction.js +0 -35
- package/lib/actions/index.d.ts +0 -20
- package/lib/components/LazyComponent.d.ts +0 -32
- package/lib/components/LazyComponent.js +0 -99
- package/lib/components/Overlay.d.ts +0 -44
- package/lib/components/Overlay.js +0 -266
- package/lib/components/PopOver.d.ts +0 -90
- package/lib/components/PopOver.js +0 -129
- package/lib/env.d.ts +0 -176
- package/lib/env.js +0 -20
- package/lib/envOverwrite.d.ts +0 -4
- package/lib/envOverwrite.js +0 -43
- package/lib/factory.d.ts +0 -85
- package/lib/factory.js +0 -324
- package/lib/index.d.ts +0 -44
- package/lib/index.js +0 -460
- package/lib/locale.d.ts +0 -84
- package/lib/locale.js +0 -133
- package/lib/renderers/Form.d.ts +0 -389
- package/lib/renderers/Form.js +0 -1234
- package/lib/renderers/Item.d.ts +0 -906
- package/lib/renderers/Item.js +0 -879
- package/lib/renderers/Options.d.ts +0 -158
- package/lib/renderers/Options.js +0 -920
- package/lib/renderers/Placeholder.d.ts +0 -6
- package/lib/renderers/Placeholder.js +0 -31
- package/lib/renderers/builtin.d.ts +0 -1
- package/lib/renderers/builtin.js +0 -27
- package/lib/renderers/register.d.ts +0 -6
- package/lib/renderers/register.js +0 -83
- package/lib/renderers/wrapControl.d.ts +0 -437
- package/lib/renderers/wrapControl.js +0 -520
- package/lib/store/app.d.ts +0 -92
- package/lib/store/app.js +0 -193
- package/lib/store/combo.d.ts +0 -10223
- package/lib/store/combo.js +0 -154
- package/lib/store/crud.d.ts +0 -128
- package/lib/store/crud.js +0 -455
- package/lib/store/form.d.ts +0 -4252
- package/lib/store/form.js +0 -664
- package/lib/store/formItem.d.ts +0 -133
- package/lib/store/formItem.js +0 -858
- package/lib/store/iRenderer.d.ts +0 -46
- package/lib/store/iRenderer.js +0 -189
- package/lib/store/index.d.ts +0 -125
- package/lib/store/index.js +0 -101
- package/lib/store/list.d.ts +0 -272
- package/lib/store/list.js +0 -256
- package/lib/store/manager.d.ts +0 -115
- package/lib/store/manager.js +0 -56
- package/lib/store/modal.d.ts +0 -84
- package/lib/store/modal.js +0 -54
- package/lib/store/node.d.ts +0 -22
- package/lib/store/node.js +0 -93
- package/lib/store/pagination.d.ts +0 -58
- package/lib/store/pagination.js +0 -60
- package/lib/store/root.d.ts +0 -85
- package/lib/store/root.js +0 -57
- package/lib/store/service.d.ts +0 -71
- package/lib/store/service.js +0 -415
- package/lib/store/table.d.ts +0 -10085
- package/lib/store/table.js +0 -1148
- package/lib/store/table2.d.ts +0 -474
- package/lib/store/table2.js +0 -571
- package/lib/theme.d.ts +0 -89
- package/lib/theme.js +0 -145
- package/lib/types.d.ts +0 -489
- package/lib/utils/Animation.d.ts +0 -22
- package/lib/utils/Animation.js +0 -290
- package/lib/utils/ColorScale.d.ts +0 -19
- package/lib/utils/ColorScale.js +0 -105
- package/lib/utils/DataSchema.d.ts +0 -25
- package/lib/utils/DataSchema.js +0 -116
- package/lib/utils/DataScope.d.ts +0 -26
- package/lib/utils/DataScope.js +0 -162
- package/lib/utils/RootClose.d.ts +0 -4
- package/lib/utils/RootClose.js +0 -30
- package/lib/utils/SimpleMap.d.ts +0 -8
- package/lib/utils/SimpleMap.js +0 -46
- package/lib/utils/api.d.ts +0 -34
- package/lib/utils/api.js +0 -621
- package/lib/utils/attachmentAdpator.d.ts +0 -8
- package/lib/utils/attachmentAdpator.js +0 -91
- package/lib/utils/autobind.d.ts +0 -7
- package/lib/utils/autobind.js +0 -94
- package/lib/utils/columnsSplit.d.ts +0 -1
- package/lib/utils/columnsSplit.js +0 -51
- package/lib/utils/dataMapping.d.ts +0 -9
- package/lib/utils/dataMapping.js +0 -151
- package/lib/utils/date.d.ts +0 -4
- package/lib/utils/date.js +0 -90
- package/lib/utils/debug.d.ts +0 -29
- package/lib/utils/debug.js +0 -392
- package/lib/utils/decodeEntity.d.ts +0 -5
- package/lib/utils/decodeEntity.js +0 -20
- package/lib/utils/dom.d.ts +0 -13
- package/lib/utils/dom.js +0 -199
- package/lib/utils/errors.d.ts +0 -6
- package/lib/utils/errors.js +0 -23
- package/lib/utils/escapeHtml.d.ts +0 -1
- package/lib/utils/escapeHtml.js +0 -24
- package/lib/utils/filter-schema.d.ts +0 -13
- package/lib/utils/filter-schema.js +0 -78
- package/lib/utils/filter.d.ts +0 -1
- package/lib/utils/filter.js +0 -503
- package/lib/utils/formatDuration.d.ts +0 -1
- package/lib/utils/formatDuration.js +0 -27
- package/lib/utils/formula.d.ts +0 -16
- package/lib/utils/formula.js +0 -234
- package/lib/utils/getVariable.d.ts +0 -3
- package/lib/utils/getVariable.js +0 -29
- package/lib/utils/grammar.d.ts +0 -4
- package/lib/utils/grammar.js +0 -54
- package/lib/utils/handleAction.d.ts +0 -7
- package/lib/utils/handleAction.js +0 -39
- package/lib/utils/helper.d.ts +0 -323
- package/lib/utils/helper.js +0 -1361
- package/lib/utils/highlight.d.ts +0 -1
- package/lib/utils/highlight.js +0 -52
- package/lib/utils/icon.d.ts +0 -16
- package/lib/utils/icon.js +0 -43
- package/lib/utils/image.d.ts +0 -18
- package/lib/utils/image.js +0 -56
- package/lib/utils/index.d.ts +0 -55
- package/lib/utils/isPureVariable.d.ts +0 -1
- package/lib/utils/isPureVariable.js +0 -26
- package/lib/utils/json-schema-2-amis-schema.d.ts +0 -6
- package/lib/utils/json-schema-2-amis-schema.js +0 -60
- package/lib/utils/keyToPath.d.ts +0 -6
- package/lib/utils/keyToPath.js +0 -34
- package/lib/utils/makeSorter.d.ts +0 -1
- package/lib/utils/makeSorter.js +0 -30
- package/lib/utils/normalizeLink.d.ts +0 -1
- package/lib/utils/normalizeLink.js +0 -47
- package/lib/utils/normalizeOptions.d.ts +0 -7
- package/lib/utils/normalizeOptions.js +0 -92
- package/lib/utils/object.d.ts +0 -15
- package/lib/utils/object.js +0 -156
- package/lib/utils/offset.d.ts +0 -15
- package/lib/utils/offset.js +0 -37
- package/lib/utils/offsetParent.d.ts +0 -5
- package/lib/utils/offsetParent.js +0 -28
- package/lib/utils/optionValueCompare.d.ts +0 -3
- package/lib/utils/optionValueCompare.js +0 -30
- package/lib/utils/position.d.ts +0 -26
- package/lib/utils/position.js +0 -59
- package/lib/utils/prettyBytes.d.ts +0 -1
- package/lib/utils/prettyBytes.js +0 -29
- package/lib/utils/renderer-event.d.ts +0 -62
- package/lib/utils/renderer-event.js +0 -218
- package/lib/utils/replaceText.d.ts +0 -3
- package/lib/utils/replaceText.js +0 -46
- package/lib/utils/resize-sensor.d.ts +0 -6
- package/lib/utils/resize-sensor.js +0 -177
- package/lib/utils/resolveVariable.d.ts +0 -1
- package/lib/utils/resolveVariable.js +0 -39
- package/lib/utils/resolveVariableAndFilter.d.ts +0 -1
- package/lib/utils/resolveVariableAndFilter.js +0 -37
- package/lib/utils/scrollPosition.d.ts +0 -16
- package/lib/utils/scrollPosition.js +0 -37
- package/lib/utils/string2regExp.d.ts +0 -1
- package/lib/utils/string2regExp.js +0 -18
- package/lib/utils/stripNumber.d.ts +0 -1
- package/lib/utils/stripNumber.js +0 -20
- package/lib/utils/style.d.ts +0 -10
- package/lib/utils/style.js +0 -67
- package/lib/utils/toNumber.d.ts +0 -7
- package/lib/utils/toNumber.js +0 -22
- package/lib/utils/tokenize.d.ts +0 -1
- package/lib/utils/tokenize.js +0 -33
- package/lib/utils/tpl-builtin.d.ts +0 -18
- package/lib/utils/tpl-builtin.js +0 -75
- package/lib/utils/tpl-lodash.d.ts +0 -4
- package/lib/utils/tpl-lodash.js +0 -71
- package/lib/utils/tpl.d.ts +0 -11
- package/lib/utils/tpl.js +0 -140
- package/lib/utils/uncontrollable.d.ts +0 -4
- package/lib/utils/uncontrollable.js +0 -22
- package/lib/utils/validations.d.ts +0 -39
- package/lib/utils/validations.js +0 -455
package/lib/store/formItem.js
DELETED
|
@@ -1,858 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* amis-core v2.6.0
|
|
3
|
-
* Copyright 2018-2022 fex
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
-
|
|
10
|
-
var tslib = require('tslib');
|
|
11
|
-
var mobxStateTree = require('mobx-state-tree');
|
|
12
|
-
var isEqualWith = require('lodash/isEqualWith');
|
|
13
|
-
var form = require('./form.js');
|
|
14
|
-
var validations = require('../utils/validations.js');
|
|
15
|
-
var combo = require('./combo.js');
|
|
16
|
-
var tpl = require('../utils/tpl.js');
|
|
17
|
-
var api = require('../utils/api.js');
|
|
18
|
-
var findIndex = require('lodash/findIndex');
|
|
19
|
-
var helper = require('../utils/helper.js');
|
|
20
|
-
var find = require('lodash/find');
|
|
21
|
-
var isPlainObject = require('lodash/isPlainObject');
|
|
22
|
-
var SimpleMap = require('../utils/SimpleMap.js');
|
|
23
|
-
var node = require('./node.js');
|
|
24
|
-
var manager = require('./manager.js');
|
|
25
|
-
var normalizeOptions = require('../utils/normalizeOptions.js');
|
|
26
|
-
var optionValueCompare = require('../utils/optionValueCompare.js');
|
|
27
|
-
var dataMapping = require('../utils/dataMapping.js');
|
|
28
|
-
var object = require('../utils/object.js');
|
|
29
|
-
|
|
30
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
|
-
|
|
32
|
-
var isEqualWith__default = /*#__PURE__*/_interopDefaultLegacy(isEqualWith);
|
|
33
|
-
var findIndex__default = /*#__PURE__*/_interopDefaultLegacy(findIndex);
|
|
34
|
-
var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
|
|
35
|
-
var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
|
|
36
|
-
|
|
37
|
-
var ErrorDetail = mobxStateTree.types.model('ErrorDetail', {
|
|
38
|
-
msg: '',
|
|
39
|
-
tag: '',
|
|
40
|
-
rule: ''
|
|
41
|
-
});
|
|
42
|
-
var FormItemStore = node.StoreNode.named('FormItemStore')
|
|
43
|
-
.props({
|
|
44
|
-
isFocused: false,
|
|
45
|
-
type: '',
|
|
46
|
-
label: '',
|
|
47
|
-
unique: false,
|
|
48
|
-
loading: false,
|
|
49
|
-
required: false,
|
|
50
|
-
tmpValue: mobxStateTree.types.frozen(),
|
|
51
|
-
emitedValue: mobxStateTree.types.frozen(),
|
|
52
|
-
rules: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
53
|
-
messages: mobxStateTree.types.optional(mobxStateTree.types.frozen(), {}),
|
|
54
|
-
errorData: mobxStateTree.types.optional(mobxStateTree.types.array(ErrorDetail), []),
|
|
55
|
-
name: mobxStateTree.types.string,
|
|
56
|
-
itemId: '',
|
|
57
|
-
unsetValueOnInvisible: false,
|
|
58
|
-
itemsRef: mobxStateTree.types.optional(mobxStateTree.types.array(mobxStateTree.types.string), []),
|
|
59
|
-
validated: false,
|
|
60
|
-
validating: false,
|
|
61
|
-
multiple: false,
|
|
62
|
-
delimiter: ',',
|
|
63
|
-
valueField: 'value',
|
|
64
|
-
labelField: 'label',
|
|
65
|
-
joinValues: true,
|
|
66
|
-
extractValue: false,
|
|
67
|
-
options: mobxStateTree.types.optional(mobxStateTree.types.frozen(), []),
|
|
68
|
-
expressionsInOptions: false,
|
|
69
|
-
selectFirst: false,
|
|
70
|
-
autoFill: mobxStateTree.types.frozen(),
|
|
71
|
-
clearValueOnHidden: false,
|
|
72
|
-
validateApi: mobxStateTree.types.optional(mobxStateTree.types.frozen(), ''),
|
|
73
|
-
selectedOptions: mobxStateTree.types.optional(mobxStateTree.types.frozen(), []),
|
|
74
|
-
filteredOptions: mobxStateTree.types.optional(mobxStateTree.types.frozen(), []),
|
|
75
|
-
dialogSchema: mobxStateTree.types.frozen(),
|
|
76
|
-
dialogOpen: false,
|
|
77
|
-
dialogData: mobxStateTree.types.frozen(),
|
|
78
|
-
resetValue: mobxStateTree.types.optional(mobxStateTree.types.frozen(), ''),
|
|
79
|
-
validateOnChange: false
|
|
80
|
-
})
|
|
81
|
-
.views(function (self) {
|
|
82
|
-
function getForm() {
|
|
83
|
-
var form$1 = self.parentStore;
|
|
84
|
-
return (form$1 === null || form$1 === void 0 ? void 0 : form$1.storeType) === form.FormStore.name ? form$1 : undefined;
|
|
85
|
-
}
|
|
86
|
-
function getValue() {
|
|
87
|
-
var _a;
|
|
88
|
-
return (_a = getForm()) === null || _a === void 0 ? void 0 : _a.getValueByName(self.name);
|
|
89
|
-
}
|
|
90
|
-
function getLastOptionValue() {
|
|
91
|
-
if (self.selectedOptions.length) {
|
|
92
|
-
return self.selectedOptions[self.selectedOptions.length - 1].value;
|
|
93
|
-
}
|
|
94
|
-
return '';
|
|
95
|
-
}
|
|
96
|
-
function getErrors() {
|
|
97
|
-
return self.errorData.map(function (item) { return item.msg; });
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
get subFormItems() {
|
|
101
|
-
return self.itemsRef.map(function (item) { return manager.getStoreById(item); });
|
|
102
|
-
},
|
|
103
|
-
get form() {
|
|
104
|
-
return getForm();
|
|
105
|
-
},
|
|
106
|
-
get value() {
|
|
107
|
-
return getValue();
|
|
108
|
-
},
|
|
109
|
-
get prinstine() {
|
|
110
|
-
var _a;
|
|
111
|
-
return (_a = getForm()) === null || _a === void 0 ? void 0 : _a.getPristineValueByName(self.name);
|
|
112
|
-
},
|
|
113
|
-
get errors() {
|
|
114
|
-
return getErrors();
|
|
115
|
-
},
|
|
116
|
-
get valid() {
|
|
117
|
-
var errors = getErrors();
|
|
118
|
-
return !!(!errors || !errors.length);
|
|
119
|
-
},
|
|
120
|
-
get errClassNames() {
|
|
121
|
-
return self.errorData
|
|
122
|
-
.map(function (item) { return item.rule; })
|
|
123
|
-
.filter(function (item, index, arr) { return item && arr.indexOf(item) === index; })
|
|
124
|
-
.map(function (item) { return "has-error--".concat(item); })
|
|
125
|
-
.join(' ');
|
|
126
|
-
},
|
|
127
|
-
get lastSelectValue() {
|
|
128
|
-
return getLastOptionValue();
|
|
129
|
-
},
|
|
130
|
-
getSelectedOptions: function (value, nodeValueArray) {
|
|
131
|
-
if (value === void 0) { value = self.tmpValue; }
|
|
132
|
-
if (typeof value === 'undefined') {
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
135
|
-
var valueArray = nodeValueArray
|
|
136
|
-
? nodeValueArray
|
|
137
|
-
: Array.isArray(value)
|
|
138
|
-
? value
|
|
139
|
-
: typeof value === 'string'
|
|
140
|
-
? value.split(self.delimiter || ',')
|
|
141
|
-
: [value];
|
|
142
|
-
var selected = valueArray.map(function (item) {
|
|
143
|
-
return item && item.hasOwnProperty(self.valueField || 'value')
|
|
144
|
-
? item[self.valueField || 'value']
|
|
145
|
-
: item;
|
|
146
|
-
});
|
|
147
|
-
var selectedOptions = [];
|
|
148
|
-
selected.forEach(function (item, index) {
|
|
149
|
-
var _a, _b;
|
|
150
|
-
var matched = helper.findTree(self.filteredOptions, optionValueCompare.optionValueCompare(item, self.valueField || 'value'));
|
|
151
|
-
if (matched) {
|
|
152
|
-
selectedOptions.push(matched);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
var unMatched = (valueArray && valueArray[index]) || item;
|
|
156
|
-
if (unMatched &&
|
|
157
|
-
(typeof unMatched === 'string' || typeof unMatched === 'number')) {
|
|
158
|
-
unMatched = (_a = {},
|
|
159
|
-
_a[self.valueField || 'value'] = item,
|
|
160
|
-
_a[self.labelField || 'label'] = item,
|
|
161
|
-
_a.__unmatched = true,
|
|
162
|
-
_a);
|
|
163
|
-
}
|
|
164
|
-
else if (unMatched && self.extractValue) {
|
|
165
|
-
unMatched = (_b = {},
|
|
166
|
-
_b[self.valueField || 'value'] = item,
|
|
167
|
-
_b[self.labelField || 'label'] = 'UnKnown',
|
|
168
|
-
_b.__unmatched = true,
|
|
169
|
-
_b);
|
|
170
|
-
}
|
|
171
|
-
unMatched && selectedOptions.push(unMatched);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
return selectedOptions;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
})
|
|
178
|
-
.actions(function (self) {
|
|
179
|
-
self.form;
|
|
180
|
-
var dialogCallbacks = new SimpleMap.SimpleMap();
|
|
181
|
-
var loadAutoUpdateCancel = null;
|
|
182
|
-
function config(_a) {
|
|
183
|
-
var required = _a.required, unique = _a.unique; _a.value; var rules = _a.rules, messages = _a.messages, delimiter = _a.delimiter, multiple = _a.multiple, valueField = _a.valueField, labelField = _a.labelField, joinValues = _a.joinValues, extractValue = _a.extractValue, type = _a.type, id = _a.id, selectFirst = _a.selectFirst, autoFill = _a.autoFill, clearValueOnHidden = _a.clearValueOnHidden, validateApi = _a.validateApi, maxLength = _a.maxLength, minLength = _a.minLength, validateOnChange = _a.validateOnChange, label = _a.label;
|
|
184
|
-
if (typeof rules === 'string') {
|
|
185
|
-
rules = validations.str2rules(rules);
|
|
186
|
-
}
|
|
187
|
-
typeof type !== 'undefined' && (self.type = type);
|
|
188
|
-
typeof id !== 'undefined' && (self.itemId = id);
|
|
189
|
-
typeof messages !== 'undefined' && (self.messages = messages);
|
|
190
|
-
typeof required !== 'undefined' && (self.required = !!required);
|
|
191
|
-
typeof unique !== 'undefined' && (self.unique = !!unique);
|
|
192
|
-
typeof multiple !== 'undefined' && (self.multiple = !!multiple);
|
|
193
|
-
typeof selectFirst !== 'undefined' && (self.selectFirst = !!selectFirst);
|
|
194
|
-
typeof autoFill !== 'undefined' && (self.autoFill = autoFill);
|
|
195
|
-
typeof joinValues !== 'undefined' && (self.joinValues = !!joinValues);
|
|
196
|
-
typeof extractValue !== 'undefined' &&
|
|
197
|
-
(self.extractValue = !!extractValue);
|
|
198
|
-
typeof delimiter !== 'undefined' &&
|
|
199
|
-
(self.delimiter = delimiter || ',');
|
|
200
|
-
typeof valueField !== 'undefined' &&
|
|
201
|
-
(self.valueField = valueField || 'value');
|
|
202
|
-
typeof labelField !== 'undefined' &&
|
|
203
|
-
(self.labelField = labelField || 'label');
|
|
204
|
-
typeof clearValueOnHidden !== 'undefined' &&
|
|
205
|
-
(self.clearValueOnHidden = !!clearValueOnHidden);
|
|
206
|
-
typeof validateApi !== 'undefined' && (self.validateApi = validateApi);
|
|
207
|
-
typeof validateOnChange !== 'undefined' &&
|
|
208
|
-
(self.validateOnChange = !!validateOnChange);
|
|
209
|
-
typeof label === 'string' && (self.label = label);
|
|
210
|
-
rules = tslib.__assign(tslib.__assign({}, rules), { isRequired: self.required || (rules === null || rules === void 0 ? void 0 : rules.isRequired) });
|
|
211
|
-
// todo 这个弄个配置由渲染器自己来决定
|
|
212
|
-
// 暂时先这样
|
|
213
|
-
if (~['input-text', 'textarea'].indexOf(self.type)) {
|
|
214
|
-
if (typeof minLength === 'number') {
|
|
215
|
-
rules.minLength = minLength;
|
|
216
|
-
}
|
|
217
|
-
if (typeof maxLength === 'number') {
|
|
218
|
-
rules.maxLength = maxLength;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (helper.isObjectShallowModified(rules, self.rules)) {
|
|
222
|
-
self.rules = rules;
|
|
223
|
-
clearError('builtin');
|
|
224
|
-
self.validated = false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function focus() {
|
|
228
|
-
self.isFocused = true;
|
|
229
|
-
}
|
|
230
|
-
function blur() {
|
|
231
|
-
self.isFocused = false;
|
|
232
|
-
}
|
|
233
|
-
var validateCancel = null;
|
|
234
|
-
var validate = mobxStateTree.flow(function validate(data, hook, customRules) {
|
|
235
|
-
var json, combo, group;
|
|
236
|
-
var _a;
|
|
237
|
-
var _b, _c, _d, _e, _f;
|
|
238
|
-
return tslib.__generator(this, function (_g) {
|
|
239
|
-
switch (_g.label) {
|
|
240
|
-
case 0:
|
|
241
|
-
if (self.validating && !api.isEffectiveApi(self.validateApi, data)) {
|
|
242
|
-
return [2 /*return*/, self.valid];
|
|
243
|
-
}
|
|
244
|
-
self.validating = true;
|
|
245
|
-
clearError();
|
|
246
|
-
if (!hook) return [3 /*break*/, 2];
|
|
247
|
-
return [4 /*yield*/, hook()];
|
|
248
|
-
case 1:
|
|
249
|
-
_g.sent();
|
|
250
|
-
_g.label = 2;
|
|
251
|
-
case 2:
|
|
252
|
-
addError(validations.validate(self.tmpValue, data, customRules ? validations.str2rules(customRules) : self.rules, self.messages, self.__));
|
|
253
|
-
if (!(!self.errors.length && api.isEffectiveApi(self.validateApi, data))) return [3 /*break*/, 4];
|
|
254
|
-
if (validateCancel) {
|
|
255
|
-
validateCancel();
|
|
256
|
-
validateCancel = null;
|
|
257
|
-
}
|
|
258
|
-
return [4 /*yield*/, mobxStateTree.getEnv(self).fetcher(self.validateApi,
|
|
259
|
-
/** 如果配置validateApi,需要将用户最新输入同步到数据域内 */
|
|
260
|
-
object.createObject(data, (_a = {}, _a[self.name] = self.tmpValue, _a)), {
|
|
261
|
-
cancelExecutor: function (executor) { return (validateCancel = executor); }
|
|
262
|
-
})];
|
|
263
|
-
case 3:
|
|
264
|
-
json = _g.sent();
|
|
265
|
-
validateCancel = null;
|
|
266
|
-
if (!json.ok && json.status === 422 && json.errors) {
|
|
267
|
-
addError(String((_d = (_c = (_b = self.validateApi) === null || _b === void 0 ? void 0 : _b.messages) === null || _c === void 0 ? void 0 : _c.failed) !== null && _d !== void 0 ? _d : (json.errors || json.msg || "\u8868\u5355\u9879\u300C".concat(self.name, "\u300D\u6821\u9A8C\u5931\u8D25"))));
|
|
268
|
-
}
|
|
269
|
-
_g.label = 4;
|
|
270
|
-
case 4:
|
|
271
|
-
self.validated = true;
|
|
272
|
-
if (self.unique && ((_f = (_e = self.form) === null || _e === void 0 ? void 0 : _e.parentStore) === null || _f === void 0 ? void 0 : _f.storeType) === 'ComboStore') {
|
|
273
|
-
combo = self.form.parentStore;
|
|
274
|
-
group = combo.uniques.get(self.name);
|
|
275
|
-
if (group.items.some(function (item) {
|
|
276
|
-
return item !== self &&
|
|
277
|
-
self.tmpValue !== undefined &&
|
|
278
|
-
self.tmpValue !== '' &&
|
|
279
|
-
item.value === self.tmpValue;
|
|
280
|
-
})) {
|
|
281
|
-
addError(self.__('Form.unique'));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
self.validating = false;
|
|
285
|
-
return [2 /*return*/, self.valid];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
function setError(msg, tag) {
|
|
290
|
-
if (tag === void 0) { tag = 'builtin'; }
|
|
291
|
-
clearError();
|
|
292
|
-
addError(msg, tag);
|
|
293
|
-
}
|
|
294
|
-
function addError(msg, tag) {
|
|
295
|
-
if (tag === void 0) { tag = 'builtin'; }
|
|
296
|
-
var msgs = Array.isArray(msg) ? msg : [msg];
|
|
297
|
-
msgs.forEach(function (item) {
|
|
298
|
-
return self.errorData.push({
|
|
299
|
-
msg: typeof item === 'string' ? item : item.msg,
|
|
300
|
-
rule: typeof item !== 'string' ? item.rule : undefined,
|
|
301
|
-
tag: tag
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
function clearError(tag) {
|
|
306
|
-
if (tag) {
|
|
307
|
-
var filtered = self.errorData.filter(function (item) { return item.tag !== tag; });
|
|
308
|
-
self.errorData.replace(filtered);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
self.errorData.clear();
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function getFirstAvaibleOption(options) {
|
|
315
|
-
if (!Array.isArray(options)) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
|
|
319
|
-
var option = options_1[_i];
|
|
320
|
-
if (Array.isArray(option.children)) {
|
|
321
|
-
var childFirst = getFirstAvaibleOption(option.children);
|
|
322
|
-
if (childFirst !== undefined) {
|
|
323
|
-
return childFirst;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
else if (option[self.valueField || 'value'] != null &&
|
|
327
|
-
!option.disabled) {
|
|
328
|
-
return option;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
function setOptions(options, onChange, data) {
|
|
333
|
-
if (!Array.isArray(options)) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
options = helper.filterTree(options, function (item) { return item; });
|
|
337
|
-
var originOptions = self.options.concat();
|
|
338
|
-
self.options = options;
|
|
339
|
-
syncOptions(originOptions, data);
|
|
340
|
-
var selectedOptions;
|
|
341
|
-
if (onChange &&
|
|
342
|
-
self.selectFirst &&
|
|
343
|
-
self.filteredOptions.length &&
|
|
344
|
-
(selectedOptions = self.getSelectedOptions(self.value)) &&
|
|
345
|
-
!selectedOptions.filter(function (item) { return !item.__unmatched; }).length) {
|
|
346
|
-
var fistOption = getFirstAvaibleOption(self.filteredOptions);
|
|
347
|
-
if (!fistOption) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
var list = [fistOption].map(function (item) {
|
|
351
|
-
if (self.extractValue || self.joinValues) {
|
|
352
|
-
return item[self.valueField || 'value'];
|
|
353
|
-
}
|
|
354
|
-
return item;
|
|
355
|
-
});
|
|
356
|
-
var value = self.joinValues && self.multiple
|
|
357
|
-
? list.join(self.delimiter)
|
|
358
|
-
: self.multiple
|
|
359
|
-
? list
|
|
360
|
-
: list[0];
|
|
361
|
-
onChange(value);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
var loadCancel = null;
|
|
365
|
-
var fetchOptions = mobxStateTree.flow(function getInitData(api$1, data, config, setErrorFlag) {
|
|
366
|
-
var json, result, apiObject, e_1, env;
|
|
367
|
-
var _a, _b, _c, _d, _e;
|
|
368
|
-
return tslib.__generator(this, function (_f) {
|
|
369
|
-
switch (_f.label) {
|
|
370
|
-
case 0:
|
|
371
|
-
_f.trys.push([0, 2, , 3]);
|
|
372
|
-
if (loadCancel) {
|
|
373
|
-
loadCancel();
|
|
374
|
-
loadCancel = null;
|
|
375
|
-
self.loading = false;
|
|
376
|
-
}
|
|
377
|
-
if (!(config === null || config === void 0 ? void 0 : config.silent)) {
|
|
378
|
-
self.loading = true;
|
|
379
|
-
}
|
|
380
|
-
return [4 /*yield*/, mobxStateTree.getEnv(self).fetcher(api$1, data, tslib.__assign({ autoAppend: false, cancelExecutor: function (executor) { return (loadCancel = executor); } }, config))];
|
|
381
|
-
case 1:
|
|
382
|
-
json = _f.sent();
|
|
383
|
-
loadCancel = null;
|
|
384
|
-
result = null;
|
|
385
|
-
if (!json.ok) {
|
|
386
|
-
apiObject = api.buildApi(api$1, data);
|
|
387
|
-
setErrorFlag !== false &&
|
|
388
|
-
setError(self.__('Form.loadOptionsFailed', {
|
|
389
|
-
reason: (_c = (_b = (_a = apiObject.messages) === null || _a === void 0 ? void 0 : _a.failed) !== null && _b !== void 0 ? _b : json.msg) !== null && _c !== void 0 ? _c : (config && config.errorMessage)
|
|
390
|
-
}));
|
|
391
|
-
mobxStateTree.getEnv(self).notify('error', (_e = (_d = apiObject.messages) === null || _d === void 0 ? void 0 : _d.failed) !== null && _e !== void 0 ? _e : (self.errors.join('') || "".concat(apiObject.url, "\uFF1A").concat(json.msg)), json.msgTimeout !== undefined
|
|
392
|
-
? {
|
|
393
|
-
closeButton: true,
|
|
394
|
-
timeout: json.msgTimeout
|
|
395
|
-
}
|
|
396
|
-
: undefined);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
result = json;
|
|
400
|
-
}
|
|
401
|
-
self.loading = false;
|
|
402
|
-
return [2 /*return*/, result];
|
|
403
|
-
case 2:
|
|
404
|
-
e_1 = _f.sent();
|
|
405
|
-
env = mobxStateTree.getEnv(self);
|
|
406
|
-
if (!mobxStateTree.isAlive(self) || self.disposed) {
|
|
407
|
-
return [2 /*return*/];
|
|
408
|
-
}
|
|
409
|
-
self.loading = false;
|
|
410
|
-
if (env.isCancel(e_1)) {
|
|
411
|
-
return [2 /*return*/];
|
|
412
|
-
}
|
|
413
|
-
console.error(e_1);
|
|
414
|
-
env.notify('error', e_1.message);
|
|
415
|
-
return [2 /*return*/];
|
|
416
|
-
case 3: return [2 /*return*/];
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
});
|
|
420
|
-
var loadOptions = mobxStateTree.flow(function getInitData(api, data, config, clearValue, onChange, setErrorFlag) {
|
|
421
|
-
var json, options;
|
|
422
|
-
var _a, _b, _c;
|
|
423
|
-
return tslib.__generator(this, function (_d) {
|
|
424
|
-
switch (_d.label) {
|
|
425
|
-
case 0: return [4 /*yield*/, fetchOptions(api, data, config, setErrorFlag)];
|
|
426
|
-
case 1:
|
|
427
|
-
json = _d.sent();
|
|
428
|
-
if (!json) {
|
|
429
|
-
return [2 /*return*/];
|
|
430
|
-
}
|
|
431
|
-
clearError();
|
|
432
|
-
self.validated = false; // 拉完数据应该需要再校验一下
|
|
433
|
-
options = ((_a = json.data) === null || _a === void 0 ? void 0 : _a.options) ||
|
|
434
|
-
((_b = json.data) === null || _b === void 0 ? void 0 : _b.items) ||
|
|
435
|
-
((_c = json.data) === null || _c === void 0 ? void 0 : _c.rows) ||
|
|
436
|
-
json.data ||
|
|
437
|
-
[];
|
|
438
|
-
options = normalizeOptions.normalizeOptions(options, undefined, self.valueField);
|
|
439
|
-
if ((config === null || config === void 0 ? void 0 : config.extendsOptions) && self.selectedOptions.length > 0) {
|
|
440
|
-
self.selectedOptions.forEach(function (item) {
|
|
441
|
-
var exited = helper.findTree(options, optionValueCompare.optionValueCompare(item, self.valueField || 'value'));
|
|
442
|
-
if (!exited) {
|
|
443
|
-
options.push(item);
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
setOptions(options, onChange, data);
|
|
448
|
-
if (json.data && typeof json.data.value !== 'undefined') {
|
|
449
|
-
onChange && onChange(json.data.value, false, true);
|
|
450
|
-
}
|
|
451
|
-
else if (clearValue && !self.selectFirst) {
|
|
452
|
-
self.selectedOptions.some(function (item) { return item.__unmatched; }) &&
|
|
453
|
-
onChange &&
|
|
454
|
-
onChange('', false, true);
|
|
455
|
-
}
|
|
456
|
-
return [2 /*return*/, json];
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
var loadAutoUpdateData = mobxStateTree.flow(function getAutoUpdateData(api, data, silent) {
|
|
461
|
-
var json, result;
|
|
462
|
-
var _a, _b;
|
|
463
|
-
if (silent === void 0) { silent = true; }
|
|
464
|
-
return tslib.__generator(this, function (_c) {
|
|
465
|
-
switch (_c.label) {
|
|
466
|
-
case 0:
|
|
467
|
-
if (loadAutoUpdateCancel) {
|
|
468
|
-
loadAutoUpdateCancel();
|
|
469
|
-
loadAutoUpdateCancel = null;
|
|
470
|
-
}
|
|
471
|
-
return [4 /*yield*/, mobxStateTree.getEnv(self).fetcher(api, data, {
|
|
472
|
-
cancelExecutor: function (executor) {
|
|
473
|
-
return (loadAutoUpdateCancel = executor);
|
|
474
|
-
}
|
|
475
|
-
})];
|
|
476
|
-
case 1:
|
|
477
|
-
json = _c.sent();
|
|
478
|
-
loadAutoUpdateCancel = null;
|
|
479
|
-
if (!json) {
|
|
480
|
-
return [2 /*return*/];
|
|
481
|
-
}
|
|
482
|
-
result = ((_a = json.data) === null || _a === void 0 ? void 0 : _a.items) || ((_b = json.data) === null || _b === void 0 ? void 0 : _b.rows);
|
|
483
|
-
// 只处理仅有一个结果的数据
|
|
484
|
-
if ((result === null || result === void 0 ? void 0 : result.length) === 1) {
|
|
485
|
-
return [2 /*return*/, result[0]];
|
|
486
|
-
}
|
|
487
|
-
else if (isPlainObject__default["default"](json.data)) {
|
|
488
|
-
return [2 /*return*/, json.data];
|
|
489
|
-
}
|
|
490
|
-
!silent &&
|
|
491
|
-
mobxStateTree.getEnv(self).notify('info', self.__('FormItem.autoFillLoadFailed'));
|
|
492
|
-
return [2 /*return*/];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
});
|
|
496
|
-
var tryDeferLoadLeftOptions = mobxStateTree.flow(function (option, leftOptions, api, data, config) {
|
|
497
|
-
var indexes, leftIndexes, topOption, json, options, newLeftOptions, children_1;
|
|
498
|
-
var _a;
|
|
499
|
-
return tslib.__generator(this, function (_b) {
|
|
500
|
-
switch (_b.label) {
|
|
501
|
-
case 0:
|
|
502
|
-
if (!Array.isArray(leftOptions)) {
|
|
503
|
-
return [2 /*return*/];
|
|
504
|
-
}
|
|
505
|
-
indexes = helper.findTreeIndex(self.options, function (item) { return item.leftOptions === leftOptions; });
|
|
506
|
-
leftIndexes = helper.findTreeIndex(leftOptions, function (item) { return item === option; });
|
|
507
|
-
topOption = helper.findTree(self.options, function (item) { return item.leftOptions === leftOptions; });
|
|
508
|
-
if (!indexes || !leftIndexes || !topOption) {
|
|
509
|
-
return [2 /*return*/];
|
|
510
|
-
}
|
|
511
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, topOption), { loading: true, leftOptions: helper.spliceTree(topOption.leftOptions, leftIndexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: true })) })), undefined, data);
|
|
512
|
-
return [4 /*yield*/, fetchOptions(api, data, tslib.__assign(tslib.__assign({}, config), { silent: true }), false)];
|
|
513
|
-
case 1:
|
|
514
|
-
json = _b.sent();
|
|
515
|
-
if (!json) {
|
|
516
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, topOption), { loading: false, error: true, leftOptions: helper.spliceTree(topOption.leftOptions, leftIndexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: false, error: true })) })), undefined, data);
|
|
517
|
-
return [2 /*return*/];
|
|
518
|
-
}
|
|
519
|
-
options = ((_a = json.data) === null || _a === void 0 ? void 0 : _a.options) ||
|
|
520
|
-
json.data.items ||
|
|
521
|
-
json.data.rows ||
|
|
522
|
-
json.data ||
|
|
523
|
-
[];
|
|
524
|
-
newLeftOptions = helper.spliceTree(topOption.leftOptions, leftIndexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: false, loaded: true, children: options }));
|
|
525
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, topOption), { loading: false, loaded: true, children: options, leftOptions: newLeftOptions })), undefined, data);
|
|
526
|
-
// 插入新的子节点,用于之后BaseSelection.resolveSelected查找
|
|
527
|
-
if (Array.isArray(topOption.children)) {
|
|
528
|
-
children_1 = topOption.children.concat();
|
|
529
|
-
helper.flattenTree(newLeftOptions).forEach(function (item) {
|
|
530
|
-
if (!helper.findTree(topOption.children, function (node) { return node.ref === item.value; })) {
|
|
531
|
-
children_1.push({ ref: item.value, defer: true });
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, topOption), { leftOptions: newLeftOptions, children: children_1 })), undefined, data);
|
|
535
|
-
}
|
|
536
|
-
return [2 /*return*/, json];
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
var deferLoadLeftOptions = mobxStateTree.flow(function (option, leftOptions, api, data, config) {
|
|
541
|
-
return tslib.__generator(this, function (_a) {
|
|
542
|
-
switch (_a.label) {
|
|
543
|
-
case 0: return [4 /*yield*/, tryDeferLoadLeftOptions(option, leftOptions, api, data, config)];
|
|
544
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
var deferLoadOptions = mobxStateTree.flow(function (option, api, data, config) {
|
|
549
|
-
var labelField, valueField, indexes, leftOptions, json, options;
|
|
550
|
-
var _a, _b;
|
|
551
|
-
return tslib.__generator(this, function (_c) {
|
|
552
|
-
switch (_c.label) {
|
|
553
|
-
case 0:
|
|
554
|
-
labelField = self.labelField || 'label';
|
|
555
|
-
valueField = self.valueField || 'value';
|
|
556
|
-
indexes = helper.findTreeIndex(self.options, function (item) {
|
|
557
|
-
return item === option ||
|
|
558
|
-
/** tree-select中会对option添加collapsed, visible属性,导致item === option不通过 */
|
|
559
|
-
isEqualWith__default["default"](item, option, function (source, target) {
|
|
560
|
-
return (source === null || source === void 0 ? void 0 : source[valueField]) != null &&
|
|
561
|
-
(target === null || target === void 0 ? void 0 : target[valueField]) != null &&
|
|
562
|
-
(source === null || source === void 0 ? void 0 : source[labelField]) === (target === null || target === void 0 ? void 0 : target[labelField]) &&
|
|
563
|
-
(source === null || source === void 0 ? void 0 : source[valueField]) === (target === null || target === void 0 ? void 0 : target[valueField]);
|
|
564
|
-
});
|
|
565
|
-
});
|
|
566
|
-
if (!!indexes) return [3 /*break*/, 2];
|
|
567
|
-
leftOptions = (_a = self.options[0]) === null || _a === void 0 ? void 0 : _a.leftOptions;
|
|
568
|
-
return [4 /*yield*/, tryDeferLoadLeftOptions(option, leftOptions, api, data, config)];
|
|
569
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
570
|
-
case 2:
|
|
571
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: true })), undefined, data);
|
|
572
|
-
return [4 /*yield*/, fetchOptions(api, data, tslib.__assign(tslib.__assign({}, config), { silent: true }), false)];
|
|
573
|
-
case 3:
|
|
574
|
-
json = _c.sent();
|
|
575
|
-
if (!json) {
|
|
576
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: false, error: true })), undefined, data);
|
|
577
|
-
return [2 /*return*/];
|
|
578
|
-
}
|
|
579
|
-
options = ((_b = json.data) === null || _b === void 0 ? void 0 : _b.options) ||
|
|
580
|
-
json.data.items ||
|
|
581
|
-
json.data.rows ||
|
|
582
|
-
json.data ||
|
|
583
|
-
[];
|
|
584
|
-
setOptions(helper.spliceTree(self.options, indexes, 1, tslib.__assign(tslib.__assign({}, option), { loading: false, loaded: true, children: options })), undefined, data);
|
|
585
|
-
return [2 /*return*/, json];
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
});
|
|
589
|
-
/**
|
|
590
|
-
* 根据当前节点路径展开树形组件父节点
|
|
591
|
-
*/
|
|
592
|
-
var expandTreeOptions = mobxStateTree.flow(function getInitData(nodePathArr, api, data, config) {
|
|
593
|
-
var traversedNode, _i, nodePathArr_1, nodePath, _loop_1, level;
|
|
594
|
-
var _a;
|
|
595
|
-
return tslib.__generator(this, function (_b) {
|
|
596
|
-
switch (_b.label) {
|
|
597
|
-
case 0:
|
|
598
|
-
traversedNode = new Map();
|
|
599
|
-
_i = 0, nodePathArr_1 = nodePathArr;
|
|
600
|
-
_b.label = 1;
|
|
601
|
-
case 1:
|
|
602
|
-
if (!(_i < nodePathArr_1.length)) return [3 /*break*/, 6];
|
|
603
|
-
nodePath = nodePathArr_1[_i];
|
|
604
|
-
// 根节点已经展开了,不需要加载
|
|
605
|
-
if (nodePath.length <= 1) {
|
|
606
|
-
return [3 /*break*/, 5];
|
|
607
|
-
}
|
|
608
|
-
_loop_1 = function (level) {
|
|
609
|
-
var tree, nodeValue, node, indexes, json, childrenOptions;
|
|
610
|
-
return tslib.__generator(this, function (_c) {
|
|
611
|
-
switch (_c.label) {
|
|
612
|
-
case 0:
|
|
613
|
-
tree = self.options.concat();
|
|
614
|
-
nodeValue = nodePath[level];
|
|
615
|
-
if (traversedNode.has(nodeValue)) {
|
|
616
|
-
return [2 /*return*/, "continue"];
|
|
617
|
-
}
|
|
618
|
-
node = helper.findTree(tree, function (item, key, treeLevel) {
|
|
619
|
-
return (treeLevel === level + 1 &&
|
|
620
|
-
optionValueCompare.optionValueCompare(nodeValue, self.valueField || 'value')(item));
|
|
621
|
-
});
|
|
622
|
-
// 只处理懒加载节点
|
|
623
|
-
if (!node || !node.defer) {
|
|
624
|
-
return [2 /*return*/, "continue"];
|
|
625
|
-
}
|
|
626
|
-
indexes = helper.findTreeIndex(tree, function (item) { return item === node; });
|
|
627
|
-
setOptions(helper.spliceTree(tree, indexes, 1, tslib.__assign(tslib.__assign({}, node), { loading: true })), undefined, node);
|
|
628
|
-
return [4 /*yield*/, fetchOptions(api, node, tslib.__assign(tslib.__assign({}, config), { silent: true }), false)];
|
|
629
|
-
case 1:
|
|
630
|
-
json = _c.sent();
|
|
631
|
-
if (!json) {
|
|
632
|
-
setOptions(helper.spliceTree(tree, indexes, 1, tslib.__assign(tslib.__assign({}, node), { loading: false, error: true })), undefined, node);
|
|
633
|
-
}
|
|
634
|
-
traversedNode.set(nodeValue, true);
|
|
635
|
-
childrenOptions = ((_a = json.data) === null || _a === void 0 ? void 0 : _a.options) ||
|
|
636
|
-
json.data.items ||
|
|
637
|
-
json.data.rows ||
|
|
638
|
-
json.data ||
|
|
639
|
-
[];
|
|
640
|
-
setOptions(helper.spliceTree(tree, indexes, 1, tslib.__assign(tslib.__assign({}, node), { loading: false, loaded: true, children: childrenOptions })), undefined, node);
|
|
641
|
-
return [2 /*return*/];
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
};
|
|
645
|
-
level = 0;
|
|
646
|
-
_b.label = 2;
|
|
647
|
-
case 2:
|
|
648
|
-
if (!(level < nodePath.length - 1)) return [3 /*break*/, 5];
|
|
649
|
-
return [5 /*yield**/, _loop_1(level)];
|
|
650
|
-
case 3:
|
|
651
|
-
_b.sent();
|
|
652
|
-
_b.label = 4;
|
|
653
|
-
case 4:
|
|
654
|
-
level++;
|
|
655
|
-
return [3 /*break*/, 2];
|
|
656
|
-
case 5:
|
|
657
|
-
_i++;
|
|
658
|
-
return [3 /*break*/, 1];
|
|
659
|
-
case 6: return [2 /*return*/];
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
});
|
|
663
|
-
// @issue 强依赖form,需要改造暂且放过。
|
|
664
|
-
function syncOptions(originOptions, data) {
|
|
665
|
-
var _a;
|
|
666
|
-
if (!self.options.length && typeof self.value === 'undefined') {
|
|
667
|
-
self.selectedOptions = [];
|
|
668
|
-
self.filteredOptions = [];
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
var value = self.tmpValue;
|
|
672
|
-
var selected = Array.isArray(value)
|
|
673
|
-
? value.map(function (item) {
|
|
674
|
-
return item && item.hasOwnProperty(self.valueField || 'value')
|
|
675
|
-
? item[self.valueField || 'value']
|
|
676
|
-
: item;
|
|
677
|
-
})
|
|
678
|
-
: typeof value === 'string'
|
|
679
|
-
? value.split(self.delimiter || ',')
|
|
680
|
-
: value === void 0
|
|
681
|
-
? []
|
|
682
|
-
: [
|
|
683
|
-
value && value.hasOwnProperty(self.valueField || 'value')
|
|
684
|
-
? value[self.valueField || 'value']
|
|
685
|
-
: value
|
|
686
|
-
];
|
|
687
|
-
if (value && value.hasOwnProperty(self.labelField || 'label')) {
|
|
688
|
-
selected[0] = (_a = {},
|
|
689
|
-
_a[self.labelField || 'label'] = value[self.labelField || 'label'],
|
|
690
|
-
_a[self.valueField || 'value'] = value[self.valueField || 'value'],
|
|
691
|
-
_a);
|
|
692
|
-
}
|
|
693
|
-
var expressionsInOptions = false;
|
|
694
|
-
var filteredOptions = self.options
|
|
695
|
-
.filter(function (item) {
|
|
696
|
-
if (!expressionsInOptions &&
|
|
697
|
-
(item.visibleOn || item.hiddenOn || item.disabledOn)) {
|
|
698
|
-
expressionsInOptions = true;
|
|
699
|
-
}
|
|
700
|
-
return item.visibleOn
|
|
701
|
-
? tpl.evalExpression(item.visibleOn, data) !== false
|
|
702
|
-
: item.hiddenOn
|
|
703
|
-
? tpl.evalExpression(item.hiddenOn, data) !== true
|
|
704
|
-
: item.visible !== false || item.hidden !== true;
|
|
705
|
-
})
|
|
706
|
-
.map(function (item, index) {
|
|
707
|
-
var disabled = tpl.evalExpression(item.disabledOn, data);
|
|
708
|
-
var newItem = item.disabledOn
|
|
709
|
-
? self.filteredOptions.length > index &&
|
|
710
|
-
self.filteredOptions[index].disabled === disabled
|
|
711
|
-
? self.filteredOptions[index]
|
|
712
|
-
: tslib.__assign(tslib.__assign({}, item), { disabled: disabled })
|
|
713
|
-
: item;
|
|
714
|
-
return newItem;
|
|
715
|
-
});
|
|
716
|
-
self.expressionsInOptions = expressionsInOptions;
|
|
717
|
-
var flattened = helper.flattenTree(filteredOptions);
|
|
718
|
-
var selectedOptions = [];
|
|
719
|
-
selected.forEach(function (item, index) {
|
|
720
|
-
var _a, _b;
|
|
721
|
-
var idx = findIndex__default["default"](flattened, optionValueCompare.optionValueCompare(item, self.valueField || 'value'));
|
|
722
|
-
if (~idx) {
|
|
723
|
-
selectedOptions.push(flattened[idx]);
|
|
724
|
-
}
|
|
725
|
-
else {
|
|
726
|
-
var unMatched = (value && value[index]) || item;
|
|
727
|
-
if (unMatched &&
|
|
728
|
-
(typeof unMatched === 'string' || typeof unMatched === 'number')) {
|
|
729
|
-
unMatched = (_a = {},
|
|
730
|
-
_a[self.valueField || 'value'] = item,
|
|
731
|
-
_a[self.labelField || 'label'] = item,
|
|
732
|
-
_a.__unmatched = true,
|
|
733
|
-
_a);
|
|
734
|
-
var orgin = originOptions &&
|
|
735
|
-
find__default["default"](originOptions, optionValueCompare.optionValueCompare(item, self.valueField || 'value'));
|
|
736
|
-
if (orgin) {
|
|
737
|
-
unMatched[self.labelField || 'label'] =
|
|
738
|
-
orgin[self.labelField || 'label'];
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
else if (unMatched && self.extractValue) {
|
|
742
|
-
unMatched = (_b = {},
|
|
743
|
-
_b[self.valueField || 'value'] = item,
|
|
744
|
-
_b[self.labelField || 'label'] = 'UnKnown',
|
|
745
|
-
_b.__unmatched = true,
|
|
746
|
-
_b);
|
|
747
|
-
}
|
|
748
|
-
unMatched && selectedOptions.push(unMatched);
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
var form = self.form;
|
|
752
|
-
var parentStore = form === null || form === void 0 ? void 0 : form.parentStore;
|
|
753
|
-
if ((parentStore === null || parentStore === void 0 ? void 0 : parentStore.storeType) === combo.ComboStore.name) {
|
|
754
|
-
var combo$1 = parentStore;
|
|
755
|
-
var group = combo$1.uniques.get(self.name);
|
|
756
|
-
var options_2 = [];
|
|
757
|
-
group &&
|
|
758
|
-
group.items.forEach(function (item) {
|
|
759
|
-
if (self !== item) {
|
|
760
|
-
options_2.push.apply(options_2, item.selectedOptions.map(function (item) { return item && item.value; }));
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
if (filteredOptions.length) {
|
|
764
|
-
filteredOptions = filteredOptions.filter(function (option) { return !~options_2.indexOf(option.value); });
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
helper.isArrayChildrenModified(self.selectedOptions, selectedOptions) &&
|
|
768
|
-
(self.selectedOptions = selectedOptions);
|
|
769
|
-
helper.isArrayChildrenModified(self.filteredOptions, filteredOptions) &&
|
|
770
|
-
(self.filteredOptions = filteredOptions);
|
|
771
|
-
}
|
|
772
|
-
function setLoading(value) {
|
|
773
|
-
self.loading = value;
|
|
774
|
-
}
|
|
775
|
-
var subStore;
|
|
776
|
-
function getSubStore() {
|
|
777
|
-
return subStore;
|
|
778
|
-
}
|
|
779
|
-
function setSubStore(store) {
|
|
780
|
-
subStore = store;
|
|
781
|
-
}
|
|
782
|
-
function reset(keepErrors) {
|
|
783
|
-
if (keepErrors === void 0) { keepErrors = false; }
|
|
784
|
-
self.validated = false;
|
|
785
|
-
if (subStore && subStore.storeType === 'ComboStore') {
|
|
786
|
-
var combo = subStore;
|
|
787
|
-
combo.forms.forEach(function (form) { return form.reset(); });
|
|
788
|
-
}
|
|
789
|
-
!keepErrors && clearError();
|
|
790
|
-
}
|
|
791
|
-
function resetValidationStatus(tag) {
|
|
792
|
-
self.validated = false;
|
|
793
|
-
clearError();
|
|
794
|
-
}
|
|
795
|
-
function openDialog(schema, ctx, callback) {
|
|
796
|
-
if (schema.data) {
|
|
797
|
-
self.dialogData = dataMapping.dataMapping(schema.data, ctx);
|
|
798
|
-
}
|
|
799
|
-
else {
|
|
800
|
-
self.dialogData = ctx;
|
|
801
|
-
}
|
|
802
|
-
self.dialogSchema = schema;
|
|
803
|
-
self.dialogOpen = true;
|
|
804
|
-
callback && dialogCallbacks.set(self.dialogData, callback);
|
|
805
|
-
}
|
|
806
|
-
function closeDialog(result) {
|
|
807
|
-
var callback = dialogCallbacks.get(self.dialogData);
|
|
808
|
-
self.dialogOpen = false;
|
|
809
|
-
if (callback) {
|
|
810
|
-
dialogCallbacks.delete(self.dialogData);
|
|
811
|
-
setTimeout(function () { return callback(result); }, 200);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
function changeTmpValue(value) {
|
|
815
|
-
self.tmpValue = value;
|
|
816
|
-
}
|
|
817
|
-
function changeEmitedValue(value) {
|
|
818
|
-
self.emitedValue = value;
|
|
819
|
-
}
|
|
820
|
-
function addSubFormItem(item) {
|
|
821
|
-
self.itemsRef.push(item.id);
|
|
822
|
-
}
|
|
823
|
-
function removeSubFormItem(item) {
|
|
824
|
-
var idx = self.itemsRef.findIndex(function (a) { return a === item.id; });
|
|
825
|
-
if (~idx) {
|
|
826
|
-
self.itemsRef.splice(idx, 1);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
return {
|
|
830
|
-
focus: focus,
|
|
831
|
-
blur: blur,
|
|
832
|
-
config: config,
|
|
833
|
-
validate: validate,
|
|
834
|
-
setError: setError,
|
|
835
|
-
addError: addError,
|
|
836
|
-
clearError: clearError,
|
|
837
|
-
setOptions: setOptions,
|
|
838
|
-
loadOptions: loadOptions,
|
|
839
|
-
deferLoadOptions: deferLoadOptions,
|
|
840
|
-
deferLoadLeftOptions: deferLoadLeftOptions,
|
|
841
|
-
expandTreeOptions: expandTreeOptions,
|
|
842
|
-
syncOptions: syncOptions,
|
|
843
|
-
setLoading: setLoading,
|
|
844
|
-
setSubStore: setSubStore,
|
|
845
|
-
getSubStore: getSubStore,
|
|
846
|
-
reset: reset,
|
|
847
|
-
resetValidationStatus: resetValidationStatus,
|
|
848
|
-
openDialog: openDialog,
|
|
849
|
-
closeDialog: closeDialog,
|
|
850
|
-
changeTmpValue: changeTmpValue,
|
|
851
|
-
changeEmitedValue: changeEmitedValue,
|
|
852
|
-
addSubFormItem: addSubFormItem,
|
|
853
|
-
removeSubFormItem: removeSubFormItem,
|
|
854
|
-
loadAutoUpdateData: loadAutoUpdateData
|
|
855
|
-
};
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
exports.FormItemStore = FormItemStore;
|