@vef-framework/components 1.0.128 → 1.0.130
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/cjs/index.cjs +1 -195
- package/cjs/internal/base.css.cjs +488 -4
- package/cjs/internal/chart.cjs +1 -20
- package/cjs/internal/index.cjs +1 -9
- package/cjs/internal/modern-normalize.css.cjs +211 -4
- package/cjs/internal/utils.cjs +1 -8
- package/cjs/vef-access-denied/access-denied-icon.cjs +1 -932
- package/cjs/vef-access-denied/index.cjs +9 -49
- package/cjs/vef-access-denied/props.cjs +0 -2
- package/cjs/vef-action-buttons/index.cjs +1 -79
- package/cjs/vef-action-buttons/props.cjs +0 -2
- package/cjs/vef-approval-flow-editor/components/edge.cjs +2 -87
- package/cjs/vef-approval-flow-editor/components/label-value.cjs +8 -31
- package/cjs/vef-approval-flow-editor/components/node-content.cjs +10 -49
- package/cjs/vef-approval-flow-editor/components/node-selector.cjs +4 -37
- package/cjs/vef-approval-flow-editor/components/node-toolbar.cjs +1 -25
- package/cjs/vef-approval-flow-editor/components/nodes/approval.cjs +1 -28
- package/cjs/vef-approval-flow-editor/components/nodes/condition.cjs +1 -28
- package/cjs/vef-approval-flow-editor/components/nodes/end.cjs +1 -28
- package/cjs/vef-approval-flow-editor/components/nodes/handle.cjs +1 -28
- package/cjs/vef-approval-flow-editor/components/nodes/index.cjs +1 -19
- package/cjs/vef-approval-flow-editor/components/nodes/submit.cjs +1 -28
- package/cjs/vef-approval-flow-editor/components/selector-content.cjs +9 -52
- package/cjs/vef-approval-flow-editor/components/source-handle.cjs +1 -44
- package/cjs/vef-approval-flow-editor/components/target-handle.cjs +1 -13
- package/cjs/vef-approval-flow-editor/constants.cjs +1 -225
- package/cjs/vef-approval-flow-editor/helper.cjs +1 -88
- package/cjs/vef-approval-flow-editor/hooks/use-edges-interaction.cjs +1 -27
- package/cjs/vef-approval-flow-editor/hooks/use-element-selection.cjs +1 -26
- package/cjs/vef-approval-flow-editor/hooks/use-nodes-interaction.cjs +1 -53
- package/cjs/vef-approval-flow-editor/index.cjs +1 -79
- package/cjs/vef-approval-flow-editor/models/edge-node.cjs +1 -23
- package/cjs/vef-approval-flow-editor/models/flow-node.cjs +1 -112
- package/cjs/vef-approval-flow-editor/props.cjs +0 -2
- package/cjs/vef-approval-flow-editor/store.cjs +1 -20
- package/cjs/vef-approval-flow-editor/styles.cjs +12 -23
- package/cjs/vef-approval-flow-editor/types.cjs +1 -18
- package/cjs/vef-area-chart/index.cjs +1 -45
- package/cjs/vef-area-chart/props.cjs +0 -2
- package/cjs/vef-auto-sizer/index.cjs +1 -10
- package/cjs/vef-auto-sizer/props.cjs +0 -2
- package/cjs/vef-avatar/index.cjs +1 -24
- package/cjs/vef-avatar/props.cjs +0 -2
- package/cjs/vef-avatar-group/index.cjs +1 -29
- package/cjs/vef-avatar-group/props.cjs +0 -2
- package/cjs/vef-badge/index.cjs +1 -51
- package/cjs/vef-badge/props.cjs +0 -2
- package/cjs/vef-bar-chart/index.cjs +1 -45
- package/cjs/vef-bar-chart/props.cjs +0 -2
- package/cjs/vef-bool/hooks/use-bool-instance.cjs +1 -36
- package/cjs/vef-bool/index.cjs +1 -64
- package/cjs/vef-bool/props.cjs +0 -2
- package/cjs/vef-breadcrumb/index.cjs +1 -52
- package/cjs/vef-breadcrumb/props.cjs +0 -2
- package/cjs/vef-button/components/base-button.cjs +1 -77
- package/cjs/vef-button/index.cjs +1 -155
- package/cjs/vef-button/props.cjs +0 -2
- package/cjs/vef-card/index.cjs +1 -29
- package/cjs/vef-card/props.cjs +0 -2
- package/cjs/vef-card-meta/index.cjs +1 -16
- package/cjs/vef-card-meta/props.cjs +0 -2
- package/cjs/vef-chart-container/hooks/use-chart-container-context.cjs +1 -16
- package/cjs/vef-chart-container/index.cjs +13 -83
- package/cjs/vef-chart-container/props.cjs +0 -2
- package/cjs/vef-chart-legend-content/index.cjs +10 -48
- package/cjs/vef-chart-legend-content/props.cjs +0 -2
- package/cjs/vef-chart-tooltip-content/index.cjs +22 -89
- package/cjs/vef-chart-tooltip-content/props.cjs +0 -2
- package/cjs/vef-checkbox/hooks/use-checkbox-instance.cjs +1 -22
- package/cjs/vef-checkbox/hooks/use-data-options.cjs +1 -42
- package/cjs/vef-checkbox/index.cjs +3 -92
- package/cjs/vef-checkbox/props.cjs +0 -2
- package/cjs/vef-code-editor/hooks/use-change-handler.cjs +1 -12
- package/cjs/vef-code-editor/hooks/use-config-extensions.cjs +1 -50
- package/cjs/vef-code-editor/hooks/use-height-props.cjs +1 -22
- package/cjs/vef-code-editor/hooks/use-language-extensions.cjs +1 -119
- package/cjs/vef-code-editor/hooks/use-setup-options.cjs +1 -39
- package/cjs/vef-code-editor/index.cjs +1 -61
- package/cjs/vef-code-editor/props.cjs +0 -2
- package/cjs/vef-code-editor/styles.cjs +46 -54
- package/cjs/vef-col/index.cjs +1 -15
- package/cjs/vef-col/props.cjs +0 -2
- package/cjs/vef-color-picker/index.cjs +1 -50
- package/cjs/vef-color-picker/props.cjs +0 -2
- package/cjs/vef-compact/index.cjs +1 -19
- package/cjs/vef-compact/props.cjs +0 -2
- package/cjs/vef-config-provider/global-style.cjs +15 -26
- package/cjs/vef-config-provider/hooks/use-ui-config.cjs +1 -128
- package/cjs/vef-config-provider/index.cjs +3 -125
- package/cjs/vef-config-provider/props.cjs +0 -2
- package/cjs/vef-config-provider/store.cjs +1 -25
- package/cjs/vef-container/index.cjs +1 -22
- package/cjs/vef-container/props.cjs +0 -2
- package/cjs/vef-crud-page/components/crud-actions.cjs +1 -36
- package/cjs/vef-crud-page/components/crud-filter.cjs +1 -58
- package/cjs/vef-crud-page/components/crud-footer.cjs +3 -120
- package/cjs/vef-crud-page/components/crud-form-modal.cjs +1 -57
- package/cjs/vef-crud-page/components/crud-header.cjs +1 -33
- package/cjs/vef-crud-page/components/crud-table.cjs +1 -80
- package/cjs/vef-crud-page/hooks/use-action-buttons.cjs +1 -39
- package/cjs/vef-crud-page/hooks/use-crud-context.cjs +1 -22
- package/cjs/vef-crud-page/hooks/use-crud-schema.cjs +1 -118
- package/cjs/vef-crud-page/hooks/use-operation-buttons.cjs +1 -62
- package/cjs/vef-crud-page/index.cjs +1 -154
- package/cjs/vef-crud-page/props.cjs +0 -2
- package/cjs/vef-crud-page/store.cjs +1 -146
- package/cjs/vef-crud-page/types.cjs +0 -2
- package/cjs/vef-data-grid/index.cjs +1 -89
- package/cjs/vef-data-grid/props.cjs +0 -2
- package/cjs/vef-data-table/index.cjs +1 -13
- package/cjs/vef-data-table/props.cjs +0 -2
- package/cjs/vef-divider/index.cjs +1 -28
- package/cjs/vef-divider/props.cjs +0 -2
- package/cjs/vef-drawer/components/action-button-wrapper.cjs +1 -53
- package/cjs/vef-drawer/components/button-props.cjs +0 -2
- package/cjs/vef-drawer/components/cancel-action-button.cjs +1 -25
- package/cjs/vef-drawer/components/ok-action-button.cjs +1 -24
- package/cjs/vef-drawer/context.cjs +1 -19
- package/cjs/vef-drawer/index.cjs +3 -159
- package/cjs/vef-drawer/props.cjs +0 -2
- package/cjs/vef-dropdown/index.cjs +1 -96
- package/cjs/vef-dropdown/props.cjs +0 -2
- package/cjs/vef-dynamic-icon/index.cjs +1 -50
- package/cjs/vef-dynamic-icon/props.cjs +1 -8
- package/cjs/vef-empty/index.cjs +1 -41
- package/cjs/vef-empty/props.cjs +0 -2
- package/cjs/vef-empty-placeholder/index.cjs +4 -23
- package/cjs/vef-empty-placeholder/props.cjs +0 -2
- package/cjs/vef-error/error-icon.cjs +1 -761
- package/cjs/vef-error/index.cjs +9 -52
- package/cjs/vef-error/props.cjs +0 -2
- package/cjs/vef-filter/components/action-buttons.cjs +5 -125
- package/cjs/vef-filter/components/advanced-filter.cjs +8 -75
- package/cjs/vef-filter/components/basic-filter.cjs +4 -39
- package/cjs/vef-filter/components/fields/index.cjs +1 -21
- package/cjs/vef-filter/components/fields/input-number.cjs +1 -94
- package/cjs/vef-filter/components/fields/input.cjs +1 -71
- package/cjs/vef-filter/components/fields/props.cjs +0 -2
- package/cjs/vef-filter/components/fields/radio.cjs +1 -113
- package/cjs/vef-filter/components/fields/select.cjs +1 -144
- package/cjs/vef-filter/components/fields/tree-select.cjs +1 -140
- package/cjs/vef-filter/components/filter-field.cjs +1 -23
- package/cjs/vef-filter/components/filter-item.cjs +1 -116
- package/cjs/vef-filter/event.cjs +1 -46
- package/cjs/vef-filter/helper.cjs +1 -17
- package/cjs/vef-filter/hooks/use-action-handlers.cjs +1 -72
- package/cjs/vef-filter/hooks/use-computed-values.cjs +1 -57
- package/cjs/vef-filter/hooks/use-filter-context.cjs +1 -22
- package/cjs/vef-filter/hooks/use-filter-initialization.cjs +1 -39
- package/cjs/vef-filter/hooks/use-filter-instance.cjs +1 -28
- package/cjs/vef-filter/hooks/use-filter-items.cjs +1 -25
- package/cjs/vef-filter/hooks/use-filter-values-change.cjs +1 -32
- package/cjs/vef-filter/hooks/use-label-config.cjs +1 -29
- package/cjs/vef-filter/index.cjs +2 -145
- package/cjs/vef-filter/props.cjs +0 -2
- package/cjs/vef-filter/store.cjs +1 -75
- package/cjs/vef-filter/types.cjs +0 -2
- package/cjs/vef-flex/index.cjs +1 -35
- package/cjs/vef-flex/props.cjs +0 -2
- package/cjs/vef-float-button/index.cjs +1 -53
- package/cjs/vef-float-button/props.cjs +0 -2
- package/cjs/vef-float-button-group/index.cjs +1 -24
- package/cjs/vef-float-button-group/props.cjs +0 -2
- package/cjs/vef-form/components/fields/icon-select.cjs +1 -69
- package/cjs/vef-form/components/fields/index.cjs +1 -27
- package/cjs/vef-form/components/fields/input-number.cjs +1 -127
- package/cjs/vef-form/components/fields/input.cjs +1 -136
- package/cjs/vef-form/components/fields/password.cjs +1 -119
- package/cjs/vef-form/components/fields/props.cjs +0 -2
- package/cjs/vef-form/components/fields/radio.cjs +1 -110
- package/cjs/vef-form/components/fields/select.cjs +1 -242
- package/cjs/vef-form/components/fields/textarea.cjs +1 -113
- package/cjs/vef-form/components/fields/tree-select.cjs +1 -238
- package/cjs/vef-form/components/form-actions.cjs +3 -62
- package/cjs/vef-form/components/form-content.cjs +2 -148
- package/cjs/vef-form/components/form-field.cjs +1 -26
- package/cjs/vef-form/components/form-group.cjs +3 -68
- package/cjs/vef-form/components/form-hidden-item.cjs +1 -40
- package/cjs/vef-form/components/form-item.cjs +1 -83
- package/cjs/vef-form/components/form-row.cjs +1 -102
- package/cjs/vef-form/event.cjs +1 -46
- package/cjs/vef-form/helper.cjs +1 -17
- package/cjs/vef-form/hooks/use-action-handlers.cjs +1 -132
- package/cjs/vef-form/hooks/use-columns-layout.cjs +1 -124
- package/cjs/vef-form/hooks/use-computed-values.cjs +1 -57
- package/cjs/vef-form/hooks/use-form-context.cjs +1 -18
- package/cjs/vef-form/hooks/use-form-initialization.cjs +1 -47
- package/cjs/vef-form/hooks/use-form-instance.cjs +1 -28
- package/cjs/vef-form/hooks/use-form-values-change.cjs +1 -32
- package/cjs/vef-form/hooks/use-label-width.cjs +1 -20
- package/cjs/vef-form/index.cjs +3 -178
- package/cjs/vef-form/props.cjs +0 -2
- package/cjs/vef-form/store.cjs +1 -69
- package/cjs/vef-form/types.cjs +0 -2
- package/cjs/vef-form/validation-rules.cjs +1 -310
- package/cjs/vef-form-drawer/index.cjs +1 -102
- package/cjs/vef-form-drawer/props.cjs +0 -2
- package/cjs/vef-form-modal/index.cjs +1 -99
- package/cjs/vef-form-modal/props.cjs +0 -2
- package/cjs/vef-generic-select/index.cjs +1 -85
- package/cjs/vef-generic-select/props.cjs +0 -2
- package/cjs/vef-grid/index.cjs +12 -81
- package/cjs/vef-grid/props.cjs +1 -6
- package/cjs/vef-grid-item/index.cjs +1 -56
- package/cjs/vef-grid-item/props.cjs +0 -2
- package/cjs/vef-icon/index.cjs +1 -54
- package/cjs/vef-icon/props.cjs +0 -2
- package/cjs/vef-icon-select/index.cjs +11 -150
- package/cjs/vef-icon-select/props.cjs +0 -2
- package/cjs/vef-input/hooks/use-input-instance.cjs +1 -17
- package/cjs/vef-input/index.cjs +1 -68
- package/cjs/vef-input/props.cjs +0 -2
- package/cjs/vef-input-number/hooks/use-input-number-instance.cjs +1 -15
- package/cjs/vef-input-number/index.cjs +1 -152
- package/cjs/vef-input-number/props.cjs +0 -2
- package/cjs/vef-intellisense-code-editor/hooks/use-change-handler.cjs +1 -12
- package/cjs/vef-intellisense-code-editor/hooks/use-editor-options.cjs +1 -33
- package/cjs/vef-intellisense-code-editor/hooks/use-path.cjs +1 -32
- package/cjs/vef-intellisense-code-editor/index.cjs +1 -46
- package/cjs/vef-intellisense-code-editor/loader.cjs +1 -141
- package/cjs/vef-intellisense-code-editor/props.cjs +0 -2
- package/cjs/vef-intellisense-code-editor/styles.cjs +9 -17
- package/cjs/vef-intellisense-code-editor/themes/github-light.json.cjs +349 -7
- package/cjs/vef-json-viewer/index.cjs +1 -42
- package/cjs/vef-json-viewer/props.cjs +0 -2
- package/cjs/vef-layout/common-styles.cjs +4 -12
- package/cjs/vef-layout/components/content.cjs +1 -17
- package/cjs/vef-layout/components/font-size.cjs +1 -72
- package/cjs/vef-layout/components/fullscreen.cjs +1 -27
- package/cjs/vef-layout/components/header-action-icons.cjs +6 -33
- package/cjs/vef-layout/components/header-content.cjs +1 -23
- package/cjs/vef-layout/components/header.cjs +6 -73
- package/cjs/vef-layout/components/icon-boy.cjs +1 -73
- package/cjs/vef-layout/components/icon-girl.cjs +1 -80
- package/cjs/vef-layout/components/icon-menu-fold-left.cjs +1 -27
- package/cjs/vef-layout/components/icon-menu-unfold-left.cjs +1 -27
- package/cjs/vef-layout/components/menu-groups.cjs +15 -127
- package/cjs/vef-layout/components/message.cjs +1 -15
- package/cjs/vef-layout/components/search.cjs +1 -15
- package/cjs/vef-layout/components/sider.cjs +5 -58
- package/cjs/vef-layout/components/title.cjs +8 -57
- package/cjs/vef-layout/components/user-avatar.cjs +9 -84
- package/cjs/vef-layout/hooks/use-layout-context.cjs +1 -14
- package/cjs/vef-layout/index.cjs +2 -37
- package/cjs/vef-layout/logo.svg.cjs +1 -7
- package/cjs/vef-layout/props.cjs +0 -2
- package/cjs/vef-layout/store.cjs +1 -20
- package/cjs/vef-line-chart/index.cjs +1 -42
- package/cjs/vef-line-chart/props.cjs +0 -2
- package/cjs/vef-loading-placeholder/index.cjs +5 -46
- package/cjs/vef-loading-placeholder/props.cjs +0 -2
- package/cjs/vef-login/index.cjs +21 -156
- package/cjs/vef-login/login-icon.cjs +1 -672
- package/cjs/vef-login/props.cjs +0 -2
- package/cjs/vef-menu/index.cjs +4 -81
- package/cjs/vef-menu/props.cjs +0 -2
- package/cjs/vef-modal/components/action-button-wrapper.cjs +1 -53
- package/cjs/vef-modal/components/button-props.cjs +0 -2
- package/cjs/vef-modal/components/cancel-action-button.cjs +1 -22
- package/cjs/vef-modal/components/ok-action-button.cjs +1 -24
- package/cjs/vef-modal/context.cjs +1 -19
- package/cjs/vef-modal/index.cjs +2 -244
- package/cjs/vef-modal/props.cjs +0 -2
- package/cjs/vef-not-found/index.cjs +9 -49
- package/cjs/vef-not-found/not-found-icon.cjs +1 -848
- package/cjs/vef-not-found/props.cjs +0 -2
- package/cjs/vef-page/index.cjs +10 -91
- package/cjs/vef-page/props.cjs +0 -2
- package/cjs/vef-pagination/index.cjs +1 -61
- package/cjs/vef-pagination/props.cjs +1 -15
- package/cjs/vef-paragraph/index.cjs +1 -93
- package/cjs/vef-paragraph/props.cjs +0 -2
- package/cjs/vef-password/hooks/use-password-instance.cjs +1 -15
- package/cjs/vef-password/index.cjs +1 -71
- package/cjs/vef-password/props.cjs +0 -2
- package/cjs/vef-pie-chart/index.cjs +8 -74
- package/cjs/vef-pie-chart/props.cjs +0 -2
- package/cjs/vef-popconfirm/index.cjs +1 -60
- package/cjs/vef-popconfirm/props.cjs +0 -2
- package/cjs/vef-popover/index.cjs +1 -38
- package/cjs/vef-popover/props.cjs +0 -2
- package/cjs/vef-radio/hooks/use-data-options.cjs +1 -42
- package/cjs/vef-radio/hooks/use-radio-instance.cjs +1 -22
- package/cjs/vef-radio/index.cjs +3 -92
- package/cjs/vef-radio/props.cjs +0 -2
- package/cjs/vef-rate/hooks/use-rate-instance.cjs +1 -15
- package/cjs/vef-rate/index.cjs +1 -34
- package/cjs/vef-rate/props.cjs +0 -2
- package/cjs/vef-responsive-container/index.cjs +2 -58
- package/cjs/vef-responsive-container/props.cjs +0 -2
- package/cjs/vef-responsive-item/index.cjs +2 -27
- package/cjs/vef-responsive-item/props.cjs +0 -2
- package/cjs/vef-ribbon/index.cjs +1 -42
- package/cjs/vef-ribbon/props.cjs +0 -2
- package/cjs/vef-row/index.cjs +1 -16
- package/cjs/vef-row/props.cjs +0 -2
- package/cjs/vef-scroll-area/components/scrollbar.cjs +7 -38
- package/cjs/vef-scroll-area/index.cjs +3 -73
- package/cjs/vef-scroll-area/props.cjs +0 -2
- package/cjs/vef-segment/index.cjs +1 -40
- package/cjs/vef-segment/props.cjs +0 -2
- package/cjs/vef-select/components/option.cjs +3 -27
- package/cjs/vef-select/hooks/use-data-options.cjs +1 -49
- package/cjs/vef-select/hooks/use-field-names.cjs +1 -23
- package/cjs/vef-select/hooks/use-render-label.cjs +2 -25
- package/cjs/vef-select/hooks/use-render-option.cjs +1 -21
- package/cjs/vef-select/hooks/use-select-instance.cjs +1 -22
- package/cjs/vef-select/index.cjs +1 -104
- package/cjs/vef-select/props.cjs +0 -2
- package/cjs/vef-slider/hooks/use-slider-instance.cjs +1 -15
- package/cjs/vef-slider/index.cjs +1 -38
- package/cjs/vef-slider/props.cjs +0 -2
- package/cjs/vef-sortable-list/components/overlay-item.cjs +2 -35
- package/cjs/vef-sortable-list/components/sortable-item.cjs +2 -79
- package/cjs/vef-sortable-list/hooks/use-merged-items.cjs +1 -23
- package/cjs/vef-sortable-list/index.cjs +1 -118
- package/cjs/vef-sortable-list/props.cjs +0 -2
- package/cjs/vef-space/index.cjs +1 -29
- package/cjs/vef-space/props.cjs +0 -2
- package/cjs/vef-spin/index.cjs +1 -16
- package/cjs/vef-spin/props.cjs +0 -2
- package/cjs/vef-splitter/index.cjs +1 -24
- package/cjs/vef-splitter/props.cjs +0 -2
- package/cjs/vef-splitter-panel/index.cjs +1 -16
- package/cjs/vef-splitter-panel/props.cjs +0 -2
- package/cjs/vef-status/index.cjs +1 -41
- package/cjs/vef-status/props.cjs +0 -2
- package/cjs/vef-table/components/columns/bool.cjs +1 -95
- package/cjs/vef-table/components/columns/code.cjs +1 -14
- package/cjs/vef-table/components/columns/data-dictionary.cjs +1 -96
- package/cjs/vef-table/components/columns/enum.cjs +1 -105
- package/cjs/vef-table/components/columns/file.cjs +1 -14
- package/cjs/vef-table/components/columns/icon.cjs +1 -14
- package/cjs/vef-table/components/columns/id.cjs +1 -86
- package/cjs/vef-table/components/columns/image.cjs +1 -15
- package/cjs/vef-table/components/columns/index.cjs +1 -35
- package/cjs/vef-table/components/columns/markdown.cjs +1 -14
- package/cjs/vef-table/components/columns/number.cjs +1 -87
- package/cjs/vef-table/components/columns/props.cjs +0 -2
- package/cjs/vef-table/components/columns/render.cjs +1 -32
- package/cjs/vef-table/components/columns/rich-text.cjs +1 -14
- package/cjs/vef-table/components/columns/text.cjs +1 -92
- package/cjs/vef-table/components/columns-settings.cjs +10 -199
- package/cjs/vef-table/components/operation-buttons.cjs +2 -234
- package/cjs/vef-table/components/settings-icon.cjs +3 -23
- package/cjs/vef-table/components/table-footer.cjs +3 -106
- package/cjs/vef-table/helper.cjs +1 -17
- package/cjs/vef-table/hooks/use-computed-batch-buttons.cjs +1 -35
- package/cjs/vef-table/hooks/use-computed-columns.cjs +1 -22
- package/cjs/vef-table/hooks/use-computed-values.cjs +1 -40
- package/cjs/vef-table/hooks/use-data.cjs +1 -59
- package/cjs/vef-table/hooks/use-default-column-configs.cjs +1 -29
- package/cjs/vef-table/hooks/use-display-value.cjs +1 -38
- package/cjs/vef-table/hooks/use-helper-columns.cjs +1 -69
- package/cjs/vef-table/hooks/use-operation-column-width.cjs +1 -52
- package/cjs/vef-table/hooks/use-pagination-props.cjs +1 -46
- package/cjs/vef-table/hooks/use-row-props.cjs +1 -41
- package/cjs/vef-table/hooks/use-row-selection-config.cjs +1 -114
- package/cjs/vef-table/hooks/use-selected-rows.cjs +1 -28
- package/cjs/vef-table/hooks/use-table-columns.cjs +1 -58
- package/cjs/vef-table/hooks/use-table-context.cjs +1 -25
- package/cjs/vef-table/hooks/use-table-instance.cjs +1 -17
- package/cjs/vef-table/hooks/use-table-summary.cjs +1 -44
- package/cjs/vef-table/hooks/use-table-width.cjs +1 -15
- package/cjs/vef-table/index.cjs +5 -231
- package/cjs/vef-table/props.cjs +0 -2
- package/cjs/vef-table/store.cjs +1 -21
- package/cjs/vef-table/types.cjs +0 -2
- package/cjs/vef-tabs/index.cjs +1 -29
- package/cjs/vef-tabs/props.cjs +0 -2
- package/cjs/vef-tag/index.cjs +1 -32
- package/cjs/vef-tag/props.cjs +0 -2
- package/cjs/vef-temporal-picker/helper.cjs +1 -59
- package/cjs/vef-temporal-picker/hooks/use-dayjs-value.cjs +1 -20
- package/cjs/vef-temporal-picker/hooks/use-temporal-limit.cjs +1 -36
- package/cjs/vef-temporal-picker/hooks/use-temporal-picker-instance.cjs +1 -21
- package/cjs/vef-temporal-picker/index.cjs +1 -129
- package/cjs/vef-temporal-picker/props.cjs +0 -2
- package/cjs/vef-temporal-range-picker/helper.cjs +1 -59
- package/cjs/vef-temporal-range-picker/hooks/use-dayjs-values.cjs +1 -25
- package/cjs/vef-temporal-range-picker/hooks/use-temporal-limit.cjs +1 -36
- package/cjs/vef-temporal-range-picker/hooks/use-temporal-range-picker-instance.cjs +1 -21
- package/cjs/vef-temporal-range-picker/index.cjs +1 -132
- package/cjs/vef-temporal-range-picker/props.cjs +1 -6
- package/cjs/vef-text/index.cjs +1 -84
- package/cjs/vef-text/props.cjs +0 -2
- package/cjs/vef-textarea/hooks/use-textarea-instance.cjs +1 -15
- package/cjs/vef-textarea/index.cjs +1 -71
- package/cjs/vef-textarea/props.cjs +0 -2
- package/cjs/vef-title/index.cjs +6 -93
- package/cjs/vef-title/props.cjs +0 -2
- package/cjs/vef-tooltip/index.cjs +1 -39
- package/cjs/vef-tooltip/props.cjs +0 -2
- package/cjs/vef-tree-select/hooks/use-change-handler.cjs +1 -35
- package/cjs/vef-tree-select/hooks/use-data-options.cjs +1 -47
- package/cjs/vef-tree-select/hooks/use-tree-select-instance.cjs +1 -22
- package/cjs/vef-tree-select/index.cjs +1 -93
- package/cjs/vef-tree-select/props.cjs +0 -2
- package/cjs/vef-virtual-grid/index.cjs +3 -111
- package/cjs/vef-virtual-grid/props.cjs +0 -2
- package/cjs/vef-virtual-list/index.cjs +4 -219
- package/cjs/vef-virtual-list/props.cjs +0 -2
- package/esm/index.js +1 -97
- package/esm/internal/base.css.js +490 -2
- package/esm/internal/chart.js +1 -18
- package/esm/internal/index.js +1 -4
- package/esm/internal/modern-normalize.css.js +213 -2
- package/esm/internal/utils.js +1 -6
- package/esm/vef-access-denied/access-denied-icon.js +1 -928
- package/esm/vef-access-denied/index.js +9 -45
- package/esm/vef-action-buttons/index.js +1 -75
- package/esm/vef-approval-flow-editor/components/edge.js +2 -83
- package/esm/vef-approval-flow-editor/components/label-value.js +8 -27
- package/esm/vef-approval-flow-editor/components/node-content.js +10 -45
- package/esm/vef-approval-flow-editor/components/node-selector.js +4 -33
- package/esm/vef-approval-flow-editor/components/node-toolbar.js +1 -21
- package/esm/vef-approval-flow-editor/components/nodes/approval.js +1 -24
- package/esm/vef-approval-flow-editor/components/nodes/condition.js +1 -24
- package/esm/vef-approval-flow-editor/components/nodes/end.js +1 -24
- package/esm/vef-approval-flow-editor/components/nodes/handle.js +1 -24
- package/esm/vef-approval-flow-editor/components/nodes/index.js +1 -17
- package/esm/vef-approval-flow-editor/components/nodes/submit.js +1 -24
- package/esm/vef-approval-flow-editor/components/selector-content.js +9 -48
- package/esm/vef-approval-flow-editor/components/source-handle.js +1 -40
- package/esm/vef-approval-flow-editor/components/target-handle.js +1 -9
- package/esm/vef-approval-flow-editor/constants.js +1 -218
- package/esm/vef-approval-flow-editor/helper.js +1 -83
- package/esm/vef-approval-flow-editor/hooks/use-edges-interaction.js +1 -25
- package/esm/vef-approval-flow-editor/hooks/use-element-selection.js +1 -24
- package/esm/vef-approval-flow-editor/hooks/use-nodes-interaction.js +1 -51
- package/esm/vef-approval-flow-editor/index.js +1 -75
- package/esm/vef-approval-flow-editor/models/edge-node.js +1 -20
- package/esm/vef-approval-flow-editor/models/flow-node.js +1 -105
- package/esm/vef-approval-flow-editor/store.js +1 -16
- package/esm/vef-approval-flow-editor/styles.js +12 -20
- package/esm/vef-approval-flow-editor/types.js +1 -15
- package/esm/vef-area-chart/index.js +1 -41
- package/esm/vef-auto-sizer/index.js +1 -6
- package/esm/vef-avatar/index.js +1 -20
- package/esm/vef-avatar-group/index.js +1 -25
- package/esm/vef-badge/index.js +1 -47
- package/esm/vef-bar-chart/index.js +1 -41
- package/esm/vef-bool/hooks/use-bool-instance.js +1 -34
- package/esm/vef-bool/index.js +1 -60
- package/esm/vef-breadcrumb/index.js +1 -48
- package/esm/vef-button/components/base-button.js +1 -73
- package/esm/vef-button/index.js +1 -151
- package/esm/vef-card/index.js +1 -25
- package/esm/vef-card-meta/index.js +1 -12
- package/esm/vef-chart-container/hooks/use-chart-container-context.js +1 -12
- package/esm/vef-chart-container/index.js +13 -79
- package/esm/vef-chart-legend-content/index.js +10 -43
- package/esm/vef-chart-tooltip-content/index.js +22 -85
- package/esm/vef-checkbox/hooks/use-checkbox-instance.js +1 -20
- package/esm/vef-checkbox/hooks/use-data-options.js +1 -40
- package/esm/vef-checkbox/index.js +3 -88
- package/esm/vef-code-editor/hooks/use-change-handler.js +1 -10
- package/esm/vef-code-editor/hooks/use-config-extensions.js +1 -48
- package/esm/vef-code-editor/hooks/use-height-props.js +1 -20
- package/esm/vef-code-editor/hooks/use-language-extensions.js +1 -117
- package/esm/vef-code-editor/hooks/use-setup-options.js +1 -37
- package/esm/vef-code-editor/index.js +1 -57
- package/esm/vef-code-editor/styles.js +46 -52
- package/esm/vef-col/index.js +1 -11
- package/esm/vef-color-picker/index.js +1 -46
- package/esm/vef-compact/index.js +1 -15
- package/esm/vef-config-provider/global-style.js +15 -23
- package/esm/vef-config-provider/hooks/use-ui-config.js +1 -126
- package/esm/vef-config-provider/index.js +3 -121
- package/esm/vef-config-provider/store.js +1 -21
- package/esm/vef-container/index.js +1 -18
- package/esm/vef-crud-page/components/crud-actions.js +1 -32
- package/esm/vef-crud-page/components/crud-filter.js +1 -54
- package/esm/vef-crud-page/components/crud-footer.js +3 -116
- package/esm/vef-crud-page/components/crud-form-modal.js +1 -53
- package/esm/vef-crud-page/components/crud-header.js +1 -29
- package/esm/vef-crud-page/components/crud-table.js +1 -76
- package/esm/vef-crud-page/hooks/use-action-buttons.js +1 -37
- package/esm/vef-crud-page/hooks/use-crud-context.js +1 -20
- package/esm/vef-crud-page/hooks/use-crud-schema.js +1 -116
- package/esm/vef-crud-page/hooks/use-operation-buttons.js +1 -60
- package/esm/vef-crud-page/index.js +1 -150
- package/esm/vef-crud-page/store.js +1 -142
- package/esm/vef-data-grid/index.js +1 -85
- package/esm/vef-data-table/index.js +1 -9
- package/esm/vef-divider/index.js +1 -24
- package/esm/vef-drawer/components/action-button-wrapper.js +1 -49
- package/esm/vef-drawer/components/cancel-action-button.js +1 -21
- package/esm/vef-drawer/components/ok-action-button.js +1 -20
- package/esm/vef-drawer/context.js +1 -15
- package/esm/vef-drawer/index.js +3 -154
- package/esm/vef-dropdown/index.js +1 -92
- package/esm/vef-dynamic-icon/index.js +1 -46
- package/esm/vef-dynamic-icon/props.js +1 -6
- package/esm/vef-empty/index.js +1 -37
- package/esm/vef-empty-placeholder/index.js +4 -19
- package/esm/vef-error/error-icon.js +1 -757
- package/esm/vef-error/index.js +9 -48
- package/esm/vef-filter/components/action-buttons.js +5 -121
- package/esm/vef-filter/components/advanced-filter.js +8 -71
- package/esm/vef-filter/components/basic-filter.js +4 -35
- package/esm/vef-filter/components/fields/index.js +1 -19
- package/esm/vef-filter/components/fields/input-number.js +1 -90
- package/esm/vef-filter/components/fields/input.js +1 -67
- package/esm/vef-filter/components/fields/radio.js +1 -109
- package/esm/vef-filter/components/fields/select.js +1 -140
- package/esm/vef-filter/components/fields/tree-select.js +1 -136
- package/esm/vef-filter/components/filter-field.js +1 -19
- package/esm/vef-filter/components/filter-item.js +1 -112
- package/esm/vef-filter/event.js +1 -44
- package/esm/vef-filter/helper.js +1 -15
- package/esm/vef-filter/hooks/use-action-handlers.js +1 -70
- package/esm/vef-filter/hooks/use-computed-values.js +1 -55
- package/esm/vef-filter/hooks/use-filter-context.js +1 -18
- package/esm/vef-filter/hooks/use-filter-initialization.js +1 -37
- package/esm/vef-filter/hooks/use-filter-instance.js +1 -26
- package/esm/vef-filter/hooks/use-filter-items.js +1 -23
- package/esm/vef-filter/hooks/use-filter-values-change.js +1 -30
- package/esm/vef-filter/hooks/use-label-config.js +1 -27
- package/esm/vef-filter/index.js +2 -141
- package/esm/vef-filter/store.js +1 -71
- package/esm/vef-flex/index.js +1 -31
- package/esm/vef-float-button/index.js +1 -49
- package/esm/vef-float-button-group/index.js +1 -20
- package/esm/vef-form/components/fields/icon-select.js +1 -65
- package/esm/vef-form/components/fields/index.js +1 -25
- package/esm/vef-form/components/fields/input-number.js +1 -123
- package/esm/vef-form/components/fields/input.js +1 -132
- package/esm/vef-form/components/fields/password.js +1 -115
- package/esm/vef-form/components/fields/radio.js +1 -106
- package/esm/vef-form/components/fields/select.js +1 -238
- package/esm/vef-form/components/fields/textarea.js +1 -109
- package/esm/vef-form/components/fields/tree-select.js +1 -234
- package/esm/vef-form/components/form-actions.js +3 -58
- package/esm/vef-form/components/form-content.js +2 -144
- package/esm/vef-form/components/form-field.js +1 -22
- package/esm/vef-form/components/form-group.js +3 -64
- package/esm/vef-form/components/form-hidden-item.js +1 -36
- package/esm/vef-form/components/form-item.js +1 -79
- package/esm/vef-form/components/form-row.js +1 -98
- package/esm/vef-form/event.js +1 -44
- package/esm/vef-form/helper.js +1 -15
- package/esm/vef-form/hooks/use-action-handlers.js +1 -130
- package/esm/vef-form/hooks/use-columns-layout.js +1 -122
- package/esm/vef-form/hooks/use-computed-values.js +1 -55
- package/esm/vef-form/hooks/use-form-context.js +1 -14
- package/esm/vef-form/hooks/use-form-initialization.js +1 -45
- package/esm/vef-form/hooks/use-form-instance.js +1 -26
- package/esm/vef-form/hooks/use-form-values-change.js +1 -30
- package/esm/vef-form/hooks/use-label-width.js +1 -18
- package/esm/vef-form/index.js +3 -174
- package/esm/vef-form/store.js +1 -65
- package/esm/vef-form/validation-rules.js +1 -286
- package/esm/vef-form-drawer/index.js +1 -98
- package/esm/vef-form-modal/index.js +1 -95
- package/esm/vef-generic-select/index.js +1 -81
- package/esm/vef-grid/index.js +12 -77
- package/esm/vef-grid/props.js +1 -4
- package/esm/vef-grid-item/index.js +1 -52
- package/esm/vef-icon/index.js +1 -50
- package/esm/vef-icon-select/index.js +11 -146
- package/esm/vef-input/hooks/use-input-instance.js +1 -15
- package/esm/vef-input/index.js +1 -64
- package/esm/vef-input-number/hooks/use-input-number-instance.js +1 -13
- package/esm/vef-input-number/index.js +1 -148
- package/esm/vef-intellisense-code-editor/hooks/use-change-handler.js +1 -10
- package/esm/vef-intellisense-code-editor/hooks/use-editor-options.js +1 -31
- package/esm/vef-intellisense-code-editor/hooks/use-path.js +1 -30
- package/esm/vef-intellisense-code-editor/index.js +1 -42
- package/esm/vef-intellisense-code-editor/loader.js +1 -120
- package/esm/vef-intellisense-code-editor/styles.js +9 -15
- package/esm/vef-intellisense-code-editor/themes/github-light.json.js +349 -3
- package/esm/vef-json-viewer/index.js +1 -38
- package/esm/vef-layout/common-styles.js +4 -10
- package/esm/vef-layout/components/content.js +1 -13
- package/esm/vef-layout/components/font-size.js +1 -68
- package/esm/vef-layout/components/fullscreen.js +1 -23
- package/esm/vef-layout/components/header-action-icons.js +6 -29
- package/esm/vef-layout/components/header-content.js +1 -19
- package/esm/vef-layout/components/header.js +6 -69
- package/esm/vef-layout/components/icon-boy.js +1 -69
- package/esm/vef-layout/components/icon-girl.js +1 -76
- package/esm/vef-layout/components/icon-menu-fold-left.js +1 -23
- package/esm/vef-layout/components/icon-menu-unfold-left.js +1 -23
- package/esm/vef-layout/components/menu-groups.js +15 -123
- package/esm/vef-layout/components/message.js +1 -11
- package/esm/vef-layout/components/search.js +1 -11
- package/esm/vef-layout/components/sider.js +5 -54
- package/esm/vef-layout/components/title.js +8 -53
- package/esm/vef-layout/components/user-avatar.js +9 -80
- package/esm/vef-layout/hooks/use-layout-context.js +1 -10
- package/esm/vef-layout/index.js +2 -33
- package/esm/vef-layout/logo.svg.js +1 -3
- package/esm/vef-layout/store.js +1 -16
- package/esm/vef-line-chart/index.js +1 -38
- package/esm/vef-loading-placeholder/index.js +5 -42
- package/esm/vef-login/index.js +21 -152
- package/esm/vef-login/login-icon.js +1 -668
- package/esm/vef-menu/index.js +4 -77
- package/esm/vef-modal/components/action-button-wrapper.js +1 -49
- package/esm/vef-modal/components/cancel-action-button.js +1 -18
- package/esm/vef-modal/components/ok-action-button.js +1 -20
- package/esm/vef-modal/context.js +1 -15
- package/esm/vef-modal/index.js +2 -239
- package/esm/vef-not-found/index.js +9 -45
- package/esm/vef-not-found/not-found-icon.js +1 -844
- package/esm/vef-page/index.js +10 -87
- package/esm/vef-pagination/index.js +1 -57
- package/esm/vef-pagination/props.js +1 -13
- package/esm/vef-paragraph/index.js +1 -89
- package/esm/vef-password/hooks/use-password-instance.js +1 -13
- package/esm/vef-password/index.js +1 -67
- package/esm/vef-pie-chart/index.js +8 -70
- package/esm/vef-popconfirm/index.js +1 -56
- package/esm/vef-popover/index.js +1 -34
- package/esm/vef-radio/hooks/use-data-options.js +1 -40
- package/esm/vef-radio/hooks/use-radio-instance.js +1 -20
- package/esm/vef-radio/index.js +3 -88
- package/esm/vef-rate/hooks/use-rate-instance.js +1 -13
- package/esm/vef-rate/index.js +1 -30
- package/esm/vef-responsive-container/index.js +2 -54
- package/esm/vef-responsive-item/index.js +2 -23
- package/esm/vef-ribbon/index.js +1 -38
- package/esm/vef-row/index.js +1 -12
- package/esm/vef-scroll-area/components/scrollbar.js +7 -34
- package/esm/vef-scroll-area/index.js +3 -69
- package/esm/vef-segment/index.js +1 -36
- package/esm/vef-select/components/option.js +3 -23
- package/esm/vef-select/hooks/use-data-options.js +1 -47
- package/esm/vef-select/hooks/use-field-names.js +1 -21
- package/esm/vef-select/hooks/use-render-label.js +2 -23
- package/esm/vef-select/hooks/use-render-option.js +1 -19
- package/esm/vef-select/hooks/use-select-instance.js +1 -20
- package/esm/vef-select/index.js +1 -100
- package/esm/vef-slider/hooks/use-slider-instance.js +1 -13
- package/esm/vef-slider/index.js +1 -34
- package/esm/vef-sortable-list/components/overlay-item.js +2 -31
- package/esm/vef-sortable-list/components/sortable-item.js +2 -75
- package/esm/vef-sortable-list/hooks/use-merged-items.js +1 -21
- package/esm/vef-sortable-list/index.js +1 -114
- package/esm/vef-space/index.js +1 -25
- package/esm/vef-spin/index.js +1 -12
- package/esm/vef-splitter/index.js +1 -20
- package/esm/vef-splitter-panel/index.js +1 -12
- package/esm/vef-status/index.js +1 -37
- package/esm/vef-table/components/columns/bool.js +1 -91
- package/esm/vef-table/components/columns/code.js +1 -10
- package/esm/vef-table/components/columns/data-dictionary.js +1 -92
- package/esm/vef-table/components/columns/enum.js +1 -101
- package/esm/vef-table/components/columns/file.js +1 -10
- package/esm/vef-table/components/columns/icon.js +1 -10
- package/esm/vef-table/components/columns/id.js +1 -82
- package/esm/vef-table/components/columns/image.js +1 -11
- package/esm/vef-table/components/columns/index.js +1 -33
- package/esm/vef-table/components/columns/markdown.js +1 -10
- package/esm/vef-table/components/columns/number.js +1 -83
- package/esm/vef-table/components/columns/render.js +1 -28
- package/esm/vef-table/components/columns/rich-text.js +1 -10
- package/esm/vef-table/components/columns/text.js +1 -88
- package/esm/vef-table/components/columns-settings.js +10 -195
- package/esm/vef-table/components/operation-buttons.js +2 -230
- package/esm/vef-table/components/settings-icon.js +3 -19
- package/esm/vef-table/components/table-footer.js +3 -102
- package/esm/vef-table/helper.js +1 -15
- package/esm/vef-table/hooks/use-computed-batch-buttons.js +1 -33
- package/esm/vef-table/hooks/use-computed-columns.js +1 -20
- package/esm/vef-table/hooks/use-computed-values.js +1 -38
- package/esm/vef-table/hooks/use-data.js +1 -57
- package/esm/vef-table/hooks/use-default-column-configs.js +1 -27
- package/esm/vef-table/hooks/use-display-value.js +1 -36
- package/esm/vef-table/hooks/use-helper-columns.js +1 -67
- package/esm/vef-table/hooks/use-operation-column-width.js +1 -50
- package/esm/vef-table/hooks/use-pagination-props.js +1 -44
- package/esm/vef-table/hooks/use-row-props.js +1 -39
- package/esm/vef-table/hooks/use-row-selection-config.js +1 -112
- package/esm/vef-table/hooks/use-selected-rows.js +1 -26
- package/esm/vef-table/hooks/use-table-columns.js +1 -56
- package/esm/vef-table/hooks/use-table-context.js +1 -21
- package/esm/vef-table/hooks/use-table-instance.js +1 -15
- package/esm/vef-table/hooks/use-table-summary.js +1 -42
- package/esm/vef-table/hooks/use-table-width.js +1 -13
- package/esm/vef-table/index.js +5 -227
- package/esm/vef-table/store.js +1 -17
- package/esm/vef-tabs/index.js +1 -25
- package/esm/vef-tag/index.js +1 -28
- package/esm/vef-temporal-picker/helper.js +1 -57
- package/esm/vef-temporal-picker/hooks/use-dayjs-value.js +1 -18
- package/esm/vef-temporal-picker/hooks/use-temporal-limit.js +1 -34
- package/esm/vef-temporal-picker/hooks/use-temporal-picker-instance.js +1 -19
- package/esm/vef-temporal-picker/index.js +1 -125
- package/esm/vef-temporal-range-picker/helper.js +1 -57
- package/esm/vef-temporal-range-picker/hooks/use-dayjs-values.js +1 -23
- package/esm/vef-temporal-range-picker/hooks/use-temporal-limit.js +1 -34
- package/esm/vef-temporal-range-picker/hooks/use-temporal-range-picker-instance.js +1 -19
- package/esm/vef-temporal-range-picker/index.js +1 -128
- package/esm/vef-temporal-range-picker/props.js +1 -4
- package/esm/vef-text/index.js +1 -80
- package/esm/vef-textarea/hooks/use-textarea-instance.js +1 -13
- package/esm/vef-textarea/index.js +1 -67
- package/esm/vef-title/index.js +6 -89
- package/esm/vef-tooltip/index.js +1 -35
- package/esm/vef-tree-select/hooks/use-change-handler.js +1 -33
- package/esm/vef-tree-select/hooks/use-data-options.js +1 -45
- package/esm/vef-tree-select/hooks/use-tree-select-instance.js +1 -20
- package/esm/vef-tree-select/index.js +1 -89
- package/esm/vef-virtual-grid/index.js +3 -107
- package/esm/vef-virtual-list/index.js +4 -215
- package/package.json +5 -5
- package/types/index.d.ts +0 -1
|
@@ -1,133 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var core = require('@vef-framework/core');
|
|
5
|
-
var shared = require('@vef-framework/shared');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var store = require('../store.cjs');
|
|
8
|
-
|
|
9
|
-
"use strict";
|
|
10
|
-
function useActionHandlers({
|
|
11
|
-
submitApi,
|
|
12
|
-
submitTip = "提交中...",
|
|
13
|
-
onBeforeSubmit,
|
|
14
|
-
onSubmit,
|
|
15
|
-
onSubmitSuccess,
|
|
16
|
-
onSubmitFailure,
|
|
17
|
-
onReset
|
|
18
|
-
}) {
|
|
19
|
-
const [
|
|
20
|
-
form,
|
|
21
|
-
scene,
|
|
22
|
-
eventBus,
|
|
23
|
-
setIsLoading,
|
|
24
|
-
virtualFieldNames,
|
|
25
|
-
getValues,
|
|
26
|
-
initialValues,
|
|
27
|
-
invokeValueChangeHandlers
|
|
28
|
-
] = store.useFormStore((state) => [
|
|
29
|
-
state.form,
|
|
30
|
-
state.scene,
|
|
31
|
-
state.eventBus,
|
|
32
|
-
state.setIsLoading,
|
|
33
|
-
state.virtualFieldNames,
|
|
34
|
-
state.getValues,
|
|
35
|
-
state.initialValues,
|
|
36
|
-
state.invokeValueChangeHandlers
|
|
37
|
-
]);
|
|
38
|
-
const { useApiMutation, stubMutationApi } = core.useApiContext();
|
|
39
|
-
const { mutate } = useApiMutation(submitApi ?? stubMutationApi);
|
|
40
|
-
if (!shared.isFunction(onSubmit) && !submitApi) {
|
|
41
|
-
throw new shared.VefError(-1, "'onSubmit' or 'submitApi' prop is required for VefForm component");
|
|
42
|
-
}
|
|
43
|
-
const handleReset = react.useCallback(() => {
|
|
44
|
-
const values = getValues();
|
|
45
|
-
form.resetFields();
|
|
46
|
-
invokeValueChangeHandlers();
|
|
47
|
-
eventBus.emitChange(initialValues);
|
|
48
|
-
onReset?.(values, scene);
|
|
49
|
-
}, [
|
|
50
|
-
form,
|
|
51
|
-
getValues,
|
|
52
|
-
onReset,
|
|
53
|
-
scene,
|
|
54
|
-
invokeValueChangeHandlers,
|
|
55
|
-
initialValues,
|
|
56
|
-
eventBus
|
|
57
|
-
]);
|
|
58
|
-
const handleSubmit = react.useMemo(() => {
|
|
59
|
-
if (shared.isFunction(onSubmit)) {
|
|
60
|
-
if (submitApi) {
|
|
61
|
-
console.warn("'submitApi' prop is ignored when 'onSubmit' prop is provided in VefForm component");
|
|
62
|
-
}
|
|
63
|
-
return async (values) => {
|
|
64
|
-
setIsLoading(true);
|
|
65
|
-
let valuesToUse = values;
|
|
66
|
-
let closeLoading = null;
|
|
67
|
-
try {
|
|
68
|
-
const submitTipToUse = shared.isFunction(submitTip) ? submitTip(values, scene) : submitTip;
|
|
69
|
-
closeLoading = shared.showLoadingMessage(submitTipToUse);
|
|
70
|
-
if (shared.isFunction(onBeforeSubmit)) {
|
|
71
|
-
valuesToUse = await onBeforeSubmit(valuesToUse, scene);
|
|
72
|
-
}
|
|
73
|
-
const valuesToSubmit = shared.omit(valuesToUse, virtualFieldNames);
|
|
74
|
-
await onSubmit(valuesToSubmit, scene);
|
|
75
|
-
eventBus.emitSubmitResult(true);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
eventBus.emitSubmitResult(false);
|
|
78
|
-
throw error;
|
|
79
|
-
} finally {
|
|
80
|
-
setIsLoading(false);
|
|
81
|
-
closeLoading?.();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return async (values) => {
|
|
86
|
-
setIsLoading(true);
|
|
87
|
-
let valuesToUse = values;
|
|
88
|
-
let closeLoading = null;
|
|
89
|
-
try {
|
|
90
|
-
const submitTipToUse = shared.isFunction(submitTip) ? submitTip(values, scene) : submitTip;
|
|
91
|
-
closeLoading = shared.showLoadingMessage(submitTipToUse);
|
|
92
|
-
if (shared.isFunction(onBeforeSubmit)) {
|
|
93
|
-
valuesToUse = await onBeforeSubmit(values, scene);
|
|
94
|
-
}
|
|
95
|
-
const toSubmitValues = shared.omit(valuesToUse, virtualFieldNames);
|
|
96
|
-
const apiResponse = await mutate(toSubmitValues);
|
|
97
|
-
(onSubmitSuccess ?? (({ message }) => {
|
|
98
|
-
shared.showSuccessMessage(message);
|
|
99
|
-
}))(apiResponse, valuesToUse, scene);
|
|
100
|
-
eventBus.emitSubmitResult(true);
|
|
101
|
-
} catch (error) {
|
|
102
|
-
eventBus.emitSubmitResult(false);
|
|
103
|
-
onSubmitFailure?.(error, valuesToUse, scene);
|
|
104
|
-
} finally {
|
|
105
|
-
setIsLoading(false);
|
|
106
|
-
closeLoading?.();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}, [
|
|
110
|
-
onSubmit,
|
|
111
|
-
submitApi,
|
|
112
|
-
setIsLoading,
|
|
113
|
-
submitTip,
|
|
114
|
-
scene,
|
|
115
|
-
onBeforeSubmit,
|
|
116
|
-
virtualFieldNames,
|
|
117
|
-
eventBus,
|
|
118
|
-
mutate,
|
|
119
|
-
onSubmitSuccess,
|
|
120
|
-
onSubmitFailure
|
|
121
|
-
]);
|
|
122
|
-
const handleSubmitFailed = react.useCallback(({ values, errorFields }) => {
|
|
123
|
-
eventBus.emitSubmitResult(false);
|
|
124
|
-
onSubmitFailure?.(new shared.VefError(-1, errorFields.flatMap((field) => field.errors).join(", ")), values, scene);
|
|
125
|
-
}, [eventBus, onSubmitFailure, scene]);
|
|
126
|
-
return {
|
|
127
|
-
handleReset,
|
|
128
|
-
handleSubmit,
|
|
129
|
-
handleSubmitFailed
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
exports.useActionHandlers = useActionHandlers;
|
|
2
|
+
"use strict";var H=require("@vef-framework/core"),t=require("@vef-framework/shared"),h=require("react"),E=require("../store.cjs");function L({submitApi:c,submitTip:u="提交中...",onBeforeSubmit:a,onSubmit:m,onSubmitSuccess:F,onSubmitFailure:b,onReset:p}){const[w,i,n,l,d,f,g,v]=E.useFormStore(e=>[e.form,e.scene,e.eventBus,e.setIsLoading,e.virtualFieldNames,e.getValues,e.initialValues,e.invokeValueChangeHandlers]),{useApiMutation:A,stubMutationApi:M}=H.useApiContext(),{mutate:V}=A(c??M);if(!t.isFunction(m)&&!c)throw new t.VefError(-1,"'onSubmit' or 'submitApi' prop is required for VefForm component");const R=h.useCallback(()=>{const e=f();w.resetFields(),v(),n.emitChange(g),p?.(e,i)},[w,f,p,i,v,g,n]),q=h.useMemo(()=>t.isFunction(m)?(c&&console.warn("'submitApi' prop is ignored when 'onSubmit' prop is provided in VefForm component"),async e=>{l(!0);let s=e,r=null;try{const o=t.isFunction(u)?u(e,i):u;r=t.showLoadingMessage(o),t.isFunction(a)&&(s=await a(s,i));const S=t.omit(s,d);await m(S,i),n.emitSubmitResult(!0)}catch(o){throw n.emitSubmitResult(!1),o}finally{l(!1),r?.()}}):async e=>{l(!0);let s=e,r=null;try{const o=t.isFunction(u)?u(e,i):u;r=t.showLoadingMessage(o),t.isFunction(a)&&(s=await a(e,i));const S=t.omit(s,d),C=await V(S);(F??(({message:k})=>{t.showSuccessMessage(k)}))(C,s,i),n.emitSubmitResult(!0)}catch(o){n.emitSubmitResult(!1),b?.(o,s,i)}finally{l(!1),r?.()}},[m,c,l,u,i,a,d,n,V,F,b]),y=h.useCallback(({values:e,errorFields:s})=>{n.emitSubmitResult(!1),b?.(new t.VefError(-1,s.flatMap(r=>r.errors).join(", ")),e,i)},[n,b,i]);return{handleReset:R,handleSubmit:q,handleSubmitFailed:y}}exports.useActionHandlers=L;
|
|
@@ -1,125 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var shared = require('@vef-framework/shared');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
|
|
7
|
-
"use strict";
|
|
8
|
-
const MAX_SPANS = 24;
|
|
9
|
-
const SPAN_BASES = [
|
|
10
|
-
{
|
|
11
|
-
breakpoint: "xs",
|
|
12
|
-
base: MAX_SPANS,
|
|
13
|
-
spans: 1
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
breakpoint: "sm",
|
|
17
|
-
base: MAX_SPANS / 2,
|
|
18
|
-
spans: 2
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
breakpoint: "md",
|
|
22
|
-
base: MAX_SPANS / 3,
|
|
23
|
-
spans: 3
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
breakpoint: "lg",
|
|
27
|
-
base: MAX_SPANS / 4,
|
|
28
|
-
spans: 4
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
breakpoint: "xl",
|
|
32
|
-
base: MAX_SPANS / 4,
|
|
33
|
-
spans: 4
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
breakpoint: "xxl",
|
|
37
|
-
base: MAX_SPANS / 6,
|
|
38
|
-
spans: 6
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
const ALLOWED_SPANS = shared.unique(SPAN_BASES.map((item) => item.spans));
|
|
42
|
-
function calculateResponsiveLayout(rowKey, columns, autoExpand) {
|
|
43
|
-
const totalSpans = columns.reduce((acc, column) => acc + (column.span ?? 1), 0);
|
|
44
|
-
if (!ALLOWED_SPANS.includes(totalSpans)) {
|
|
45
|
-
throw new shared.VefError(-3, `The total spans of the columns of the row [${rowKey}] must be one of the following: ${ALLOWED_SPANS.join(", ")}.`);
|
|
46
|
-
}
|
|
47
|
-
const requiredBase = 24 / totalSpans;
|
|
48
|
-
const layout = {};
|
|
49
|
-
for (const {
|
|
50
|
-
breakpoint,
|
|
51
|
-
base,
|
|
52
|
-
spans
|
|
53
|
-
} of SPAN_BASES) {
|
|
54
|
-
if (requiredBase >= base) {
|
|
55
|
-
layout[breakpoint] = columns.reduce((acc, column) => {
|
|
56
|
-
acc[column.key] = (column.span ?? 1) * requiredBase;
|
|
57
|
-
return acc;
|
|
58
|
-
}, {});
|
|
59
|
-
} else {
|
|
60
|
-
const map = {};
|
|
61
|
-
let remainingSpans = spans;
|
|
62
|
-
let lastColumnKey = null;
|
|
63
|
-
for (const column of columns) {
|
|
64
|
-
const requiredSpan = column.span ?? 1;
|
|
65
|
-
if (remainingSpans >= requiredSpan) {
|
|
66
|
-
map[column.key] = requiredSpan * base;
|
|
67
|
-
remainingSpans -= requiredSpan;
|
|
68
|
-
lastColumnKey = column.key;
|
|
69
|
-
} else {
|
|
70
|
-
if (lastColumnKey) {
|
|
71
|
-
if (autoExpand) {
|
|
72
|
-
map[lastColumnKey] += remainingSpans * base;
|
|
73
|
-
}
|
|
74
|
-
remainingSpans = spans;
|
|
75
|
-
lastColumnKey = null;
|
|
76
|
-
}
|
|
77
|
-
if (requiredSpan > spans) {
|
|
78
|
-
map[column.key] = 24;
|
|
79
|
-
} else {
|
|
80
|
-
map[column.key] = requiredSpan * base;
|
|
81
|
-
remainingSpans -= requiredSpan;
|
|
82
|
-
lastColumnKey = column.key;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (remainingSpans === 0) {
|
|
86
|
-
remainingSpans = spans;
|
|
87
|
-
lastColumnKey = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (remainingSpans > 0) {
|
|
91
|
-
if (autoExpand) {
|
|
92
|
-
map[lastColumnKey] += remainingSpans * base;
|
|
93
|
-
}
|
|
94
|
-
lastColumnKey = null;
|
|
95
|
-
}
|
|
96
|
-
layout[breakpoint] = map;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return layout;
|
|
100
|
-
}
|
|
101
|
-
function calculateFixedLayout(rowKey, columns) {
|
|
102
|
-
const totalSpans = columns.reduce((acc, column) => acc + (column.span ?? 1), 0);
|
|
103
|
-
if (totalSpans > MAX_SPANS || MAX_SPANS % totalSpans !== 0) {
|
|
104
|
-
throw new shared.VefError(-3, `The total spans of the columns of the row [${rowKey}] must be less than or equal to ${MAX_SPANS} and a divisor of ${MAX_SPANS}.`);
|
|
105
|
-
}
|
|
106
|
-
const base = MAX_SPANS / totalSpans;
|
|
107
|
-
return columns.reduce((acc, column) => {
|
|
108
|
-
acc[column.key] = (column.span ?? 1) * base;
|
|
109
|
-
return acc;
|
|
110
|
-
}, {});
|
|
111
|
-
}
|
|
112
|
-
function useColumnsLayout(rowKey, columns, layoutMode, autoExpand) {
|
|
113
|
-
return react.useMemo(() => {
|
|
114
|
-
if (columns.length === 0) {
|
|
115
|
-
return {};
|
|
116
|
-
}
|
|
117
|
-
if (layoutMode === "responsive") {
|
|
118
|
-
return calculateResponsiveLayout(rowKey, columns, autoExpand);
|
|
119
|
-
} else {
|
|
120
|
-
return calculateFixedLayout(rowKey, columns);
|
|
121
|
-
}
|
|
122
|
-
}, []);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
exports.useColumnsLayout = useColumnsLayout;
|
|
2
|
+
"use strict";var h=require("@vef-framework/shared"),y=require("react");const s=24,m=[{breakpoint:"xs",base:s,spans:1},{breakpoint:"sm",base:s/2,spans:2},{breakpoint:"md",base:s/3,spans:3},{breakpoint:"lg",base:s/4,spans:4},{breakpoint:"xl",base:s/4,spans:4},{breakpoint:"xxl",base:s/6,spans:6}],d=h.unique(m.map(t=>t.spans));function w(t,n,a){const l=n.reduce((b,i)=>b+(i.span??1),0);if(!d.includes(l))throw new h.VefError(-3,`The total spans of the columns of the row [${t}] must be one of the following: ${d.join(", ")}.`);const p=24/l,r={};for(const{breakpoint:b,base:i,spans:k}of m)if(p>=i)r[b]=n.reduce((o,e)=>(o[e.key]=(e.span??1)*p,o),{});else{const o={};let e=k,u=null;for(const c of n){const f=c.span??1;e>=f?(o[c.key]=f*i,e-=f,u=c.key):(u&&(a&&(o[u]+=e*i),e=k,u=null),f>k?o[c.key]=24:(o[c.key]=f*i,e-=f,u=c.key)),e===0&&(e=k,u=null)}e>0&&(a&&(o[u]+=e*i),u=null),r[b]=o}return r}function $(t,n){const a=n.reduce((p,r)=>p+(r.span??1),0);if(a>s||s%a!==0)throw new h.VefError(-3,`The total spans of the columns of the row [${t}] must be less than or equal to ${s} and a divisor of ${s}.`);const l=s/a;return n.reduce((p,r)=>(p[r.key]=(r.span??1)*l,p),{})}function g(t,n,a,l){return y.useMemo(()=>n.length===0?{}:a==="responsive"?w(t,n,l):$(t,n),[])}exports.useColumnsLayout=g;
|
|
@@ -1,58 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var hooks = require('@vef-framework/hooks');
|
|
5
|
-
var shared = require('@vef-framework/shared');
|
|
6
|
-
var helper = require('../helper.cjs');
|
|
7
|
-
var store = require('../store.cjs');
|
|
8
|
-
|
|
9
|
-
"use strict";
|
|
10
|
-
function useComputedValues(values, returnAsObject = false) {
|
|
11
|
-
const [scene, eventBus, getValues] = store.useFormStore((state) => [state.scene, state.eventBus, state.getValues]);
|
|
12
|
-
const forceUpdate = hooks.useUpdater();
|
|
13
|
-
const currentValues = getValues();
|
|
14
|
-
const computedValues = hooks.useDeepMemo(() => values.reduce((acc, it) => {
|
|
15
|
-
const {
|
|
16
|
-
key,
|
|
17
|
-
rawValue,
|
|
18
|
-
defaultValue
|
|
19
|
-
} = it;
|
|
20
|
-
const computedValue = helper.computeValue(rawValue, currentValues, scene, defaultValue);
|
|
21
|
-
acc[key] = computedValue;
|
|
22
|
-
return acc;
|
|
23
|
-
}, {}), [currentValues, scene, values]);
|
|
24
|
-
hooks.useDeepLayoutEffect(() => {
|
|
25
|
-
const realComputedValues = values.filter(({ rawValue }) => shared.isFunctionOrExpression(rawValue));
|
|
26
|
-
const shouldListenChangeEvent = realComputedValues.length > 0;
|
|
27
|
-
if (shouldListenChangeEvent) {
|
|
28
|
-
const handleChange = (newValues) => {
|
|
29
|
-
for (const value of realComputedValues) {
|
|
30
|
-
const {
|
|
31
|
-
key,
|
|
32
|
-
rawValue,
|
|
33
|
-
defaultValue
|
|
34
|
-
} = value;
|
|
35
|
-
const computedValue = computedValues[key];
|
|
36
|
-
const refreshedValue = helper.computeValue(rawValue, newValues, scene, defaultValue);
|
|
37
|
-
if (!shared.isDeepEqual(refreshedValue, computedValue)) {
|
|
38
|
-
forceUpdate();
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
eventBus.onChange(handleChange);
|
|
44
|
-
return () => {
|
|
45
|
-
eventBus.offChange(handleChange);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}, [computedValues, eventBus, forceUpdate, scene, values]);
|
|
49
|
-
if (returnAsObject) {
|
|
50
|
-
return values.reduce((acc, { key }) => {
|
|
51
|
-
acc[key] = computedValues[key];
|
|
52
|
-
return acc;
|
|
53
|
-
}, {});
|
|
54
|
-
}
|
|
55
|
-
return values.map(({ key }) => computedValues[key]);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
exports.useComputedValues = useComputedValues;
|
|
2
|
+
"use strict";var i=require("@vef-framework/hooks"),V=require("@vef-framework/shared"),d=require("../helper.cjs"),v=require("../store.cjs");function C(r,m=!1){const[s,o,h]=v.useFormStore(e=>[e.scene,e.eventBus,e.getValues]),f=i.useUpdater(),p=h(),a=i.useDeepMemo(()=>r.reduce((e,u)=>{const{key:t,rawValue:n,defaultValue:l}=u,c=d.computeValue(n,p,s,l);return e[t]=c,e},{}),[p,s,r]);return i.useDeepLayoutEffect(()=>{const e=r.filter(({rawValue:u})=>V.isFunctionOrExpression(u));if(e.length>0){const u=t=>{for(const n of e){const{key:l,rawValue:c,defaultValue:k}=n,y=a[l],q=d.computeValue(c,t,s,k);if(!V.isDeepEqual(q,y)){f();break}}};return o.onChange(u),()=>{o.offChange(u)}}},[a,o,f,s,r]),m?r.reduce((e,{key:u})=>(e[u]=a[u],e),{}):r.map(({key:e})=>a[e])}exports.useComputedValues=C;
|
|
@@ -1,19 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var shared = require('@vef-framework/shared');
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
const {
|
|
8
|
-
useContextSelector: useFormContextSelector,
|
|
9
|
-
useContext: useFormContext,
|
|
10
|
-
ContextProvider: FormContextProvider
|
|
11
|
-
} = shared.createSelectableContext({
|
|
12
|
-
autoExpand: true,
|
|
13
|
-
labelPosition: "top",
|
|
14
|
-
layoutMode: "responsive"
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
exports.FormContextProvider = FormContextProvider;
|
|
18
|
-
exports.useFormContext = useFormContext;
|
|
19
|
-
exports.useFormContextSelector = useFormContextSelector;
|
|
2
|
+
"use strict";var e=require("@vef-framework/shared");const{useContextSelector:t,useContext:o,ContextProvider:r}=e.createSelectableContext({autoExpand:!0,labelPosition:"top",layoutMode:"responsive"});exports.FormContextProvider=r,exports.useFormContext=o,exports.useFormContextSelector=t;
|
|
@@ -1,48 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var shared = require('@vef-framework/shared');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
|
|
7
|
-
"use strict";
|
|
8
|
-
function useFormInitialization(schema, initialValues) {
|
|
9
|
-
return react.useMemo(() => {
|
|
10
|
-
const mergedInitialValues = {
|
|
11
|
-
...initialValues
|
|
12
|
-
};
|
|
13
|
-
const valueChangeHandlers = {};
|
|
14
|
-
const virtualFieldNames = [];
|
|
15
|
-
for (const group of schema) {
|
|
16
|
-
const { rows } = group;
|
|
17
|
-
for (const row of rows) {
|
|
18
|
-
const { columns } = row;
|
|
19
|
-
for (const column of columns) {
|
|
20
|
-
const { items } = column;
|
|
21
|
-
for (const item of items) {
|
|
22
|
-
const {
|
|
23
|
-
name,
|
|
24
|
-
defaultValue,
|
|
25
|
-
virtual
|
|
26
|
-
} = item;
|
|
27
|
-
if (!shared.isNullish(defaultValue) && shared.isNullish(mergedInitialValues[name])) {
|
|
28
|
-
mergedInitialValues[name] = defaultValue;
|
|
29
|
-
}
|
|
30
|
-
if (item.type !== "Hidden" && shared.isFunction(item.onChange)) {
|
|
31
|
-
valueChangeHandlers[name] = item.onChange;
|
|
32
|
-
}
|
|
33
|
-
if (virtual === true) {
|
|
34
|
-
virtualFieldNames.push(name);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
mergedInitialValues,
|
|
42
|
-
valueChangeHandlers,
|
|
43
|
-
virtualFieldNames
|
|
44
|
-
};
|
|
45
|
-
}, []);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
exports.useFormInitialization = useFormInitialization;
|
|
2
|
+
"use strict";var o=require("@vef-framework/shared"),g=require("react");function F(a,u){return g.useMemo(()=>{const s={...u},t={},i=[];for(const l of a){const{rows:c}=l;for(const f of c){const{columns:m}=f;for(const d of m){const{items:h}=d;for(const e of h){const{name:n,defaultValue:r,virtual:v}=e;!o.isNullish(r)&&o.isNullish(s[n])&&(s[n]=r),e.type!=="Hidden"&&o.isFunction(e.onChange)&&(t[n]=e.onChange),v===!0&&i.push(n)}}}}return{mergedInitialValues:s,valueChangeHandlers:t,virtualFieldNames:i}},[])}exports.useFormInitialization=F;
|
|
@@ -1,29 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var store = require('../store.cjs');
|
|
6
|
-
|
|
7
|
-
"use strict";
|
|
8
|
-
function useFormInstance(ref, reset) {
|
|
9
|
-
const [form, eventBus, getValues, setValues] = store.useFormStore((state) => [state.form, state.eventBus, state.getValues, state.setValues]);
|
|
10
|
-
react.useImperativeHandle(ref, () => ({
|
|
11
|
-
submit: () => new Promise((resolve, reject) => {
|
|
12
|
-
const handleResult = (result) => {
|
|
13
|
-
eventBus.offSubmitResult(handleResult);
|
|
14
|
-
if (result) {
|
|
15
|
-
resolve();
|
|
16
|
-
} else {
|
|
17
|
-
reject(result);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
eventBus.onSubmitResult(handleResult);
|
|
21
|
-
form.submit();
|
|
22
|
-
}),
|
|
23
|
-
reset,
|
|
24
|
-
getValues,
|
|
25
|
-
setValues
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
exports.useFormInstance = useFormInstance;
|
|
2
|
+
"use strict";var c=require("react"),l=require("../store.cjs");function b(r,n){const[o,s,a,i]=l.useFormStore(e=>[e.form,e.eventBus,e.getValues,e.setValues]);c.useImperativeHandle(r,()=>({submit:()=>new Promise((e,m)=>{const t=u=>{s.offSubmitResult(t),u?e():m(u)};s.onSubmitResult(t),o.submit()}),reset:n,getValues:a,setValues:i}))}exports.useFormInstance=b;
|
|
@@ -1,33 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var shared = require('@vef-framework/shared');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var store = require('../store.cjs');
|
|
7
|
-
|
|
8
|
-
"use strict";
|
|
9
|
-
function useFormValuesChange(onChange) {
|
|
10
|
-
const [scene, eventBus, invokeValueChangeHandlers] = store.useFormStore((state) => [state.scene, state.eventBus, state.invokeValueChangeHandlers]);
|
|
11
|
-
const handleValuesChange = react.useMemo(() => (_, values) => {
|
|
12
|
-
eventBus.emitChange(values);
|
|
13
|
-
}, [eventBus]);
|
|
14
|
-
react.useEffect(() => {
|
|
15
|
-
if (shared.isFunction(onChange)) {
|
|
16
|
-
const handleChange = (values) => {
|
|
17
|
-
onChange(values, scene);
|
|
18
|
-
};
|
|
19
|
-
eventBus.onChange(handleChange);
|
|
20
|
-
return () => {
|
|
21
|
-
eventBus.offChange(handleChange);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}, [eventBus, onChange, scene]);
|
|
25
|
-
react.useLayoutEffect(() => {
|
|
26
|
-
invokeValueChangeHandlers();
|
|
27
|
-
}, []);
|
|
28
|
-
return {
|
|
29
|
-
handleValuesChange
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.useFormValuesChange = useFormValuesChange;
|
|
2
|
+
"use strict";var i=require("@vef-framework/shared"),u=require("react"),c=require("../store.cjs");function h(n){const[a,s,t]=c.useFormStore(e=>[e.scene,e.eventBus,e.invokeValueChangeHandlers]),o=u.useMemo(()=>(e,r)=>{s.emitChange(r)},[s]);return u.useEffect(()=>{if(i.isFunction(n)){const e=r=>{n(r,a)};return s.onChange(e),()=>{s.offChange(e)}}},[s,n,a]),u.useLayoutEffect(()=>{t()},[]),{handleValuesChange:o}}exports.useFormValuesChange=h;
|
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var shared = require('@vef-framework/shared');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
|
|
7
|
-
"use strict";
|
|
8
|
-
function useLabelWidth(labelPosition, labelWidth) {
|
|
9
|
-
const labelWidthToUse = react.useMemo(() => {
|
|
10
|
-
if (labelPosition === "top" || !labelWidth) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (labelWidth < 60 || labelWidth > 120) {
|
|
14
|
-
shared.showWarningMessage("The labelWidth of VefForm component must be between 60 and 120, otherwise it will be 60 or 120.");
|
|
15
|
-
}
|
|
16
|
-
return Math.min(Math.max(labelWidth, 60), 120);
|
|
17
|
-
}, [labelPosition, labelWidth]);
|
|
18
|
-
return labelWidthToUse;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
exports.useLabelWidth = useLabelWidth;
|
|
2
|
+
"use strict";var r=require("@vef-framework/shared"),i=require("react");function a(t,e){return i.useMemo(()=>{if(!(t==="top"||!e))return(e<60||e>120)&&r.showWarningMessage("The labelWidth of VefForm component must be between 60 and 120, otherwise it will be 60 or 120."),Math.min(Math.max(e,60),120)},[t,e])}exports.useLabelWidth=a;
|
package/cjs/vef-form/index.cjs
CHANGED
|
@@ -1,179 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
7
|
-
var react$1 = require('@emotion/react');
|
|
8
|
-
var hooks = require('@vef-framework/hooks');
|
|
9
|
-
var shared = require('@vef-framework/shared');
|
|
10
|
-
var antd = require('antd');
|
|
11
|
-
var react = require('react');
|
|
12
|
-
require('../internal/index.cjs');
|
|
13
|
-
var formActions = require('./components/form-actions.cjs');
|
|
14
|
-
var formContent = require('./components/form-content.cjs');
|
|
15
|
-
var event = require('./event.cjs');
|
|
16
|
-
var useActionHandlers = require('./hooks/use-action-handlers.cjs');
|
|
17
|
-
var useFormContext = require('./hooks/use-form-context.cjs');
|
|
18
|
-
var useFormInitialization = require('./hooks/use-form-initialization.cjs');
|
|
19
|
-
var useFormInstance = require('./hooks/use-form-instance.cjs');
|
|
20
|
-
var useFormValuesChange = require('./hooks/use-form-values-change.cjs');
|
|
21
|
-
var useLabelWidth = require('./hooks/use-label-width.cjs');
|
|
22
|
-
var store = require('./store.cjs');
|
|
23
|
-
var utils = require('../internal/utils.cjs');
|
|
24
|
-
|
|
25
|
-
"use strict";
|
|
26
|
-
const { useForm } = antd.Form;
|
|
27
|
-
const scrollToFirstErrorOptions = {
|
|
28
|
-
scrollMode: "if-needed",
|
|
29
|
-
behavior: "smooth"
|
|
30
|
-
};
|
|
31
|
-
function VefFormBase({
|
|
32
|
-
schema,
|
|
33
|
-
labelAlign = "right",
|
|
34
|
-
variant,
|
|
35
|
-
showTabs = false,
|
|
36
|
-
height = "auto",
|
|
37
|
-
size,
|
|
38
|
-
disabled = false,
|
|
39
|
-
onChange,
|
|
40
|
-
submissionButton,
|
|
41
|
-
resetButton,
|
|
42
|
-
submitApi,
|
|
43
|
-
submitTip,
|
|
44
|
-
onBeforeSubmit,
|
|
45
|
-
onSubmit,
|
|
46
|
-
onSubmitSuccess,
|
|
47
|
-
onSubmitFailure,
|
|
48
|
-
onReset
|
|
49
|
-
}, ref) {
|
|
50
|
-
const [labelPosition, labelWidth] = useFormContext.useFormContextSelector((ctx) => [ctx.labelPosition, ctx.labelWidth]);
|
|
51
|
-
const [form, initialValues, isLoading] = store.useFormStore((state) => [state.form, state.initialValues, state.isLoading]);
|
|
52
|
-
const { handleValuesChange } = useFormValuesChange.useFormValuesChange(onChange);
|
|
53
|
-
const {
|
|
54
|
-
handleReset,
|
|
55
|
-
handleSubmit,
|
|
56
|
-
handleSubmitFailed
|
|
57
|
-
} = useActionHandlers.useActionHandlers({
|
|
58
|
-
submitApi,
|
|
59
|
-
submitTip,
|
|
60
|
-
onBeforeSubmit,
|
|
61
|
-
onSubmit,
|
|
62
|
-
onSubmitSuccess,
|
|
63
|
-
onSubmitFailure,
|
|
64
|
-
onReset
|
|
65
|
-
});
|
|
66
|
-
useFormInstance.useFormInstance(ref, handleReset);
|
|
67
|
-
const labelCol = react.useMemo(() => {
|
|
68
|
-
if (!labelWidth) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
return { flex: `0 0 ${labelWidth}px` };
|
|
72
|
-
}, [labelWidth]);
|
|
73
|
-
const formStyle = react.useMemo(() => {
|
|
74
|
-
let heightValue = height;
|
|
75
|
-
if (height === "full") {
|
|
76
|
-
heightValue = "100%";
|
|
77
|
-
} else if (shared.isNumber(height)) {
|
|
78
|
-
heightValue = `${height}px`;
|
|
79
|
-
}
|
|
80
|
-
return react$1.css`
|
|
81
|
-
height: ${heightValue};
|
|
82
|
-
`;
|
|
83
|
-
}, [height]);
|
|
84
|
-
const contextDisabled = hooks.useContextDisabled();
|
|
85
|
-
const formDisabled = contextDisabled || disabled || isLoading;
|
|
86
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
87
|
-
antd.Form,
|
|
88
|
-
{
|
|
89
|
-
labelWrap: true,
|
|
90
|
-
colon: false,
|
|
91
|
-
css: formStyle,
|
|
92
|
-
disabled: formDisabled,
|
|
93
|
-
form,
|
|
94
|
-
initialValues,
|
|
95
|
-
labelAlign,
|
|
96
|
-
labelCol,
|
|
97
|
-
layout: labelPosition === "top" ? "vertical" : "horizontal",
|
|
98
|
-
scrollToFirstError: scrollToFirstErrorOptions,
|
|
99
|
-
size: utils.convertBasicSizeToUiSize(size),
|
|
100
|
-
variant,
|
|
101
|
-
onFinish: handleSubmit,
|
|
102
|
-
onFinishFailed: handleSubmitFailed,
|
|
103
|
-
onValuesChange: handleValuesChange,
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
-
formContent.default,
|
|
107
|
-
{
|
|
108
|
-
height,
|
|
109
|
-
schema,
|
|
110
|
-
showTabs: showTabs === true ? "switch" : showTabs
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
-
formActions.default,
|
|
115
|
-
{
|
|
116
|
-
handleReset,
|
|
117
|
-
resetButton,
|
|
118
|
-
submissionButton
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
const VefFormBaseForwarded = react.forwardRef(VefFormBase);
|
|
126
|
-
VefFormBaseForwarded.displayName = "VefFormBase";
|
|
127
|
-
function VefFormWrapper({
|
|
128
|
-
initialValues,
|
|
129
|
-
scene,
|
|
130
|
-
layoutMode = "responsive",
|
|
131
|
-
autoExpand = false,
|
|
132
|
-
labelPosition = "top",
|
|
133
|
-
labelWidth,
|
|
134
|
-
...restProps
|
|
135
|
-
}, ref) {
|
|
136
|
-
const { schema } = restProps;
|
|
137
|
-
const [form] = useForm();
|
|
138
|
-
const eventBus = hooks.useSingleton(() => new event.FormEventBus());
|
|
139
|
-
hooks.useUnmount(() => {
|
|
140
|
-
eventBus.clear();
|
|
141
|
-
});
|
|
142
|
-
const labelWidthToUse = useLabelWidth.useLabelWidth(labelPosition, labelWidth);
|
|
143
|
-
const formContext = react.useMemo(() => ({
|
|
144
|
-
labelPosition,
|
|
145
|
-
labelWidth: labelWidthToUse,
|
|
146
|
-
autoExpand,
|
|
147
|
-
layoutMode
|
|
148
|
-
}), [layoutMode, autoExpand, labelPosition, labelWidthToUse]);
|
|
149
|
-
const {
|
|
150
|
-
mergedInitialValues,
|
|
151
|
-
valueChangeHandlers,
|
|
152
|
-
virtualFieldNames
|
|
153
|
-
} = useFormInitialization.useFormInitialization(schema, initialValues);
|
|
154
|
-
const initialState = react.useMemo(() => ({
|
|
155
|
-
eventBus,
|
|
156
|
-
form,
|
|
157
|
-
initialValues: mergedInitialValues,
|
|
158
|
-
scene,
|
|
159
|
-
valueChangeHandlers,
|
|
160
|
-
virtualFieldNames
|
|
161
|
-
}), [eventBus, form, mergedInitialValues, scene, valueChangeHandlers, virtualFieldNames]);
|
|
162
|
-
return /* @__PURE__ */ jsxRuntime.jsx(store.FormStoreProvider, { initialState, children: /* @__PURE__ */ jsxRuntime.jsx(useFormContext.FormContextProvider, { value: formContext, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
-
VefFormBaseForwarded,
|
|
164
|
-
{
|
|
165
|
-
ref,
|
|
166
|
-
...restProps
|
|
167
|
-
}
|
|
168
|
-
) }) });
|
|
169
|
-
}
|
|
170
|
-
const VefForm = react.memo(
|
|
171
|
-
react.forwardRef(VefFormWrapper),
|
|
172
|
-
(prevProps, nextProps) => shared.isDeepEqual(
|
|
173
|
-
shared.omit(prevProps, ["initialValues", "schema"]),
|
|
174
|
-
shared.omit(nextProps, ["initialValues", "schema"])
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
VefForm.displayName = "VefForm";
|
|
178
|
-
|
|
179
|
-
exports.default = VefForm;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@emotion/react/jsx-runtime"),L=require("@emotion/react"),p=require("@vef-framework/hooks"),v=require("@vef-framework/shared"),C=require("antd"),r=require("react");require("../internal/index.cjs");var $=require("./components/form-actions.cjs"),D=require("./components/form-content.cjs"),O=require("./event.cjs"),U=require("./hooks/use-action-handlers.cjs"),B=require("./hooks/use-form-context.cjs"),_=require("./hooks/use-form-initialization.cjs"),k=require("./hooks/use-form-instance.cjs"),K=require("./hooks/use-form-values-change.cjs"),G=require("./hooks/use-label-width.cjs"),j=require("./store.cjs"),J=require("../internal/utils.cjs");const{useForm:Q}=C.Form,X={scrollMode:"if-needed",behavior:"smooth"};function Y({schema:a,labelAlign:s="right",variant:u,showTabs:o=!1,height:e="auto",size:F,disabled:l=!1,onChange:f,submissionButton:S,resetButton:m,submitApi:n,submitTip:d,onBeforeSubmit:q,onSubmit:c,onSubmitSuccess:h,onSubmitFailure:b,onReset:g},y){const[z,x]=B.useFormContextSelector(i=>[i.labelPosition,i.labelWidth]),[A,R,T]=j.useFormStore(i=>[i.form,i.initialValues,i.isLoading]),{handleValuesChange:W}=K.useFormValuesChange(f),{handleReset:V,handleSubmit:E,handleSubmitFailed:I}=U.useActionHandlers({submitApi:n,submitTip:d,onBeforeSubmit:q,onSubmit:c,onSubmitSuccess:h,onSubmitFailure:b,onReset:g});k.useFormInstance(y,V);const N=r.useMemo(()=>{if(x)return{flex:`0 0 ${x}px`}},[x]),P=r.useMemo(()=>{let i=e;return e==="full"?i="100%":v.isNumber(e)&&(i=`${e}px`),L.css`
|
|
3
|
+
height: ${i};
|
|
4
|
+
`},[e]),H=p.useContextDisabled()||l||T;return t.jsxs(C.Form,{labelWrap:!0,colon:!1,css:P,disabled:H,form:A,initialValues:R,labelAlign:s,labelCol:N,layout:z==="top"?"vertical":"horizontal",scrollToFirstError:X,size:J.convertBasicSizeToUiSize(F),variant:u,onFinish:E,onFinishFailed:I,onValuesChange:W,children:[t.jsx(D.default,{height:e,schema:a,showTabs:o===!0?"switch":o}),t.jsx($.default,{handleReset:V,resetButton:m,submissionButton:S})]})}const M=r.forwardRef(Y);M.displayName="VefFormBase";function Z({initialValues:a,scene:s,layoutMode:u="responsive",autoExpand:o=!1,labelPosition:e="top",labelWidth:F,...l},f){const{schema:S}=l,[m]=Q(),n=p.useSingleton(()=>new O.FormEventBus);p.useUnmount(()=>{n.clear()});const d=G.useLabelWidth(e,F),q=r.useMemo(()=>({labelPosition:e,labelWidth:d,autoExpand:o,layoutMode:u}),[u,o,e,d]),{mergedInitialValues:c,valueChangeHandlers:h,virtualFieldNames:b}=_.useFormInitialization(S,a),g=r.useMemo(()=>({eventBus:n,form:m,initialValues:c,scene:s,valueChangeHandlers:h,virtualFieldNames:b}),[n,m,c,s,h,b]);return t.jsx(j.FormStoreProvider,{initialState:g,children:t.jsx(B.FormContextProvider,{value:q,children:t.jsx(M,{ref:f,...l})})})}const w=r.memo(r.forwardRef(Z),(a,s)=>v.isDeepEqual(v.omit(a,["initialValues","schema"]),v.omit(s,["initialValues","schema"])));w.displayName="VefForm",exports.default=w;
|
package/cjs/vef-form/props.cjs
CHANGED