@seniorsistemas/angular-components 19.9.15 → 19.10.0-develop-ef29acb7
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/README.md +84 -2
- package/accordion/README.md +5 -4
- package/accordion/lib/accordion/accordion.module.d.ts +7 -0
- package/alert/lib/alert/alert.module.d.ts +7 -0
- package/badge/README.md +5 -4
- package/badge/lib/badge/badge.module.d.ts +10 -0
- package/bignumber-input/README.md +5 -4
- package/bignumber-input/lib/bignumber-input/bignumber-input.directive.d.ts +16 -39
- package/bignumber-input/lib/bignumber-input/bignumber-input.module.d.ts +7 -0
- package/breadcrumb/README.md +5 -4
- package/breadcrumb/lib/dynamic-breadcrumb/dynamic-breadcrumb.module.d.ts +5 -1
- package/button/lib/button/button.module.d.ts +7 -0
- package/calendar-mask/README.md +5 -4
- package/calendar-mask/lib/calendar-mask/calendar-mask.module.d.ts +7 -0
- package/card/README.md +6 -5
- package/card/lib/card/card.module.d.ts +7 -0
- package/chat/README.md +11 -8
- package/chat/lib/chat/chat.module.d.ts +7 -0
- package/checkbox-list/README.md +5 -4
- package/checkbox-list/lib/checkbox-list/checkbox-list.module.d.ts +7 -0
- package/chips/README.md +5 -4
- package/chips/lib/chips/chips.module.d.ts +7 -0
- package/code-editor/README.md +5 -4
- package/code-editor/lib/code-editor/code-editor.module.d.ts +7 -0
- package/collapse-link/README.md +5 -4
- package/collapse-link/lib/collapse-link/collapse-link.module.d.ts +7 -0
- package/common/lib/angular-components.module.d.ts +9 -0
- package/common/lib/provide-angular-components.d.ts +19 -0
- package/common/lib/svg-factory/svg-factory.module.d.ts +7 -0
- package/common/public-api.d.ts +1 -0
- package/content-generator/README.md +2 -2
- package/content-generator/lib/content-generator/content-generator.module.d.ts +7 -0
- package/control-errors/README.md +2 -2
- package/control-errors/lib/control-errors/control-errors.module.d.ts +7 -0
- package/country-phone-picker/README.md +2 -2
- package/country-phone-picker/lib/country-phone-picker/country-phone-picker.module.d.ts +7 -0
- package/currency/README.md +1 -1
- package/custom-fields/README.md +14 -3
- package/custom-fields/lib/custom-fields/custom-fields.module.d.ts +7 -0
- package/custom-fields/lib/custom-fields/models/custom-field-value-parser.d.ts +21 -0
- package/custom-fields/lib/custom-fields/models/index.d.ts +1 -0
- package/dialog/README.md +1 -1
- package/drawer/README.md +8 -4
- package/drawer/lib/drawer/drawer.module.d.ts +10 -0
- package/dynamic-form/README.md +18 -2
- package/dynamic-form/dynamic-form/dynamic-form.module.d.ts +7 -0
- package/dynamic-form/dynamic-form/form-field/addon-config.d.ts +10 -1
- package/dynamic-form/dynamic-form/form-field/configurations/fields/currency-field.d.ts +15 -15
- package/dynamic-form/dynamic-form/form-field/configurations/fields/number-field.d.ts +8 -6
- package/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.d.ts +5 -2
- package/dynamic-form/public-api.d.ts +0 -1
- package/editable-overlay/README.md +2 -2
- package/editable-overlay/lib/editable-overlay/editable-overlay.module.d.ts +7 -0
- package/empty-state/README.md +5 -2
- package/empty-state/lib/empty-state/empty-state.module.d.ts +7 -0
- package/esm2022/accordion/lib/accordion/accordion.module.mjs +8 -1
- package/esm2022/alert/lib/alert/alert.module.mjs +8 -1
- package/esm2022/badge/lib/badge/badge.module.mjs +11 -1
- package/esm2022/bignumber-input/lib/bignumber-input/bignumber-input.directive.mjs +19 -127
- package/esm2022/bignumber-input/lib/bignumber-input/bignumber-input.module.mjs +8 -1
- package/esm2022/breadcrumb/lib/dynamic-breadcrumb/dynamic-breadcrumb.module.mjs +6 -2
- package/esm2022/button/lib/button/button.module.mjs +8 -1
- package/esm2022/calendar-mask/lib/calendar-mask/calendar-mask.module.mjs +8 -1
- package/esm2022/card/lib/card/card.module.mjs +8 -1
- package/esm2022/chat/lib/chat/chat.module.mjs +8 -1
- package/esm2022/checkbox-list/lib/checkbox-list/checkbox-list.module.mjs +8 -1
- package/esm2022/chips/lib/chips/chips.module.mjs +8 -1
- package/esm2022/code-editor/lib/code-editor/code-editor.component.mjs +10 -1
- package/esm2022/code-editor/lib/code-editor/code-editor.module.mjs +9 -15
- package/esm2022/collapse-link/lib/collapse-link/collapse-link.module.mjs +8 -1
- package/esm2022/common/lib/angular-components.module.mjs +10 -1
- package/esm2022/common/lib/provide-angular-components.mjs +22 -0
- package/esm2022/common/lib/svg-factory/svg-factory.module.mjs +8 -1
- package/esm2022/common/public-api.mjs +2 -1
- package/esm2022/content-generator/lib/content-generator/content-generator.module.mjs +8 -1
- package/esm2022/control-errors/lib/control-errors/control-errors.module.mjs +8 -1
- package/esm2022/country-phone-picker/lib/country-phone-picker/country-phone-picker.module.mjs +8 -1
- package/esm2022/country-phone-picker/lib/country-phone-picker/country-phone-picker.service.mjs +4 -3
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.component.mjs +17 -13
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.module.mjs +8 -1
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.service.mjs +4 -3
- package/esm2022/custom-fields/lib/custom-fields/models/custom-field-type.mjs +4 -2
- package/esm2022/custom-fields/lib/custom-fields/models/custom-field-value-parser.mjs +46 -0
- package/esm2022/custom-fields/lib/custom-fields/models/index.mjs +2 -1
- package/esm2022/drawer/lib/drawer/drawer.module.mjs +11 -1
- package/esm2022/dynamic-form/dynamic-form/dynamic-form.module.mjs +8 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/addon-config.mjs +6 -2
- package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/currency-field.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/number-field.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.mjs +33 -10
- package/esm2022/dynamic-form/public-api.mjs +2 -7
- package/esm2022/editable-overlay/lib/editable-overlay/editable-overlay.module.mjs +8 -1
- package/esm2022/empty-state/lib/empty-state/empty-state.module.mjs +8 -1
- package/esm2022/fieldset/lib/fieldset/fieldset.module.mjs +8 -1
- package/esm2022/file-picker/lib/file-picker/file-picker.module.mjs +8 -1
- package/esm2022/file-picker/lib/file-picker/file-picker.service.mjs +4 -3
- package/esm2022/gantt/lib/gantt/gantt.module.mjs +8 -1
- package/esm2022/global-search/lib/global-search/global-search.module.mjs +19 -1
- package/esm2022/grid-menu/lib/grid-menu/grid-menu.module.mjs +8 -1
- package/esm2022/help-popover/lib/help-popover/help-popover.module.mjs +8 -1
- package/esm2022/image-cropper/lib/image-cropper/image-cropper.module.mjs +12 -1
- package/esm2022/image-cropper/lib/image-cropper/image-cropper.service.mjs +4 -3
- package/esm2022/infinite-scroll/lib/infinite-scroll/infinite-scroll.module.mjs +8 -1
- package/esm2022/info-sign/lib/info-sign/info-sign.module.mjs +8 -1
- package/esm2022/inline-edit/lib/inline-edit/components/fields/inline-edit-number/inline-edit-number.component.mjs +5 -5
- package/esm2022/inline-edit/lib/inline-edit/inline-edit.module.mjs +8 -1
- package/esm2022/input-group/lib/input-group/input-group.module.mjs +8 -1
- package/esm2022/input-mask/lib/input-mask/input-mask.module.mjs +8 -1
- package/esm2022/input-text/lib/input-text/input-text.module.mjs +8 -1
- package/esm2022/insights/lib/insights/insights.module.mjs +11 -1
- package/esm2022/kanban/lib/kanban/kanban-event.service.mjs +4 -3
- package/esm2022/kanban/lib/kanban/kanban.module.mjs +11 -1
- package/esm2022/label-value/lib/label-value/label-value.module.mjs +8 -1
- package/esm2022/loading-state/lib/loading-state/loading-state.module.mjs +8 -1
- package/esm2022/locale/lib/locale/locale.module.mjs +14 -1
- package/esm2022/locale/lib/locale/locale.service.mjs +10 -32
- package/esm2022/locale/lib/locale/options/index.mjs +1 -13
- package/esm2022/locale/lib/locale/options/locale-presets.mjs +199 -0
- package/esm2022/locale/lib/locale/pipes/localized-bignumber-impure.pipe.mjs +1 -1
- package/esm2022/locale/lib/locale/pipes/localized-bignumber.pipe.mjs +10 -2
- package/esm2022/locale/lib/locale/provide-locale.mjs +42 -0
- package/esm2022/locale/public-api.mjs +3 -1
- package/esm2022/localized-number-input/lib/localized-number-input/localized-number-input.directive.mjs +5 -1
- package/esm2022/localized-number-input/lib/localized-number-input/localized-number-input.module.mjs +8 -1
- package/esm2022/mask/lib/mask/mask-formatter.module.mjs +8 -1
- package/esm2022/mouse-events/lib/mouse-events/mouse-events.module.mjs +8 -1
- package/esm2022/navigation-button/lib/navigation-button/navigation-button.module.mjs +8 -1
- package/esm2022/number-input/lib/number-input/number-input.directive.mjs +2 -2
- package/esm2022/number-input/lib/number-input/number-input.module.mjs +9 -2
- package/esm2022/numeric/lib/numeric.module.mjs +8 -1
- package/esm2022/numeric-mask/lib/numeric-mask/numeric-mask.directive.mjs +178 -15
- package/esm2022/numeric-mask/lib/numeric-mask/numeric-mask.module.mjs +8 -1
- package/esm2022/object-card/lib/object-card/object-card.module.mjs +12 -1
- package/esm2022/panel/lib/panel/panel.module.mjs +11 -1
- package/esm2022/password-strength/lib/password-strength/password-strength.module.mjs +8 -1
- package/esm2022/picklist/lib/picklist/picklist.module.mjs +8 -1
- package/esm2022/pin-code-field/lib/pin-code-field.module.mjs +8 -1
- package/esm2022/profile-picture-picker/lib/profile-picture-picker/profile-picture-picker.module.mjs +8 -1
- package/esm2022/progressbar/lib/progressbar/progressbar.module.mjs +8 -1
- package/esm2022/rating-scale/lib/rating-scale/rating-scale.module.mjs +8 -1
- package/esm2022/select/lib/select/select.component.mjs +16 -3
- package/esm2022/select-button/lib/select-button/select-button.module.mjs +8 -1
- package/esm2022/shared/lib/shared/border-button/border-button.module.mjs +8 -1
- package/esm2022/slide-in-bar/lib/slide-in-bar/slide-in-bar.module.mjs +8 -1
- package/esm2022/slide-in-bar/lib/slide-in-bar/slide-in-bar.service.mjs +4 -3
- package/esm2022/slider/lib/slider/slider.module.mjs +8 -1
- package/esm2022/speech-recognition/lib/speech-recognition/speech-recognition.module.mjs +8 -1
- package/esm2022/split-button/lib/split-button/split-button.module.mjs +8 -1
- package/esm2022/stats-card/lib/stats-card/stats-card.module.mjs +8 -1
- package/esm2022/stepper/lib/stepper/stepper.module.mjs +8 -1
- package/esm2022/structure/lib/structure/structure.module.mjs +8 -1
- package/esm2022/switch/lib/switch/switch.module.mjs +8 -1
- package/esm2022/table/lib/table/table.module.mjs +9 -1
- package/esm2022/table-header/lib/table-header/table-header-checkox.module.mjs +8 -1
- package/esm2022/template/lib/template/template.module.mjs +8 -1
- package/esm2022/text-area/lib/text-area.module.mjs +8 -1
- package/esm2022/thumbnail/lib/thumbnail/thumbnail.module.mjs +8 -1
- package/esm2022/thumbnails/lib/thumbnails/thumbnails.module.mjs +8 -1
- package/esm2022/tiered-menu/lib/tiered-menu/tiered-menu.module.mjs +8 -1
- package/esm2022/tile/lib/tile/tile.module.mjs +11 -1
- package/esm2022/timeline/lib/timeline/timeline.module.mjs +8 -1
- package/esm2022/toast/lib/toast/toast.module.mjs +8 -1
- package/esm2022/token-list/lib/token-list/token-list.module.mjs +8 -1
- package/esm2022/tooltip/lib/tooltip/tooltip.module.mjs +8 -1
- package/esm2022/topbar/lib/topbar/topbar.module.mjs +11 -1
- package/esm2022/tree/lib/tree/tree.module.mjs +8 -1
- package/esm2022/workspace-switch/lib/workspace-switch/workspace-switch.module.mjs +8 -1
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-alert.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-alert.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-badge.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-badge.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs +25 -126
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs +5 -1
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-button.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-card.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-chat.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-chat.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-checkbox-list.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-checkbox-list.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-chips.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-chips.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs +164 -160
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-collapse-link.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-collapse-link.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-common.mjs +38 -2
- package/fesm2022/seniorsistemas-angular-components-common.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-control-errors.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-control-errors.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-country-phone-picker.mjs +10 -2
- package/fesm2022/seniorsistemas-angular-components-country-phone-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-custom-fields.mjs +75 -15
- package/fesm2022/seniorsistemas-angular-components-custom-fields.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +52 -208
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-editable-overlay.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-editable-overlay.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-fieldset.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-fieldset.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs +10 -2
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-gantt.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-gantt.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs +18 -0
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-grid-menu.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-grid-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs +14 -2
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-infinite-scroll.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-infinite-scroll.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-info-sign.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-info-sign.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs +11 -4
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-group.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-input-group.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-mask.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-input-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-text.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-input-text.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-insights.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-insights.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs +13 -2
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-label-value.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-label-value.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-loading-state.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-loading-state.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-locale.mjs +260 -33
- package/fesm2022/seniorsistemas-angular-components-locale.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-localized-number-input.mjs +11 -0
- package/fesm2022/seniorsistemas-angular-components-localized-number-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-mask.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-mouse-events.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-mouse-events.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-number-input.mjs +9 -2
- package/fesm2022/seniorsistemas-angular-components-number-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs +184 -14
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-numeric.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-numeric.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs +11 -0
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-panel.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-panel.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-password-strength.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-password-strength.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-progressbar.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-progressbar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-rating-scale.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-rating-scale.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select-button.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-select-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select.mjs +15 -2
- package/fesm2022/seniorsistemas-angular-components-select.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-shared.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-shared.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-slide-in-bar.mjs +10 -2
- package/fesm2022/seniorsistemas-angular-components-slide-in-bar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-slider.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-slider.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-speech-recognition.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-speech-recognition.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-split-button.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-split-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-stats-card.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-stats-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-stepper.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-structure.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-structure.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-switch.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-switch.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-table-header.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-table-header.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-table.mjs +8 -0
- package/fesm2022/seniorsistemas-angular-components-table.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-template.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-template.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-text-area.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-text-area.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-thumbnails.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-thumbnails.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tile.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-tile.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-timeline.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-timeline.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-toast.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-toast.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-token-list.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-token-list.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs +10 -0
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tree.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-tree.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-workspace-switch.mjs +7 -0
- package/fesm2022/seniorsistemas-angular-components-workspace-switch.mjs.map +1 -1
- package/fieldset/README.md +2 -2
- package/fieldset/lib/fieldset/fieldset.module.d.ts +7 -0
- package/file-picker/README.md +2 -2
- package/file-picker/lib/file-picker/file-picker.module.d.ts +7 -0
- package/file-upload/README.md +1 -1
- package/gantt/README.md +2 -2
- package/gantt/lib/gantt/gantt.module.d.ts +7 -0
- package/global-search/README.md +5 -2
- package/global-search/lib/global-search/global-search.module.d.ts +18 -0
- package/grid-menu/README.md +5 -4
- package/grid-menu/lib/grid-menu/grid-menu.module.d.ts +7 -0
- package/help-popover/README.md +5 -4
- package/help-popover/lib/help-popover/help-popover.module.d.ts +7 -0
- package/ia-insight/README.md +1 -1
- package/image-cropper/README.md +6 -5
- package/image-cropper/lib/image-cropper/image-cropper.module.d.ts +11 -0
- package/infinite-scroll/README.md +5 -4
- package/infinite-scroll/lib/infinite-scroll/infinite-scroll.module.d.ts +7 -0
- package/info-sign/README.md +5 -4
- package/info-sign/lib/info-sign/info-sign.module.d.ts +7 -0
- package/inline-edit/README.md +5 -4
- package/inline-edit/lib/inline-edit/inline-edit.module.d.ts +7 -0
- package/input-group/lib/input-group/input-group.module.d.ts +7 -0
- package/input-mask/lib/input-mask/input-mask.module.d.ts +7 -0
- package/input-text/lib/input-text/input-text.module.d.ts +7 -0
- package/insights/README.md +6 -4
- package/insights/lib/insights/insights.module.d.ts +10 -0
- package/kanban/README.md +6 -4
- package/kanban/lib/kanban/kanban.module.d.ts +10 -0
- package/label-value/README.md +5 -4
- package/label-value/lib/label-value/label-value.module.d.ts +7 -0
- package/loading-state/README.md +9 -5
- package/loading-state/lib/loading-state/loading-state.module.d.ts +7 -0
- package/locale/lib/locale/locale.module.d.ts +13 -0
- package/locale/lib/locale/locale.service.d.ts +0 -3
- package/locale/lib/locale/options/locale-presets.d.ts +22 -0
- package/locale/lib/locale/pipes/localized-bignumber-impure.pipe.d.ts +2 -2
- package/locale/lib/locale/pipes/localized-bignumber.pipe.d.ts +20 -1
- package/locale/lib/locale/provide-locale.d.ts +18 -0
- package/locale/public-api.d.ts +2 -0
- package/localized-number-input/README.md +32 -8
- package/localized-number-input/lib/localized-number-input/localized-number-input.directive.d.ts +4 -0
- package/localized-number-input/lib/localized-number-input/localized-number-input.module.d.ts +7 -0
- package/mask/lib/mask/mask-formatter.module.d.ts +7 -0
- package/mouse-events/README.md +5 -4
- package/mouse-events/lib/mouse-events/mouse-events.module.d.ts +7 -0
- package/navigation-button/README.md +5 -4
- package/navigation-button/lib/navigation-button/navigation-button.module.d.ts +7 -0
- package/number-input/lib/number-input/number-input.directive.d.ts +1 -1
- package/number-input/lib/number-input/number-input.module.d.ts +8 -1
- package/numeric/README.md +6 -5
- package/numeric/lib/numeric.module.d.ts +7 -0
- package/numeric-mask/README.md +44 -1
- package/numeric-mask/lib/numeric-mask/numeric-mask.directive.d.ts +65 -4
- package/numeric-mask/lib/numeric-mask/numeric-mask.module.d.ts +7 -0
- package/object-card/README.md +11 -4
- package/object-card/lib/object-card/object-card.module.d.ts +11 -0
- package/package.json +1 -1
- package/panel/README.md +8 -4
- package/panel/lib/panel/panel.module.d.ts +10 -0
- package/password-strength/README.md +6 -3
- package/password-strength/lib/password-strength/password-strength.module.d.ts +7 -0
- package/picklist/README.md +8 -5
- package/picklist/lib/picklist/picklist.module.d.ts +7 -0
- package/pin-code-field/lib/pin-code-field.module.d.ts +7 -0
- package/product-header/README.md +2 -2
- package/profile-picture-picker/README.md +6 -3
- package/profile-picture-picker/lib/profile-picture-picker/profile-picture-picker.module.d.ts +7 -0
- package/progressbar/README.md +6 -3
- package/progressbar/lib/progressbar/progressbar.module.d.ts +7 -0
- package/rating-scale/README.md +6 -3
- package/rating-scale/lib/rating-scale/rating-scale.module.d.ts +7 -0
- package/schematics/collection.json +40 -0
- package/schematics/migrations/migrate-app-to-standalone/index.d.ts +32 -0
- package/schematics/migrations/migrate-app-to-standalone/index.js +98 -0
- package/schematics/migrations/migrate-app-to-standalone/index.js.map +1 -0
- package/schematics/migrations/migrate-deprecated-apis/index.d.ts +49 -0
- package/schematics/migrations/migrate-deprecated-apis/index.js +660 -0
- package/schematics/migrations/migrate-deprecated-apis/index.js.map +1 -0
- package/schematics/migrations/migrate-deprecated-datepicker/index.d.ts +31 -0
- package/schematics/migrations/migrate-deprecated-datepicker/index.js +115 -0
- package/schematics/migrations/migrate-deprecated-datepicker/index.js.map +1 -0
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.d.ts +52 -0
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.js +661 -0
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.js.map +1 -0
- package/schematics/migrations/migrate-deprecated-imports/index.d.ts +23 -0
- package/schematics/migrations/migrate-deprecated-imports/index.js +335 -0
- package/schematics/migrations/migrate-deprecated-imports/index.js.map +1 -0
- package/schematics/migrations/migrate-deprecated-selectors/index.d.ts +15 -0
- package/schematics/migrations/migrate-deprecated-selectors/index.js +76 -0
- package/schematics/migrations/migrate-deprecated-selectors/index.js.map +1 -0
- package/schematics/migrations/migrate-modules-to-standalone/index.d.ts +51 -0
- package/schematics/migrations/migrate-modules-to-standalone/index.js +632 -0
- package/schematics/migrations/migrate-modules-to-standalone/index.js.map +1 -0
- package/schematics/migrations/migrate-modules-to-standalone/modules-map.json +1656 -0
- package/schematics/migrations/migrate-v20/index.d.ts +9 -0
- package/schematics/migrations/migrate-v20/index.js +90 -0
- package/schematics/migrations/migrate-v20/index.js.map +1 -0
- package/schematics/migrations/migrate-v20/items.d.ts +7 -0
- package/schematics/migrations/migrate-v20/items.js +54 -0
- package/schematics/migrations/migrate-v20/items.js.map +1 -0
- package/schematics/migrations/migrate-v20/plan.d.ts +32 -0
- package/schematics/migrations/migrate-v20/plan.js +29 -0
- package/schematics/migrations/migrate-v20/plan.js.map +1 -0
- package/schematics/migrations.json +5 -1
- package/schematics/schema/app-standalone.schema.json +21 -0
- package/schematics/schema/migrate-v20.schema.json +33 -0
- package/schematics/schema/scope.schema.json +17 -0
- package/schematics/utils/ast-utils.js +16 -0
- package/schematics/utils/ast-utils.js.map +1 -1
- package/schematics/utils/eol.d.ts +5 -0
- package/schematics/utils/eol.js +17 -0
- package/schematics/utils/eol.js.map +1 -0
- package/schematics/utils/prompt-utils.d.ts +62 -0
- package/schematics/utils/prompt-utils.js +166 -0
- package/schematics/utils/prompt-utils.js.map +1 -0
- package/schematics/utils/report.d.ts +27 -0
- package/schematics/utils/report.js +70 -0
- package/schematics/utils/report.js.map +1 -0
- package/schematics/utils/scope.d.ts +17 -0
- package/schematics/utils/scope.js +55 -0
- package/schematics/utils/scope.js.map +1 -0
- package/schematics/utils/selection.d.ts +21 -0
- package/schematics/utils/selection.js +60 -0
- package/schematics/utils/selection.js.map +1 -0
- package/schematics/utils/symbol-utils.d.ts +31 -0
- package/schematics/utils/symbol-utils.js +202 -0
- package/schematics/utils/symbol-utils.js.map +1 -0
- package/schematics/utils/template-utils.d.ts +62 -0
- package/schematics/utils/template-utils.js +165 -0
- package/schematics/utils/template-utils.js.map +1 -0
- package/schematics/utils/tsconfig-paths.d.ts +5 -0
- package/schematics/utils/tsconfig-paths.js +73 -0
- package/schematics/utils/tsconfig-paths.js.map +1 -0
- package/select/lib/select/select.component.d.ts +8 -0
- package/select-button/README.md +6 -3
- package/select-button/lib/select-button/select-button.module.d.ts +7 -0
- package/shared/lib/shared/border-button/border-button.module.d.ts +7 -0
- package/sidebar/README.md +2 -2
- package/slide-in-bar/README.md +5 -5
- package/slide-in-bar/lib/slide-in-bar/slide-in-bar.module.d.ts +7 -0
- package/slider/README.md +6 -3
- package/slider/lib/slider/slider.module.d.ts +7 -0
- package/speech-recognition/README.md +6 -3
- package/speech-recognition/lib/speech-recognition/speech-recognition.module.d.ts +7 -0
- package/split-button/README.md +6 -3
- package/split-button/lib/split-button/split-button.module.d.ts +7 -0
- package/stats-card/README.md +6 -3
- package/stats-card/lib/stats-card/stats-card.module.d.ts +7 -0
- package/stepper/README.md +6 -3
- package/stepper/lib/stepper/stepper.module.d.ts +7 -0
- package/structure/lib/structure/structure.module.d.ts +7 -0
- package/switch/README.md +6 -3
- package/switch/lib/switch/switch.module.d.ts +7 -0
- package/table/README.md +12 -4
- package/table/lib/table/table.module.d.ts +8 -0
- package/table-header/lib/table-header/table-header-checkox.module.d.ts +7 -0
- package/template/README.md +0 -11
- package/template/lib/template/template.module.d.ts +7 -0
- package/text-area/lib/text-area.module.d.ts +7 -0
- package/text-area-ia/README.md +1 -1
- package/thumbnail/lib/thumbnail/thumbnail.module.d.ts +7 -0
- package/thumbnails/lib/thumbnails/thumbnails.module.d.ts +7 -0
- package/tiered-menu/lib/tiered-menu/tiered-menu.module.d.ts +7 -0
- package/tile/lib/tile/tile.module.d.ts +10 -0
- package/timeline/lib/timeline/timeline.module.d.ts +7 -0
- package/toast/lib/toast/toast.module.d.ts +7 -0
- package/token-list/lib/token-list/token-list.module.d.ts +7 -0
- package/tooltip/lib/tooltip/tooltip.module.d.ts +7 -0
- package/topbar/lib/topbar/topbar.module.d.ts +10 -0
- package/tree/lib/tree/tree.module.d.ts +7 -0
- package/workspace-switch/lib/workspace-switch/workspace-switch.module.d.ts +7 -0
- package/dynamic-form/dynamic-form/form-field/fields/currency/currency-field.component.d.ts +0 -664
- package/dynamic-form/dynamic-form/form-field/fields/number/number-field.component.d.ts +0 -29
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/currency/currency-field.component.mjs +0 -96
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/number/number-field.component.mjs +0 -124
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ITEM_ID = void 0;
|
|
4
|
+
exports.migrateFieldTypesInContent = migrateFieldTypesInContent;
|
|
5
|
+
exports.migrateFieldsBindingsInContent = migrateFieldsBindingsInContent;
|
|
6
|
+
exports.migrateDeprecatedDynamicForm = migrateDeprecatedDynamicForm;
|
|
7
|
+
exports.migrate = migrate;
|
|
8
|
+
const ts = require("typescript");
|
|
9
|
+
const ast_utils_1 = require("../../utils/ast-utils");
|
|
10
|
+
const symbol_utils_1 = require("../../utils/symbol-utils");
|
|
11
|
+
const report_1 = require("../../utils/report");
|
|
12
|
+
const scope_1 = require("../../utils/scope");
|
|
13
|
+
const eol_1 = require("../../utils/eol");
|
|
14
|
+
exports.ITEM_ID = 'dynamic-form';
|
|
15
|
+
const PKG = '@seniorsistemas/angular-components';
|
|
16
|
+
const DYNAMIC_FORM = `${PKG}/dynamic-form`;
|
|
17
|
+
const CALENDAR_TYPES = new Set(['date', 'dateTime', 'localDateTime', 'time']);
|
|
18
|
+
const MEMO_METHOD = 'dynamicTypeToConfigs';
|
|
19
|
+
const MEMO_CACHE = 'dynamicTypeToConfigsCache';
|
|
20
|
+
const MAX_PASSES = 25;
|
|
21
|
+
// ─── Utilitários de AST ───────────────────────────────────────────────────────
|
|
22
|
+
function parse(content) {
|
|
23
|
+
return ts.createSourceFile('_dynamic-form.ts', content, ts.ScriptTarget.Latest, true);
|
|
24
|
+
}
|
|
25
|
+
function elementName(el) {
|
|
26
|
+
const name = el.name;
|
|
27
|
+
if (!name)
|
|
28
|
+
return undefined;
|
|
29
|
+
return ts.isIdentifier(name) || ts.isStringLiteralLike(name) ? name.text : undefined;
|
|
30
|
+
}
|
|
31
|
+
function findElement(o, name) {
|
|
32
|
+
return o.properties.find((p) => elementName(p) === name);
|
|
33
|
+
}
|
|
34
|
+
function literalType(o, sf) {
|
|
35
|
+
const el = findElement(o, 'type');
|
|
36
|
+
if (!el || !ts.isPropertyAssignment(el) || !ts.isStringLiteralLike(el.initializer))
|
|
37
|
+
return undefined;
|
|
38
|
+
return {
|
|
39
|
+
el,
|
|
40
|
+
value: el.initializer.text,
|
|
41
|
+
quote: el.initializer.getText(sf)[0] === '"' ? '"' : "'",
|
|
42
|
+
key: el.name.getText(sf),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function hasModifier(node, kind) {
|
|
46
|
+
return ts.canHaveModifiers(node) && (ts.getModifiers(node) ?? []).some((m) => m.kind === kind);
|
|
47
|
+
}
|
|
48
|
+
function decoratorNames(node) {
|
|
49
|
+
if (!ts.canHaveDecorators(node))
|
|
50
|
+
return [];
|
|
51
|
+
return (ts.getDecorators(node) ?? []).map((d) => {
|
|
52
|
+
const expr = ts.isCallExpression(d.expression) ? d.expression.expression : d.expression;
|
|
53
|
+
return ts.isIdentifier(expr) ? expr.text : '';
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function lineIndent(content, pos) {
|
|
57
|
+
const lineStart = content.lastIndexOf('\n', pos - 1) + 1;
|
|
58
|
+
return /^[ \t]*/.exec(content.slice(lineStart, pos))?.[0] ?? '';
|
|
59
|
+
}
|
|
60
|
+
/** Indentação da linha quando o nó é o primeiro item dela, senão `undefined`. */
|
|
61
|
+
function ownLineIndent(content, pos) {
|
|
62
|
+
const lineStart = content.lastIndexOf('\n', pos - 1) + 1;
|
|
63
|
+
const prefix = content.slice(lineStart, pos);
|
|
64
|
+
return /^[ \t]*$/.test(prefix) ? prefix : undefined;
|
|
65
|
+
}
|
|
66
|
+
function removeUnusedImport(content, name) {
|
|
67
|
+
const sf = parse(content);
|
|
68
|
+
let uses = 0;
|
|
69
|
+
const visit = (node) => {
|
|
70
|
+
if (ts.isImportDeclaration(node))
|
|
71
|
+
return;
|
|
72
|
+
if (ts.isIdentifier(node) && node.text === name)
|
|
73
|
+
uses++;
|
|
74
|
+
ts.forEachChild(node, visit);
|
|
75
|
+
};
|
|
76
|
+
visit(sf);
|
|
77
|
+
if (uses > 0)
|
|
78
|
+
return content;
|
|
79
|
+
const { changes } = (0, ast_utils_1.buildRemoveNamedImportsChanges)(sf, [name], PKG);
|
|
80
|
+
return changes.length > 0 ? (0, ast_utils_1.applyChanges)(content, (0, symbol_utils_1.consumeRemovedLineBreaks)(content, changes)) : content;
|
|
81
|
+
}
|
|
82
|
+
function rebuildObject(content, sf, o, edit) {
|
|
83
|
+
const props = [...o.properties];
|
|
84
|
+
const removed = new Set(edit.remove ?? []);
|
|
85
|
+
const multiline = content.slice(o.getStart(sf), o.getEnd()).includes('\n');
|
|
86
|
+
let indent = lineIndent(content, o.getStart(sf)) + ' ';
|
|
87
|
+
for (const p of [...props].reverse()) {
|
|
88
|
+
const own = ownLineIndent(content, p.getStart(sf));
|
|
89
|
+
if (own !== undefined) {
|
|
90
|
+
indent = own;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const parts = [];
|
|
95
|
+
for (const p of props) {
|
|
96
|
+
if (removed.has(p))
|
|
97
|
+
continue;
|
|
98
|
+
const text = edit.replace?.get(p) ?? content.slice(p.getStart(sf), p.getEnd());
|
|
99
|
+
const lead = content.slice(p.getFullStart(), p.getStart(sf)).trim();
|
|
100
|
+
const hasComment = lead.startsWith('//') || lead.startsWith('/*');
|
|
101
|
+
parts.push(hasComment ? `${lead}\n${indent}${text}` : text);
|
|
102
|
+
}
|
|
103
|
+
parts.push(...(edit.append ?? []));
|
|
104
|
+
if (props.length === 0 || parts.length === 0) {
|
|
105
|
+
return {
|
|
106
|
+
start: o.getStart(sf),
|
|
107
|
+
end: o.getEnd(),
|
|
108
|
+
replacement: parts.length === 0 ? '{}' : `{ ${parts.join(', ')} }`,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
start: props[0].getStart(sf),
|
|
113
|
+
end: props[props.length - 1].getEnd(),
|
|
114
|
+
replacement: parts.join(multiline ? `,\n${indent}` : ', '),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function applyObjectPass(content, handler, manual) {
|
|
118
|
+
let current = content;
|
|
119
|
+
for (let i = 0; i < MAX_PASSES; i++) {
|
|
120
|
+
const sf = parse(current);
|
|
121
|
+
const changes = [];
|
|
122
|
+
const imports = [];
|
|
123
|
+
const ctx = { sf, content: current };
|
|
124
|
+
const visit = (node) => {
|
|
125
|
+
if (ts.isObjectLiteralExpression(node)) {
|
|
126
|
+
const edit = handler(node, ctx);
|
|
127
|
+
if (edit) {
|
|
128
|
+
changes.push(rebuildObject(current, sf, node, edit), ...(edit.outer ?? []));
|
|
129
|
+
imports.push(...(edit.imports ?? []));
|
|
130
|
+
const line = (0, report_1.lineOf)(current, node.getStart(sf));
|
|
131
|
+
for (const message of edit.manual ?? [])
|
|
132
|
+
manual.push({ line, message, target: 'code' });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
ts.forEachChild(node, visit);
|
|
137
|
+
};
|
|
138
|
+
visit(sf);
|
|
139
|
+
if (changes.length === 0)
|
|
140
|
+
break;
|
|
141
|
+
current = (0, ast_utils_1.applyChanges)(current, changes);
|
|
142
|
+
for (const { name, from } of imports)
|
|
143
|
+
current = (0, ast_utils_1.ensureNamedImport)(current, name, from);
|
|
144
|
+
}
|
|
145
|
+
return current;
|
|
146
|
+
}
|
|
147
|
+
// ─── integer -> number, textAreaIA, calendário, priority, appendTo ────────────
|
|
148
|
+
const integerHandler = (o, ctx) => {
|
|
149
|
+
const t = literalType(o, ctx.sf);
|
|
150
|
+
if (!t || t.value !== 'integer')
|
|
151
|
+
return undefined;
|
|
152
|
+
const edit = {
|
|
153
|
+
replace: new Map([[t.el, `${t.key}: ${t.quote}number${t.quote}`]]),
|
|
154
|
+
append: [],
|
|
155
|
+
};
|
|
156
|
+
if (!findElement(o, 'scale'))
|
|
157
|
+
edit.append.push('scale: 0');
|
|
158
|
+
for (const flag of ['allowNegative', 'autoClear']) {
|
|
159
|
+
const el = findElement(o, flag);
|
|
160
|
+
if (!el) {
|
|
161
|
+
edit.append.push(`${flag}: false`);
|
|
162
|
+
}
|
|
163
|
+
else if (ts.isPropertyAssignment(el)) {
|
|
164
|
+
edit.replace.set(el, `${el.name.getText(ctx.sf)}: false`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return edit;
|
|
168
|
+
};
|
|
169
|
+
const textAreaIaHandler = (o, ctx) => {
|
|
170
|
+
const t = literalType(o, ctx.sf);
|
|
171
|
+
if (!t || t.value !== 'textAreaIA')
|
|
172
|
+
return undefined;
|
|
173
|
+
return { replace: new Map([[t.el, `${t.key}: ${t.quote}contentGenerator${t.quote}`]]) };
|
|
174
|
+
};
|
|
175
|
+
function localeOptionsLiteral(init) {
|
|
176
|
+
if (ts.isObjectLiteralExpression(init))
|
|
177
|
+
return init;
|
|
178
|
+
if ((ts.isNewExpression(init) || ts.isCallExpression(init)) && init.arguments?.length) {
|
|
179
|
+
const [arg] = init.arguments;
|
|
180
|
+
if (ts.isObjectLiteralExpression(arg))
|
|
181
|
+
return arg;
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
const calendarLocaleHandler = (o, ctx) => {
|
|
186
|
+
const el = findElement(o, 'calendarLocaleOptions');
|
|
187
|
+
if (!el || !ts.isPropertyAssignment(el))
|
|
188
|
+
return undefined;
|
|
189
|
+
const literal = localeOptionsLiteral(el.initializer);
|
|
190
|
+
if (!literal)
|
|
191
|
+
return undefined;
|
|
192
|
+
const edit = { remove: [el], append: [] };
|
|
193
|
+
for (const name of ['dateFormat', 'hourFormat']) {
|
|
194
|
+
const inner = findElement(literal, name);
|
|
195
|
+
if (inner && !findElement(o, name)) {
|
|
196
|
+
edit.append.push(ctx.content.slice(inner.getStart(ctx.sf), inner.getEnd()));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return edit;
|
|
200
|
+
};
|
|
201
|
+
const priorityHandler = (o, ctx) => {
|
|
202
|
+
const parent = o.parent;
|
|
203
|
+
if (!ts.isPropertyAssignment(parent))
|
|
204
|
+
return undefined;
|
|
205
|
+
const parentName = elementName(parent);
|
|
206
|
+
if (parentName !== 'leftAddon' && parentName !== 'rightAddon')
|
|
207
|
+
return undefined;
|
|
208
|
+
const el = findElement(o, 'priority');
|
|
209
|
+
return el ? { remove: [el] } : undefined;
|
|
210
|
+
};
|
|
211
|
+
const appendToHandler = (o, ctx) => {
|
|
212
|
+
const t = literalType(o, ctx.sf);
|
|
213
|
+
if (!t || !CALENDAR_TYPES.has(t.value))
|
|
214
|
+
return undefined;
|
|
215
|
+
const el = findElement(o, 'appendTo');
|
|
216
|
+
return el ? { remove: [el] } : undefined;
|
|
217
|
+
};
|
|
218
|
+
/** `numberLocaleOptions` não tem mais efeito; `legacyNumber` fica de fora (não é migrado). */
|
|
219
|
+
const numberLocaleOptionsHandler = (o, ctx) => {
|
|
220
|
+
const t = literalType(o, ctx.sf);
|
|
221
|
+
if (!t || t.value === 'legacyNumber')
|
|
222
|
+
return undefined;
|
|
223
|
+
const el = findElement(o, 'numberLocaleOptions');
|
|
224
|
+
return el ? { remove: [el] } : undefined;
|
|
225
|
+
};
|
|
226
|
+
// ─── Tipos CurrencyFieldConfig / NumberFieldConfig -> BignumberFieldConfig ────
|
|
227
|
+
function renameConfigTypes(content) {
|
|
228
|
+
// CurrencyFieldConfig não é renomeada: 'money' é um tipo estável, não migrado.
|
|
229
|
+
// NumberFieldConfig continua válido para legacyNumber: só troca quando o arquivo não o usa.
|
|
230
|
+
const names = [];
|
|
231
|
+
if (!content.includes('legacyNumber'))
|
|
232
|
+
names.push('NumberFieldConfig');
|
|
233
|
+
const sf = parse(content);
|
|
234
|
+
const { changes, removedNames } = (0, ast_utils_1.buildRemoveNamedImportsChanges)(sf, names, DYNAMIC_FORM);
|
|
235
|
+
if (removedNames.length === 0)
|
|
236
|
+
return content;
|
|
237
|
+
const renamed = new Set(removedNames);
|
|
238
|
+
const visit = (node) => {
|
|
239
|
+
if (ts.isImportDeclaration(node))
|
|
240
|
+
return;
|
|
241
|
+
if (ts.isIdentifier(node) && renamed.has(node.text)) {
|
|
242
|
+
const parent = node.parent;
|
|
243
|
+
const isTypePosition = (ts.isTypeReferenceNode(parent) && parent.typeName === node) ||
|
|
244
|
+
(ts.isExpressionWithTypeArguments(parent) && parent.expression === node);
|
|
245
|
+
if (isTypePosition) {
|
|
246
|
+
changes.push({ start: node.getStart(sf), end: node.getEnd(), replacement: 'BignumberFieldConfig' });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
ts.forEachChild(node, visit);
|
|
250
|
+
};
|
|
251
|
+
visit(sf);
|
|
252
|
+
return (0, ast_utils_1.ensureNamedImport)((0, ast_utils_1.applyChanges)(content, changes), 'BignumberFieldConfig', DYNAMIC_FORM);
|
|
253
|
+
}
|
|
254
|
+
// ─── Migração de tipos/propriedades de um arquivo .ts ─────────────────────────
|
|
255
|
+
const TRIGGERS = [
|
|
256
|
+
'integer',
|
|
257
|
+
'textAreaIA',
|
|
258
|
+
'calendarLocaleOptions',
|
|
259
|
+
'priority',
|
|
260
|
+
'appendTo',
|
|
261
|
+
'numberLocaleOptions',
|
|
262
|
+
'NumberFieldConfig',
|
|
263
|
+
];
|
|
264
|
+
function dedupeManual(entries) {
|
|
265
|
+
const seen = new Set();
|
|
266
|
+
return entries.filter((e) => {
|
|
267
|
+
const key = `${e.line}:${e.message}`;
|
|
268
|
+
if (seen.has(key))
|
|
269
|
+
return false;
|
|
270
|
+
seen.add(key);
|
|
271
|
+
return true;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/** Parte pura dos tipos de campo e propriedades depreciadas (sem `[fields]` -> `[configs]`). */
|
|
275
|
+
function migrateFieldTypesInContent(content) {
|
|
276
|
+
if (!content.includes(PKG) || !TRIGGERS.some((t) => content.includes(t))) {
|
|
277
|
+
return { updated: content, manual: [] };
|
|
278
|
+
}
|
|
279
|
+
const manual = [];
|
|
280
|
+
let updated = content;
|
|
281
|
+
updated = applyObjectPass(updated, integerHandler, manual);
|
|
282
|
+
updated = applyObjectPass(updated, textAreaIaHandler, manual);
|
|
283
|
+
const afterCalendar = applyObjectPass(updated, calendarLocaleHandler, manual);
|
|
284
|
+
if (afterCalendar !== updated) {
|
|
285
|
+
updated = removeUnusedImport(afterCalendar, 'CalendarLocaleOptions');
|
|
286
|
+
}
|
|
287
|
+
const afterPriority = applyObjectPass(updated, priorityHandler, manual);
|
|
288
|
+
if (afterPriority !== updated) {
|
|
289
|
+
updated = removeUnusedImport(afterPriority, 'ButtonPriority');
|
|
290
|
+
}
|
|
291
|
+
updated = applyObjectPass(updated, appendToHandler, manual);
|
|
292
|
+
const afterNumberLocale = applyObjectPass(updated, numberLocaleOptionsHandler, manual);
|
|
293
|
+
if (afterNumberLocale !== updated) {
|
|
294
|
+
updated = removeUnusedImport(afterNumberLocale, 'NumberLocaleOptions');
|
|
295
|
+
}
|
|
296
|
+
updated = renameConfigTypes(updated);
|
|
297
|
+
// calendarLocaleOptions que não são literais não podem ser convertidos automaticamente.
|
|
298
|
+
if (updated.includes('calendarLocaleOptions')) {
|
|
299
|
+
const sf = parse(updated);
|
|
300
|
+
const visit = (node) => {
|
|
301
|
+
if (ts.isPropertyAssignment(node) && elementName(node) === 'calendarLocaleOptions') {
|
|
302
|
+
manual.push({
|
|
303
|
+
line: (0, report_1.lineOf)(updated, node.getStart(sf)),
|
|
304
|
+
message: '"calendarLocaleOptions" não é um objeto literal: mova "dateFormat"/"hourFormat" para o campo e remova a propriedade manualmente.',
|
|
305
|
+
target: 'code',
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
ts.forEachChild(node, visit);
|
|
309
|
+
};
|
|
310
|
+
visit(sf);
|
|
311
|
+
}
|
|
312
|
+
return { updated, manual: dedupeManual(manual) };
|
|
313
|
+
}
|
|
314
|
+
// ─── [fields] -> [configs] ────────────────────────────────────────────────────
|
|
315
|
+
const MEMO_MEMBERS = (indent) => [
|
|
316
|
+
`private readonly ${MEMO_CACHE} = new WeakMap<DynamicType[], DynamicStructure[]>();`,
|
|
317
|
+
'',
|
|
318
|
+
`${indent}protected ${MEMO_METHOD}(fields: DynamicType[] | null | undefined): DynamicStructure[] {`,
|
|
319
|
+
`${indent} if (!fields) return [];`,
|
|
320
|
+
`${indent} let configs = this.${MEMO_CACHE}.get(fields);`,
|
|
321
|
+
`${indent} if (!configs) {`,
|
|
322
|
+
`${indent} configs = dynamicTypeToDynamicStructure(fields);`,
|
|
323
|
+
`${indent} this.${MEMO_CACHE}.set(fields, configs);`,
|
|
324
|
+
`${indent} }`,
|
|
325
|
+
`${indent} return configs;`,
|
|
326
|
+
`${indent}}`,
|
|
327
|
+
].join('\n');
|
|
328
|
+
function findComponentClass(sf, requireInlineTemplate) {
|
|
329
|
+
for (const node of sf.statements) {
|
|
330
|
+
if (!ts.isClassDeclaration(node))
|
|
331
|
+
continue;
|
|
332
|
+
for (const d of ts.getDecorators(node) ?? []) {
|
|
333
|
+
if (!ts.isCallExpression(d.expression))
|
|
334
|
+
continue;
|
|
335
|
+
if (d.expression.expression.getText(sf) !== 'Component')
|
|
336
|
+
continue;
|
|
337
|
+
if (!requireInlineTemplate)
|
|
338
|
+
return node;
|
|
339
|
+
if (inlineTemplateNode(d.expression))
|
|
340
|
+
return node;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
function inlineTemplateNode(call) {
|
|
346
|
+
const [arg] = call.arguments;
|
|
347
|
+
if (!arg || !ts.isObjectLiteralExpression(arg))
|
|
348
|
+
return undefined;
|
|
349
|
+
const el = findElement(arg, 'template');
|
|
350
|
+
if (el && ts.isPropertyAssignment(el) && ts.isStringLiteralLike(el.initializer))
|
|
351
|
+
return el.initializer;
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
function inlineTemplate(sf) {
|
|
355
|
+
for (const node of sf.statements) {
|
|
356
|
+
if (!ts.isClassDeclaration(node))
|
|
357
|
+
continue;
|
|
358
|
+
for (const d of ts.getDecorators(node) ?? []) {
|
|
359
|
+
if (!ts.isCallExpression(d.expression) || d.expression.expression.getText(sf) !== 'Component')
|
|
360
|
+
continue;
|
|
361
|
+
const tpl = inlineTemplateNode(d.expression);
|
|
362
|
+
if (tpl) {
|
|
363
|
+
const start = tpl.getStart(sf) + 1;
|
|
364
|
+
const end = tpl.getEnd() - 1;
|
|
365
|
+
return { start, end, text: sf.text.slice(start, end) };
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
function analyzeExpression(expr) {
|
|
372
|
+
const sf = ts.createSourceFile('_expr.ts', `(${expr});`, ts.ScriptTarget.Latest, true);
|
|
373
|
+
const stmt = sf.statements[0];
|
|
374
|
+
if (!stmt || !ts.isExpressionStatement(stmt))
|
|
375
|
+
return { kind: 'other' };
|
|
376
|
+
let node = stmt.expression;
|
|
377
|
+
while (ts.isParenthesizedExpression(node))
|
|
378
|
+
node = node.expression;
|
|
379
|
+
if (ts.isIdentifier(node))
|
|
380
|
+
return { kind: 'prop', name: node.text };
|
|
381
|
+
if (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword) {
|
|
382
|
+
return { kind: 'prop', name: node.name.text };
|
|
383
|
+
}
|
|
384
|
+
return { kind: 'other' };
|
|
385
|
+
}
|
|
386
|
+
function countIdentifierInTemplate(tpl, name) {
|
|
387
|
+
const escaped = name.replace(/[$]/g, '\\$');
|
|
388
|
+
// O nome do atributo ([fields]/[configs]) não conta como uso da propriedade.
|
|
389
|
+
const withoutAttrNames = tpl.replace(/\[(?:fields|configs)\]=/g, '');
|
|
390
|
+
return (withoutAttrNames.match(new RegExp(`(?<![\\w$.])${escaped}(?![\\w$])`, 'g')) ?? []).length;
|
|
391
|
+
}
|
|
392
|
+
function reindent(text, extra) {
|
|
393
|
+
return text
|
|
394
|
+
.split('\n')
|
|
395
|
+
.map((line, i) => (i === 0 || line.trim() === '' ? line : extra + line))
|
|
396
|
+
.join('\n');
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Migra `[fields]` para `[configs]` em um componente. `html` é o template externo; sem ele usa o `template:` inline.
|
|
400
|
+
* Retorna o `.ts` (e o template, quando externo) reescritos e as pendências manuais.
|
|
401
|
+
*/
|
|
402
|
+
function migrateFieldsBindingsInContent(tsContent, html) {
|
|
403
|
+
const manual = [];
|
|
404
|
+
const unchanged = { ts: tsContent, html, manual };
|
|
405
|
+
const sf = parse(tsContent);
|
|
406
|
+
const inline = html === undefined ? inlineTemplate(sf) : undefined;
|
|
407
|
+
const tpl = html ?? inline?.text;
|
|
408
|
+
if (tpl === undefined || !tpl.includes('s-dynamic-form'))
|
|
409
|
+
return unchanged;
|
|
410
|
+
const bindingRe = /\[fields\]="([^"]*)"|\[configs\]="([A-Za-z_$][\w$]*)Configs"|\[configs\]="dynamicTypeToConfigs\(/g;
|
|
411
|
+
const tagRe = /<s-dynamic-form\b[^>]*>/g;
|
|
412
|
+
if (!tpl.match(tagRe)?.some((tag) => /\[fields\]=|\[configs\]=/.test(tag)))
|
|
413
|
+
return unchanged;
|
|
414
|
+
const cls = findComponentClass(sf, html === undefined);
|
|
415
|
+
if (!cls) {
|
|
416
|
+
if (/\[fields\]="/.test(tpl)) {
|
|
417
|
+
manual.push({
|
|
418
|
+
line: 1,
|
|
419
|
+
message: 'Classe do componente não encontrada: troque "[fields]" por "[configs]" manualmente (DynamicStructure[]).',
|
|
420
|
+
target: 'template',
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
return { ts: tsContent, html, manual };
|
|
424
|
+
}
|
|
425
|
+
const changes = [];
|
|
426
|
+
const wrapped = new Set();
|
|
427
|
+
let memoEnsured = false;
|
|
428
|
+
let needsMemoImports = false;
|
|
429
|
+
let needsStructureImport = false;
|
|
430
|
+
const indent = cls.members[0] ? lineIndent(tsContent, cls.members[0].getStart(sf)) : ' ';
|
|
431
|
+
const ensureMemo = () => {
|
|
432
|
+
needsMemoImports = true;
|
|
433
|
+
if (memoEnsured)
|
|
434
|
+
return false;
|
|
435
|
+
memoEnsured = true;
|
|
436
|
+
const existing = cls.members.find((m) => ts.isMethodDeclaration(m) && ts.isIdentifier(m.name) && m.name.text === MEMO_METHOD);
|
|
437
|
+
if (existing) {
|
|
438
|
+
if (cls.getText(sf).includes(MEMO_CACHE))
|
|
439
|
+
return false;
|
|
440
|
+
changes.push({
|
|
441
|
+
start: existing.getStart(sf),
|
|
442
|
+
end: existing.getEnd(),
|
|
443
|
+
replacement: MEMO_MEMBERS(indent),
|
|
444
|
+
});
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
const insertAt = cls.getEnd() - 1;
|
|
448
|
+
changes.push({
|
|
449
|
+
start: insertAt,
|
|
450
|
+
end: insertAt,
|
|
451
|
+
replacement: `\n${indent}${MEMO_MEMBERS(indent)}\n`,
|
|
452
|
+
});
|
|
453
|
+
return true;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Escolhe entre as duas estratégias de migração de `[fields]`/getter `*Configs` para `[configs]`:
|
|
457
|
+
*
|
|
458
|
+
* - **Reescrever na origem** (preferida): converte o próprio array para `DynamicStructure[]`
|
|
459
|
+
* (`[{ type: 'row', fields: [...] }]`), remove o getter e liga `[configs]` direto na propriedade. Só é seguro
|
|
460
|
+
* quando a propriedade é um array **literal**, não é `static`/`declare`/`@Input()`, **não é referenciada em
|
|
461
|
+
* nenhum outro ponto da classe** (`this.x`) e aparece uma única vez no template: aí ninguém mais depende do
|
|
462
|
+
* formato `DynamicType[]`.
|
|
463
|
+
* - **Memoizar** (fallback, `false` aqui): mantém o array como está e passa a converter via `dynamicTypeToConfigs`,
|
|
464
|
+
* que memoiza por referência do array (`WeakMap`). Gera aviso manual: quem mutar o array no lugar
|
|
465
|
+
* (`push`/`splice`) precisa reatribuí-lo para o formulário atualizar.
|
|
466
|
+
*/
|
|
467
|
+
const tryWrapAtOrigin = (name, getter) => {
|
|
468
|
+
const member = cls.members.find((m) => ts.isPropertyDeclaration(m) && ts.isIdentifier(m.name) && m.name.text === name);
|
|
469
|
+
if (!member || !member.initializer || !ts.isArrayLiteralExpression(member.initializer))
|
|
470
|
+
return false;
|
|
471
|
+
if (hasModifier(member, ts.SyntaxKind.StaticKeyword) || hasModifier(member, ts.SyntaxKind.DeclareKeyword)) {
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
if (decoratorNames(member).includes('Input'))
|
|
475
|
+
return false;
|
|
476
|
+
let references = 0;
|
|
477
|
+
const visit = (node) => {
|
|
478
|
+
if (node === member || node === getter)
|
|
479
|
+
return;
|
|
480
|
+
if (ts.isPropertyAccessExpression(node) &&
|
|
481
|
+
node.expression.kind === ts.SyntaxKind.ThisKeyword &&
|
|
482
|
+
node.name.text === name) {
|
|
483
|
+
references++;
|
|
484
|
+
}
|
|
485
|
+
ts.forEachChild(node, visit);
|
|
486
|
+
};
|
|
487
|
+
visit(cls);
|
|
488
|
+
if (references > 0)
|
|
489
|
+
return false;
|
|
490
|
+
if (wrapped.has(name))
|
|
491
|
+
return true;
|
|
492
|
+
wrapped.add(name);
|
|
493
|
+
needsStructureImport = true;
|
|
494
|
+
const arr = member.initializer;
|
|
495
|
+
const original = arr.getText(sf);
|
|
496
|
+
const base = lineIndent(tsContent, member.getStart(sf));
|
|
497
|
+
const step = ' ';
|
|
498
|
+
const replacement = original.includes('\n')
|
|
499
|
+
? `[\n${base}${step}{\n${base}${step}${step}type: 'row',\n${base}${step}${step}fields: ${reindent(original, step + step)},\n${base}${step}},\n${base}]`
|
|
500
|
+
: `[{ type: 'row', fields: ${original} }]`;
|
|
501
|
+
changes.push({ start: arr.getStart(sf), end: arr.getEnd(), replacement });
|
|
502
|
+
if (member.type) {
|
|
503
|
+
changes.push({ start: member.type.getStart(sf), end: member.type.getEnd(), replacement: 'DynamicStructure[]' });
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
const anchor = member.questionToken ?? member.exclamationToken ?? member.name;
|
|
507
|
+
changes.push({ start: anchor.getEnd(), end: anchor.getEnd(), replacement: ': DynamicStructure[]' });
|
|
508
|
+
}
|
|
509
|
+
if (getter) {
|
|
510
|
+
changes.push({ start: getter.getFullStart(), end: getter.getEnd(), replacement: '' });
|
|
511
|
+
}
|
|
512
|
+
return true;
|
|
513
|
+
};
|
|
514
|
+
const newTpl = tpl.replace(tagRe, (tag, tagOffset) => tag.replace(bindingRe, (match, fieldsExpr, getterProp, offset) => {
|
|
515
|
+
const line = (0, report_1.lineOf)(tpl, tagOffset + (offset ?? 0));
|
|
516
|
+
if (fieldsExpr !== undefined) {
|
|
517
|
+
const info = analyzeExpression(fieldsExpr);
|
|
518
|
+
if (info.kind === 'prop' && countIdentifierInTemplate(tpl, info.name) === 1) {
|
|
519
|
+
if (tryWrapAtOrigin(info.name, undefined))
|
|
520
|
+
return `[configs]="${info.name}"`;
|
|
521
|
+
}
|
|
522
|
+
ensureMemo();
|
|
523
|
+
manual.push({
|
|
524
|
+
line,
|
|
525
|
+
target: 'template',
|
|
526
|
+
message: `"[fields]" migrado para "[configs]" via "${MEMO_METHOD}(...)", que memoiza por referência do array: se "${fieldsExpr}" for mutado no lugar (push/splice), reatribua o array para atualizar o formulário.`,
|
|
527
|
+
});
|
|
528
|
+
return `[configs]="${MEMO_METHOD}(${fieldsExpr})"`;
|
|
529
|
+
}
|
|
530
|
+
if (getterProp !== undefined) {
|
|
531
|
+
const getterName = `${getterProp}Configs`;
|
|
532
|
+
const getter = cls.members.find((m) => ts.isGetAccessorDeclaration(m) && ts.isIdentifier(m.name) && m.name.text === getterName);
|
|
533
|
+
const body = getter?.body?.getText(sf) ?? '';
|
|
534
|
+
const source = /^\{\s*return\s+dynamicTypeToDynamicStructure\(\s*this\.([\w$]+)\s*\)\s*;?\s*\}$/.exec(body);
|
|
535
|
+
if (!getter || !source)
|
|
536
|
+
return match;
|
|
537
|
+
const prop = source[1];
|
|
538
|
+
if (countIdentifierInTemplate(tpl, getterName) === 1 && countIdentifierInTemplate(tpl, prop) === 0) {
|
|
539
|
+
if (tryWrapAtOrigin(prop, getter))
|
|
540
|
+
return `[configs]="${prop}"`;
|
|
541
|
+
}
|
|
542
|
+
ensureMemo();
|
|
543
|
+
changes.push({
|
|
544
|
+
start: getter.body.getStart(sf),
|
|
545
|
+
end: getter.body.getEnd(),
|
|
546
|
+
replacement: `{\n${indent}${indent}return this.${MEMO_METHOD}(this.${prop});\n${indent}}`,
|
|
547
|
+
});
|
|
548
|
+
manual.push({
|
|
549
|
+
line: (0, report_1.lineOf)(tsContent, getter.getStart(sf)),
|
|
550
|
+
target: 'code',
|
|
551
|
+
message: `O getter "${getterName}" agora memoiza o resultado por referência de "${prop}": se o array for mutado no lugar (push/splice), reatribua-o para atualizar o formulário.`,
|
|
552
|
+
});
|
|
553
|
+
return match;
|
|
554
|
+
}
|
|
555
|
+
// [configs]="dynamicTypeToConfigs(expr)" gerado pelo v19: só garante a memoização do método.
|
|
556
|
+
if (ensureMemo()) {
|
|
557
|
+
manual.push({
|
|
558
|
+
line,
|
|
559
|
+
target: 'template',
|
|
560
|
+
message: `O método "${MEMO_METHOD}" agora memoiza por referência do array: se ele for mutado no lugar (push/splice), reatribua o array para atualizar o formulário.`,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
return match;
|
|
564
|
+
}));
|
|
565
|
+
if (changes.length === 0 && newTpl === tpl)
|
|
566
|
+
return { ts: tsContent, html, manual: [] };
|
|
567
|
+
if (inline && newTpl !== tpl) {
|
|
568
|
+
changes.push({ start: inline.start, end: inline.end, replacement: newTpl });
|
|
569
|
+
}
|
|
570
|
+
let updatedTs = changes.length > 0 ? (0, ast_utils_1.applyChanges)(tsContent, changes) : tsContent;
|
|
571
|
+
if (needsMemoImports) {
|
|
572
|
+
for (const name of ['DynamicType', 'DynamicStructure', 'dynamicTypeToDynamicStructure']) {
|
|
573
|
+
updatedTs = (0, ast_utils_1.ensureNamedImport)(updatedTs, name, DYNAMIC_FORM);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
else if (needsStructureImport) {
|
|
577
|
+
updatedTs = (0, ast_utils_1.ensureNamedImport)(updatedTs, 'DynamicStructure', DYNAMIC_FORM);
|
|
578
|
+
}
|
|
579
|
+
if (wrapped.size > 0) {
|
|
580
|
+
// O getter `*Configs` (que chamava `dynamicTypeToDynamicStructure`) e o tipo do array saem da classe:
|
|
581
|
+
// limpa o que deixou de ser referenciado.
|
|
582
|
+
for (const name of ['DynamicType', 'ExpandedDynamicType', 'dynamicTypeToDynamicStructure']) {
|
|
583
|
+
updatedTs = removeUnusedImport(updatedTs, name);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return { ts: updatedTs, html: html === undefined ? undefined : newTpl, manual };
|
|
587
|
+
}
|
|
588
|
+
// ─── Rule ─────────────────────────────────────────────────────────────────────
|
|
589
|
+
function migrateDeprecatedDynamicForm(options, report) {
|
|
590
|
+
return (tree, context) => {
|
|
591
|
+
const tsFiles = [];
|
|
592
|
+
const htmlFiles = [];
|
|
593
|
+
(0, scope_1.visitScopedFiles)(tree, options, context, (path) => {
|
|
594
|
+
if (path.includes('/dist/') || path.endsWith('.d.ts'))
|
|
595
|
+
return;
|
|
596
|
+
if (path.endsWith('.ts'))
|
|
597
|
+
tsFiles.push(path);
|
|
598
|
+
else if (path.endsWith('.html'))
|
|
599
|
+
htmlFiles.push(path);
|
|
600
|
+
});
|
|
601
|
+
const changed = new Set();
|
|
602
|
+
const write = (path, content, updated) => {
|
|
603
|
+
if (updated === content)
|
|
604
|
+
return;
|
|
605
|
+
tree.overwrite(path, (0, eol_1.preserveLineEndings)(content, updated));
|
|
606
|
+
changed.add(path);
|
|
607
|
+
};
|
|
608
|
+
// 1) Tipos de campo e propriedades depreciadas.
|
|
609
|
+
for (const path of tsFiles) {
|
|
610
|
+
const content = tree.readText(path);
|
|
611
|
+
const result = migrateFieldTypesInContent(content);
|
|
612
|
+
write(path, content, result.updated);
|
|
613
|
+
for (const m of result.manual) {
|
|
614
|
+
report.addManual(exports.ITEM_ID, { file: path, line: m.line, message: m.message }, context);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
// 2) [fields] -> [configs] em templates inline.
|
|
618
|
+
for (const path of tsFiles) {
|
|
619
|
+
const content = tree.readText(path);
|
|
620
|
+
if (!content.includes('s-dynamic-form'))
|
|
621
|
+
continue;
|
|
622
|
+
const result = migrateFieldsBindingsInContent(content);
|
|
623
|
+
write(path, content, result.ts);
|
|
624
|
+
for (const m of result.manual) {
|
|
625
|
+
report.addManual(exports.ITEM_ID, { file: path, line: m.line, message: m.message }, context);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
// 3) [fields] -> [configs] em templates externos (pareados com o .ts de mesmo nome).
|
|
629
|
+
for (const htmlPath of htmlFiles) {
|
|
630
|
+
const html = tree.readText(htmlPath);
|
|
631
|
+
if (!html.includes('s-dynamic-form'))
|
|
632
|
+
continue;
|
|
633
|
+
if (!html.includes('[fields]') && !html.includes('[configs]'))
|
|
634
|
+
continue;
|
|
635
|
+
const tsPath = htmlPath.replace(/\.html$/, '.ts');
|
|
636
|
+
if (!tree.exists(tsPath)) {
|
|
637
|
+
if (html.includes('[fields]')) {
|
|
638
|
+
report.addManual(exports.ITEM_ID, {
|
|
639
|
+
file: htmlPath,
|
|
640
|
+
message: `Não foi possível encontrar ${tsPath.replace(/^\//, '')}: troque "[fields]" por "[configs]" manualmente (DynamicStructure[]).`,
|
|
641
|
+
}, context);
|
|
642
|
+
}
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
645
|
+
const tsContent = tree.readText(tsPath);
|
|
646
|
+
const result = migrateFieldsBindingsInContent(tsContent, html);
|
|
647
|
+
write(tsPath, tsContent, result.ts);
|
|
648
|
+
if (result.html !== undefined)
|
|
649
|
+
write(htmlPath, html, result.html);
|
|
650
|
+
for (const m of result.manual) {
|
|
651
|
+
report.addManual(exports.ITEM_ID, { file: m.target === 'template' ? htmlPath : tsPath, line: m.line, message: m.message }, context);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
for (const path of changed)
|
|
655
|
+
report.markChanged(exports.ITEM_ID, path);
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
function migrate(options = {}) {
|
|
659
|
+
return migrateDeprecatedDynamicForm(options, new report_1.MigrationReport());
|
|
660
|
+
}
|
|
661
|
+
//# sourceMappingURL=index.js.map
|