ngx-axis-appforge 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +17 -0
- package/README.md +111 -0
- package/angular.json +40 -0
- package/axis-components/badge/badge.css +3 -0
- package/axis-components/badge/badge.html +20 -0
- package/axis-components/badge/badge.options.ts +23 -0
- package/axis-components/badge/badge.ts +17 -0
- package/axis-components/badge/design/config.ts +52 -0
- package/axis-components/badge/design/ng-package.json +5 -0
- package/axis-components/badge/design/setting/setting.css +0 -0
- package/axis-components/badge/design/setting/setting.html +181 -0
- package/axis-components/badge/design/setting/setting.ts +126 -0
- package/axis-components/badge/ng-package.json +5 -0
- package/axis-components/button/button.css +3 -0
- package/axis-components/button/button.html +13 -0
- package/axis-components/button/button.options.ts +17 -0
- package/axis-components/button/button.ts +56 -0
- package/axis-components/button/design/config.ts +30 -0
- package/axis-components/button/design/ng-package.json +5 -0
- package/axis-components/button/design/setting/setting.css +0 -0
- package/axis-components/button/design/setting/setting.html +151 -0
- package/axis-components/button/design/setting/setting.ts +76 -0
- package/axis-components/button/ng-package.json +5 -0
- package/axis-components/cmp-map.ts +52 -0
- package/axis-components/cmplib.ts +9 -0
- package/axis-components/desc/desc.css +8 -0
- package/axis-components/desc/desc.html +19 -0
- package/axis-components/desc/desc.options.ts +24 -0
- package/axis-components/desc/desc.ts +29 -0
- package/axis-components/desc/design/config.ts +113 -0
- package/axis-components/desc/design/desc-item-setting/desc-item-setting.css +0 -0
- package/axis-components/desc/design/desc-item-setting/desc-item-setting.html +47 -0
- package/axis-components/desc/design/desc-item-setting/desc-item-setting.ts +40 -0
- package/axis-components/desc/design/desc-items-menu/desc-items-menu.css +0 -0
- package/axis-components/desc/design/desc-items-menu/desc-items-menu.html +9 -0
- package/axis-components/desc/design/desc-items-menu/desc-items-menu.ts +23 -0
- package/axis-components/desc/design/desc-setting/desc-setting.css +0 -0
- package/axis-components/desc/design/desc-setting/desc-setting.html +76 -0
- package/axis-components/desc/design/desc-setting/desc-setting.ts +51 -0
- package/axis-components/desc/design/ng-package.json +5 -0
- package/axis-components/desc/ng-package.json +5 -0
- package/axis-components/design/cmplib/cmplib.css +5 -0
- package/axis-components/design/cmplib/cmplib.html +52 -0
- package/axis-components/design/cmplib/cmplib.ts +96 -0
- package/axis-components/design/design/config.ts +29 -0
- package/axis-components/design/design/ng-package.json +5 -0
- package/axis-components/design/design/setting/setting.css +0 -0
- package/axis-components/design/design/setting/setting.html +33 -0
- package/axis-components/design/design/setting/setting.ts +33 -0
- package/axis-components/design/design.css +15 -0
- package/axis-components/design/design.html +51 -0
- package/axis-components/design/design.options.ts +9 -0
- package/axis-components/design/design.ts +509 -0
- package/axis-components/design/ng-package.json +5 -0
- package/axis-components/design/preview/drag.service.ts +148 -0
- package/axis-components/design/preview/drop-handler.ts +56 -0
- package/axis-components/design/preview/preview.css +3 -0
- package/axis-components/design/preview/preview.html +1 -0
- package/axis-components/design/preview/preview.ts +250 -0
- package/axis-components/design/preview/select.service.ts +140 -0
- package/axis-components/design/shortcut-key.ts +160 -0
- package/axis-components/design/toolbar/toolbar.css +24 -0
- package/axis-components/design/toolbar/toolbar.html +96 -0
- package/axis-components/design/toolbar/toolbar.ts +65 -0
- package/axis-components/design/tree/drag-drop.ts +125 -0
- package/axis-components/design/tree/tree.css +30 -0
- package/axis-components/design/tree/tree.html +49 -0
- package/axis-components/design/tree/tree.ts +292 -0
- package/axis-components/dynamic-container/design/config.ts +30 -0
- package/axis-components/dynamic-container/design/ng-package.json +5 -0
- package/axis-components/dynamic-container/design/setting/setting.css +0 -0
- package/axis-components/dynamic-container/design/setting/setting.html +20 -0
- package/axis-components/dynamic-container/design/setting/setting.ts +30 -0
- package/axis-components/dynamic-container/dynamic-container.css +3 -0
- package/axis-components/dynamic-container/dynamic-container.html +2 -0
- package/axis-components/dynamic-container/dynamic-container.options.ts +6 -0
- package/axis-components/dynamic-container/dynamic-container.ts +17 -0
- package/axis-components/dynamic-container/ng-package.json +5 -0
- package/axis-components/editor/editor.css +47 -0
- package/axis-components/editor/editor.html +10 -0
- package/axis-components/editor/editor.options.ts +10 -0
- package/axis-components/editor/editor.ts +86 -0
- package/axis-components/editor/ng-package.json +5 -0
- package/axis-components/examples/examples/badge.ts +17 -0
- package/axis-components/examples/examples/button.ts +38 -0
- package/axis-components/examples/examples/desc.ts +31 -0
- package/axis-components/examples/examples/design.ts +15 -0
- package/axis-components/examples/examples/dynamic-container.ts +21 -0
- package/axis-components/examples/examples/flex.ts +18 -0
- package/axis-components/examples/examples/form-item.ts +39 -0
- package/axis-components/examples/examples/form.ts +315 -0
- package/axis-components/examples/examples/icon.ts +16 -0
- package/axis-components/examples/examples/image.ts +15 -0
- package/axis-components/examples/examples/input-component.ts +15 -0
- package/axis-components/examples/examples/input-icon.ts +15 -0
- package/axis-components/examples/examples/input-json.ts +15 -0
- package/axis-components/examples/examples/input-number.ts +15 -0
- package/axis-components/examples/examples/input.ts +15 -0
- package/axis-components/examples/examples/modal.ts +15 -0
- package/axis-components/examples/examples/scope.ts +17 -0
- package/axis-components/examples/examples/single-selector.ts +25 -0
- package/axis-components/examples/examples/splitter.ts +36 -0
- package/axis-components/examples/examples/table.ts +126 -0
- package/axis-components/examples/examples/text.ts +15 -0
- package/axis-components/examples/examples/textarea.ts +15 -0
- package/axis-components/examples/examples/tree-selector.ts +35 -0
- package/axis-components/examples/examples/upload.ts +15 -0
- package/axis-components/examples/examples.ts +73 -0
- package/axis-components/flex/design/config.ts +49 -0
- package/axis-components/flex/design/ng-package.json +5 -0
- package/axis-components/flex/design/setting/setting.css +0 -0
- package/axis-components/flex/design/setting/setting.html +72 -0
- package/axis-components/flex/design/setting/setting.ts +43 -0
- package/axis-components/flex/flex.css +5 -0
- package/axis-components/flex/flex.html +6 -0
- package/axis-components/flex/flex.options.ts +12 -0
- package/axis-components/flex/flex.ts +15 -0
- package/axis-components/flex/ng-package.json +5 -0
- package/axis-components/form/design/config.ts +71 -0
- package/axis-components/form/design/ng-package.json +5 -0
- package/axis-components/form/design/setting/setting.css +0 -0
- package/axis-components/form/design/setting/setting.html +21 -0
- package/axis-components/form/design/setting/setting.ts +31 -0
- package/axis-components/form/form.css +3 -0
- package/axis-components/form/form.html +3 -0
- package/axis-components/form/form.options.ts +9 -0
- package/axis-components/form/form.ts +121 -0
- package/axis-components/form/ng-package.json +5 -0
- package/axis-components/form-item/design/config.ts +43 -0
- package/axis-components/form-item/design/ng-package.json +5 -0
- package/axis-components/form-item/design/setting/input-validator/input-validator.css +8 -0
- package/axis-components/form-item/design/setting/input-validator/input-validator.html +140 -0
- package/axis-components/form-item/design/setting/input-validator/input-validator.ts +158 -0
- package/axis-components/form-item/design/setting/setting.css +0 -0
- package/axis-components/form-item/design/setting/setting.html +39 -0
- package/axis-components/form-item/design/setting/setting.ts +40 -0
- package/axis-components/form-item/form-item.css +4 -0
- package/axis-components/form-item/form-item.html +16 -0
- package/axis-components/form-item/form-item.options.ts +12 -0
- package/axis-components/form-item/form-item.ts +128 -0
- package/axis-components/form-item/ng-package.json +5 -0
- package/axis-components/icon/design/config.ts +29 -0
- package/axis-components/icon/design/ng-package.json +5 -0
- package/axis-components/icon/design/setting/setting.css +0 -0
- package/axis-components/icon/design/setting/setting.html +67 -0
- package/axis-components/icon/design/setting/setting.ts +48 -0
- package/axis-components/icon/icon.css +0 -0
- package/axis-components/icon/icon.html +7 -0
- package/axis-components/icon/icon.options.ts +10 -0
- package/axis-components/icon/icon.ts +17 -0
- package/axis-components/icon/ng-package.json +5 -0
- package/axis-components/image/design/config.ts +30 -0
- package/axis-components/image/design/ng-package.json +5 -0
- package/axis-components/image/design/setting/setting.css +0 -0
- package/axis-components/image/design/setting/setting.html +42 -0
- package/axis-components/image/design/setting/setting.ts +37 -0
- package/axis-components/image/image.css +58 -0
- package/axis-components/image/image.html +14 -0
- package/axis-components/image/image.options.ts +8 -0
- package/axis-components/image/image.ts +29 -0
- package/axis-components/image/ng-package.json +5 -0
- package/axis-components/input/design/config.ts +80 -0
- package/axis-components/input/design/ng-package.json +5 -0
- package/axis-components/input/design/setting/setting.css +0 -0
- package/axis-components/input/design/setting/setting.html +79 -0
- package/axis-components/input/design/setting/setting.ts +51 -0
- package/axis-components/input/input.css +4 -0
- package/axis-components/input/input.html +32 -0
- package/axis-components/input/input.options.ts +14 -0
- package/axis-components/input/input.ts +53 -0
- package/axis-components/input/ng-package.json +5 -0
- package/axis-components/input-component/design/config.ts +30 -0
- package/axis-components/input-component/design/ng-package.json +5 -0
- package/axis-components/input-component/design/setting/setting.css +0 -0
- package/axis-components/input-component/design/setting/setting.html +33 -0
- package/axis-components/input-component/design/setting/setting.ts +33 -0
- package/axis-components/input-component/input-component.css +4 -0
- package/axis-components/input-component/input-component.html +25 -0
- package/axis-components/input-component/input-component.options.ts +7 -0
- package/axis-components/input-component/input-component.ts +50 -0
- package/axis-components/input-component/ng-package.json +5 -0
- package/axis-components/input-icon/design/config.ts +30 -0
- package/axis-components/input-icon/design/ng-package.json +5 -0
- package/axis-components/input-icon/design/setting/setting.css +0 -0
- package/axis-components/input-icon/design/setting/setting.html +29 -0
- package/axis-components/input-icon/design/setting/setting.ts +33 -0
- package/axis-components/input-icon/input-icon.css +4 -0
- package/axis-components/input-icon/input-icon.html +70 -0
- package/axis-components/input-icon/input-icon.options.ts +7 -0
- package/axis-components/input-icon/input-icon.ts +51 -0
- package/axis-components/input-icon/ng-package.json +5 -0
- package/axis-components/input-json/design/config.ts +29 -0
- package/axis-components/input-json/design/ng-package.json +5 -0
- package/axis-components/input-json/design/setting/setting.css +0 -0
- package/axis-components/input-json/design/setting/setting.html +7 -0
- package/axis-components/input-json/design/setting/setting.ts +26 -0
- package/axis-components/input-json/input-json.css +4 -0
- package/axis-components/input-json/input-json.html +19 -0
- package/axis-components/input-json/input-json.ts +67 -0
- package/axis-components/input-json/ng-package.json +5 -0
- package/axis-components/input-number/design/config.ts +30 -0
- package/axis-components/input-number/design/ng-package.json +5 -0
- package/axis-components/input-number/design/setting/setting.css +0 -0
- package/axis-components/input-number/design/setting/setting.html +118 -0
- package/axis-components/input-number/design/setting/setting.ts +66 -0
- package/axis-components/input-number/input-number.css +22 -0
- package/axis-components/input-number/input-number.html +11 -0
- package/axis-components/input-number/input-number.options.ts +17 -0
- package/axis-components/input-number/input-number.ts +30 -0
- package/axis-components/input-number/ng-package.json +5 -0
- package/axis-components/modal/design/config.ts +50 -0
- package/axis-components/modal/design/ng-package.json +5 -0
- package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.css +0 -0
- package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.html +15 -0
- package/axis-components/modal/design/set-modal-visible-handler/set-modal-visible-handler.ts +34 -0
- package/axis-components/modal/design/setting/setting.css +0 -0
- package/axis-components/modal/design/setting/setting.html +139 -0
- package/axis-components/modal/design/setting/setting.ts +92 -0
- package/axis-components/modal/modal.css +0 -0
- package/axis-components/modal/modal.html +7 -0
- package/axis-components/modal/modal.options.ts +20 -0
- package/axis-components/modal/modal.ts +57 -0
- package/axis-components/modal/ng-package.json +5 -0
- package/axis-components/ng-package.json +5 -0
- package/axis-components/scope/design/config.ts +59 -0
- package/axis-components/scope/design/ng-package.json +5 -0
- package/axis-components/scope/design/setting/datasource-editor/datasource-editor.css +28 -0
- package/axis-components/scope/design/setting/datasource-editor/datasource-editor.html +188 -0
- package/axis-components/scope/design/setting/datasource-editor/datasource-editor.ts +245 -0
- package/axis-components/scope/design/setting/setting.css +0 -0
- package/axis-components/scope/design/setting/setting.html +19 -0
- package/axis-components/scope/design/setting/setting.ts +30 -0
- package/axis-components/scope/ng-package.json +5 -0
- package/axis-components/scope/scope.css +6 -0
- package/axis-components/scope/scope.html +4 -0
- package/axis-components/scope/scope.options.ts +8 -0
- package/axis-components/scope/scope.ts +48 -0
- package/axis-components/single-selector/design/config.ts +30 -0
- package/axis-components/single-selector/design/ng-package.json +5 -0
- package/axis-components/single-selector/design/setting/setting.css +0 -0
- package/axis-components/single-selector/design/setting/setting.html +164 -0
- package/axis-components/single-selector/design/setting/setting.ts +80 -0
- package/axis-components/single-selector/ng-package.json +5 -0
- package/axis-components/single-selector/single-selector.css +8 -0
- package/axis-components/single-selector/single-selector.html +51 -0
- package/axis-components/single-selector/single-selector.options.ts +22 -0
- package/axis-components/single-selector/single-selector.ts +80 -0
- package/axis-components/splitter/design/config.ts +84 -0
- package/axis-components/splitter/design/ng-package.json +5 -0
- package/axis-components/splitter/design/splitter-menu/splitter-menu.css +0 -0
- package/axis-components/splitter/design/splitter-menu/splitter-menu.html +10 -0
- package/axis-components/splitter/design/splitter-menu/splitter-menu.ts +22 -0
- package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.css +0 -0
- package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.html +66 -0
- package/axis-components/splitter/design/splitter-panel-setting/splitter-panel-setting.ts +47 -0
- package/axis-components/splitter/design/splitter-setting/splitter-setting.css +0 -0
- package/axis-components/splitter/design/splitter-setting/splitter-setting.html +28 -0
- package/axis-components/splitter/design/splitter-setting/splitter-setting.ts +30 -0
- package/axis-components/splitter/ng-package.json +5 -0
- package/axis-components/splitter/splitter.css +7 -0
- package/axis-components/splitter/splitter.html +12 -0
- package/axis-components/splitter/splitter.options.ts +18 -0
- package/axis-components/splitter/splitter.ts +29 -0
- package/axis-components/table/design/config.ts +147 -0
- package/axis-components/table/design/ng-package.json +5 -0
- package/axis-components/table/design/table-field-setting/table-field-setting.css +0 -0
- package/axis-components/table/design/table-field-setting/table-field-setting.html +259 -0
- package/axis-components/table/design/table-field-setting/table-field-setting.ts +105 -0
- package/axis-components/table/design/table-fields-menu/table-fields-menu.css +0 -0
- package/axis-components/table/design/table-fields-menu/table-fields-menu.html +9 -0
- package/axis-components/table/design/table-fields-menu/table-fields-menu.ts +24 -0
- package/axis-components/table/design/table-setting/table-setting.css +0 -0
- package/axis-components/table/design/table-setting/table-setting.html +417 -0
- package/axis-components/table/design/table-setting/table-setting.ts +173 -0
- package/axis-components/table/expand.ts +12 -0
- package/axis-components/table/ng-package.json +5 -0
- package/axis-components/table/select.ts +66 -0
- package/axis-components/table/table-setter/table-setter.css +55 -0
- package/axis-components/table/table-setter/table-setter.html +38 -0
- package/axis-components/table/table-setter/table-setter.ts +121 -0
- package/axis-components/table/table.css +5 -0
- package/axis-components/table/table.html +191 -0
- package/axis-components/table/table.options.ts +72 -0
- package/axis-components/table/table.ts +204 -0
- package/axis-components/text/design/config.ts +30 -0
- package/axis-components/text/design/ng-package.json +5 -0
- package/axis-components/text/design/setting/setting.css +0 -0
- package/axis-components/text/design/setting/setting.html +84 -0
- package/axis-components/text/design/setting/setting.ts +54 -0
- package/axis-components/text/ng-package.json +5 -0
- package/axis-components/text/text.css +3 -0
- package/axis-components/text/text.html +17 -0
- package/axis-components/text/text.options.ts +10 -0
- package/axis-components/text/text.ts +54 -0
- package/axis-components/textarea/design/config.ts +30 -0
- package/axis-components/textarea/design/ng-package.json +5 -0
- package/axis-components/textarea/design/setting/setting.css +0 -0
- package/axis-components/textarea/design/setting/setting.html +76 -0
- package/axis-components/textarea/design/setting/setting.ts +55 -0
- package/axis-components/textarea/ng-package.json +5 -0
- package/axis-components/textarea/textarea.css +4 -0
- package/axis-components/textarea/textarea.html +11 -0
- package/axis-components/textarea/textarea.options.ts +13 -0
- package/axis-components/textarea/textarea.ts +49 -0
- package/axis-components/tree-selector/design/config.ts +55 -0
- package/axis-components/tree-selector/design/ng-package.json +5 -0
- package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.css +0 -0
- package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.html +9 -0
- package/axis-components/tree-selector/design/tree-selector-menu/tree-selector-menu.ts +26 -0
- package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.css +0 -0
- package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.html +80 -0
- package/axis-components/tree-selector/design/tree-selector-menu-setting/tree-selector-menu-setting.ts +58 -0
- package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.css +0 -0
- package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.html +235 -0
- package/axis-components/tree-selector/design/tree-selector-setting/tree-selector-setting.ts +87 -0
- package/axis-components/tree-selector/ng-package.json +5 -0
- package/axis-components/tree-selector/tree-selector.css +43 -0
- package/axis-components/tree-selector/tree-selector.html +65 -0
- package/axis-components/tree-selector/tree-selector.options.ts +50 -0
- package/axis-components/tree-selector/tree-selector.ts +252 -0
- package/axis-components/upload/design/config.ts +37 -0
- package/axis-components/upload/design/ng-package.json +5 -0
- package/axis-components/upload/design/setting/setting.css +0 -0
- package/axis-components/upload/design/setting/setting.html +288 -0
- package/axis-components/upload/design/setting/setting.ts +96 -0
- package/axis-components/upload/ng-package.json +5 -0
- package/axis-components/upload/upload.css +3 -0
- package/axis-components/upload/upload.html +36 -0
- package/axis-components/upload/upload.options.ts +29 -0
- package/axis-components/upload/upload.ts +130 -0
- package/axis-components-covers/badge.svg +1 -0
- package/axis-components-covers/button.svg +14 -0
- package/axis-components-covers/desc.svg +39 -0
- package/axis-components-covers/design.jpg +0 -0
- package/axis-components-covers/dynamic-container.svg +9 -0
- package/axis-components-covers/flex.svg +33 -0
- package/axis-components-covers/form-item.svg +22 -0
- package/axis-components-covers/form.svg +38 -0
- package/axis-components-covers/icon.svg +22 -0
- package/axis-components-covers/image.svg +13 -0
- package/axis-components-covers/input-component.svg +27 -0
- package/axis-components-covers/input-icon.svg +29 -0
- package/axis-components-covers/input-json.svg +29 -0
- package/axis-components-covers/input-number.svg +35 -0
- package/axis-components-covers/input.svg +21 -0
- package/axis-components-covers/modal.svg +23 -0
- package/axis-components-covers/scope.svg +9 -0
- package/axis-components-covers/single-selector.svg +20 -0
- package/axis-components-covers/splitter.svg +8 -0
- package/axis-components-covers/table.svg +27 -0
- package/axis-components-covers/text.svg +22 -0
- package/axis-components-covers/textarea.svg +9 -0
- package/axis-components-covers/tree-selector.svg +77 -0
- package/axis-components-covers/upload.svg +26 -0
- package/core/base/base-menu.ts +22 -0
- package/core/base/base.ts +143 -0
- package/core/base/design-builder.ts +8 -0
- package/core/base/funfield-base.ts +106 -0
- package/core/base/funfield-value-base.ts +53 -0
- package/core/base/value-access.ts +70 -0
- package/core/directives/dynamic.ts +216 -0
- package/core/directives/scope.ts +432 -0
- package/core/models/api.options.ts +5 -0
- package/core/models/base.options.ts +11 -0
- package/core/models/cmplib.ts +7 -0
- package/core/models/data-source.options.ts +11 -0
- package/core/models/data.options.ts +6 -0
- package/core/models/design-build.ts +26 -0
- package/core/models/design-config.ts +14 -0
- package/core/models/design-tree-node.ts +16 -0
- package/core/models/event-desc.ts +28 -0
- package/core/models/event-handler.ts +6 -0
- package/core/models/event.options.ts +14 -0
- package/core/models/examples.ts +21 -0
- package/core/models/form-registe.options.ts +12 -0
- package/core/models/fun-field.options.ts +6 -0
- package/core/models/initobs.ts +8 -0
- package/core/models/options-node.ts +149 -0
- package/core/models/static-data-source.options.ts +4 -0
- package/core/models/trigge-events.options.ts +3 -0
- package/core/models/value-access.options.ts +10 -0
- package/core/ng-package.json +5 -0
- package/core/pipes/how-long.pipe.ts +69 -0
- package/core/public-api.ts +39 -0
- package/core/share/api-handler/api-handler.css +0 -0
- package/core/share/api-handler/api-handler.html +38 -0
- package/core/share/api-handler/api-handler.ts +51 -0
- package/core/share/array-filter-handler/array-filter-handler.css +0 -0
- package/core/share/array-filter-handler/array-filter-handler.html +26 -0
- package/core/share/array-filter-handler/array-filter-handler.ts +65 -0
- package/core/share/array-filter-handler/input-filter-options/filter-options.css +19 -0
- package/core/share/array-filter-handler/input-filter-options/filter-options.html +57 -0
- package/core/share/array-filter-handler/input-filter-options/filter-options.ts +100 -0
- package/core/share/base-design-setting/base-design-setting.css +0 -0
- package/core/share/base-design-setting/base-design-setting.html +50 -0
- package/core/share/base-design-setting/base-design-setting.ts +55 -0
- package/core/share/base-event-handler-descs.ts +100 -0
- package/core/share/common-menu/common-menu.css +0 -0
- package/core/share/common-menu/common-menu.html +21 -0
- package/core/share/common-menu/common-menu.ts +73 -0
- package/core/share/data-handler/data-handler.css +0 -0
- package/core/share/data-handler/data-handler.html +13 -0
- package/core/share/data-handler/data-handler.ts +39 -0
- package/core/share/events-handler.service.ts +185 -0
- package/core/share/fun-field/fun-field.css +55 -0
- package/core/share/fun-field/fun-field.html +175 -0
- package/core/share/fun-field/fun-field.ts +363 -0
- package/core/share/input-trigger/input-trigger.css +16 -0
- package/core/share/input-trigger/input-trigger.html +114 -0
- package/core/share/input-trigger/input-trigger.ts +394 -0
- package/core/share/msg-tip-handler/msg-tip-handler.css +0 -0
- package/core/share/msg-tip-handler/msg-tip-handler.html +40 -0
- package/core/share/msg-tip-handler/msg-tip-handler.ts +46 -0
- package/core/share/refresh-data-source-handler/refresh-data-source-handler.css +0 -0
- package/core/share/refresh-data-source-handler/refresh-data-source-handler.html +29 -0
- package/core/share/refresh-data-source-handler/refresh-data-source-handler.ts +55 -0
- package/core/share/route-handler/route-handler.css +0 -0
- package/core/share/route-handler/route-handler.html +49 -0
- package/core/share/route-handler/route-handler.ts +51 -0
- package/core/share/set-data-source-handler/set-data-source-handler.css +0 -0
- package/core/share/set-data-source-handler/set-data-source-handler.html +23 -0
- package/core/share/set-data-source-handler/set-data-source-handler.ts +44 -0
- package/core/share/simple-menu/simple-menu.css +0 -0
- package/core/share/simple-menu/simple-menu.html +5 -0
- package/core/share/simple-menu/simple-menu.ts +17 -0
- package/core/share/tokens.ts +29 -0
- package/core/share/value-design-setting/value-design-setting.css +0 -0
- package/core/share/value-design-setting/value-design-setting.html +48 -0
- package/core/share/value-design-setting/value-design-setting.ts +54 -0
- package/core/utils/code-name.utils.ts +19 -0
- package/core/utils/components-loader.ts +29 -0
- package/core/utils/declaration.utils.ts +38 -0
- package/core/utils/dynamic.util.ts +57 -0
- package/core/utils/form-validators.ts +160 -0
- package/core/utils/form.util.ts +25 -0
- package/core/utils/http.utils.ts +8 -0
- package/core/utils/object.utils.ts +182 -0
- package/core/utils/scripts-loader.ts +25 -0
- package/ng-package.json +13 -0
- package/package.json +37 -0
- package/providers/ng-package.json +5 -0
- package/providers/providers.ts +44 -0
- package/providers/public-api.ts +1 -0
- package/public-api.ts +1 -0
- package/tsconfig.json +38 -0
- package/tsconfig.lib.json +19 -0
- package/tsconfig.lib.prod.json +11 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Directive, inject, ViewChild } from '@angular/core';
|
|
2
|
+
import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
|
|
3
|
+
import { AXIS_DESIGN_OPTIONS_NODE_FOR_MENU } from '../share/tokens';
|
|
4
|
+
import { OptionsNode } from '../models/options-node';
|
|
5
|
+
|
|
6
|
+
@Directive()
|
|
7
|
+
export abstract class BaseMenu {
|
|
8
|
+
|
|
9
|
+
private readonly contextMenuService: NzContextMenuService = inject(NzContextMenuService);
|
|
10
|
+
readonly optionsNodes: { current: OptionsNode, parent?: OptionsNode } = inject(AXIS_DESIGN_OPTIONS_NODE_FOR_MENU);
|
|
11
|
+
|
|
12
|
+
@ViewChild("menu", { static: true })
|
|
13
|
+
menu!: NzDropdownMenuComponent;
|
|
14
|
+
|
|
15
|
+
onChange: any;
|
|
16
|
+
|
|
17
|
+
contextMenu(e: MouseEvent): void {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
this.contextMenuService.create(e, this.menu);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { AfterViewInit, Directive, HostBinding, inject, Injector, isSignal, OnDestroy, WritableSignal } from "@angular/core";
|
|
2
|
+
import { merge, Observable, of, Subscription } from "rxjs";
|
|
3
|
+
import { ScopeDirective } from "../directives/scope";
|
|
4
|
+
import { EventsHandlerService } from "../share/events-handler.service";
|
|
5
|
+
import { BaseOptions } from "../models/base.options";
|
|
6
|
+
import { EventHandlerOptions } from "../models/event.options";
|
|
7
|
+
import { TriggeEventsOptions } from "../models/trigge-events.options";
|
|
8
|
+
import { loadScripts } from "../utils/scripts-loader";
|
|
9
|
+
|
|
10
|
+
@Directive()
|
|
11
|
+
export abstract class Base<T extends BaseOptions> implements OnDestroy, AfterViewInit {
|
|
12
|
+
|
|
13
|
+
onAfterViewInit?: Function;
|
|
14
|
+
injector = inject(Injector);
|
|
15
|
+
isDesign = false;
|
|
16
|
+
protected options!: T;
|
|
17
|
+
private eventsService = inject(EventsHandlerService)
|
|
18
|
+
private scope: ScopeDirective | null = inject(ScopeDirective, { optional: true });
|
|
19
|
+
private _sub: { [tag: string]: Subscription[] } = { "default": [] };
|
|
20
|
+
|
|
21
|
+
@HostBinding('style')
|
|
22
|
+
get style() {
|
|
23
|
+
return this.options.style()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ngAfterViewInit(): void {
|
|
27
|
+
this.onAfterViewInit?.();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async preloadImports(optionsConfig: any): Promise<void> {
|
|
31
|
+
const imports = new Set<string>();
|
|
32
|
+
Object.entries(optionsConfig).forEach(([key, value]) => {
|
|
33
|
+
if (key.startsWith("$")) {
|
|
34
|
+
((value as any).imports as any[]).forEach(i => imports.add(i));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
await Promise.all(Array.from(imports.values()).map(i => loadScripts(i)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
bindWithConfig(optionsConfig: any, config?: { options?: any, snapshot?: boolean, tag?: string, tempDataSource?: any }): void {
|
|
41
|
+
let options = config?.options ?? this.options;
|
|
42
|
+
let snapshot = config?.snapshot ?? false;
|
|
43
|
+
if (!snapshot) {
|
|
44
|
+
this.unsubscribe([options?.tag]);
|
|
45
|
+
}
|
|
46
|
+
if (this.scope && !snapshot) {
|
|
47
|
+
this.addAllSubscribe(this.scope.bindOptions(optionsConfig, options!, config?.tempDataSource), options?.tag ?? "bindWithConfig");
|
|
48
|
+
} else {
|
|
49
|
+
if (this.scope && snapshot) {
|
|
50
|
+
optionsConfig = this.scope.snapshotOptions(optionsConfig, config?.tempDataSource);
|
|
51
|
+
}
|
|
52
|
+
for (const en of Object.entries(options!)) {
|
|
53
|
+
const value = optionsConfig[en[0]];
|
|
54
|
+
if (value !== undefined) {
|
|
55
|
+
if (isSignal(en[1])) {
|
|
56
|
+
(en[1] as WritableSignal<any>).set(value);
|
|
57
|
+
} else {
|
|
58
|
+
(options as any)[en[0]] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
unsubscribeAll() {
|
|
66
|
+
Object.values(this._sub).forEach(srr => srr.forEach(s => s.unsubscribe()));
|
|
67
|
+
this._sub = { "default": [] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
unsubscribe(tags: string[]) {
|
|
71
|
+
Object.keys(this._sub)
|
|
72
|
+
.filter(tag => tags.includes(tag))
|
|
73
|
+
.forEach(tag => {
|
|
74
|
+
this._sub[tag].forEach(s => s.unsubscribe());
|
|
75
|
+
delete this._sub[tag];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
addSubscribe(sub: Subscription, tag: string = "default") {
|
|
80
|
+
if (!this._sub[tag]) {
|
|
81
|
+
this._sub[tag] = [];
|
|
82
|
+
}
|
|
83
|
+
this._sub[tag].push(sub);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
addAllSubscribe(subs: Subscription[], tag: string = "default") {
|
|
87
|
+
if (!this._sub[tag]) {
|
|
88
|
+
this._sub[tag] = [];
|
|
89
|
+
}
|
|
90
|
+
this._sub[tag] = this._sub[tag].concat(subs);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onEvents?(e: EventHandlerOptions<any>): Observable<boolean> | undefined;
|
|
94
|
+
|
|
95
|
+
hasEventHandler(trigger: string, triggeEvents?: TriggeEventsOptions): boolean {
|
|
96
|
+
const te = triggeEvents ?? this.options.triggeEvents();
|
|
97
|
+
return !!te?.[trigger]?.length;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
triggeEvents(trigger: string, tempDataSource?: any, triggeEvents?: TriggeEventsOptions, scope?: ScopeDirective): Observable<boolean> {
|
|
101
|
+
scope ??= this.scope ?? undefined;
|
|
102
|
+
const te = triggeEvents ?? this.options.triggeEvents();
|
|
103
|
+
if (te && te[trigger]) {
|
|
104
|
+
return merge(...te[trigger].filter(e => !scope?.snapshotField(e, "disabled", tempDataSource)).map(e => {
|
|
105
|
+
if (scope) {
|
|
106
|
+
e = scope.snapshotOptions(e, tempDataSource);
|
|
107
|
+
}
|
|
108
|
+
e.tempDataSource = tempDataSource;
|
|
109
|
+
return this.triggeEvent(e, scope);
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
return of(true);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
triggeEvent(e: EventHandlerOptions<unknown>, scope?: ScopeDirective): Observable<boolean> {
|
|
116
|
+
scope ??= this.scope ?? undefined;
|
|
117
|
+
console.log("triggeEvent", e);
|
|
118
|
+
e.ref = this;
|
|
119
|
+
let obs: Observable<boolean> | undefined;
|
|
120
|
+
switch (e.target) {
|
|
121
|
+
case "component":
|
|
122
|
+
if (e.id) {
|
|
123
|
+
obs = (scope)?.findInstance(e.id)?.onEvents?.(e);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
case "service":
|
|
127
|
+
obs = this.eventsService.onEvents(e);
|
|
128
|
+
break;
|
|
129
|
+
case "scope":
|
|
130
|
+
obs = scope?.onEvents(e);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return obs ?? of(true);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getScope(): ScopeDirective | null {
|
|
137
|
+
return this.scope;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ngOnDestroy(): void {
|
|
141
|
+
this.unsubscribeAll();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentRef } from "@angular/core";
|
|
2
|
+
import { ScopeDirective } from "../directives/scope";
|
|
3
|
+
|
|
4
|
+
export class DesignBuilder {
|
|
5
|
+
|
|
6
|
+
constructor(public buildElement: (ref: ComponentRef<any>, options: any) => void, public buildScope: (scope: ScopeDirective) => void) { }
|
|
7
|
+
|
|
8
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { inject } from "@angular/core";
|
|
2
|
+
import { FormBuilder, UntypedFormGroup } from "@angular/forms";
|
|
3
|
+
import { FunFieldValue } from "../share/fun-field/fun-field";
|
|
4
|
+
import { copy } from "../utils/object.utils";
|
|
5
|
+
import { FunFieldOptions } from "../models/fun-field.options";
|
|
6
|
+
import { updateAndValidAll } from "../utils/form.util";
|
|
7
|
+
|
|
8
|
+
export abstract class FunFieldBase {
|
|
9
|
+
|
|
10
|
+
private orivalue: any;
|
|
11
|
+
protected readonly fb = inject(FormBuilder);
|
|
12
|
+
abstract fg: UntypedFormGroup;
|
|
13
|
+
protected funFields: FunFieldOptions = {};
|
|
14
|
+
|
|
15
|
+
reset(value?: any) {
|
|
16
|
+
this.orivalue = value;
|
|
17
|
+
this.fg.patchValue(this.buildFunField(value), { emitEvent: false });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getValue(): any {
|
|
21
|
+
return this.recoverFunField(this.fg.value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
valid(): boolean {
|
|
25
|
+
return updateAndValidAll(this.fg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
buildFunField(obj: any, funFields?: FunFieldOptions): any {
|
|
29
|
+
funFields ??= this.funFields;
|
|
30
|
+
const cloneObj = obj ? copy(obj) : {};
|
|
31
|
+
if (funFields) {
|
|
32
|
+
Object.keys(funFields).forEach(f => {
|
|
33
|
+
let value;
|
|
34
|
+
if (funFields[f].child) {
|
|
35
|
+
if (Array.isArray(cloneObj[f])) {
|
|
36
|
+
value = cloneObj[f].map(item => this.buildFunField(item, funFields[f].child));
|
|
37
|
+
} else {
|
|
38
|
+
value = this.buildFunField(cloneObj[f], funFields[f].child);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
value = {
|
|
42
|
+
funMode: cloneObj.hasOwnProperty(`$${f}`),
|
|
43
|
+
originValue: undefined,
|
|
44
|
+
fnValue: {
|
|
45
|
+
fn: "return undefined;"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (value.funMode) {
|
|
49
|
+
value.fnValue = cloneObj[`$${f}`];
|
|
50
|
+
if (typeof (cloneObj[`$${f}`]) == "string") {
|
|
51
|
+
value.fnValue = {
|
|
52
|
+
fn: cloneObj[`$${f}`]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
delete cloneObj[`$${f}`];
|
|
56
|
+
} else {
|
|
57
|
+
if (cloneObj[f] !== undefined) {
|
|
58
|
+
value.originValue = cloneObj[f];
|
|
59
|
+
} else {
|
|
60
|
+
value.originValue = funFields[f].defaultValue;
|
|
61
|
+
}
|
|
62
|
+
value.fnValue = {
|
|
63
|
+
fn: `return ${JSON.stringify(value.originValue)}`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
cloneObj[f] = value;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return cloneObj;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
recoverFunField(obj: any, funFields?: FunFieldOptions, oriObj?: any) {
|
|
74
|
+
funFields ??= this.funFields;
|
|
75
|
+
oriObj ??= this.orivalue ?? {};
|
|
76
|
+
const cloneObj = obj ? copy(obj) : {};
|
|
77
|
+
const cloneOriObj = copy(oriObj);
|
|
78
|
+
if (obj && funFields) {
|
|
79
|
+
Object.keys(funFields).forEach(k => {
|
|
80
|
+
const f: FunFieldValue = cloneObj[k];
|
|
81
|
+
if (f) {
|
|
82
|
+
if (funFields[k].child) {
|
|
83
|
+
if (Array.isArray(cloneObj[k])) {
|
|
84
|
+
cloneObj[k] = cloneObj[k].map((item, i) => this.recoverFunField(item, funFields[k].child, cloneOriObj[k][i]));
|
|
85
|
+
} else {
|
|
86
|
+
cloneObj[k] = this.recoverFunField(cloneObj[k], funFields[k].child, cloneOriObj[k] ?? {});
|
|
87
|
+
}
|
|
88
|
+
delete cloneObj[`$${k}`];
|
|
89
|
+
} else {
|
|
90
|
+
if (f.funMode) {
|
|
91
|
+
cloneObj[`$${k}`] = f.fnValue;
|
|
92
|
+
delete cloneObj[k];
|
|
93
|
+
} else {
|
|
94
|
+
cloneObj[k] = f.originValue;
|
|
95
|
+
delete cloneObj[`$${k}`];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
delete cloneOriObj[k];
|
|
99
|
+
delete cloneOriObj[`$${k}`];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return Object.assign({}, cloneOriObj, cloneObj)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Directive, model, OnDestroy, OnInit } from "@angular/core";
|
|
2
|
+
import { ControlValueAccessor } from "@angular/forms";
|
|
3
|
+
import { Subscription } from "rxjs";
|
|
4
|
+
import { FunFieldBase } from "./funfield-base";
|
|
5
|
+
import { updateAndValidAll } from "../utils/form.util";
|
|
6
|
+
|
|
7
|
+
@Directive()
|
|
8
|
+
export abstract class FunFieldValueBase extends FunFieldBase implements OnInit, OnDestroy, ControlValueAccessor {
|
|
9
|
+
|
|
10
|
+
public onChange: any;
|
|
11
|
+
protected readonly value = model<any>();
|
|
12
|
+
protected readonly formValue = model<any>();
|
|
13
|
+
private sub!: Subscription;
|
|
14
|
+
protected sendInitValue = false;
|
|
15
|
+
|
|
16
|
+
writeValue(value: any): void {
|
|
17
|
+
this.value.set(value);
|
|
18
|
+
this.reset(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
registerOnChange(fn: any): void {
|
|
22
|
+
this.onChange = fn;
|
|
23
|
+
}
|
|
24
|
+
registerOnTouched(fn: any): void {
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override reset(value?: any): void {
|
|
28
|
+
super.reset(value);
|
|
29
|
+
this.formValue.set(this.fg.value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ngOnInit(): void {
|
|
33
|
+
this.formValue.set(this.fg.value);
|
|
34
|
+
if (this.sendInitValue) {
|
|
35
|
+
this.value.set(this.recoverFunField(this.fg.value));
|
|
36
|
+
this.onChange?.(this.value());
|
|
37
|
+
}
|
|
38
|
+
this.sub = this.fg.valueChanges.subscribe(v => {
|
|
39
|
+
this.formValue.set(v);
|
|
40
|
+
if (updateAndValidAll(this.fg)) {
|
|
41
|
+
this.value.set(this.recoverFunField(v));
|
|
42
|
+
this.onChange?.(this.value());
|
|
43
|
+
} else {
|
|
44
|
+
console.log("invalid", v)
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ngOnDestroy(): void {
|
|
50
|
+
this.sub.unsubscribe();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ControlValueAccessor } from "@angular/forms";
|
|
2
|
+
import { Base } from "./base";
|
|
3
|
+
import { Directive, effect, inject, model } from "@angular/core";
|
|
4
|
+
import { Observable, of } from "rxjs";
|
|
5
|
+
import { EventHandlerOptions } from "../models/event.options";
|
|
6
|
+
import { ValueAccessOptions } from "../models/value-access.options";
|
|
7
|
+
import { AXIS_FORMITEM_REGISTE_VALUE_ACCESS_TOKEN } from "../share/tokens";
|
|
8
|
+
import { RegisteValueAccessOptions } from "../models/form-registe.options";
|
|
9
|
+
|
|
10
|
+
@Directive()
|
|
11
|
+
export abstract class ValueAccess<T extends ValueAccessOptions> extends Base<T> implements ControlValueAccessor {
|
|
12
|
+
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
effect(() => {
|
|
16
|
+
if (this.options.initValue() !== undefined) {
|
|
17
|
+
this.setInitValue(this.options.initValue());
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected readonly value = model<any>(undefined);
|
|
23
|
+
private readonly registe = inject(AXIS_FORMITEM_REGISTE_VALUE_ACCESS_TOKEN, { optional: true });
|
|
24
|
+
|
|
25
|
+
setInitValue(value: any) {
|
|
26
|
+
this.registValueAccess({
|
|
27
|
+
initValue: value,
|
|
28
|
+
});
|
|
29
|
+
this.value.set(value);
|
|
30
|
+
if (value !== undefined && this.options.emitInitEvent()) {
|
|
31
|
+
this.triggeEvents("valueChange", { value: value });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onChange?: (value: any) => void;
|
|
36
|
+
onTouched?: (value: any) => {};
|
|
37
|
+
writeValue(value: any): void {
|
|
38
|
+
this.value.set(value);
|
|
39
|
+
if (value !== undefined) {
|
|
40
|
+
this.triggeEvents("valueChange", { value: value });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
registerOnChange(fn: any): void {
|
|
44
|
+
this.onChange = (value) => {
|
|
45
|
+
this.triggeEvents("valueChange", { value: value });
|
|
46
|
+
fn?.(value);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
registerOnTouched(fn: any): void {
|
|
50
|
+
this.onTouched = fn;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override onEvents(e: EventHandlerOptions<any>): Observable<boolean> | undefined {
|
|
54
|
+
const obs = super.onEvents?.(e);
|
|
55
|
+
if (obs) {
|
|
56
|
+
return obs;
|
|
57
|
+
}
|
|
58
|
+
switch (e.name) {
|
|
59
|
+
case "setValue":
|
|
60
|
+
this.writeValue(e.data?.data);
|
|
61
|
+
return of(true);
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected registValueAccess(opt: RegisteValueAccessOptions): void {
|
|
67
|
+
this.registe?.(opt);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Directive, effect, forwardRef, input, OnDestroy, Type, ViewContainerRef, inject, ComponentRef, Injector } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { ScopeDirective } from './scope';
|
|
4
|
+
import { Observable, Subscription } from 'rxjs';
|
|
5
|
+
import { Base } from '../base/base';
|
|
6
|
+
import { ValueAccess } from '../base/value-access';
|
|
7
|
+
import { BaseOptions } from '../models/base.options';
|
|
8
|
+
import { ValueAccessOptions } from '../models/value-access.options';
|
|
9
|
+
import { AXIS_COMPONENTS_LOADER_TOKEN, AXIS_CURRENT_USER_PERMISSIONS_TOKEN, AXIS_FORM_REGISTE_CONTROL_TOKEN, AXIS_FORMITEM_REGISTE_VALUE_ACCESS_TOKEN } from '../share/tokens';
|
|
10
|
+
import { DesignBuilder } from '../base/design-builder';
|
|
11
|
+
import { EventHandlerOptions } from '../models/event.options';
|
|
12
|
+
|
|
13
|
+
const DynamicComponentsMap = new Map<string, Type<any>>();
|
|
14
|
+
|
|
15
|
+
@Directive({
|
|
16
|
+
selector: '[axisDynamic]',
|
|
17
|
+
exportAs: 'axisDynamic',
|
|
18
|
+
providers: [
|
|
19
|
+
{
|
|
20
|
+
provide: NG_VALUE_ACCESSOR,
|
|
21
|
+
useExisting: forwardRef(() => DynamicDirective),
|
|
22
|
+
multi: true
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class DynamicDirective implements ControlValueAccessor, OnDestroy {
|
|
27
|
+
|
|
28
|
+
readonly axisDynamic = input.required<any>();
|
|
29
|
+
readonly standalone = input(false);
|
|
30
|
+
readonly isDesign = input(false);
|
|
31
|
+
|
|
32
|
+
private component?: string;
|
|
33
|
+
private sub?: Subscription;
|
|
34
|
+
private id?: string;
|
|
35
|
+
private readonly injector = inject(Injector);
|
|
36
|
+
private _designBuilder = inject(DesignBuilder, { optional: true });
|
|
37
|
+
private loader = inject(AXIS_COMPONENTS_LOADER_TOKEN);
|
|
38
|
+
readonly currentUserPermissions = inject(AXIS_CURRENT_USER_PERMISSIONS_TOKEN, { optional: true });
|
|
39
|
+
private container = inject(ViewContainerRef);
|
|
40
|
+
private _scope = inject(ScopeDirective, { optional: true });
|
|
41
|
+
private ref?: ComponentRef<Base<BaseOptions>>;
|
|
42
|
+
|
|
43
|
+
private get scope(): ScopeDirective | null {
|
|
44
|
+
return this.standalone() ? null : this._scope;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private get designBuilder(): DesignBuilder | null {
|
|
48
|
+
return !this.standalone() || this.isDesign() ? this._designBuilder : null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private get valueInstance(): ValueAccess<ValueAccessOptions> | undefined {
|
|
52
|
+
if (this.ref?.instance && this.ref.instance instanceof ValueAccess) {
|
|
53
|
+
return this.ref.instance;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onChange?: (value: any) => {};
|
|
59
|
+
onTouched?: (value: any) => {};
|
|
60
|
+
triggeEvent?: (e: EventHandlerOptions<any>) => Observable<boolean>;
|
|
61
|
+
onEvents?: (e: EventHandlerOptions<any>) => Observable<boolean> | undefined;
|
|
62
|
+
value: any;
|
|
63
|
+
|
|
64
|
+
constructor() {
|
|
65
|
+
effect(() => {
|
|
66
|
+
if (!this.axisDynamic()?.component) {
|
|
67
|
+
this.destoryInstance();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.sub?.unsubscribe();
|
|
71
|
+
if (!this.hasPermission() && !this.designBuilder) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let inuse = this.axisDynamic().inuse;
|
|
75
|
+
if (this.scope) {
|
|
76
|
+
const io = this.scope.dynamicField(this.axisDynamic(), "inuse");
|
|
77
|
+
if (io.init !== undefined) {
|
|
78
|
+
inuse = io.init;
|
|
79
|
+
}
|
|
80
|
+
if (io.obs) {
|
|
81
|
+
this.sub = io.obs.subscribe(inuse => {
|
|
82
|
+
if (inuse) {
|
|
83
|
+
if (this.id != this.axisDynamic().id) {
|
|
84
|
+
if (this.id) {
|
|
85
|
+
this.scope!.unRegistInstance(this.id);
|
|
86
|
+
}
|
|
87
|
+
this.id = this.axisDynamic().id;
|
|
88
|
+
}
|
|
89
|
+
this.render();
|
|
90
|
+
} else {
|
|
91
|
+
this.destoryInstance();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (inuse) {
|
|
97
|
+
if (this.id != this.axisDynamic().id) {
|
|
98
|
+
this.id = this.axisDynamic().id;
|
|
99
|
+
}
|
|
100
|
+
this.render();
|
|
101
|
+
} else {
|
|
102
|
+
this.destoryInstance();
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private hasPermission(): boolean {
|
|
108
|
+
const { requiredPermissions } = this.axisDynamic();
|
|
109
|
+
if (!requiredPermissions?.length) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return (requiredPermissions as string[]).every(permission => this.currentUserPermissions?.includes(permission));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private async render() {
|
|
116
|
+
if (this.axisDynamic()?.component && (!this.component || this.component != this.axisDynamic().component)) {
|
|
117
|
+
this.component = this.axisDynamic().component;
|
|
118
|
+
let componentType: Type<any> | undefined;
|
|
119
|
+
if (DynamicComponentsMap.has(this.component!)) {
|
|
120
|
+
componentType = DynamicComponentsMap.get(this.component!);
|
|
121
|
+
} else {
|
|
122
|
+
try {
|
|
123
|
+
componentType = await this.loader.loadComponent(this.component!);
|
|
124
|
+
DynamicComponentsMap.set(this.component!, componentType!);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
await this.scope?.preloadImports(this.axisDynamic());
|
|
130
|
+
this.container.clear();
|
|
131
|
+
this.ref = this.container.createComponent<Base<BaseOptions>>(componentType!, { injector: this.buildInjector() });
|
|
132
|
+
this.onEvents = this.ref.instance.onEvents?.bind(this.ref.instance);
|
|
133
|
+
this.triggeEvent = this.ref.instance.triggeEvent?.bind(this.ref.instance);
|
|
134
|
+
this.scope?.registInstance(this.axisDynamic().id, this.ref.instance)
|
|
135
|
+
this.ref.instance?.bindWithConfig(this.axisDynamic());
|
|
136
|
+
this.valueInstance?.registerOnChange(this.onChange);
|
|
137
|
+
this.valueInstance?.registerOnTouched(this.onTouched);
|
|
138
|
+
if (this.value !== undefined) {
|
|
139
|
+
this.valueInstance?.writeValue(this.value);
|
|
140
|
+
}
|
|
141
|
+
if (this.designBuilder) {
|
|
142
|
+
this.ref.instance.isDesign = true;
|
|
143
|
+
this.ref.instance!.onAfterViewInit = () => {
|
|
144
|
+
this.designBuilder!.buildElement(this.ref!, this.axisDynamic());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
this.ref?.instance?.bindWithConfig(this.axisDynamic());
|
|
149
|
+
this.designBuilder?.buildElement(this.ref!, this.axisDynamic());
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private buildInjector(): Injector | undefined {
|
|
154
|
+
if (this.standalone()) {
|
|
155
|
+
return Injector.create({
|
|
156
|
+
providers: [
|
|
157
|
+
{
|
|
158
|
+
provide: ScopeDirective,
|
|
159
|
+
useValue: null
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
provide: DynamicDirective,
|
|
163
|
+
useValue: null
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
provide: DesignBuilder,
|
|
167
|
+
useValue: this.isDesign() ? this.designBuilder : null
|
|
168
|
+
}, {
|
|
169
|
+
provide: AXIS_FORM_REGISTE_CONTROL_TOKEN,
|
|
170
|
+
useValue: null
|
|
171
|
+
}, {
|
|
172
|
+
provide: AXIS_FORMITEM_REGISTE_VALUE_ACCESS_TOKEN,
|
|
173
|
+
useValue: null
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
parent: this.injector
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return this.injector;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
forceRender(): void {
|
|
183
|
+
this.component = undefined;
|
|
184
|
+
this.id = undefined;
|
|
185
|
+
this.render();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
writeValue(value: any): void {
|
|
189
|
+
this.valueInstance?.writeValue(value);
|
|
190
|
+
this.value = value;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
registerOnChange(fn: any): void {
|
|
194
|
+
this.onChange = fn;
|
|
195
|
+
this.valueInstance?.registerOnChange(fn);
|
|
196
|
+
}
|
|
197
|
+
registerOnTouched(fn: any): void {
|
|
198
|
+
this.onTouched = fn;
|
|
199
|
+
this.valueInstance?.registerOnTouched(fn);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
destoryInstance() {
|
|
203
|
+
if (this.id) {
|
|
204
|
+
this.scope?.unRegistInstance(this.id);
|
|
205
|
+
this.id = undefined;
|
|
206
|
+
}
|
|
207
|
+
this.component = undefined;
|
|
208
|
+
this.container.clear();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
ngOnDestroy(): void {
|
|
212
|
+
this.sub?.unsubscribe();
|
|
213
|
+
this.destoryInstance();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}
|