ngx-axis-appforge 0.0.0-watch
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 +111 -0
- package/axis-components/badge/design/index.d.ts +5 -0
- package/axis-components/badge/design/index.d.ts.map +1 -0
- package/axis-components/badge/index.d.ts +27 -0
- package/axis-components/badge/index.d.ts.map +1 -0
- package/axis-components/button/design/index.d.ts +5 -0
- package/axis-components/button/index.d.ts +33 -0
- package/axis-components/checkbox/design/index.d.ts +5 -0
- package/axis-components/checkbox/design/index.d.ts.map +1 -0
- package/axis-components/checkbox/index.d.ts +32 -0
- package/axis-components/checkbox/index.d.ts.map +1 -0
- package/axis-components/color-picker/design/index.d.ts +5 -0
- package/axis-components/color-picker/design/index.d.ts.map +1 -0
- package/axis-components/color-picker/index.d.ts +20 -0
- package/axis-components/color-picker/index.d.ts.map +1 -0
- package/axis-components/cytoscape/design/index.d.ts +5 -0
- package/axis-components/cytoscape/design/index.d.ts.map +1 -0
- package/axis-components/cytoscape/index.d.ts +20 -0
- package/axis-components/cytoscape/index.d.ts.map +1 -0
- package/axis-components/date-picker/design/index.d.ts +5 -0
- package/axis-components/date-picker/design/index.d.ts.map +1 -0
- package/axis-components/date-picker/index.d.ts +36 -0
- package/axis-components/date-picker/index.d.ts.map +1 -0
- package/axis-components/desc/design/index.d.ts +5 -0
- package/axis-components/desc/design/index.d.ts.map +1 -0
- package/axis-components/desc/index.d.ts +30 -0
- package/axis-components/desc/index.d.ts.map +1 -0
- package/axis-components/design/design/index.d.ts +5 -0
- package/axis-components/design/index.d.ts +282 -0
- package/axis-components/dropdown/design/index.d.ts +5 -0
- package/axis-components/dropdown/design/index.d.ts.map +1 -0
- package/axis-components/dropdown/index.d.ts +25 -0
- package/axis-components/dropdown/index.d.ts.map +1 -0
- package/axis-components/dynamic-container/design/index.d.ts +5 -0
- package/axis-components/dynamic-container/design/index.d.ts.map +1 -0
- package/axis-components/dynamic-container/index.d.ts +44 -0
- package/axis-components/dynamic-container/index.d.ts.map +1 -0
- package/axis-components/dynamic-value/design/index.d.ts +5 -0
- package/axis-components/dynamic-value/design/index.d.ts.map +1 -0
- package/axis-components/dynamic-value/index.d.ts +16 -0
- package/axis-components/dynamic-value/index.d.ts.map +1 -0
- package/axis-components/edit-table/design/index.d.ts +5 -0
- package/axis-components/edit-table/design/index.d.ts.map +1 -0
- package/axis-components/edit-table/index.d.ts +106 -0
- package/axis-components/edit-table/index.d.ts.map +1 -0
- package/axis-components/editor/design/index.d.ts +5 -0
- package/axis-components/editor/index.d.ts +33 -0
- package/axis-components/flex/design/index.d.ts +5 -0
- package/axis-components/flex/index.d.ts +20 -0
- package/axis-components/form/design/index.d.ts +5 -0
- package/axis-components/form/index.d.ts +31 -0
- package/axis-components/form-item/design/index.d.ts +5 -0
- package/axis-components/form-item/index.d.ts +34 -0
- package/axis-components/icon/design/index.d.ts +5 -0
- package/axis-components/icon/index.d.ts +16 -0
- package/axis-components/image/design/index.d.ts +5 -0
- package/axis-components/image/design/index.d.ts.map +1 -0
- package/axis-components/image/index.d.ts +18 -0
- package/axis-components/image/index.d.ts.map +1 -0
- package/axis-components/index.d.ts +5 -0
- package/axis-components/index.d.ts.map +1 -0
- package/axis-components/input/design/index.d.ts +5 -0
- package/axis-components/input/index.d.ts +27 -0
- package/axis-components/input-component/design/index.d.ts +5 -0
- package/axis-components/input-component/design/index.d.ts.map +1 -0
- package/axis-components/input-component/index.d.ts +43 -0
- package/axis-components/input-component/index.d.ts.map +1 -0
- package/axis-components/input-icon/design/index.d.ts +5 -0
- package/axis-components/input-icon/index.d.ts +25 -0
- package/axis-components/input-json/design/index.d.ts +5 -0
- package/axis-components/input-json/index.d.ts +25 -0
- package/axis-components/input-number/design/index.d.ts +5 -0
- package/axis-components/input-number/design/index.d.ts.map +1 -0
- package/axis-components/input-number/index.d.ts +25 -0
- package/axis-components/input-number/index.d.ts.map +1 -0
- package/axis-components/menu/design/index.d.ts +5 -0
- package/axis-components/menu/design/index.d.ts.map +1 -0
- package/axis-components/menu/index.d.ts +43 -0
- package/axis-components/menu/index.d.ts.map +1 -0
- package/axis-components/modal/design/index.d.ts +5 -0
- package/axis-components/modal/design/index.d.ts.map +1 -0
- package/axis-components/modal/index.d.ts +33 -0
- package/axis-components/modal/index.d.ts.map +1 -0
- package/axis-components/radio/design/index.d.ts +5 -0
- package/axis-components/radio/design/index.d.ts.map +1 -0
- package/axis-components/radio/index.d.ts +31 -0
- package/axis-components/radio/index.d.ts.map +1 -0
- package/axis-components/rate/design/index.d.ts +5 -0
- package/axis-components/rate/design/index.d.ts.map +1 -0
- package/axis-components/rate/index.d.ts +16 -0
- package/axis-components/rate/index.d.ts.map +1 -0
- package/axis-components/rich-text-editor/design/index.d.ts +5 -0
- package/axis-components/rich-text-editor/design/index.d.ts.map +1 -0
- package/axis-components/rich-text-editor/index.d.ts +28 -0
- package/axis-components/rich-text-editor/index.d.ts.map +1 -0
- package/axis-components/scope/design/index.d.ts +5 -0
- package/axis-components/scope/index.d.ts +26 -0
- package/axis-components/select/design/index.d.ts +5 -0
- package/axis-components/select/index.d.ts +48 -0
- package/axis-components/single-selector/design/index.d.ts +5 -0
- package/axis-components/single-selector/index.d.ts +37 -0
- package/axis-components/splitter/design/index.d.ts +5 -0
- package/axis-components/splitter/design/index.d.ts.map +1 -0
- package/axis-components/splitter/index.d.ts +29 -0
- package/axis-components/splitter/index.d.ts.map +1 -0
- package/axis-components/steps/design/index.d.ts +5 -0
- package/axis-components/steps/design/index.d.ts.map +1 -0
- package/axis-components/steps/index.d.ts +38 -0
- package/axis-components/steps/index.d.ts.map +1 -0
- package/axis-components/switch/design/index.d.ts +5 -0
- package/axis-components/switch/design/index.d.ts.map +1 -0
- package/axis-components/switch/index.d.ts +23 -0
- package/axis-components/switch/index.d.ts.map +1 -0
- package/axis-components/table/design/index.d.ts +5 -0
- package/axis-components/table/index.d.ts +144 -0
- package/axis-components/table-helper/index.d.ts +220 -0
- package/axis-components/tabs/design/index.d.ts +5 -0
- package/axis-components/tabs/design/index.d.ts.map +1 -0
- package/axis-components/tabs/index.d.ts +38 -0
- package/axis-components/tabs/index.d.ts.map +1 -0
- package/axis-components/text/design/index.d.ts +5 -0
- package/axis-components/text/index.d.ts +24 -0
- package/axis-components/textarea/design/index.d.ts +5 -0
- package/axis-components/textarea/design/index.d.ts.map +1 -0
- package/axis-components/textarea/index.d.ts +25 -0
- package/axis-components/textarea/index.d.ts.map +1 -0
- package/axis-components/timer/design/index.d.ts +5 -0
- package/axis-components/timer/design/index.d.ts.map +1 -0
- package/axis-components/timer/index.d.ts +22 -0
- package/axis-components/timer/index.d.ts.map +1 -0
- package/axis-components/transfer/design/index.d.ts +5 -0
- package/axis-components/transfer/design/index.d.ts.map +1 -0
- package/axis-components/transfer/index.d.ts +113 -0
- package/axis-components/transfer/index.d.ts.map +1 -0
- package/axis-components/tree-selector/design/index.d.ts +5 -0
- package/axis-components/tree-selector/design/index.d.ts.map +1 -0
- package/axis-components/tree-selector/index.d.ts +80 -0
- package/axis-components/tree-selector/index.d.ts.map +1 -0
- package/axis-components/upload/design/index.d.ts +5 -0
- package/axis-components/upload/design/index.d.ts.map +1 -0
- package/axis-components/upload/index.d.ts +52 -0
- package/axis-components/upload/index.d.ts.map +1 -0
- package/axis-components-covers/badge.svg +1 -0
- package/axis-components-covers/button.svg +14 -0
- package/axis-components-covers/checkbox.svg +24 -0
- package/axis-components-covers/color-picker.svg +98 -0
- package/axis-components-covers/cytoscape.svg +17 -0
- package/axis-components-covers/date-picker.svg +28 -0
- package/axis-components-covers/desc.svg +39 -0
- package/axis-components-covers/design.jpg +0 -0
- package/axis-components-covers/dropdown.svg +39 -0
- package/axis-components-covers/dynamic-container.svg +9 -0
- package/axis-components-covers/dynamic-value.svg +32 -0
- package/axis-components-covers/edit-table.png +0 -0
- package/axis-components-covers/editor.png +0 -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/menu.svg +17 -0
- package/axis-components-covers/modal.svg +23 -0
- package/axis-components-covers/radio.svg +19 -0
- package/axis-components-covers/rate.svg +31 -0
- package/axis-components-covers/rich-text-editor.png +0 -0
- package/axis-components-covers/scope.svg +9 -0
- package/axis-components-covers/select.svg +20 -0
- package/axis-components-covers/splitter.svg +8 -0
- package/axis-components-covers/steps.svg +1 -0
- package/axis-components-covers/switch.svg +14 -0
- package/axis-components-covers/table.svg +27 -0
- package/axis-components-covers/tabs.svg +1 -0
- package/axis-components-covers/text.svg +22 -0
- package/axis-components-covers/textarea.svg +9 -0
- package/axis-components-covers/timer.svg +1 -0
- package/axis-components-covers/transfer.svg +86 -0
- package/axis-components-covers/tree-selector.svg +77 -0
- package/axis-components-covers/upload.svg +26 -0
- package/core/index.d.ts +853 -0
- package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs +191 -0
- package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs +39 -0
- package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs +120 -0
- package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-button.mjs +80 -0
- package/fesm2022/ngx-axis-appforge-axis-components-button.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs +92 -0
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs +119 -0
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs +97 -0
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs +34 -0
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs +63 -0
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs +54 -0
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs +115 -0
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs +104 -0
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs +224 -0
- package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs +51 -0
- package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs +83 -0
- package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs +1922 -0
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs +178 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs +55 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs +83 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs +149 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs +77 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs +29 -0
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs +344 -0
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs +332 -0
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs +75 -0
- package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs +99 -0
- package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs +98 -0
- package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs +31 -0
- package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs +108 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs +88 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs +97 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form.mjs +151 -0
- package/fesm2022/ngx-axis-appforge-axis-components-form.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs +88 -0
- package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs +28 -0
- package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs +75 -0
- package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-image.mjs +56 -0
- package/fesm2022/ngx-axis-appforge-axis-components-image.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs +83 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs +64 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs +142 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs +71 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs +75 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs +60 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs +74 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs +107 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs +48 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input.mjs +68 -0
- package/fesm2022/ngx-axis-appforge-axis-components-input.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs +356 -0
- package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs +98 -0
- package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs +181 -0
- package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs +74 -0
- package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs +104 -0
- package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs +100 -0
- package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs +80 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs +30 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs +76 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs +141 -0
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs +388 -0
- package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs +75 -0
- package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs +146 -0
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs +202 -0
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs +121 -0
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs +106 -0
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs +178 -0
- package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs +60 -0
- package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs +197 -0
- package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs +61 -0
- package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs +79 -0
- package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs +48 -0
- package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs +497 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs +650 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs +374 -0
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs +260 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs +69 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs +95 -0
- package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-text.mjs +64 -0
- package/fesm2022/ngx-axis-appforge-axis-components-text.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs +94 -0
- package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs +64 -0
- package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs +69 -0
- package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs +59 -0
- package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs +359 -0
- package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs +278 -0
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs +223 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs +337 -0
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs +146 -0
- package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs +175 -0
- package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-axis-components.mjs +1643 -0
- package/fesm2022/ngx-axis-appforge-axis-components.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-core.mjs +3611 -0
- package/fesm2022/ngx-axis-appforge-core.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge-providers.mjs +52 -0
- package/fesm2022/ngx-axis-appforge-providers.mjs.map +1 -0
- package/fesm2022/ngx-axis-appforge.mjs +6 -0
- package/fesm2022/ngx-axis-appforge.mjs.map +1 -0
- package/index.d.ts +2 -0
- package/package.json +389 -0
- package/providers/index.d.ts +13 -0
- package/providers/index.d.ts.map +1 -0
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, computed, signal, inject, effect, ChangeDetectionStrategy, Component, ViewChild, model, ElementRef, ChangeDetectorRef, Injector, ViewContainerRef, HostListener } from '@angular/core';
|
|
3
|
+
import * as i1$3 from 'ng-zorro-antd/splitter';
|
|
4
|
+
import { NzSplitterModule } from 'ng-zorro-antd/splitter';
|
|
5
|
+
import * as i2$3 from 'ng-zorro-antd/tabs';
|
|
6
|
+
import { NzTabsModule } from 'ng-zorro-antd/tabs';
|
|
7
|
+
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
8
|
+
import * as i1 from '@angular/forms';
|
|
9
|
+
import { FormsModule } from '@angular/forms';
|
|
10
|
+
import { NzHighlightPipe } from 'ng-zorro-antd/core/highlight';
|
|
11
|
+
import * as i3 from 'ng-zorro-antd/icon';
|
|
12
|
+
import { NzIconModule } from 'ng-zorro-antd/icon';
|
|
13
|
+
import * as i2 from 'ng-zorro-antd/input';
|
|
14
|
+
import { NzInputModule } from 'ng-zorro-antd/input';
|
|
15
|
+
import * as i4 from 'ng-zorro-antd/tree-view';
|
|
16
|
+
import { NzTreeFlattener, NzTreeFlatDataSource, NzTreeViewModule } from 'ng-zorro-antd/tree-view';
|
|
17
|
+
import { BehaviorSubject, combineLatest, auditTime, tap, map, filter, take, debounceTime, Subject, switchMap, merge, Observable, NEVER, from, of } from 'rxjs';
|
|
18
|
+
import * as i3$1 from 'ng-zorro-antd/flex';
|
|
19
|
+
import { NzFlexModule } from 'ng-zorro-antd/flex';
|
|
20
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
21
|
+
import { FilteredTreeResult, AXIS_FILE_BASE_URL_TOKEN, AXIS_HTTP_CONTEXT_DATA_TOKEN, AXIS_COMPONENTS_LOADER_TOKEN, ScopeDirective, DynamicDirective, DesignBuilder, AXIS_INJECT_DATA_TOKEN, AXIS_INJECT_FUNC_TOKEN, AXIS_DESIGN_CMPLIBS_TOKEN, isEquals, ValueAccessOptions, copy, HowLongPipe, ValueAccess, AXIS_DESIGN_SCOPE_INFOS_GETTER_TOKEN, AXIS_DESIGN_COMPONENT_INFO_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_GETTER_TOKEN, AXIS_DESIGN_ALL_PERMISSIONS_TOKEN, AXIS_DESIGN_OPTIONS_NODE_FOR_MENU, AXIS_DESIGN_CHOOSE_COMPONENT_FUNC_TOKEN, OptionsNode } from 'ngx-axis-appforge/core';
|
|
22
|
+
import * as i6 from 'ng-zorro-antd/button';
|
|
23
|
+
import { NzButtonModule } from 'ng-zorro-antd/button';
|
|
24
|
+
import * as i9 from 'ng-zorro-antd/tooltip';
|
|
25
|
+
import { NzTooltipModule } from 'ng-zorro-antd/tooltip';
|
|
26
|
+
import * as i10 from 'ng-zorro-antd/empty';
|
|
27
|
+
import { NzEmptyModule } from 'ng-zorro-antd/empty';
|
|
28
|
+
import * as i7 from 'ng-zorro-antd/core/transition-patch';
|
|
29
|
+
import * as i8 from 'ng-zorro-antd/core/wave';
|
|
30
|
+
import { CommonModule } from '@angular/common';
|
|
31
|
+
import * as i1$1 from 'ng-zorro-antd/collapse';
|
|
32
|
+
import { NzCollapseModule } from 'ng-zorro-antd/collapse';
|
|
33
|
+
import * as i2$1 from 'ng-zorro-antd/card';
|
|
34
|
+
import { NzCardModule } from 'ng-zorro-antd/card';
|
|
35
|
+
import * as i3$2 from 'ng-zorro-antd/grid';
|
|
36
|
+
import { NzGridModule } from 'ng-zorro-antd/grid';
|
|
37
|
+
import * as i7$1 from 'ng-zorro-antd/dropdown';
|
|
38
|
+
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
|
|
39
|
+
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
40
|
+
import * as i12 from 'ng-zorro-antd/select';
|
|
41
|
+
import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
42
|
+
import * as i6$1 from 'ng-zorro-antd/menu';
|
|
43
|
+
import * as i6$2 from 'ng-zorro-antd/drawer';
|
|
44
|
+
import { NzDrawerModule } from 'ng-zorro-antd/drawer';
|
|
45
|
+
import * as i1$2 from 'ng-zorro-antd/modal';
|
|
46
|
+
import { NzModalModule } from 'ng-zorro-antd/modal';
|
|
47
|
+
import * as i2$2 from 'ng-zorro-antd/table';
|
|
48
|
+
import { NzTableModule } from 'ng-zorro-antd/table';
|
|
49
|
+
import * as i8$1 from 'ng-zorro-antd/popover';
|
|
50
|
+
import { NzPopoverModule } from 'ng-zorro-antd/popover';
|
|
51
|
+
import { ClipboardService } from 'ngx-clipboard';
|
|
52
|
+
|
|
53
|
+
class DragDrop {
|
|
54
|
+
optionsNodes;
|
|
55
|
+
optionIdflatNodes;
|
|
56
|
+
treeControl;
|
|
57
|
+
onChange;
|
|
58
|
+
constructor(optionsNodes, optionIdflatNodes, treeControl, onChange) {
|
|
59
|
+
this.optionsNodes = optionsNodes;
|
|
60
|
+
this.optionIdflatNodes = optionIdflatNodes;
|
|
61
|
+
this.treeControl = treeControl;
|
|
62
|
+
this.onChange = onChange;
|
|
63
|
+
}
|
|
64
|
+
dragNode;
|
|
65
|
+
dropNode;
|
|
66
|
+
targetIndex;
|
|
67
|
+
element;
|
|
68
|
+
pos;
|
|
69
|
+
canDrag(nodeId) {
|
|
70
|
+
const node = this.optionsNodes.get(nodeId);
|
|
71
|
+
return !!node && !node?.isRoot && node?.canDrag;
|
|
72
|
+
}
|
|
73
|
+
onDragStart(e, nodeId) {
|
|
74
|
+
this.dragNode = this.optionsNodes.get(nodeId);
|
|
75
|
+
if (this.dragNode?.children?.length) {
|
|
76
|
+
this.treeControl.collapse(this.optionIdflatNodes.get(nodeId));
|
|
77
|
+
}
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
e.target.style.display = 'none';
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
onDragOver(e, nodeId) {
|
|
83
|
+
const node = this.optionsNodes.get(nodeId);
|
|
84
|
+
const parent = node.parentId ? this.optionsNodes.get(node.parentId) : undefined;
|
|
85
|
+
let canDropIn = this.canDrop(node);
|
|
86
|
+
let canDropSide = !!parent && this.canDrop(parent);
|
|
87
|
+
if (!canDropIn && !canDropSide) {
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const pos = this.getPos(e, canDropIn, canDropSide);
|
|
92
|
+
const element = e.currentTarget;
|
|
93
|
+
this.updateElementStyle(element, pos);
|
|
94
|
+
if (pos == 0) {
|
|
95
|
+
this.targetIndex = node?.defaultDropIndex;
|
|
96
|
+
this.dropNode = node;
|
|
97
|
+
this.treeControl.expand(this.optionIdflatNodes.get(node.id));
|
|
98
|
+
}
|
|
99
|
+
else if (pos == -1) {
|
|
100
|
+
this.targetIndex = node.indexOfParentObj;
|
|
101
|
+
this.dropNode = parent;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.targetIndex = node.indexOfParentObj + 1;
|
|
105
|
+
this.dropNode = parent;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
updateElementStyle(element, pos) {
|
|
109
|
+
if (element != this.element || pos != this.pos) {
|
|
110
|
+
this.element?.classList.remove("drop_in", "drop_up", "drop_down");
|
|
111
|
+
if (element) {
|
|
112
|
+
switch (pos) {
|
|
113
|
+
case -1:
|
|
114
|
+
element.classList.add("drop_up");
|
|
115
|
+
break;
|
|
116
|
+
case 0:
|
|
117
|
+
element.classList.add("drop_in");
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
element.classList.add("drop_down");
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.element = element;
|
|
125
|
+
this.pos = pos;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
onDragEnd(e, nodeId) {
|
|
129
|
+
e.target.style.display = 'flex';
|
|
130
|
+
if (this.dropNode) {
|
|
131
|
+
if (this.dropNode.dropObj == this.dragNode.parentObj && this.dragNode.indexOfParentObj == this.targetIndex) {
|
|
132
|
+
this.updateElementStyle();
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (this.dropNode.dropObj instanceof Array && this.dropNode.dropObj == this.dragNode.parentObj && this.dragNode.indexOfParentObj < this.targetIndex) {
|
|
136
|
+
this.targetIndex--;
|
|
137
|
+
}
|
|
138
|
+
const dragObj = this.dragNode.options;
|
|
139
|
+
if (!this.dragNode.isRoot) {
|
|
140
|
+
if (this.dragNode?.parentObj instanceof Array) {
|
|
141
|
+
this.dragNode.parentObj.splice(this.dragNode.indexOfParentObj, 1);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.dragNode.parentObj[this.dragNode.indexOfParentObj] = null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (this.dropNode.dropObj instanceof Array) {
|
|
148
|
+
this.dropNode.dropObj.splice(this.targetIndex, 0, dragObj);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.dropNode.dropObj[this.targetIndex] = dragObj;
|
|
152
|
+
}
|
|
153
|
+
this.onChange({ historyDesc: `拖拽${this.dragNode?.name}` });
|
|
154
|
+
}
|
|
155
|
+
this.dragNode = undefined;
|
|
156
|
+
this.updateElementStyle();
|
|
157
|
+
}
|
|
158
|
+
canDrop(node) {
|
|
159
|
+
if (node && node.canDrop && node.dropType == this.dragNode.dragType) {
|
|
160
|
+
return !node.dropObj[node.defaultDropIndex];
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
getPos(e, canDropIn, canDropSide) {
|
|
165
|
+
const element = e.target;
|
|
166
|
+
const rect = element.getBoundingClientRect();
|
|
167
|
+
const clientY = e.clientY - rect.top;
|
|
168
|
+
const height = rect.height;
|
|
169
|
+
if (canDropIn && canDropSide) {
|
|
170
|
+
return 1 - Math.floor(clientY / height * 3);
|
|
171
|
+
}
|
|
172
|
+
else if (canDropSide) {
|
|
173
|
+
return clientY < height / 2 ? -1 : 1;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
class Tree {
|
|
182
|
+
cdRef;
|
|
183
|
+
node = input.required(...(ngDevMode ? [{ debugName: "node" }] : []));
|
|
184
|
+
optionsNodes = input.required(...(ngDevMode ? [{ debugName: "optionsNodes" }] : []));
|
|
185
|
+
onChange = output();
|
|
186
|
+
onSelect = output();
|
|
187
|
+
onContextMenu = output();
|
|
188
|
+
dragdrop = computed(() => new DragDrop(this.optionsNodes(), this.optionIdflatNodes, this.treeControl, (e) => this.onChange.emit(e)), ...(ngDevMode ? [{ debugName: "dragdrop" }] : []));
|
|
189
|
+
optionIdflatNodes = new Map();
|
|
190
|
+
flatNodeMap = new Map();
|
|
191
|
+
nestedNodeMap = new Map();
|
|
192
|
+
searchValue = signal('', ...(ngDevMode ? [{ debugName: "searchValue" }] : []));
|
|
193
|
+
originData$ = new BehaviorSubject([]);
|
|
194
|
+
searchValue$ = new BehaviorSubject('');
|
|
195
|
+
selectListSelection = new SelectionModel(true);
|
|
196
|
+
design = inject(Design);
|
|
197
|
+
subs = [];
|
|
198
|
+
transformer = (node, level) => {
|
|
199
|
+
const existingNode = this.nestedNodeMap.get(node.id);
|
|
200
|
+
const currentNode = {
|
|
201
|
+
expandable: !!node.children && node.children.length > 0,
|
|
202
|
+
id: node.id,
|
|
203
|
+
title: node.name ?? "",
|
|
204
|
+
icon: node.icon,
|
|
205
|
+
level
|
|
206
|
+
};
|
|
207
|
+
let flatNode;
|
|
208
|
+
if (existingNode?.id == currentNode.id && existingNode.expandable == currentNode.expandable && existingNode.level == currentNode.level) {
|
|
209
|
+
flatNode = Object.assign(existingNode, currentNode);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
flatNode = currentNode;
|
|
213
|
+
}
|
|
214
|
+
this.optionIdflatNodes.set(flatNode.id, flatNode);
|
|
215
|
+
this.flatNodeMap.set(flatNode.id, node);
|
|
216
|
+
this.nestedNodeMap.set(node.id, flatNode);
|
|
217
|
+
return flatNode;
|
|
218
|
+
};
|
|
219
|
+
treeControl = new FlatTreeControl(node => node.level, node => node.expandable, {
|
|
220
|
+
trackBy: flatNode => flatNode.id
|
|
221
|
+
});
|
|
222
|
+
treeFlattener = new NzTreeFlattener(this.transformer, node => node.level, node => node.expandable, node => node.children);
|
|
223
|
+
dataSource = new NzTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
224
|
+
filteredData$ = combineLatest([
|
|
225
|
+
this.originData$,
|
|
226
|
+
this.searchValue$.pipe(auditTime(300), tap(value => this.searchValue.set(value)))
|
|
227
|
+
]).pipe(map(([data, value]) => (value ? filterTreeData(data, value) : new FilteredTreeResult(data, this.treeControl.expansionModel.selected.filter(id => this.optionsNodes().has(id))))));
|
|
228
|
+
constructor(cdRef) {
|
|
229
|
+
this.cdRef = cdRef;
|
|
230
|
+
effect(() => {
|
|
231
|
+
if (this.node()) {
|
|
232
|
+
this.originData$.next([this.node()]);
|
|
233
|
+
}
|
|
234
|
+
const oldlength = this.selectListSelection.selected.length;
|
|
235
|
+
this.selectListSelection.deselect(...this.selectListSelection.selected.filter(nodeid => !this.optionsNodes().has(nodeid)));
|
|
236
|
+
this.treeControl.expansionModel.deselect(...this.treeControl.expansionModel.selected.filter(id => !this.optionsNodes().has(id)));
|
|
237
|
+
if (oldlength != this.selectListSelection.selected.length) {
|
|
238
|
+
this.sendSelectEvent();
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
this.subs.push(this.filteredData$.subscribe(result => {
|
|
242
|
+
this.dataSource.setData(result.treeData);
|
|
243
|
+
this.treeControl.expansionModel.setSelection(...result.needsToExpanded);
|
|
244
|
+
}));
|
|
245
|
+
this.subs.push(this.filteredData$.pipe(filter(r => r.treeData.length > 0), take(1)).subscribe(result => {
|
|
246
|
+
this.selectOne(result.treeData[0].id, { sendEvent: true });
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
hasChild = (_, node) => node.expandable;
|
|
250
|
+
get hasExpanded() {
|
|
251
|
+
return this.treeControl.expansionModel.selected.length > 0;
|
|
252
|
+
}
|
|
253
|
+
onNodeClick(e, node) {
|
|
254
|
+
if (e.metaKey) {
|
|
255
|
+
this.toggleSelect(node.id, { sendEvent: true });
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.selectOne(node.id, { sendEvent: true });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
select(nodeId, opt) {
|
|
262
|
+
this.selectListSelection.select(nodeId);
|
|
263
|
+
if (opt?.sendEvent) {
|
|
264
|
+
this.sendSelectEvent();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
selectOne(nodeId, opt) {
|
|
268
|
+
this.unSelectAll();
|
|
269
|
+
this.selectListSelection.select(nodeId);
|
|
270
|
+
if (opt?.sendEvent) {
|
|
271
|
+
this.sendSelectEvent();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
toggleSelect(nodeId, opt) {
|
|
275
|
+
this.selectListSelection.toggle(nodeId);
|
|
276
|
+
if (opt?.sendEvent) {
|
|
277
|
+
this.sendSelectEvent();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
unSelect(nodeId, opt) {
|
|
281
|
+
this.selectListSelection.deselect(nodeId);
|
|
282
|
+
if (opt?.sendEvent) {
|
|
283
|
+
this.sendSelectEvent();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
unSelectAll(opt) {
|
|
287
|
+
this.selectListSelection.clear();
|
|
288
|
+
if (opt?.sendEvent) {
|
|
289
|
+
this.sendSelectEvent();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
sendSelectEvent() {
|
|
293
|
+
this.onSelect.emit(this.selectListSelection.selected);
|
|
294
|
+
}
|
|
295
|
+
selectByNodeIds(nodeIds) {
|
|
296
|
+
this.unSelectAll();
|
|
297
|
+
for (const nodeId of nodeIds) {
|
|
298
|
+
this.select(nodeId);
|
|
299
|
+
const node = this.optionsNodes().get(nodeId);
|
|
300
|
+
if (node?.parentId) {
|
|
301
|
+
this.treeControl.expand(this.optionIdflatNodes.get(node.parentId));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
this.cdRef.markForCheck();
|
|
305
|
+
}
|
|
306
|
+
expandByNodeIds(nodeIds) {
|
|
307
|
+
for (const nodeId of nodeIds) {
|
|
308
|
+
const node = this.optionIdflatNodes.get(nodeId);
|
|
309
|
+
if (node) {
|
|
310
|
+
this.treeControl.expand(node);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
toggleExpanded() {
|
|
315
|
+
if (this.hasExpanded) {
|
|
316
|
+
this.treeControl.collapseAll();
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.treeControl.expandAll();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
reset() {
|
|
323
|
+
this.optionIdflatNodes.clear();
|
|
324
|
+
this.flatNodeMap.clear();
|
|
325
|
+
}
|
|
326
|
+
contextMenu(e, nodeId) {
|
|
327
|
+
this.onContextMenu.emit({ event: e, nodeId });
|
|
328
|
+
}
|
|
329
|
+
removeSelected() {
|
|
330
|
+
let changed = false;
|
|
331
|
+
let next = undefined;
|
|
332
|
+
let nextNodeId;
|
|
333
|
+
for (const nodeId of this.selectListSelection.selected) {
|
|
334
|
+
const node = this.optionsNodes().get(nodeId);
|
|
335
|
+
if (node?.canSetting) {
|
|
336
|
+
changed = true;
|
|
337
|
+
if (node.isRoot) {
|
|
338
|
+
next = null;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
nextNodeId = node.parentId;
|
|
342
|
+
if (Array.isArray(node.parentObj)) {
|
|
343
|
+
node.parentObj.splice(node.parentObj.indexOf(node.options), 1);
|
|
344
|
+
if (node.parentObj.length) {
|
|
345
|
+
nextNodeId = node.parentObj[Math.min(node.indexOfParentObj, node.parentObj.length - 1)].id;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
node.parentObj[node.indexOfParentObj] = null;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (changed) {
|
|
355
|
+
this.onChange.emit({ value: next, nextNodeId: nextNodeId, historyDesc: `删除${this.selectListSelection.selected.length}个组件` });
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
addNodeForSelected(nodes, deleteSuccess = false, historyDesc) {
|
|
359
|
+
if (nodes.length && this.selectListSelection.selected) {
|
|
360
|
+
for (const nodeId of this.selectListSelection.selected) {
|
|
361
|
+
const parentNode = this.optionsNodes().get(nodeId);
|
|
362
|
+
if (parentNode && parentNode.canDrop && parentNode.dropType == "component") {
|
|
363
|
+
if (Array.isArray(parentNode.dropObj)) {
|
|
364
|
+
parentNode.dropObj.splice(parentNode.dropObj.length, 0, ...nodes.map(n => n.options));
|
|
365
|
+
nodes.forEach(n => this.deleteNode(n));
|
|
366
|
+
}
|
|
367
|
+
else if (!parentNode.dropObj[parentNode.defaultDropIndex]) {
|
|
368
|
+
const n = nodes[nodes.length - 1];
|
|
369
|
+
parentNode.dropObj[parentNode.defaultDropIndex] = n.options;
|
|
370
|
+
if (deleteSuccess) {
|
|
371
|
+
this.deleteNode(n);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
this.onChange.emit({ historyDesc });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
deleteNode(node) {
|
|
380
|
+
if (node.parentObj) {
|
|
381
|
+
if (Array.isArray(node.parentObj)) {
|
|
382
|
+
node.parentObj.splice(node.indexOfParentObj, 1);
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
delete node.parentObj[node.indexOfParentObj];
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
addRootComponent() {
|
|
390
|
+
this.design.chooseComponent().subscribe(res => {
|
|
391
|
+
const { options, config } = res;
|
|
392
|
+
if (options && config) {
|
|
393
|
+
this.onChange.emit({ value: options, historyDesc: `添加${config.componentName}` });
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
ngOnDestroy() {
|
|
398
|
+
for (let sub of this.subs) {
|
|
399
|
+
sub.unsubscribe();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Tree, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
403
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: Tree, isStandalone: true, selector: "axis-design-tree", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, optionsNodes: { classPropertyName: "optionsNodes", publicName: "optionsNodes", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { onChange: "onChange", onSelect: "onSelect", onContextMenu: "onContextMenu" }, ngImport: i0, template: "<div nz-flex [nzVertical]=\"true\" style=\"height: 100%;\">\n <div nz-flex style=\"padding-right: 8px;\" nzGap=\"4px\" nzAlign=\"center\">\n <input style=\"flex:1;\" type=\"text\" nz-input placeholder=\"\u641C\u7D22\" nzBorderless ngModel\n (ngModelChange)=\"searchValue$.next($event)\" />\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" (click)=\"toggleExpanded()\">\n <nz-icon [nzType]=\"hasExpanded?'shrink':'arrows-alt'\" nzTheme=\"outline\" />\n </button>\n </div>\n @if (node() === null) {\n <nz-empty [nzNotFoundContent]=\"contentTpl\" [nzNotFoundFooter]=\"footerTpl\">\n <ng-template #contentTpl>\n \u6CA1\u6709\u7EC4\u4EF6\n </ng-template>\n <ng-template #footerTpl>\n <button nz-button nzType=\"dashed\" (click)=\"addRootComponent()\">\n <nz-icon nzType=\"plus\"></nz-icon>\n \u6DFB\u52A0\u7EC4\u4EF6\n </button>\n </ng-template>\n </nz-empty>\n }@else {\n <nz-tree-view nzDirectoryTree [nzTreeControl]=\"treeControl\" [nzDataSource]=\"dataSource\">\n <nz-tree-node *nzTreeNodeDef=\"let node\" nzTreeNodePadding [nzTreeNodePaddingIndent]=\"8\"\n (contextmenu)=\"contextMenu($event, node.id)\" [draggable]=\"dragdrop().canDrag(node.id)\"\n (dragstart)=\"dragdrop().onDragStart($event, node.id)\" (dragover)=\"dragdrop().onDragOver($event, node.id)\"\n (dragend)=\"dragdrop().onDragEnd($event,node.id)\">\n <nz-tree-node-toggle nzTreeNodeNoopToggle></nz-tree-node-toggle>\n <nz-tree-node-option [nzDisabled]=\"node.disabled\" [nzSelected]=\"selectListSelection.isSelected(node.id)\"\n (nzClick)=\"onNodeClick($event,node)\" [nz-tooltip]=\"node.id\" [nzTooltipMouseEnterDelay]=\"0.6\">\n <i nz-icon [nzType]=\"node.icon\" style=\"margin: 4px;\"></i>\n <span [innerHTML]=\"node.title | nzHighlight: searchValue() : 'i' : 'highlight'\"></span>\n </nz-tree-node-option>\n </nz-tree-node>\n <nz-tree-node *nzTreeNodeDef=\"let node; when: hasChild\" nzTreeNodePadding [nzTreeNodePaddingIndent]=\"8\"\n (contextmenu)=\"contextMenu($event, node.id)\" [draggable]=\"dragdrop().canDrag(node.id)\"\n (dragstart)=\"dragdrop().onDragStart($event, node.id)\" (dragover)=\"dragdrop().onDragOver($event, node.id)\"\n (dragend)=\"dragdrop().onDragEnd($event,node.id)\">\n <nz-tree-node-toggle>\n <nz-icon nzType=\"caret-down\" nzTreeNodeToggleRotateIcon />\n </nz-tree-node-toggle>\n <nz-tree-node-option [nzDisabled]=\"node.disabled\" [nzSelected]=\"selectListSelection.isSelected(node.id)\"\n (nzClick)=\"onNodeClick($event,node)\" [nz-tooltip]=\"node.id\" [nzTooltipMouseEnterDelay]=\"0.6\">\n <i nz-icon [nzType]=\"node.icon\" style=\"margin: 4px;\"></i>\n <span [innerHTML]=\"node.title | nzHighlight: searchValue() : 'i' : 'highlight'\"></span>\n </nz-tree-node-option>\n </nz-tree-node>\n </nz-tree-view>\n }\n</div>", styles: ["::ng-deep .highlight{color:#f50}nz-tree-view{overflow:auto;flex:1}.drop_in{outline:1px solid blue}.drop_up:after{content:\"\";position:absolute;top:-1px;width:100%;height:2px;background-color:#00f}.drop_down:after{content:\"\";position:absolute;bottom:-1px;width:100%;height:2px;background-color:#00f}nz-tree-view ::ng-deep .ant-tree-list-holder{margin-bottom:300px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzInputModule }, { kind: "directive", type: i2.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzVariant", "nzSize", "nzStepperless", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzTreeViewModule }, { kind: "component", type: i4.NzTreeViewComponent, selector: "nz-tree-view", exportAs: ["nzTreeView"] }, { kind: "directive", type: i4.NzTreeNodeDefDirective, selector: "[nzTreeNodeDef]", inputs: ["nzTreeNodeDefWhen"] }, { kind: "component", type: i4.NzTreeNodeComponent, selector: "nz-tree-node:not([builtin])", exportAs: ["nzTreeNode"] }, { kind: "directive", type: i4.NzTreeNodeToggleDirective, selector: "nz-tree-node-toggle:not([nzTreeNodeNoopToggle]), [nzTreeNodeToggle]", inputs: ["nzTreeNodeToggleRecursive"] }, { kind: "directive", type: i4.NzTreeNodePaddingDirective, selector: "[nzTreeNodePadding]", inputs: ["nzTreeNodePadding", "nzTreeNodePaddingIndent"] }, { kind: "directive", type: i4.NzTreeNodeToggleRotateIconDirective, selector: "[nzTreeNodeToggleRotateIcon]" }, { kind: "component", type: i4.NzTreeNodeOptionComponent, selector: "nz-tree-node-option", inputs: ["nzSelected", "nzDisabled"], outputs: ["nzClick"] }, { kind: "directive", type: i4.NzTreeNodeNoopToggleDirective, selector: "nz-tree-node-toggle[nzTreeNodeNoopToggle], [nzTreeNodeNoopToggle]" }, { kind: "ngmodule", type: NzFlexModule }, { kind: "directive", type: i3$1.NzFlexDirective, selector: "[nz-flex],nz-flex", inputs: ["nzVertical", "nzJustify", "nzAlign", "nzGap", "nzWrap", "nzFlex"], exportAs: ["nzFlex"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i6.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i7.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i8.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { kind: "ngmodule", type: NzTooltipModule }, { kind: "directive", type: i9.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "cdkConnectedOverlayPush", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }, { kind: "ngmodule", type: NzEmptyModule }, { kind: "component", type: i10.NzEmptyComponent, selector: "nz-empty", inputs: ["nzNotFoundImage", "nzNotFoundContent", "nzNotFoundFooter"], exportAs: ["nzEmpty"] }, { kind: "pipe", type: NzHighlightPipe, name: "nzHighlight" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
404
|
+
}
|
|
405
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Tree, decorators: [{
|
|
406
|
+
type: Component,
|
|
407
|
+
args: [{ selector: 'axis-design-tree', imports: [FormsModule, NzInputModule, NzIconModule, NzTreeViewModule, NzFlexModule, NzHighlightPipe, NzButtonModule, NzTooltipModule, NzEmptyModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div nz-flex [nzVertical]=\"true\" style=\"height: 100%;\">\n <div nz-flex style=\"padding-right: 8px;\" nzGap=\"4px\" nzAlign=\"center\">\n <input style=\"flex:1;\" type=\"text\" nz-input placeholder=\"\u641C\u7D22\" nzBorderless ngModel\n (ngModelChange)=\"searchValue$.next($event)\" />\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" (click)=\"toggleExpanded()\">\n <nz-icon [nzType]=\"hasExpanded?'shrink':'arrows-alt'\" nzTheme=\"outline\" />\n </button>\n </div>\n @if (node() === null) {\n <nz-empty [nzNotFoundContent]=\"contentTpl\" [nzNotFoundFooter]=\"footerTpl\">\n <ng-template #contentTpl>\n \u6CA1\u6709\u7EC4\u4EF6\n </ng-template>\n <ng-template #footerTpl>\n <button nz-button nzType=\"dashed\" (click)=\"addRootComponent()\">\n <nz-icon nzType=\"plus\"></nz-icon>\n \u6DFB\u52A0\u7EC4\u4EF6\n </button>\n </ng-template>\n </nz-empty>\n }@else {\n <nz-tree-view nzDirectoryTree [nzTreeControl]=\"treeControl\" [nzDataSource]=\"dataSource\">\n <nz-tree-node *nzTreeNodeDef=\"let node\" nzTreeNodePadding [nzTreeNodePaddingIndent]=\"8\"\n (contextmenu)=\"contextMenu($event, node.id)\" [draggable]=\"dragdrop().canDrag(node.id)\"\n (dragstart)=\"dragdrop().onDragStart($event, node.id)\" (dragover)=\"dragdrop().onDragOver($event, node.id)\"\n (dragend)=\"dragdrop().onDragEnd($event,node.id)\">\n <nz-tree-node-toggle nzTreeNodeNoopToggle></nz-tree-node-toggle>\n <nz-tree-node-option [nzDisabled]=\"node.disabled\" [nzSelected]=\"selectListSelection.isSelected(node.id)\"\n (nzClick)=\"onNodeClick($event,node)\" [nz-tooltip]=\"node.id\" [nzTooltipMouseEnterDelay]=\"0.6\">\n <i nz-icon [nzType]=\"node.icon\" style=\"margin: 4px;\"></i>\n <span [innerHTML]=\"node.title | nzHighlight: searchValue() : 'i' : 'highlight'\"></span>\n </nz-tree-node-option>\n </nz-tree-node>\n <nz-tree-node *nzTreeNodeDef=\"let node; when: hasChild\" nzTreeNodePadding [nzTreeNodePaddingIndent]=\"8\"\n (contextmenu)=\"contextMenu($event, node.id)\" [draggable]=\"dragdrop().canDrag(node.id)\"\n (dragstart)=\"dragdrop().onDragStart($event, node.id)\" (dragover)=\"dragdrop().onDragOver($event, node.id)\"\n (dragend)=\"dragdrop().onDragEnd($event,node.id)\">\n <nz-tree-node-toggle>\n <nz-icon nzType=\"caret-down\" nzTreeNodeToggleRotateIcon />\n </nz-tree-node-toggle>\n <nz-tree-node-option [nzDisabled]=\"node.disabled\" [nzSelected]=\"selectListSelection.isSelected(node.id)\"\n (nzClick)=\"onNodeClick($event,node)\" [nz-tooltip]=\"node.id\" [nzTooltipMouseEnterDelay]=\"0.6\">\n <i nz-icon [nzType]=\"node.icon\" style=\"margin: 4px;\"></i>\n <span [innerHTML]=\"node.title | nzHighlight: searchValue() : 'i' : 'highlight'\"></span>\n </nz-tree-node-option>\n </nz-tree-node>\n </nz-tree-view>\n }\n</div>", styles: ["::ng-deep .highlight{color:#f50}nz-tree-view{overflow:auto;flex:1}.drop_in{outline:1px solid blue}.drop_up:after{content:\"\";position:absolute;top:-1px;width:100%;height:2px;background-color:#00f}.drop_down:after{content:\"\";position:absolute;bottom:-1px;width:100%;height:2px;background-color:#00f}nz-tree-view ::ng-deep .ant-tree-list-holder{margin-bottom:300px}\n"] }]
|
|
408
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });
|
|
409
|
+
function filterTreeData(data, value) {
|
|
410
|
+
const needsToExpanded = new Set();
|
|
411
|
+
const _filter = (node, result) => {
|
|
412
|
+
if (node.name?.search(value) !== -1 || node.id?.search(value) !== -1) {
|
|
413
|
+
result.push(node);
|
|
414
|
+
return result;
|
|
415
|
+
}
|
|
416
|
+
if (Array.isArray(node.children)) {
|
|
417
|
+
const nodes = node.children.reduce((a, b) => _filter(b, a), []);
|
|
418
|
+
if (nodes.length) {
|
|
419
|
+
const parentNode = node.copyWith({ children: nodes });
|
|
420
|
+
needsToExpanded.add(parentNode.id);
|
|
421
|
+
result.push(parentNode);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
};
|
|
426
|
+
const treeData = data.reduce((a, b) => _filter(b, a), []);
|
|
427
|
+
return new FilteredTreeResult(treeData, [...needsToExpanded]);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
class DropHandler {
|
|
431
|
+
dragNode;
|
|
432
|
+
dropNode;
|
|
433
|
+
elementOptionIds;
|
|
434
|
+
isHorizontal;
|
|
435
|
+
placeholder;
|
|
436
|
+
beforeElement;
|
|
437
|
+
constructor(dragNode, dropNode, elementOptionIds, isHorizontal) {
|
|
438
|
+
this.dragNode = dragNode;
|
|
439
|
+
this.dropNode = dropNode;
|
|
440
|
+
this.elementOptionIds = elementOptionIds;
|
|
441
|
+
this.isHorizontal = isHorizontal;
|
|
442
|
+
this.placeholder = dragNode.element.cloneNode(true);
|
|
443
|
+
this.placeholder.style.display = "inline";
|
|
444
|
+
this.placeholder.style.opacity = "0.5";
|
|
445
|
+
}
|
|
446
|
+
onDragEnd() {
|
|
447
|
+
this.placeholder.remove();
|
|
448
|
+
}
|
|
449
|
+
onDragOver(e) {
|
|
450
|
+
const element = this.getBeforeElement(e);
|
|
451
|
+
if (element === this.beforeElement) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
this.beforeElement = element;
|
|
455
|
+
if (element) {
|
|
456
|
+
this.dropNode.dropElement.insertBefore(this.placeholder, element);
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.dropNode.dropElement.appendChild(this.placeholder);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
close() {
|
|
463
|
+
this.placeholder.remove();
|
|
464
|
+
this.beforeElement = undefined;
|
|
465
|
+
}
|
|
466
|
+
getBeforeElement(e) {
|
|
467
|
+
for (const child of this.dropNode.dropElement.children) {
|
|
468
|
+
if (this.elementOptionIds.has(child)) {
|
|
469
|
+
const rect = child.getBoundingClientRect();
|
|
470
|
+
if (this.isHorizontal) {
|
|
471
|
+
const middle = rect.left + (rect.width / 2);
|
|
472
|
+
if (e.clientX <= middle) {
|
|
473
|
+
return child;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
const middle = rect.top + (rect.height / 2);
|
|
478
|
+
if (e.clientY <= middle) {
|
|
479
|
+
return child;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return null;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
class DragService {
|
|
489
|
+
preview;
|
|
490
|
+
constructor(preview) {
|
|
491
|
+
this.preview = preview;
|
|
492
|
+
}
|
|
493
|
+
canDropNodes = [];
|
|
494
|
+
oriDragDisplay;
|
|
495
|
+
currentDropNodes = new Map();
|
|
496
|
+
dragEn;
|
|
497
|
+
dropHandler;
|
|
498
|
+
initElement(node, en) {
|
|
499
|
+
if (!node.isRoot && node.canDrag) {
|
|
500
|
+
this.bindDragEvent(en);
|
|
501
|
+
}
|
|
502
|
+
if (node.canDrop) {
|
|
503
|
+
this.canDropNodes.push(en);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
getOptionsNode(node) {
|
|
507
|
+
return this.preview.optionsNodes().get(node.id);
|
|
508
|
+
}
|
|
509
|
+
bindDragEvent(node) {
|
|
510
|
+
node.element.setAttribute("draggable", "true");
|
|
511
|
+
node.element.ondragstart = (e) => {
|
|
512
|
+
e.stopPropagation();
|
|
513
|
+
this.dragStart(node);
|
|
514
|
+
this.oriDragDisplay = node.element.style.display;
|
|
515
|
+
setTimeout(() => {
|
|
516
|
+
node.element.style.display = "none";
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
node.element.ondragend = (e) => {
|
|
520
|
+
e.preventDefault();
|
|
521
|
+
e.stopPropagation();
|
|
522
|
+
this.dragEnd();
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
bindDropEvent(en) {
|
|
526
|
+
this.currentDropNodes.set(en, null);
|
|
527
|
+
setTimeout(() => {
|
|
528
|
+
const { clientWidth, clientHeight } = en.dropElement;
|
|
529
|
+
if (!clientWidth || !clientHeight) {
|
|
530
|
+
const { display, minWidth, minHeight } = en.dropElement.style;
|
|
531
|
+
this.currentDropNodes.set(en, { display, minWidth, minHeight });
|
|
532
|
+
if (!clientWidth) {
|
|
533
|
+
en.dropElement.style.minWidth = "100px";
|
|
534
|
+
}
|
|
535
|
+
if (!clientHeight) {
|
|
536
|
+
en.dropElement.style.minHeight = "50px";
|
|
537
|
+
}
|
|
538
|
+
en.dropElement.style.display = "block";
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
en.dropElement.ondragenter = (e) => {
|
|
542
|
+
e?.preventDefault();
|
|
543
|
+
e.stopPropagation();
|
|
544
|
+
if (this.dropHandler?.dropNode == en) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
this.dropHandler?.close();
|
|
548
|
+
const node = this.getOptionsNode(en);
|
|
549
|
+
this.dropHandler = new DropHandler(this.dragEn, en, this.preview.elementOptionIds, node.childDirection == "horizontal");
|
|
550
|
+
};
|
|
551
|
+
en.dropElement.ondragover = (e) => {
|
|
552
|
+
e.preventDefault();
|
|
553
|
+
e.stopPropagation();
|
|
554
|
+
this.dropHandler?.onDragOver?.(e);
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
dragStart(dragEn) {
|
|
558
|
+
this.dragEn = dragEn;
|
|
559
|
+
this.canDropNodes = this.canDropNodes.filter(en => this.preview.optionsNodes().has(en.id));
|
|
560
|
+
this.canDropNodes
|
|
561
|
+
.filter(dropEn => {
|
|
562
|
+
const dropNode = this.getOptionsNode(dropEn);
|
|
563
|
+
const dragNode = this.getOptionsNode(dragEn);
|
|
564
|
+
return dropNode.dropType == dragNode.dragType && !dropNode.dropObj[dropNode.defaultDropIndex] && dropEn.dropElement;
|
|
565
|
+
})
|
|
566
|
+
.forEach(node => this.bindDropEvent(node));
|
|
567
|
+
this.preview.onDragStart();
|
|
568
|
+
}
|
|
569
|
+
dragEnd() {
|
|
570
|
+
let dragId;
|
|
571
|
+
if (this.dropHandler) {
|
|
572
|
+
const dropEn = this.dropHandler.dropNode;
|
|
573
|
+
const dropNode = this.getOptionsNode(dropEn);
|
|
574
|
+
const dragNode = this.getOptionsNode(this.dragEn);
|
|
575
|
+
let targetIndex = this.dropHandler.beforeElement ? this.preview.getNodeByElement(this.dropHandler.beforeElement)?.indexOfParentObj : dropNode?.defaultDropIndex;
|
|
576
|
+
if (dropNode.dropObj == dragNode.parentObj && dragNode.indexOfParentObj == targetIndex) {
|
|
577
|
+
this.preview.onDragEnd({ historyDesc: `拖拽${dragNode.name}` });
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
dragId = dragNode?.id;
|
|
581
|
+
if (dropNode.dropObj instanceof Array && dropNode.dropObj == dragNode.parentObj && dragNode.indexOfParentObj < targetIndex) {
|
|
582
|
+
targetIndex--;
|
|
583
|
+
}
|
|
584
|
+
const dragObj = dragNode.options;
|
|
585
|
+
if (!dragNode.isRoot) {
|
|
586
|
+
if (dragNode?.parentObj instanceof Array) {
|
|
587
|
+
dragNode.parentObj.splice(dragNode.indexOfParentObj, 1);
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
dragNode.parentObj[dragNode.indexOfParentObj] = null;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (dropNode?.dropObj instanceof Array) {
|
|
594
|
+
dropNode.dropObj.splice(targetIndex, 0, dragObj);
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
dropNode.dropObj[targetIndex] = dragObj;
|
|
598
|
+
}
|
|
599
|
+
this.preview.onDragEnd({ historyDesc: `拖拽${dragNode.name}` });
|
|
600
|
+
}
|
|
601
|
+
this.dropHandler.onDragEnd();
|
|
602
|
+
this.dropHandler = undefined;
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
this.preview.onDragEnd();
|
|
606
|
+
}
|
|
607
|
+
this.dragEn.element.style.display = this.oriDragDisplay;
|
|
608
|
+
this.dragEn = undefined;
|
|
609
|
+
this.oriDragDisplay = undefined;
|
|
610
|
+
this.currentDropNodes.forEach((style, en) => {
|
|
611
|
+
if (style) {
|
|
612
|
+
en.dropElement.style.minWidth = style.minWidth;
|
|
613
|
+
en.dropElement.style.minHeight = style.minHeight;
|
|
614
|
+
en.dropElement.style.display = style.display;
|
|
615
|
+
}
|
|
616
|
+
en.dropElement.ondragenter = null;
|
|
617
|
+
en.dropElement.ondragover = null;
|
|
618
|
+
});
|
|
619
|
+
this.currentDropNodes.clear();
|
|
620
|
+
return dragId;
|
|
621
|
+
}
|
|
622
|
+
reset() {
|
|
623
|
+
this.dropHandler?.close();
|
|
624
|
+
this.dragEn = undefined;
|
|
625
|
+
this.dropHandler = undefined;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
class SelectService {
|
|
630
|
+
preview;
|
|
631
|
+
hoverElements = [];
|
|
632
|
+
enable = true;
|
|
633
|
+
selectElements = new Set();
|
|
634
|
+
constructor(preview) {
|
|
635
|
+
this.preview = preview;
|
|
636
|
+
}
|
|
637
|
+
initElement(element) {
|
|
638
|
+
element.style.outlineOffset = "1px";
|
|
639
|
+
element.onclick = (e) => {
|
|
640
|
+
e.stopPropagation();
|
|
641
|
+
if (e.altKey) {
|
|
642
|
+
this.toggleSelect(element, { sendEvent: true });
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
this.selectOne(element, { sendEvent: true });
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
element.onmouseenter = () => {
|
|
649
|
+
if (this.enable) {
|
|
650
|
+
this.addHoverElement(element);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
element.onmouseleave = () => {
|
|
654
|
+
if (this.enable) {
|
|
655
|
+
this.popHoverElement(element);
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
enableHover() {
|
|
660
|
+
this.enable = true;
|
|
661
|
+
}
|
|
662
|
+
disableHover() {
|
|
663
|
+
this.enable = false;
|
|
664
|
+
}
|
|
665
|
+
addHoverElement(element) {
|
|
666
|
+
this.hoverElements.unshift(element);
|
|
667
|
+
this.refreshHoverElements();
|
|
668
|
+
}
|
|
669
|
+
popHoverElement(element) {
|
|
670
|
+
const i = this.hoverElements.lastIndexOf(element);
|
|
671
|
+
if (i != -1) {
|
|
672
|
+
for (const e of this.hoverElements.splice(0, i + 1)) {
|
|
673
|
+
if (!this.selectElements.has(element)) {
|
|
674
|
+
element.style.outline = "none";
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
this.refreshHoverElements();
|
|
679
|
+
}
|
|
680
|
+
select(element, opt) {
|
|
681
|
+
this.selectElements.add(element);
|
|
682
|
+
element.style.outline = "2px dashed green";
|
|
683
|
+
if (opt?.sendEvent) {
|
|
684
|
+
this.sendSelectEvent();
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
selectOne(element, opt) {
|
|
688
|
+
this.unSelectAll();
|
|
689
|
+
this.selectElements.add(element);
|
|
690
|
+
element.style.outline = "2px dashed green";
|
|
691
|
+
if (opt?.sendEvent) {
|
|
692
|
+
this.sendSelectEvent();
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
toggleSelect(element, opt) {
|
|
696
|
+
if (this.selectElements.has(element)) {
|
|
697
|
+
this.unSelect(element);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
this.select(element);
|
|
701
|
+
}
|
|
702
|
+
if (opt?.sendEvent) {
|
|
703
|
+
this.sendSelectEvent();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
unSelect(element, opt) {
|
|
707
|
+
if (this.selectElements.has(element)) {
|
|
708
|
+
this.selectElements.delete(element);
|
|
709
|
+
element.style.outline = "none";
|
|
710
|
+
if (opt?.sendEvent) {
|
|
711
|
+
this.sendSelectEvent();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
unSelectAll(opt) {
|
|
716
|
+
for (let element of this.selectElements) {
|
|
717
|
+
this.unSelect(element);
|
|
718
|
+
}
|
|
719
|
+
if (opt?.sendEvent) {
|
|
720
|
+
this.sendSelectEvent();
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
sendSelectEvent() {
|
|
724
|
+
this.preview.onSelectChange?.(Array.from(this.selectElements));
|
|
725
|
+
}
|
|
726
|
+
refreshHoverElements() {
|
|
727
|
+
this.hoverElements = this.hoverElements.filter(e => this.preview.elementOptionIds.has(e));
|
|
728
|
+
if (this.hoverElements.length && !this.selectElements.has(this.hoverElements[0])) {
|
|
729
|
+
this.hoverElements[0].style.outline = "1.5px dashed rgb(255,0,0)";
|
|
730
|
+
}
|
|
731
|
+
if (this.hoverElements.length > 1 && !this.selectElements.has(this.hoverElements[1])) {
|
|
732
|
+
this.hoverElements[1].style.outline = "1.5px dashed rgba(255,0,0,0.4)";
|
|
733
|
+
}
|
|
734
|
+
if (this.hoverElements.length > 2) {
|
|
735
|
+
this.hoverElements.slice(2).filter(r => !this.selectElements.has(r)).forEach((e) => {
|
|
736
|
+
e.style.outline = "none";
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
reset(opt) {
|
|
741
|
+
for (const element of this.hoverElements) {
|
|
742
|
+
element.style.outline = "none";
|
|
743
|
+
}
|
|
744
|
+
for (const element of this.selectElements) {
|
|
745
|
+
element.style.outline = "none";
|
|
746
|
+
}
|
|
747
|
+
this.hoverElements = [];
|
|
748
|
+
this.selectElements.clear();
|
|
749
|
+
if (opt?.sendEvent) {
|
|
750
|
+
this.sendSelectEvent();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
getSelectElements() {
|
|
754
|
+
return [...this.selectElements.values()];
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
class Preview {
|
|
759
|
+
constructor() {
|
|
760
|
+
effect(async () => {
|
|
761
|
+
if (this.loadAndOptions()) {
|
|
762
|
+
await this.loadAndOptions()[0];
|
|
763
|
+
this.refresh();
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
let injectUrl = inject(AXIS_FILE_BASE_URL_TOKEN, { optional: true, skipSelf: true }) ?? "";
|
|
767
|
+
effect(() => {
|
|
768
|
+
this.fileBaseUrlSub?.unsubscribe();
|
|
769
|
+
let url = this.fileBaseUrl() ?? "";
|
|
770
|
+
if (!url) {
|
|
771
|
+
url = injectUrl;
|
|
772
|
+
}
|
|
773
|
+
if (url instanceof BehaviorSubject) {
|
|
774
|
+
this.fileBaseUrlSub = url.subscribe(this.fileBaseUrlSubject);
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
this.fileBaseUrlSubject.next(url);
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
let injectHttpContextData = inject(AXIS_HTTP_CONTEXT_DATA_TOKEN, { optional: true, skipSelf: true });
|
|
781
|
+
effect(() => {
|
|
782
|
+
this.httpContextDataSub?.unsubscribe();
|
|
783
|
+
let data = this.httpContextData();
|
|
784
|
+
if (!data) {
|
|
785
|
+
data = injectHttpContextData;
|
|
786
|
+
}
|
|
787
|
+
if (data instanceof BehaviorSubject) {
|
|
788
|
+
this.httpContextDataSub = data.subscribe(this.httpContextDataSubject);
|
|
789
|
+
}
|
|
790
|
+
else {
|
|
791
|
+
this.httpContextDataSubject.next(data);
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
effect(() => {
|
|
795
|
+
this.injectFuncSub?.unsubscribe();
|
|
796
|
+
let func = this.injectFunc() ?? null;
|
|
797
|
+
if (func instanceof BehaviorSubject) {
|
|
798
|
+
this.injectFuncSub = func.subscribe(this.injectFuncSubject);
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
this.injectFuncSubject.next(func ?? {});
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
loadAndOptions = input.required(...(ngDevMode ? [{ debugName: "loadAndOptions" }] : []));
|
|
806
|
+
optionsNodes = input.required(...(ngDevMode ? [{ debugName: "optionsNodes" }] : []));
|
|
807
|
+
injectData = input.required(...(ngDevMode ? [{ debugName: "injectData" }] : []));
|
|
808
|
+
httpContextData = input(...(ngDevMode ? [undefined, { debugName: "httpContextData" }] : []));
|
|
809
|
+
httpContextDataSubject = new BehaviorSubject(undefined);
|
|
810
|
+
httpContextDataSub;
|
|
811
|
+
fileBaseUrl = input(...(ngDevMode ? [undefined, { debugName: "fileBaseUrl" }] : []));
|
|
812
|
+
fileBaseUrlSubject = new BehaviorSubject("");
|
|
813
|
+
fileBaseUrlSub;
|
|
814
|
+
injectFunc = input(...(ngDevMode ? [undefined, { debugName: "injectFunc" }] : []));
|
|
815
|
+
injectFuncSubject = new BehaviorSubject({});
|
|
816
|
+
injectFuncSub;
|
|
817
|
+
loader = inject(AXIS_COMPONENTS_LOADER_TOKEN);
|
|
818
|
+
onChange = output();
|
|
819
|
+
onSelect = output();
|
|
820
|
+
onContextMenu = output();
|
|
821
|
+
elementOptionIds = new Map();
|
|
822
|
+
elementComponentRefs = new Map();
|
|
823
|
+
optionIdElements = new Map();
|
|
824
|
+
scopeSubjects = new Map();
|
|
825
|
+
dragService = new DragService(this);
|
|
826
|
+
selectService = new SelectService(this);
|
|
827
|
+
selected = new Map();
|
|
828
|
+
dynamicDirective;
|
|
829
|
+
initScope(scope) {
|
|
830
|
+
this.getAndUpdateScopeSubject(scope.axisScope(), scope);
|
|
831
|
+
}
|
|
832
|
+
async initElement(ref, options) {
|
|
833
|
+
await this.loadAndOptions()[0];
|
|
834
|
+
if (!options?.id || !this.optionsNodes().has(options.id)) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
try {
|
|
838
|
+
const element = ref.location.nativeElement;
|
|
839
|
+
ref.onDestroy(() => {
|
|
840
|
+
this.elementComponentRefs.delete(element);
|
|
841
|
+
this.elementOptionIds.delete(element);
|
|
842
|
+
if (this.optionIdElements.has(options.id)) {
|
|
843
|
+
this.optionIdElements.set(options.id, this.optionIdElements.get(options.id).filter(e => e !== element));
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
this.elementComponentRefs.set(element, ref);
|
|
847
|
+
const { component } = options;
|
|
848
|
+
const config = await this.loader.loadComponent(`${component}/design`);
|
|
849
|
+
if (config) {
|
|
850
|
+
const binds = config.bindElementsOptionsNode?.(element, options);
|
|
851
|
+
if (binds) {
|
|
852
|
+
for (const en of Object.entries(binds)) {
|
|
853
|
+
const nodeId = en[0];
|
|
854
|
+
const element = en[1].element;
|
|
855
|
+
const node = this.optionsNodes().get(nodeId);
|
|
856
|
+
if (node && element && !this.elementOptionIds.has(element)) {
|
|
857
|
+
if (!this.optionIdElements.has(nodeId)) {
|
|
858
|
+
this.optionIdElements.set(nodeId, []);
|
|
859
|
+
}
|
|
860
|
+
this.optionIdElements.get(nodeId)?.push(element);
|
|
861
|
+
this.elementOptionIds.set(element, nodeId);
|
|
862
|
+
this.selectService.initElement(element);
|
|
863
|
+
if (node.canDrag || node.canDrop) {
|
|
864
|
+
this.dragService.initElement(node, node.toElementNode(en[1]));
|
|
865
|
+
}
|
|
866
|
+
if (node.contextMenu) {
|
|
867
|
+
element.oncontextmenu = (e) => {
|
|
868
|
+
this.onContextMenu.emit({ event: e, nodeId: en[0] });
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
if (this.selected.has(nodeId) && this.selected.get(nodeId) == this.optionIdElements.get(nodeId).length - 1) {
|
|
872
|
+
this.selectService.select(element);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
catch (_) {
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
getNodeByElement(element) {
|
|
883
|
+
const id = this.elementOptionIds.get(element);
|
|
884
|
+
if (id) {
|
|
885
|
+
return this.optionsNodes().get(id);
|
|
886
|
+
}
|
|
887
|
+
return undefined;
|
|
888
|
+
}
|
|
889
|
+
onSelectChange(elements) {
|
|
890
|
+
this.selected.clear();
|
|
891
|
+
for (const element of elements) {
|
|
892
|
+
const id = this.elementOptionIds.get(element);
|
|
893
|
+
if (id) {
|
|
894
|
+
const elementList = this.optionIdElements.get(id);
|
|
895
|
+
this.selected.set(id, elementList?.indexOf(element) ?? 0);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
this.onSelect.emit(Array.from(this.selected.keys()));
|
|
899
|
+
}
|
|
900
|
+
onDragStart() {
|
|
901
|
+
this.selectService.disableHover();
|
|
902
|
+
}
|
|
903
|
+
onDragEnd(e) {
|
|
904
|
+
if (e) {
|
|
905
|
+
this.onChange.emit(e);
|
|
906
|
+
}
|
|
907
|
+
this.selectService.enableHover();
|
|
908
|
+
}
|
|
909
|
+
forceRender() {
|
|
910
|
+
this.elementOptionIds.clear();
|
|
911
|
+
this.optionIdElements.clear();
|
|
912
|
+
this.dragService.reset();
|
|
913
|
+
this.selectService.reset();
|
|
914
|
+
this.dynamicDirective?.forceRender();
|
|
915
|
+
}
|
|
916
|
+
refresh() {
|
|
917
|
+
Array.from(this.optionIdElements.keys()).forEach(id => {
|
|
918
|
+
if (!this.optionsNodes().has(id)) {
|
|
919
|
+
this.optionIdElements.get(id)?.forEach(element => {
|
|
920
|
+
this.elementOptionIds.delete(element);
|
|
921
|
+
});
|
|
922
|
+
this.optionIdElements.delete(id);
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
setTimeout(() => {
|
|
926
|
+
this.selectService.getSelectElements().filter(e => !document.contains(e)).forEach(e => {
|
|
927
|
+
const nodeId = this.elementOptionIds.get(e);
|
|
928
|
+
this.elementComponentRefs.delete(e);
|
|
929
|
+
if (nodeId) {
|
|
930
|
+
const elements = this.optionIdElements.get(nodeId);
|
|
931
|
+
elements?.splice(elements.indexOf(e), 1);
|
|
932
|
+
const res = this.getParentComponentRef(nodeId);
|
|
933
|
+
if (res) {
|
|
934
|
+
this.initElement(res.ref, res.options);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
}, 50);
|
|
939
|
+
}
|
|
940
|
+
getParentComponentRef(nodeId) {
|
|
941
|
+
const node = this.optionsNodes().get(nodeId);
|
|
942
|
+
if (node?.parentId) {
|
|
943
|
+
const parent = this.optionsNodes().get(node.parentId);
|
|
944
|
+
if (parent) {
|
|
945
|
+
const ref = this.getComponentRef(parent.id);
|
|
946
|
+
if (ref) {
|
|
947
|
+
return { ref, options: parent.options };
|
|
948
|
+
}
|
|
949
|
+
return this.getParentComponentRef(parent.id);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return undefined;
|
|
953
|
+
}
|
|
954
|
+
getComponentRef(nodeId) {
|
|
955
|
+
const elements = this.optionIdElements.get(nodeId);
|
|
956
|
+
if (elements) {
|
|
957
|
+
const element = elements[this.selected.get(nodeId) ?? 0];
|
|
958
|
+
if (element) {
|
|
959
|
+
return this.elementComponentRefs.get(element);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return undefined;
|
|
963
|
+
}
|
|
964
|
+
selectByNodeIds(nodeIds) {
|
|
965
|
+
if (nodeIds?.some(id => !this.selected.has(id))) {
|
|
966
|
+
this.selectService.unSelectAll();
|
|
967
|
+
this.selected.clear();
|
|
968
|
+
for (const nodeId of nodeIds) {
|
|
969
|
+
this.selected.set(nodeId, 0);
|
|
970
|
+
const elements = this.optionIdElements.get(nodeId);
|
|
971
|
+
if (elements?.[0]) {
|
|
972
|
+
this.selectService.select(elements[0]);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
getAndUpdateScopeSubject(scopeId, initScope) {
|
|
978
|
+
if (!this.scopeSubjects.has(scopeId)) {
|
|
979
|
+
this.scopeSubjects.set(scopeId, new BehaviorSubject(initScope));
|
|
980
|
+
}
|
|
981
|
+
const subject = this.scopeSubjects.get(scopeId);
|
|
982
|
+
if (initScope && initScope != subject.value) {
|
|
983
|
+
subject.next(initScope);
|
|
984
|
+
}
|
|
985
|
+
return subject;
|
|
986
|
+
}
|
|
987
|
+
updateScopeWithSelectedElement(scopeId) {
|
|
988
|
+
const elements = this.selectService.getSelectElements();
|
|
989
|
+
if (elements.length > 0) {
|
|
990
|
+
const ref = this.elementComponentRefs.get(elements[0]);
|
|
991
|
+
const scope = ref?.injector.get(ScopeDirective, null)?.findScope(scopeId);
|
|
992
|
+
if (scope) {
|
|
993
|
+
this.getAndUpdateScopeSubject(scope.axisScope(), scope);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
dragForOuter(node) {
|
|
998
|
+
this.dragService.dragStart(node);
|
|
999
|
+
}
|
|
1000
|
+
dragEndForOuter() {
|
|
1001
|
+
return this.dragService.dragEnd();
|
|
1002
|
+
}
|
|
1003
|
+
ngOnDestroy() {
|
|
1004
|
+
for (const s of this.scopeSubjects.values()) {
|
|
1005
|
+
s.unsubscribe();
|
|
1006
|
+
}
|
|
1007
|
+
this.fileBaseUrlSub?.unsubscribe();
|
|
1008
|
+
this.httpContextDataSub?.unsubscribe();
|
|
1009
|
+
this.injectFuncSub?.unsubscribe();
|
|
1010
|
+
}
|
|
1011
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Preview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1012
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.4", type: Preview, isStandalone: true, selector: "axis-design-preview", inputs: { loadAndOptions: { classPropertyName: "loadAndOptions", publicName: "loadAndOptions", isSignal: true, isRequired: true, transformFunction: null }, optionsNodes: { classPropertyName: "optionsNodes", publicName: "optionsNodes", isSignal: true, isRequired: true, transformFunction: null }, injectData: { classPropertyName: "injectData", publicName: "injectData", isSignal: true, isRequired: true, transformFunction: null }, httpContextData: { classPropertyName: "httpContextData", publicName: "httpContextData", isSignal: true, isRequired: false, transformFunction: null }, fileBaseUrl: { classPropertyName: "fileBaseUrl", publicName: "fileBaseUrl", isSignal: true, isRequired: false, transformFunction: null }, injectFunc: { classPropertyName: "injectFunc", publicName: "injectFunc", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange", onSelect: "onSelect", onContextMenu: "onContextMenu" }, providers: [
|
|
1013
|
+
{
|
|
1014
|
+
provide: DesignBuilder,
|
|
1015
|
+
useFactory: (preview) => {
|
|
1016
|
+
return new DesignBuilder((ref, options) => preview.initElement(ref, options), (scope) => preview.initScope(scope));
|
|
1017
|
+
},
|
|
1018
|
+
deps: [Preview]
|
|
1019
|
+
}, {
|
|
1020
|
+
provide: AXIS_INJECT_DATA_TOKEN,
|
|
1021
|
+
useFactory: (preview) => {
|
|
1022
|
+
return preview.injectData();
|
|
1023
|
+
},
|
|
1024
|
+
deps: [Preview]
|
|
1025
|
+
}, {
|
|
1026
|
+
provide: AXIS_HTTP_CONTEXT_DATA_TOKEN,
|
|
1027
|
+
useFactory: (preview) => {
|
|
1028
|
+
return preview.httpContextDataSubject;
|
|
1029
|
+
},
|
|
1030
|
+
deps: [Preview]
|
|
1031
|
+
}, {
|
|
1032
|
+
provide: AXIS_FILE_BASE_URL_TOKEN,
|
|
1033
|
+
useFactory: (preview) => {
|
|
1034
|
+
return preview.fileBaseUrlSubject;
|
|
1035
|
+
},
|
|
1036
|
+
deps: [Preview]
|
|
1037
|
+
}, {
|
|
1038
|
+
provide: AXIS_INJECT_FUNC_TOKEN,
|
|
1039
|
+
useFactory: (preview) => {
|
|
1040
|
+
return preview.injectFuncSubject;
|
|
1041
|
+
},
|
|
1042
|
+
deps: [Preview]
|
|
1043
|
+
},
|
|
1044
|
+
], viewQueries: [{ propertyName: "dynamicDirective", first: true, predicate: ["child"], descendants: true, read: DynamicDirective }], ngImport: i0, template: "<ng-container #child [axisDynamic]=\"loadAndOptions()?.[1]\" [standalone]=\"true\" [isDesign]=\"true\"></ng-container>", styles: [":host{padding:4px}\n"], dependencies: [{ kind: "directive", type: DynamicDirective, selector: "[axisDynamic]", inputs: ["axisDynamic", "standalone", "isDesign"], outputs: ["onRegisteValueAccess"], exportAs: ["axisDynamic"] }, { kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1045
|
+
}
|
|
1046
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Preview, decorators: [{
|
|
1047
|
+
type: Component,
|
|
1048
|
+
args: [{ selector: 'axis-design-preview', imports: [DynamicDirective, CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1049
|
+
{
|
|
1050
|
+
provide: DesignBuilder,
|
|
1051
|
+
useFactory: (preview) => {
|
|
1052
|
+
return new DesignBuilder((ref, options) => preview.initElement(ref, options), (scope) => preview.initScope(scope));
|
|
1053
|
+
},
|
|
1054
|
+
deps: [Preview]
|
|
1055
|
+
}, {
|
|
1056
|
+
provide: AXIS_INJECT_DATA_TOKEN,
|
|
1057
|
+
useFactory: (preview) => {
|
|
1058
|
+
return preview.injectData();
|
|
1059
|
+
},
|
|
1060
|
+
deps: [Preview]
|
|
1061
|
+
}, {
|
|
1062
|
+
provide: AXIS_HTTP_CONTEXT_DATA_TOKEN,
|
|
1063
|
+
useFactory: (preview) => {
|
|
1064
|
+
return preview.httpContextDataSubject;
|
|
1065
|
+
},
|
|
1066
|
+
deps: [Preview]
|
|
1067
|
+
}, {
|
|
1068
|
+
provide: AXIS_FILE_BASE_URL_TOKEN,
|
|
1069
|
+
useFactory: (preview) => {
|
|
1070
|
+
return preview.fileBaseUrlSubject;
|
|
1071
|
+
},
|
|
1072
|
+
deps: [Preview]
|
|
1073
|
+
}, {
|
|
1074
|
+
provide: AXIS_INJECT_FUNC_TOKEN,
|
|
1075
|
+
useFactory: (preview) => {
|
|
1076
|
+
return preview.injectFuncSubject;
|
|
1077
|
+
},
|
|
1078
|
+
deps: [Preview]
|
|
1079
|
+
},
|
|
1080
|
+
], template: "<ng-container #child [axisDynamic]=\"loadAndOptions()?.[1]\" [standalone]=\"true\" [isDesign]=\"true\"></ng-container>", styles: [":host{padding:4px}\n"] }]
|
|
1081
|
+
}], ctorParameters: () => [], propDecorators: { dynamicDirective: [{
|
|
1082
|
+
type: ViewChild,
|
|
1083
|
+
args: ["child", { read: DynamicDirective }]
|
|
1084
|
+
}] } });
|
|
1085
|
+
|
|
1086
|
+
class Cmplib {
|
|
1087
|
+
constructor() {
|
|
1088
|
+
effect(() => {
|
|
1089
|
+
this.tags();
|
|
1090
|
+
this.cmplib();
|
|
1091
|
+
this.searchValue$.next(this.searchValue$.value);
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
cmplibs = inject(AXIS_DESIGN_CMPLIBS_TOKEN, { optional: true });
|
|
1095
|
+
cmplib = model(...(ngDevMode ? [undefined, { debugName: "cmplib" }] : []));
|
|
1096
|
+
dragOptions = signal(undefined, ...(ngDevMode ? [{ debugName: "dragOptions" }] : []));
|
|
1097
|
+
selectMode = input.required(...(ngDevMode ? [{ debugName: "selectMode" }] : []));
|
|
1098
|
+
tags = input(...(ngDevMode ? [undefined, { debugName: "tags" }] : []));
|
|
1099
|
+
dragExample;
|
|
1100
|
+
clickExample = output();
|
|
1101
|
+
dragStart = output();
|
|
1102
|
+
dragEnd = output();
|
|
1103
|
+
dragElement;
|
|
1104
|
+
searchValue$ = new BehaviorSubject('');
|
|
1105
|
+
displayCmpLib = toSignal(this.searchValue$.pipe(auditTime(300), map(v => {
|
|
1106
|
+
if (v || this.tags()?.length) {
|
|
1107
|
+
v = v.toLowerCase();
|
|
1108
|
+
return this.cmplib()?.map(group => ({
|
|
1109
|
+
groupName: group.groupName,
|
|
1110
|
+
children: group.children.filter(c => (!v || c.component.includes(v)) && (!this.tags()?.length || c.tags?.some(t => this.tags().includes(t))))
|
|
1111
|
+
})).filter(group => group.children.length);
|
|
1112
|
+
}
|
|
1113
|
+
else {
|
|
1114
|
+
return this.cmplib();
|
|
1115
|
+
}
|
|
1116
|
+
})));
|
|
1117
|
+
ngOnInit() {
|
|
1118
|
+
if (this.cmplibs?.length) {
|
|
1119
|
+
this.cmplib.set(this.cmplibs[0].lib);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
onClick(example) {
|
|
1123
|
+
if (this.selectMode() == "click") {
|
|
1124
|
+
this.clickExample.emit(example);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
preloadDragElement(example, desc) {
|
|
1128
|
+
if (this.selectMode() == "drag") {
|
|
1129
|
+
this.dragOptions.set(example.options);
|
|
1130
|
+
this.dragExample = example;
|
|
1131
|
+
if (desc) {
|
|
1132
|
+
example.name ??= desc.component;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
onDragStart(e) {
|
|
1137
|
+
if (this.selectMode() == "drag") {
|
|
1138
|
+
e.stopPropagation();
|
|
1139
|
+
if (e.dataTransfer) {
|
|
1140
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
1141
|
+
}
|
|
1142
|
+
e.dataTransfer?.setDragImage(this.dragElement?.nativeElement, 0, 0);
|
|
1143
|
+
setTimeout(() => {
|
|
1144
|
+
this.dragStart.emit({ example: this.dragExample, element: this.dragElement?.nativeElement });
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
onDragEnd(e) {
|
|
1149
|
+
if (this.selectMode() == "drag") {
|
|
1150
|
+
e.stopPropagation();
|
|
1151
|
+
e.preventDefault();
|
|
1152
|
+
this.dragEnd.emit();
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Cmplib, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1156
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: Cmplib, isStandalone: true, selector: "axis-cmplib", inputs: { cmplib: { classPropertyName: "cmplib", publicName: "cmplib", isSignal: true, isRequired: false, transformFunction: null }, selectMode: { classPropertyName: "selectMode", publicName: "selectMode", isSignal: true, isRequired: true, transformFunction: null }, tags: { classPropertyName: "tags", publicName: "tags", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cmplib: "cmplibChange", clickExample: "clickExample", dragStart: "dragStart", dragEnd: "dragEnd" }, viewQueries: [{ propertyName: "dragElement", first: true, predicate: ["dragElement"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div nz-flex nzAlign=\"center\">\n <input style=\"flex:1\" type=\"text\" nz-input placeholder=\"\u641C\u7D22\" nzBorderless ngModel\n (ngModelChange)=\"searchValue$.next($event)\" />\n <nz-select [(ngModel)]=\"cmplib\" nzSize=\"small\" nzBorderless style=\"width: auto;font-size: 12px;\">\n @for (lib of cmplibs; track $index) {\n <nz-option [nzValue]=\"lib.lib\" [nzLabel]=\"lib.libName\"></nz-option>\n }\n </nz-select>\n</div>\n<nz-collapse nzAccordion>\n @for (group of displayCmpLib(); track group.groupName) {\n <nz-collapse-panel [nzHeader]=\"`${group.groupName}(${group.children.length})`\">\n <div nz-row [nzGutter]=\"[8,8]\">\n @for (item of group.children; track item.component) {\n <div nz-col [nzSpan]=\"item.span\">\n <nz-card nzSize=\"small\" nzHoverable [nzCover]=\"coverTemplate\" [nzTitle]=\"item.component\"\n [nzExtra]=\"item.moreExamples? more:''\" [nzBodyStyle]=\"{padding:0}\" (click)=\"onClick(item.example)\"\n [draggable]=\"selectMode()=='drag'\" (mouseenter)=\"preloadDragElement(item.example,item)\"\n (dragstart)=\"onDragStart($event)\" (dragend)=\"onDragEnd($event)\">\n </nz-card>\n <ng-template #coverTemplate>\n <img style=\"margin: 4px;object-fit: contain;\" [style.height.px]=\"item.height\"\n [src]=\"item.coverImg\" />\n </ng-template>\n <ng-template #more>\n <a nz-button nzType=\"link\" nzSize=\"small\" nz-dropdown [nzDropdownMenu]=\"examples\">\n <nz-icon nzType=\"ellipsis\"></nz-icon>\n </a>\n <nz-dropdown-menu #examples=\"nzDropdownMenu\">\n <ul nz-menu nzSelectable>\n @for (item of item.moreExamples; track item.name) {\n <li nz-menu-item (click)=\"onClick(item)\" [draggable]=\"selectMode()=='drag'\"\n (mouseenter)=\"preloadDragElement(item)\" (dragstart)=\"onDragStart($event)\"\n (dragend)=\"onDragEnd($event)\">{{item.name}}</li>\n }\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n </div>\n }\n </div>\n </nz-collapse-panel>\n }\n</nz-collapse>\n<div class=\"dragElementContainer\">\n <div #dragElement>\n @if (dragOptions()) {\n <ng-container [axisDynamic]=\"dragOptions()\" [standalone]=\"true\"></ng-container>\n {{dragOptions().type}}\n }\n </div>\n</div>", styles: [".dragElementContainer{position:absolute;z-index:-9999;top:100px}\n"], dependencies: [{ kind: "ngmodule", type: NzCollapseModule }, { kind: "component", type: i1$1.NzCollapsePanelComponent, selector: "nz-collapse-panel", inputs: ["nzActive", "nzDisabled", "nzShowArrow", "nzExtra", "nzHeader", "nzExpandedIcon", "nzCollapsible"], outputs: ["nzActiveChange"], exportAs: ["nzCollapsePanel"] }, { kind: "component", type: i1$1.NzCollapseComponent, selector: "nz-collapse", inputs: ["nzAccordion", "nzBordered", "nzGhost", "nzExpandIconPosition", "nzSize"], exportAs: ["nzCollapse"] }, { kind: "ngmodule", type: NzCardModule }, { kind: "component", type: i2$1.NzCardComponent, selector: "nz-card", inputs: ["nzBordered", "nzLoading", "nzHoverable", "nzBodyStyle", "nzCover", "nzActions", "nzType", "nzSize", "nzTitle", "nzExtra"], exportAs: ["nzCard"] }, { kind: "ngmodule", type: NzGridModule }, { kind: "directive", type: i3$2.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i3$2.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "directive", type: DynamicDirective, selector: "[axisDynamic]", inputs: ["axisDynamic", "standalone", "isDesign"], outputs: ["onRegisteValueAccess"], exportAs: ["axisDynamic"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i6.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i7.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "ngmodule", type: NzDropDownModule }, { kind: "directive", type: i6$1.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i6$1.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzArrow", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "directive", type: i7$1.NzDropDownADirective, selector: "a[nz-dropdown]" }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i7$1.NzDropdownButtonDirective, selector: "[nz-button][nz-dropdown]" }, { kind: "ngmodule", type: NzInputModule }, { kind: "directive", type: i2.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzVariant", "nzSize", "nzStepperless", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzFlexModule }, { kind: "directive", type: i3$1.NzFlexDirective, selector: "[nz-flex],nz-flex", inputs: ["nzVertical", "nzJustify", "nzAlign", "nzGap", "nzWrap", "nzFlex"], exportAs: ["nzFlex"] }, { kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i12.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i12.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzVariant", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzPrefix", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzBorderless", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus", "nzOnClear"], exportAs: ["nzSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1157
|
+
}
|
|
1158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Cmplib, decorators: [{
|
|
1159
|
+
type: Component,
|
|
1160
|
+
args: [{ selector: 'axis-cmplib', imports: [NzCollapseModule, NzCardModule, NzGridModule, DynamicDirective, NzButtonModule, NzDropDownModule, NzInputModule, FormsModule, NzIconModule, NzFlexModule, NzSelectModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div nz-flex nzAlign=\"center\">\n <input style=\"flex:1\" type=\"text\" nz-input placeholder=\"\u641C\u7D22\" nzBorderless ngModel\n (ngModelChange)=\"searchValue$.next($event)\" />\n <nz-select [(ngModel)]=\"cmplib\" nzSize=\"small\" nzBorderless style=\"width: auto;font-size: 12px;\">\n @for (lib of cmplibs; track $index) {\n <nz-option [nzValue]=\"lib.lib\" [nzLabel]=\"lib.libName\"></nz-option>\n }\n </nz-select>\n</div>\n<nz-collapse nzAccordion>\n @for (group of displayCmpLib(); track group.groupName) {\n <nz-collapse-panel [nzHeader]=\"`${group.groupName}(${group.children.length})`\">\n <div nz-row [nzGutter]=\"[8,8]\">\n @for (item of group.children; track item.component) {\n <div nz-col [nzSpan]=\"item.span\">\n <nz-card nzSize=\"small\" nzHoverable [nzCover]=\"coverTemplate\" [nzTitle]=\"item.component\"\n [nzExtra]=\"item.moreExamples? more:''\" [nzBodyStyle]=\"{padding:0}\" (click)=\"onClick(item.example)\"\n [draggable]=\"selectMode()=='drag'\" (mouseenter)=\"preloadDragElement(item.example,item)\"\n (dragstart)=\"onDragStart($event)\" (dragend)=\"onDragEnd($event)\">\n </nz-card>\n <ng-template #coverTemplate>\n <img style=\"margin: 4px;object-fit: contain;\" [style.height.px]=\"item.height\"\n [src]=\"item.coverImg\" />\n </ng-template>\n <ng-template #more>\n <a nz-button nzType=\"link\" nzSize=\"small\" nz-dropdown [nzDropdownMenu]=\"examples\">\n <nz-icon nzType=\"ellipsis\"></nz-icon>\n </a>\n <nz-dropdown-menu #examples=\"nzDropdownMenu\">\n <ul nz-menu nzSelectable>\n @for (item of item.moreExamples; track item.name) {\n <li nz-menu-item (click)=\"onClick(item)\" [draggable]=\"selectMode()=='drag'\"\n (mouseenter)=\"preloadDragElement(item)\" (dragstart)=\"onDragStart($event)\"\n (dragend)=\"onDragEnd($event)\">{{item.name}}</li>\n }\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n </div>\n }\n </div>\n </nz-collapse-panel>\n }\n</nz-collapse>\n<div class=\"dragElementContainer\">\n <div #dragElement>\n @if (dragOptions()) {\n <ng-container [axisDynamic]=\"dragOptions()\" [standalone]=\"true\"></ng-container>\n {{dragOptions().type}}\n }\n </div>\n</div>", styles: [".dragElementContainer{position:absolute;z-index:-9999;top:100px}\n"] }]
|
|
1161
|
+
}], ctorParameters: () => [], propDecorators: { dragElement: [{
|
|
1162
|
+
type: ViewChild,
|
|
1163
|
+
args: ["dragElement", { read: ElementRef, static: true }]
|
|
1164
|
+
}] } });
|
|
1165
|
+
|
|
1166
|
+
class ShortcutKey {
|
|
1167
|
+
design;
|
|
1168
|
+
constructor(design) {
|
|
1169
|
+
this.design = design;
|
|
1170
|
+
}
|
|
1171
|
+
cutNodeIds;
|
|
1172
|
+
onKeyPress(e) {
|
|
1173
|
+
const isInput = e.target.matches('input:not([disabled]), textarea:not([disabled]), [contenteditable="true"]');
|
|
1174
|
+
if (isInput) {
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
let event;
|
|
1178
|
+
if (e.key == "Backspace") {
|
|
1179
|
+
event = "delete";
|
|
1180
|
+
}
|
|
1181
|
+
else if (e.key == "z" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
|
|
1182
|
+
event = "undo";
|
|
1183
|
+
}
|
|
1184
|
+
else if (e.key.toLowerCase() == "z" && (e.metaKey || e.ctrlKey) && e.shiftKey) {
|
|
1185
|
+
event = "redo";
|
|
1186
|
+
}
|
|
1187
|
+
else if (e.key == "c" && e.metaKey && e.ctrlKey) {
|
|
1188
|
+
event = "onlyPreview";
|
|
1189
|
+
}
|
|
1190
|
+
else if (e.key == "r" && e.metaKey && e.ctrlKey) {
|
|
1191
|
+
event = "forceRender";
|
|
1192
|
+
}
|
|
1193
|
+
else if (e.key == "h" && e.metaKey && e.ctrlKey) {
|
|
1194
|
+
event = "shortcutKeysInfo";
|
|
1195
|
+
}
|
|
1196
|
+
else if (e.key == "c" && (e.metaKey || e.ctrlKey) && (!getSelection()?.toString() || getSelection()?.anchorNode == document.body)) {
|
|
1197
|
+
event = "copy";
|
|
1198
|
+
}
|
|
1199
|
+
else if (e.key == "x" && (e.metaKey || e.ctrlKey)) {
|
|
1200
|
+
event = "cut";
|
|
1201
|
+
}
|
|
1202
|
+
else if (e.key == "v" && (e.metaKey || e.ctrlKey)) {
|
|
1203
|
+
event = "paste";
|
|
1204
|
+
}
|
|
1205
|
+
// console.log(event, e.key, "meta", e.metaKey, "ctrl", e.ctrlKey, "shift", e.shiftKey)
|
|
1206
|
+
if (event) {
|
|
1207
|
+
e.preventDefault();
|
|
1208
|
+
e.stopPropagation();
|
|
1209
|
+
this.doEvent(event);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
doEvent(event) {
|
|
1213
|
+
switch (event) {
|
|
1214
|
+
case "delete":
|
|
1215
|
+
this.design.tree.removeSelected();
|
|
1216
|
+
this.design.element.nativeElement.focus();
|
|
1217
|
+
break;
|
|
1218
|
+
case "undo":
|
|
1219
|
+
this.design.tools.undo();
|
|
1220
|
+
break;
|
|
1221
|
+
case "redo":
|
|
1222
|
+
this.design.tools.redo();
|
|
1223
|
+
break;
|
|
1224
|
+
case "onlyPreview":
|
|
1225
|
+
this.onlyPreview();
|
|
1226
|
+
break;
|
|
1227
|
+
case "forceRender":
|
|
1228
|
+
this.forceRender();
|
|
1229
|
+
break;
|
|
1230
|
+
case "shortcutKeysInfo":
|
|
1231
|
+
this.shortcutKeysInfo();
|
|
1232
|
+
break;
|
|
1233
|
+
case "copy":
|
|
1234
|
+
this.copy();
|
|
1235
|
+
break;
|
|
1236
|
+
case "cut":
|
|
1237
|
+
this.cut();
|
|
1238
|
+
break;
|
|
1239
|
+
case "paste":
|
|
1240
|
+
this.paste();
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
onlyPreview() {
|
|
1245
|
+
this.design.tools.onlyPreview.set(!this.design.tools.onlyPreview());
|
|
1246
|
+
}
|
|
1247
|
+
forceRender() {
|
|
1248
|
+
this.design.preview.forceRender();
|
|
1249
|
+
}
|
|
1250
|
+
shortcutKeysInfo() {
|
|
1251
|
+
this.design.tools.shortcutKeysModal.set(true);
|
|
1252
|
+
}
|
|
1253
|
+
copy() {
|
|
1254
|
+
const { selected } = this.design.tree.selectListSelection;
|
|
1255
|
+
let options = selected.map(nodeId => this.design.optionsNodes.get(nodeId)).map(node => node?.options);
|
|
1256
|
+
if (options.length == 1) {
|
|
1257
|
+
options = options[0];
|
|
1258
|
+
}
|
|
1259
|
+
this.design.clipboard.copy(JSON.stringify(options, null, 2));
|
|
1260
|
+
}
|
|
1261
|
+
cut() {
|
|
1262
|
+
const { selected } = this.design.tree.selectListSelection;
|
|
1263
|
+
this.cutNodeIds = selected;
|
|
1264
|
+
const options = selected.map(nodeId => this.design.optionsNodes.get(nodeId)).map(node => node?.options);
|
|
1265
|
+
this.design.clipboard.copy(JSON.stringify(options, null, 2));
|
|
1266
|
+
}
|
|
1267
|
+
async paste() {
|
|
1268
|
+
try {
|
|
1269
|
+
const text = await navigator.clipboard.readText();
|
|
1270
|
+
if (text) {
|
|
1271
|
+
const j = JSON.parse(text);
|
|
1272
|
+
let objs;
|
|
1273
|
+
if (Array.isArray(j)) {
|
|
1274
|
+
objs = j.filter(r => this.isComponentObj(r));
|
|
1275
|
+
}
|
|
1276
|
+
else if (this.isComponentObj(j)) {
|
|
1277
|
+
objs = [j];
|
|
1278
|
+
}
|
|
1279
|
+
if (objs?.length && this.design.tree.selectListSelection.selected.length > 0) {
|
|
1280
|
+
if (this.cutNodeIds?.length && isEquals(objs.map(r => r.id), this.cutNodeIds)) {
|
|
1281
|
+
this.design.onNodesMove(this.cutNodeIds);
|
|
1282
|
+
this.cutNodeIds = undefined;
|
|
1283
|
+
}
|
|
1284
|
+
else {
|
|
1285
|
+
this.design.onPaste(objs);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
catch (e) {
|
|
1291
|
+
console.error(e);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
isComponentObj(obj) {
|
|
1295
|
+
return obj && obj.hasOwnProperty("id") && obj.hasOwnProperty("component");
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
class DesignOptions extends ValueAccessOptions {
|
|
1300
|
+
injectData = signal({}, ...(ngDevMode ? [{ debugName: "injectData" }] : []));
|
|
1301
|
+
injectFunc = signal(undefined, ...(ngDevMode ? [{ debugName: "injectFunc" }] : []));
|
|
1302
|
+
allPermissions = signal({}, ...(ngDevMode ? [{ debugName: "allPermissions" }] : []));
|
|
1303
|
+
httpContextData = signal(undefined, ...(ngDevMode ? [{ debugName: "httpContextData" }] : []));
|
|
1304
|
+
fileBaseUrl = signal("", ...(ngDevMode ? [{ debugName: "fileBaseUrl" }] : []));
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
class Toolbar {
|
|
1308
|
+
design = inject(Design);
|
|
1309
|
+
cdr = inject(ChangeDetectorRef);
|
|
1310
|
+
onlyPreview = signal(false, ...(ngDevMode ? [{ debugName: "onlyPreview" }] : []));
|
|
1311
|
+
shortcutKeysModal = model(false, ...(ngDevMode ? [{ debugName: "shortcutKeysModal" }] : []));
|
|
1312
|
+
history = [];
|
|
1313
|
+
historyIndex = 0;
|
|
1314
|
+
putHistory(options, desc) {
|
|
1315
|
+
if (this.historyIndex > 0) {
|
|
1316
|
+
this.history.splice(0, this.historyIndex);
|
|
1317
|
+
this.historyIndex = 0;
|
|
1318
|
+
}
|
|
1319
|
+
this.history.unshift({ options: copy(options, true), time: new Date(), desc });
|
|
1320
|
+
if (this.history.length > 50) {
|
|
1321
|
+
this.history.pop();
|
|
1322
|
+
}
|
|
1323
|
+
this.cdr.markForCheck();
|
|
1324
|
+
}
|
|
1325
|
+
undo() {
|
|
1326
|
+
if (this.historyIndex < this.history.length - 1) {
|
|
1327
|
+
this.historyIndex++;
|
|
1328
|
+
this.design.onChangeOptionsConfig({ value: copy(this.history[this.historyIndex].options, true), putHistory: false });
|
|
1329
|
+
this.cdr.markForCheck();
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
redo() {
|
|
1333
|
+
if (this.historyIndex > 0) {
|
|
1334
|
+
this.historyIndex--;
|
|
1335
|
+
this.design.onChangeOptionsConfig({ value: copy(this.history[this.historyIndex].options, true), putHistory: false });
|
|
1336
|
+
this.cdr.markForCheck();
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
switchHistory(index) {
|
|
1340
|
+
if (index != this.historyIndex && index > -1 && index < this.history.length) {
|
|
1341
|
+
this.historyIndex = index;
|
|
1342
|
+
this.design.onChangeOptionsConfig({ value: copy(this.history[this.historyIndex].options, true), putHistory: false });
|
|
1343
|
+
this.cdr.markForCheck();
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Toolbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1347
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: Toolbar, isStandalone: true, selector: "axis-toolbar", inputs: { shortcutKeysModal: { classPropertyName: "shortcutKeysModal", publicName: "shortcutKeysModal", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { shortcutKeysModal: "shortcutKeysModalChange" }, ngImport: i0, template: "<div class=\"tools\" nz-flex nzGap=\"4px\">\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u5FEB\u6377\u952E\u8BF4\u660E\"\n (click)=\"shortcutKeysModal.set(true)\">\n <nz-icon nzType=\"exclamation-circle\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u7F16\u8F91\u5386\u53F2\" nz-popover\n [nzPopoverTitle]=\"historyTitle\" nzPopoverTrigger=\"click\" [nzPopoverContent]=\"historyTemp\"\n nzPopoverPlacement=\"bottom\" nzPopoverOverlayClassName=\"history-popover\">\n <nz-icon nzType=\"history\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" [nz-tooltip]=\"onlyPreview()?'\u6062\u590D':'\u653E\u5927'\"\n (click)=\"onlyPreview.set(!onlyPreview())\">\n <nz-icon [nzType]=\"onlyPreview()?'fullscreen-exit':'fullscreen'\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u91CD\u65B0\u8F7D\u5165\"\n (click)=\"design.preview.forceRender()\">\n <nz-icon nzType=\"reload\" />\n </button>\n</div>\n\n<ng-template #historyTitle>\n <div nz-flex>\n <div style=\"flex:1\">\u7F16\u8F91\u5386\u53F2</div>\n <button nz-button nzSize=\"small\" nzType=\"link\" nzShape=\"circle\" nz-tooltip=\"\u64A4\u9500\" (click)=\"undo()\"\n [disabled]=\"historyIndex==history.length-1\">\n <nz-icon nzType=\"undo\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"link\" nzShape=\"circle\" nz-tooltip=\"\u91CD\u505A\" (click)=\"redo()\"\n [disabled]=\"historyIndex==0\">\n <nz-icon nzType=\"redo\" nzTheme=\"outline\" />\n </button>\n </div>\n</ng-template>\n\n<ng-template #historyTemp>\n <div nz-flex nzVertical nzGap=\"6px\" style=\"max-height: 300px;overflow: auto;\">\n @for (item of history; track item.time;let i=$index) {\n <div nz-flex nzAlign=\"center\" [class.active]=\"i == historyIndex\" class=\"history-item\" (click)=\"switchHistory(i)\">\n <div style=\"width: 20px;\">\n @if (i == historyIndex) {\n <nz-icon nzType=\"aim\" nzTheme=\"outline\" />\n }\n </div>\n <div nz-flex nzVertical>\n <span>{{item.desc}}</span>\n <span style=\"font-size: 10px;color:rgba(0,0,0,0.38)\"> {{item.time | axisHowLong}}</span>\n </div>\n </div>\n }\n </div>\n</ng-template>\n\n<nz-modal [(nzVisible)]=\"shortcutKeysModal\" nzTitle=\"\u5FEB\u6377\u952E\u8BF4\u660E\" nzDraggable [nzOkText]=\"null\" nzCancelText=\"\u5173\u95ED\"\n (nzOnCancel)=\"shortcutKeysModal.set(false)\">\n <ng-container *nzModalContent>\n <nz-table nzTemplateMode nzSize=\"small\">\n <thead>\n <tr>\n <th>\u529F\u80FD</th>\n <th>\u5FEB\u6377\u952E</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\u67E5\u770B\u5FEB\u6377\u952E\u8BF4\u660E</td>\n <td>Ctrl Meta H</td>\n </tr>\n <tr>\n <td>\u590D\u5236</td>\n <td>Ctrl C</td>\n </tr>\n <tr>\n <td>\u526A\u5207</td>\n <td>Ctrl X</td>\n </tr>\n <tr>\n <td>\u7C98\u8D34</td>\n <td>Ctrl V</td>\n </tr>\n <tr>\n <td>\u64A4\u9500</td>\n <td>Ctrl Z</td>\n </tr>\n <tr>\n <td>\u91CD\u505A</td>\n <td>Ctrl Shift Z</td>\n </tr>\n <tr>\n <td>\u9884\u89C8\u653E\u5927/\u6062\u590D</td>\n <td>Ctrl Meta C</td>\n </tr>\n <tr>\n <td>\u91CD\u65B0\u8F7D\u5165</td>\n <td>Ctrl Meta R</td>\n </tr>\n </tbody>\n </nz-table>\n </ng-container>\n</nz-modal>", styles: [".tools{position:absolute;right:20px;top:10px}::ng-deep .history-popover .ant-popover-inner-content{width:100%;padding:12px 0}.history-item{padding:0 12px;cursor:pointer}.history-item:hover{background-color:var(--ant-primary-1)}.active{color:var(--ant-primary-color);pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: NzModalModule }, { kind: "component", type: i1$2.NzModalComponent, selector: "nz-modal", inputs: ["nzMask", "nzMaskClosable", "nzCloseOnNavigation", "nzVisible", "nzClosable", "nzOkLoading", "nzOkDisabled", "nzCancelDisabled", "nzCancelLoading", "nzKeyboard", "nzNoAnimation", "nzCentered", "nzDraggable", "nzContent", "nzFooter", "nzZIndex", "nzWidth", "nzWrapClassName", "nzClassName", "nzStyle", "nzTitle", "nzCloseIcon", "nzMaskStyle", "nzBodyStyle", "nzOkText", "nzCancelText", "nzOkType", "nzOkDanger", "nzIconType", "nzModalType", "nzAutofocus", "nzOnOk", "nzOnCancel"], outputs: ["nzOnOk", "nzOnCancel", "nzAfterOpen", "nzAfterClose", "nzVisibleChange"], exportAs: ["nzModal"] }, { kind: "directive", type: i1$2.NzModalContentDirective, selector: "[nzModalContent]", exportAs: ["nzModalContent"] }, { kind: "ngmodule", type: NzTableModule }, { kind: "component", type: i2$2.NzTableComponent, selector: "nz-table", inputs: ["nzTableLayout", "nzShowTotal", "nzItemRender", "nzTitle", "nzFooter", "nzNoResult", "nzPageSizeOptions", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualForTrackBy", "nzLoadingDelay", "nzPageIndex", "nzPageSize", "nzTotal", "nzWidthConfig", "nzData", "nzCustomColumn", "nzPaginationPosition", "nzScroll", "noDataVirtualHeight", "nzPaginationType", "nzFrontPagination", "nzTemplateMode", "nzShowPagination", "nzLoading", "nzOuterBordered", "nzLoadingIndicator", "nzBordered", "nzSize", "nzShowSizeChanger", "nzHideOnSinglePage", "nzShowQuickJumper", "nzSimple"], outputs: ["nzPageSizeChange", "nzPageIndexChange", "nzQueryParams", "nzCurrentPageDataChange", "nzCustomColumnChange"], exportAs: ["nzTable"] }, { kind: "directive", type: i2$2.NzTableCellDirective, selector: "th:not(.nz-disable-th), td:not(.nz-disable-td)" }, { kind: "directive", type: i2$2.NzThMeasureDirective, selector: "th", inputs: ["nzWidth", "colspan", "colSpan", "rowspan", "rowSpan"] }, { kind: "component", type: i2$2.NzTheadComponent, selector: "thead:not(.ant-table-thead)", outputs: ["nzSortOrderChange"] }, { kind: "component", type: i2$2.NzTbodyComponent, selector: "tbody" }, { kind: "directive", type: i2$2.NzTrDirective, selector: "tr:not([nz-table-measure-row]):not([nzExpand]):not([nz-table-fixed-row])" }, { kind: "ngmodule", type: NzFlexModule }, { kind: "directive", type: i3$1.NzFlexDirective, selector: "[nz-flex],nz-flex", inputs: ["nzVertical", "nzJustify", "nzAlign", "nzGap", "nzWrap", "nzFlex"], exportAs: ["nzFlex"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i3.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzTooltipModule }, { kind: "directive", type: i9.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "cdkConnectedOverlayPush", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i6.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i7.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "ngmodule", type: NzPopoverModule }, { kind: "directive", type: i8$1.NzPopoverDirective, selector: "[nz-popover]", inputs: ["nzPopoverArrowPointAtCenter", "nzPopoverTitle", "nzPopoverTitleContext", "nzPopoverContent", "nzPopoverContentContext", "nz-popover", "nzPopoverTrigger", "nzPopoverPlacement", "nzPopoverOrigin", "nzPopoverVisible", "nzPopoverMouseEnterDelay", "nzPopoverMouseLeaveDelay", "nzPopoverOverlayClassName", "nzPopoverOverlayStyle", "nzPopoverOverlayClickable", "nzPopoverBackdrop"], outputs: ["nzPopoverVisibleChange"], exportAs: ["nzPopover"] }, { kind: "pipe", type: HowLongPipe, name: "axisHowLong" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1348
|
+
}
|
|
1349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Toolbar, decorators: [{
|
|
1350
|
+
type: Component,
|
|
1351
|
+
args: [{ selector: 'axis-toolbar', imports: [NzModalModule, NzTableModule, NzFlexModule, NzIconModule, NzTooltipModule, NzButtonModule, NzPopoverModule, HowLongPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"tools\" nz-flex nzGap=\"4px\">\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u5FEB\u6377\u952E\u8BF4\u660E\"\n (click)=\"shortcutKeysModal.set(true)\">\n <nz-icon nzType=\"exclamation-circle\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u7F16\u8F91\u5386\u53F2\" nz-popover\n [nzPopoverTitle]=\"historyTitle\" nzPopoverTrigger=\"click\" [nzPopoverContent]=\"historyTemp\"\n nzPopoverPlacement=\"bottom\" nzPopoverOverlayClassName=\"history-popover\">\n <nz-icon nzType=\"history\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" [nz-tooltip]=\"onlyPreview()?'\u6062\u590D':'\u653E\u5927'\"\n (click)=\"onlyPreview.set(!onlyPreview())\">\n <nz-icon [nzType]=\"onlyPreview()?'fullscreen-exit':'fullscreen'\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"text\" nzShape=\"circle\" nz-tooltip=\"\u91CD\u65B0\u8F7D\u5165\"\n (click)=\"design.preview.forceRender()\">\n <nz-icon nzType=\"reload\" />\n </button>\n</div>\n\n<ng-template #historyTitle>\n <div nz-flex>\n <div style=\"flex:1\">\u7F16\u8F91\u5386\u53F2</div>\n <button nz-button nzSize=\"small\" nzType=\"link\" nzShape=\"circle\" nz-tooltip=\"\u64A4\u9500\" (click)=\"undo()\"\n [disabled]=\"historyIndex==history.length-1\">\n <nz-icon nzType=\"undo\" nzTheme=\"outline\" />\n </button>\n <button nz-button nzSize=\"small\" nzType=\"link\" nzShape=\"circle\" nz-tooltip=\"\u91CD\u505A\" (click)=\"redo()\"\n [disabled]=\"historyIndex==0\">\n <nz-icon nzType=\"redo\" nzTheme=\"outline\" />\n </button>\n </div>\n</ng-template>\n\n<ng-template #historyTemp>\n <div nz-flex nzVertical nzGap=\"6px\" style=\"max-height: 300px;overflow: auto;\">\n @for (item of history; track item.time;let i=$index) {\n <div nz-flex nzAlign=\"center\" [class.active]=\"i == historyIndex\" class=\"history-item\" (click)=\"switchHistory(i)\">\n <div style=\"width: 20px;\">\n @if (i == historyIndex) {\n <nz-icon nzType=\"aim\" nzTheme=\"outline\" />\n }\n </div>\n <div nz-flex nzVertical>\n <span>{{item.desc}}</span>\n <span style=\"font-size: 10px;color:rgba(0,0,0,0.38)\"> {{item.time | axisHowLong}}</span>\n </div>\n </div>\n }\n </div>\n</ng-template>\n\n<nz-modal [(nzVisible)]=\"shortcutKeysModal\" nzTitle=\"\u5FEB\u6377\u952E\u8BF4\u660E\" nzDraggable [nzOkText]=\"null\" nzCancelText=\"\u5173\u95ED\"\n (nzOnCancel)=\"shortcutKeysModal.set(false)\">\n <ng-container *nzModalContent>\n <nz-table nzTemplateMode nzSize=\"small\">\n <thead>\n <tr>\n <th>\u529F\u80FD</th>\n <th>\u5FEB\u6377\u952E</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>\u67E5\u770B\u5FEB\u6377\u952E\u8BF4\u660E</td>\n <td>Ctrl Meta H</td>\n </tr>\n <tr>\n <td>\u590D\u5236</td>\n <td>Ctrl C</td>\n </tr>\n <tr>\n <td>\u526A\u5207</td>\n <td>Ctrl X</td>\n </tr>\n <tr>\n <td>\u7C98\u8D34</td>\n <td>Ctrl V</td>\n </tr>\n <tr>\n <td>\u64A4\u9500</td>\n <td>Ctrl Z</td>\n </tr>\n <tr>\n <td>\u91CD\u505A</td>\n <td>Ctrl Shift Z</td>\n </tr>\n <tr>\n <td>\u9884\u89C8\u653E\u5927/\u6062\u590D</td>\n <td>Ctrl Meta C</td>\n </tr>\n <tr>\n <td>\u91CD\u65B0\u8F7D\u5165</td>\n <td>Ctrl Meta R</td>\n </tr>\n </tbody>\n </nz-table>\n </ng-container>\n</nz-modal>", styles: [".tools{position:absolute;right:20px;top:10px}::ng-deep .history-popover .ant-popover-inner-content{width:100%;padding:12px 0}.history-item{padding:0 12px;cursor:pointer}.history-item:hover{background-color:var(--ant-primary-1)}.active{color:var(--ant-primary-color);pointer-events:none}\n"] }]
|
|
1352
|
+
}] });
|
|
1353
|
+
|
|
1354
|
+
class Design extends ValueAccess {
|
|
1355
|
+
constructor() {
|
|
1356
|
+
super();
|
|
1357
|
+
this.addSubscribe(this.changeSubject
|
|
1358
|
+
.pipe(debounceTime(300))
|
|
1359
|
+
.subscribe((value) => this.onChangeOptionsConfig(value)));
|
|
1360
|
+
}
|
|
1361
|
+
options = new DesignOptions();
|
|
1362
|
+
element = inject(ElementRef);
|
|
1363
|
+
clipboard = inject(ClipboardService);
|
|
1364
|
+
loader = inject(AXIS_COMPONENTS_LOADER_TOKEN);
|
|
1365
|
+
injectDataObs = toObservable(this.options.injectData);
|
|
1366
|
+
funcByInject = inject(AXIS_INJECT_FUNC_TOKEN, { optional: true });
|
|
1367
|
+
injectFunc = computed(() => {
|
|
1368
|
+
if (this.options.injectFunc()) {
|
|
1369
|
+
return this.options.injectFunc();
|
|
1370
|
+
}
|
|
1371
|
+
if (this.funcByInject instanceof BehaviorSubject) {
|
|
1372
|
+
return this.funcByInject.value;
|
|
1373
|
+
}
|
|
1374
|
+
else {
|
|
1375
|
+
return this.funcByInject ?? {};
|
|
1376
|
+
}
|
|
1377
|
+
}, ...(ngDevMode ? [{ debugName: "injectFunc" }] : []));
|
|
1378
|
+
treeNode = signal(undefined, ...(ngDevMode ? [{ debugName: "treeNode" }] : []));
|
|
1379
|
+
loadAndOptions = signal(undefined, ...(ngDevMode ? [{ debugName: "loadAndOptions" }] : []));
|
|
1380
|
+
menu;
|
|
1381
|
+
chooseComponentVisible = model(false, ...(ngDevMode ? [{ debugName: "chooseComponentVisible" }] : []));
|
|
1382
|
+
chooseComponentSubject = new Subject();
|
|
1383
|
+
chooseComponentTags = signal([], ...(ngDevMode ? [{ debugName: "chooseComponentTags" }] : []));
|
|
1384
|
+
cacheSized = [300, 300];
|
|
1385
|
+
setting;
|
|
1386
|
+
settingRef;
|
|
1387
|
+
settingOptionsNodeId;
|
|
1388
|
+
settingOptionsStr = model("", ...(ngDevMode ? [{ debugName: "settingOptionsStr" }] : []));
|
|
1389
|
+
preview;
|
|
1390
|
+
tree;
|
|
1391
|
+
codeEditor;
|
|
1392
|
+
tools;
|
|
1393
|
+
shortcutKey = new ShortcutKey(this);
|
|
1394
|
+
onKeyPress(e) {
|
|
1395
|
+
this.shortcutKey.onKeyPress(e);
|
|
1396
|
+
}
|
|
1397
|
+
optionsNodes = new Map();
|
|
1398
|
+
optionsNodeScopes = new Map();
|
|
1399
|
+
scopeInfos = new Map();
|
|
1400
|
+
componentsInfo = new Map;
|
|
1401
|
+
componentsCounter = new Map();
|
|
1402
|
+
scopInfoSubjects = new Map();
|
|
1403
|
+
changeSubject = new Subject();
|
|
1404
|
+
setInitValue(value) {
|
|
1405
|
+
super.setInitValue(value);
|
|
1406
|
+
this.tools.putHistory(value, "初始化");
|
|
1407
|
+
this.render(value);
|
|
1408
|
+
}
|
|
1409
|
+
writeValue(value) {
|
|
1410
|
+
super.writeValue(value);
|
|
1411
|
+
this.tools.putHistory(value, "初始化");
|
|
1412
|
+
this.render(value);
|
|
1413
|
+
}
|
|
1414
|
+
async inspect(nextInfo) {
|
|
1415
|
+
if (!nextInfo.currentObject?.component) {
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
const config = await this.loader.loadComponent(`${nextInfo.currentObject.component}/design`);
|
|
1419
|
+
if (!this.componentsInfo.has(nextInfo.currentObject.component)) {
|
|
1420
|
+
this.componentsInfo.set(nextInfo.currentObject.component, { component: nextInfo.currentObject.component, componentName: config.componentName, eventHandlerDescs: config.eventHandlerDescs });
|
|
1421
|
+
}
|
|
1422
|
+
if (!this.componentsCounter.has(nextInfo.currentObject.component)) {
|
|
1423
|
+
this.componentsCounter.set(nextInfo.currentObject.component, 0);
|
|
1424
|
+
}
|
|
1425
|
+
this.componentsCounter.set(nextInfo.currentObject.component, this.componentsCounter.get(nextInfo.currentObject.component) + 1);
|
|
1426
|
+
const res = config.buildOptionsNodes?.(nextInfo);
|
|
1427
|
+
if (res) {
|
|
1428
|
+
let nodes = [res.treeNode];
|
|
1429
|
+
while (nodes.length) {
|
|
1430
|
+
let next = [];
|
|
1431
|
+
for (const node of nodes) {
|
|
1432
|
+
this.optionsNodes.set(node.id, node);
|
|
1433
|
+
if (node.children) {
|
|
1434
|
+
next = next.concat(node.children);
|
|
1435
|
+
}
|
|
1436
|
+
nodes = next;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
if (res.treeNode.scopeId) {
|
|
1440
|
+
if (!this.optionsNodeScopes.has(res.treeNode.scopeId)) {
|
|
1441
|
+
this.optionsNodeScopes.set(res.treeNode.scopeId, []);
|
|
1442
|
+
}
|
|
1443
|
+
this.optionsNodeScopes.get(res.treeNode.scopeId).push(res.treeNode);
|
|
1444
|
+
}
|
|
1445
|
+
if (res.newScopes) {
|
|
1446
|
+
for (const scope of res.newScopes) {
|
|
1447
|
+
this.scopeInfos.set(scope.scopeId, scope);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
if (res.next?.length) {
|
|
1451
|
+
for (let r of res.next) {
|
|
1452
|
+
if (Array.isArray(r.parentObject)) {
|
|
1453
|
+
for (let i = 0; i < r.parentObject.length; i++) {
|
|
1454
|
+
r = copy(r);
|
|
1455
|
+
r.indexOfParent = i;
|
|
1456
|
+
r.currentObject = r.parentObject[i];
|
|
1457
|
+
const parent = this.optionsNodes.get(r.parentId);
|
|
1458
|
+
const child = await this.inspect(r);
|
|
1459
|
+
if (child) {
|
|
1460
|
+
parent?.children?.push(child);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
else if (r.indexOfParent != undefined) {
|
|
1465
|
+
r.currentObject = r.parentObject[r.indexOfParent];
|
|
1466
|
+
const child = await this.inspect(r);
|
|
1467
|
+
if (child) {
|
|
1468
|
+
this.optionsNodes.get(r.parentId)?.children?.push(child);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
return res?.treeNode;
|
|
1475
|
+
}
|
|
1476
|
+
onChangeOptionsConfig(e) {
|
|
1477
|
+
this.reset();
|
|
1478
|
+
let value = e.value;
|
|
1479
|
+
if (value === undefined) {
|
|
1480
|
+
value = this.value();
|
|
1481
|
+
}
|
|
1482
|
+
this.value.set(copy(value, true));
|
|
1483
|
+
this.render(this.value());
|
|
1484
|
+
const putHistory = e.putHistory ?? true;
|
|
1485
|
+
this.loadAndOptions()?.[0].then(() => {
|
|
1486
|
+
if (!putHistory && this.settingOptionsNodeId) {
|
|
1487
|
+
const node = this.optionsNodes.get(this.settingOptionsNodeId);
|
|
1488
|
+
if (node) {
|
|
1489
|
+
this.settingRef?.instance.writeValue(node.options);
|
|
1490
|
+
}
|
|
1491
|
+
this.syncToCode();
|
|
1492
|
+
}
|
|
1493
|
+
if (e.nextNodeId) {
|
|
1494
|
+
this.tree.selectByNodeIds([e.nextNodeId]);
|
|
1495
|
+
this.preview.selectByNodeIds([e.nextNodeId]);
|
|
1496
|
+
if (e.sameSetting) {
|
|
1497
|
+
this.settingOptionsNodeId = e.nextNodeId;
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
this.loadSetting(e.nextNodeId);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
this.onChange?.(this.value());
|
|
1505
|
+
if (putHistory) {
|
|
1506
|
+
this.tools.putHistory(this.value(), e.historyDesc ?? "未知变更");
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
render(value) {
|
|
1510
|
+
this.loadAndOptions.set([this.inspect({ currentObject: value }).then(v => {
|
|
1511
|
+
this.treeNode.set(v ?? null);
|
|
1512
|
+
return v;
|
|
1513
|
+
}), value]);
|
|
1514
|
+
}
|
|
1515
|
+
onSettingChange(settingValue) {
|
|
1516
|
+
if (this.settingOptionsNodeId) {
|
|
1517
|
+
const optionsNode = this.optionsNodes.get(this.settingOptionsNodeId);
|
|
1518
|
+
if (optionsNode) {
|
|
1519
|
+
if (optionsNode.isRoot) {
|
|
1520
|
+
Object.assign(this.value(), settingValue);
|
|
1521
|
+
}
|
|
1522
|
+
else {
|
|
1523
|
+
optionsNode.updateOptions(settingValue);
|
|
1524
|
+
}
|
|
1525
|
+
this.changeSubject.next({ historyDesc: `设置属性${optionsNode.name}`, nextNodeId: optionsNode.id, sameSetting: true });
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
else if (this.treeNode() == null) {
|
|
1529
|
+
this.value.set(settingValue);
|
|
1530
|
+
this.changeSubject.next({ historyDesc: "修改配置", nextNodeId: settingValue.id });
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
onTreeSelect(nodeIds) {
|
|
1534
|
+
this.preview.selectByNodeIds(nodeIds);
|
|
1535
|
+
if (nodeIds.length == 1) {
|
|
1536
|
+
this.updateScopeWithNodeId(nodeIds[0]);
|
|
1537
|
+
this.loadSetting(nodeIds[0]);
|
|
1538
|
+
}
|
|
1539
|
+
else {
|
|
1540
|
+
this.settingOptionsNodeId = undefined;
|
|
1541
|
+
this.resetSetting();
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
onPreviewSelect(nodeIds) {
|
|
1545
|
+
this.menu.clear();
|
|
1546
|
+
this.tree.selectByNodeIds(nodeIds);
|
|
1547
|
+
if (nodeIds.length == 1) {
|
|
1548
|
+
this.updateScopeWithNodeId(nodeIds[0]);
|
|
1549
|
+
this.loadSetting(nodeIds[0]);
|
|
1550
|
+
}
|
|
1551
|
+
else {
|
|
1552
|
+
this.settingOptionsNodeId = undefined;
|
|
1553
|
+
this.resetSetting();
|
|
1554
|
+
}
|
|
1555
|
+
let expandIds = [];
|
|
1556
|
+
for (const nodeid of nodeIds) {
|
|
1557
|
+
expandIds = expandIds.concat(this.getAllParentNodes(nodeid).map(n => n.id));
|
|
1558
|
+
}
|
|
1559
|
+
this.tree.expandByNodeIds(expandIds);
|
|
1560
|
+
}
|
|
1561
|
+
updateScopeWithNodeId(nodeId) {
|
|
1562
|
+
let scopeId = this.optionsNodes.get(nodeId)?.scopeId;
|
|
1563
|
+
while (scopeId && this.scopeInfos.has(scopeId)) {
|
|
1564
|
+
this.preview.updateScopeWithSelectedElement(scopeId);
|
|
1565
|
+
scopeId = this.scopeInfos.get(scopeId)?.parentScopeId;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
loadSetting(nodeId, force = false) {
|
|
1569
|
+
if (nodeId && this.optionsNodes.has(nodeId)) {
|
|
1570
|
+
if (!force) {
|
|
1571
|
+
if (this.settingOptionsNodeId == nodeId) {
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
else if (this.settingOptionsNodeId) {
|
|
1575
|
+
const oldNode = this.optionsNodes.get(this.settingOptionsNodeId);
|
|
1576
|
+
const newNode = this.optionsNodes.get(nodeId);
|
|
1577
|
+
if (newNode.canSetting && oldNode && oldNode.parentId == newNode.parentId && oldNode.settingType == newNode.settingType) {
|
|
1578
|
+
this.settingOptionsNodeId = nodeId;
|
|
1579
|
+
this.settingOptionsStr.set(JSON.stringify(newNode.options, null, " "));
|
|
1580
|
+
this.settingRef?.instance.writeValue(newNode.options);
|
|
1581
|
+
return;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
this.resetSetting();
|
|
1586
|
+
const optionsNode = this.optionsNodes.get(nodeId);
|
|
1587
|
+
if (!optionsNode.canSetting) {
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
this.settingOptionsNodeId = nodeId;
|
|
1591
|
+
this.settingOptionsStr.set(JSON.stringify(optionsNode.options, null, " "));
|
|
1592
|
+
if (optionsNode.settingType) {
|
|
1593
|
+
const injector = Injector.create({
|
|
1594
|
+
providers: [
|
|
1595
|
+
{ provide: AXIS_DESIGN_SCOPE_INFOS_GETTER_TOKEN, useValue: this.buildScopeInfosGetter(optionsNode) },
|
|
1596
|
+
{ provide: AXIS_DESIGN_COMPONENT_INFO_FOR_SETTING_TOKEN, useValue: this.buildComponentInfoForSetting(optionsNode) },
|
|
1597
|
+
{ provide: AXIS_DESIGN_COMPONENT_REF_FOR_SETTING_TOKEN, useFactory: () => this.buildComponentRefForSetting(optionsNode) },
|
|
1598
|
+
{ provide: AXIS_DESIGN_COMPONENT_REF_GETTER_TOKEN, useValue: (nodeId) => this.preview.getComponentRef(nodeId) },
|
|
1599
|
+
{ provide: AXIS_DESIGN_ALL_PERMISSIONS_TOKEN, useValue: this.options.allPermissions() },
|
|
1600
|
+
{ provide: AXIS_INJECT_FUNC_TOKEN, useValue: this.injectFunc() },
|
|
1601
|
+
{ provide: AXIS_HTTP_CONTEXT_DATA_TOKEN, useValue: this.options.httpContextData() }
|
|
1602
|
+
]
|
|
1603
|
+
});
|
|
1604
|
+
this.settingRef = this.setting.createComponent(optionsNode.settingType, { injector: injector });
|
|
1605
|
+
this.settingRef.instance.onChange = this.onSettingChange.bind(this);
|
|
1606
|
+
this.settingRef.instance.writeValue(optionsNode.options);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
this.resetSetting();
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
buildScopeInfosGetter(optionsNode) {
|
|
1614
|
+
const _scopeId = optionsNode.scopeId;
|
|
1615
|
+
return (scopeId) => {
|
|
1616
|
+
scopeId ??= _scopeId;
|
|
1617
|
+
if (scopeId) {
|
|
1618
|
+
if (!this.scopInfoSubjects.has(scopeId)) {
|
|
1619
|
+
this.scopInfoSubjects.set(scopeId, this.buildScopeInfoSubject(scopeId));
|
|
1620
|
+
}
|
|
1621
|
+
return this.scopInfoSubjects.get(scopeId);
|
|
1622
|
+
}
|
|
1623
|
+
return new BehaviorSubject([]);
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
buildScopeInfoSubject(scopeId) {
|
|
1627
|
+
const scopeObs = [];
|
|
1628
|
+
const scopeInfosOrder = [];
|
|
1629
|
+
while (scopeId && this.scopeInfos.has(scopeId)) {
|
|
1630
|
+
const scopeInfo = this.scopeInfos.get(scopeId);
|
|
1631
|
+
scopeInfosOrder.push(scopeId);
|
|
1632
|
+
const scopeSubject = this.preview.getAndUpdateScopeSubject(scopeId);
|
|
1633
|
+
scopeObs.push(scopeSubject.pipe(filter(s => !!s), switchMap(s => {
|
|
1634
|
+
return merge(new Observable(sub => sub.next(s.getSnapshoptAllWithScopeId(s.axisScope()))), s.getAllWithScopeId(s.axisScope()) ?? NEVER);
|
|
1635
|
+
}), filter(realDs => !!realDs && this.scopeInfos.has(scopeInfo.scopeId)), map(realDs => {
|
|
1636
|
+
const _scopeInfo = this.scopeInfos.get(scopeInfo.scopeId);
|
|
1637
|
+
return {
|
|
1638
|
+
scopeInfo: { ..._scopeInfo, ds: { ..._scopeInfo.ds, ...realDs } },
|
|
1639
|
+
index: scopeInfosOrder.indexOf(scopeInfo.scopeId),
|
|
1640
|
+
};
|
|
1641
|
+
})));
|
|
1642
|
+
scopeId = scopeInfo.parentScopeId;
|
|
1643
|
+
}
|
|
1644
|
+
const subject = new BehaviorSubject([]);
|
|
1645
|
+
const res = scopeInfosOrder.map(scopeId => this.scopeInfos.get(scopeId));
|
|
1646
|
+
this.addSubscribe(merge(...scopeObs).pipe(map(row => {
|
|
1647
|
+
res[row.index] = row.scopeInfo;
|
|
1648
|
+
return [...res];
|
|
1649
|
+
})).subscribe(subject));
|
|
1650
|
+
return subject;
|
|
1651
|
+
}
|
|
1652
|
+
buildComponentInfoForSetting(optionsNode) {
|
|
1653
|
+
const componentInfo = new Map();
|
|
1654
|
+
let scopeId = optionsNode.scopeId;
|
|
1655
|
+
while (scopeId) {
|
|
1656
|
+
let nodes = this.optionsNodeScopes.get(scopeId);
|
|
1657
|
+
if (nodes) {
|
|
1658
|
+
for (const node of nodes) {
|
|
1659
|
+
const component = node.options.component;
|
|
1660
|
+
if (!componentInfo.has(component)) {
|
|
1661
|
+
const info = this.componentsInfo.get(component);
|
|
1662
|
+
componentInfo.set(component, { component: info.component, componentName: info.componentName, nodes: [], eventHandlerDescs: info.eventHandlerDescs ?? {} });
|
|
1663
|
+
}
|
|
1664
|
+
componentInfo.get(component).nodes.push(node);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
scopeId = this.scopeInfos.get(scopeId)?.parentScopeId;
|
|
1668
|
+
}
|
|
1669
|
+
return Array.from(componentInfo.values());
|
|
1670
|
+
}
|
|
1671
|
+
buildComponentRefForSetting(node) {
|
|
1672
|
+
while (node && !node.options.component) {
|
|
1673
|
+
if (node.parentId) {
|
|
1674
|
+
node = this.optionsNodes.get(node.parentId);
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
break;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
if (node) {
|
|
1681
|
+
return {
|
|
1682
|
+
options: node.options,
|
|
1683
|
+
ref: this.preview.getComponentRef(node.id)
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
return { options: undefined };
|
|
1687
|
+
}
|
|
1688
|
+
onContextMenu(e, nodeId) {
|
|
1689
|
+
const node = this.optionsNodes.get(nodeId);
|
|
1690
|
+
if (node?.contextMenu) {
|
|
1691
|
+
const parent = node.isRoot ? undefined : this.optionsNodes.get(node.parentId);
|
|
1692
|
+
const injector = Injector.create({
|
|
1693
|
+
providers: [
|
|
1694
|
+
{ provide: AXIS_DESIGN_OPTIONS_NODE_FOR_MENU, useValue: { current: node, parent } },
|
|
1695
|
+
{ provide: AXIS_DESIGN_CHOOSE_COMPONENT_FUNC_TOKEN, useValue: this.chooseComponent.bind(this) },
|
|
1696
|
+
]
|
|
1697
|
+
});
|
|
1698
|
+
this.menu.clear();
|
|
1699
|
+
const ref = this.menu.createComponent(node.contextMenu, { injector: injector });
|
|
1700
|
+
ref.instance.contextMenu(e);
|
|
1701
|
+
ref.instance.onChange = async (e) => {
|
|
1702
|
+
this.onChangeOptionsConfig(e);
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
chooseComponent(...tags) {
|
|
1707
|
+
this.chooseComponentTags.set(tags);
|
|
1708
|
+
this.chooseComponentVisible.set(true);
|
|
1709
|
+
return this.chooseComponentSubject.asObservable()
|
|
1710
|
+
.pipe(take(1), map((example) => example ? this.replaceExampleId(example.options) : null), switchMap(options => options ? from(this.loader.loadComponent(`${options.component}/design`)).pipe(map(config => ({ options, config }))) : of({})));
|
|
1711
|
+
}
|
|
1712
|
+
genNewComponentId(component, offset = 1, existsIds) {
|
|
1713
|
+
let id;
|
|
1714
|
+
if (this.componentsCounter.has(component)) {
|
|
1715
|
+
id = `${component}#${this.componentsCounter.get(component) + offset}`;
|
|
1716
|
+
}
|
|
1717
|
+
else {
|
|
1718
|
+
id = `${component}#${offset}`;
|
|
1719
|
+
}
|
|
1720
|
+
if (existsIds?.has(id) || this.optionsNodes.has(id)) {
|
|
1721
|
+
return this.genNewComponentId(component, offset + 1, existsIds);
|
|
1722
|
+
}
|
|
1723
|
+
return { id, offset };
|
|
1724
|
+
}
|
|
1725
|
+
onCmplibDragStart(example, element) {
|
|
1726
|
+
const options = this.replaceExampleId(example.options);
|
|
1727
|
+
const optionsNode = new OptionsNode({
|
|
1728
|
+
canDrag: true,
|
|
1729
|
+
dragType: "component",
|
|
1730
|
+
rootOptions: options,
|
|
1731
|
+
name: example.name
|
|
1732
|
+
});
|
|
1733
|
+
this.optionsNodes.set(optionsNode.id, optionsNode);
|
|
1734
|
+
this.preview.dragForOuter(optionsNode.toElementNode({ element }));
|
|
1735
|
+
}
|
|
1736
|
+
async onCmplibDragEnd() {
|
|
1737
|
+
const nodeId = this.preview.dragEndForOuter();
|
|
1738
|
+
if (nodeId) {
|
|
1739
|
+
await this.loadAndOptions()[0];
|
|
1740
|
+
this.tree.selectByNodeIds([nodeId]);
|
|
1741
|
+
this.preview.selectByNodeIds([nodeId]);
|
|
1742
|
+
this.loadSetting(nodeId);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
onPaste(objs) {
|
|
1746
|
+
const nodes = [];
|
|
1747
|
+
for (const obj of objs) {
|
|
1748
|
+
const options = this.replaceExampleId(obj);
|
|
1749
|
+
const optionsNode = new OptionsNode({
|
|
1750
|
+
canDrag: true,
|
|
1751
|
+
dragType: "component",
|
|
1752
|
+
rootOptions: options
|
|
1753
|
+
});
|
|
1754
|
+
nodes.push(optionsNode);
|
|
1755
|
+
this.optionsNodes.set(optionsNode.id, optionsNode);
|
|
1756
|
+
}
|
|
1757
|
+
this.tree.addNodeForSelected(nodes, undefined, `粘贴${nodes.length}个组件`);
|
|
1758
|
+
}
|
|
1759
|
+
replaceExampleId(example) {
|
|
1760
|
+
const idMap = new Map();
|
|
1761
|
+
const idMap2 = new Map();
|
|
1762
|
+
this.buildIdMap(example, idMap, idMap2);
|
|
1763
|
+
let exampleStr = JSON.stringify(example);
|
|
1764
|
+
while (idMap.size > 0) {
|
|
1765
|
+
idMap.forEach((newId, oldId) => {
|
|
1766
|
+
exampleStr = exampleStr.replaceAll(oldId, newId);
|
|
1767
|
+
idMap.delete(oldId);
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
while (idMap2.size > 0) {
|
|
1771
|
+
idMap2.forEach((newId, oldId) => {
|
|
1772
|
+
exampleStr = exampleStr.replaceAll(oldId, newId);
|
|
1773
|
+
idMap2.delete(oldId);
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
return JSON.parse(exampleStr);
|
|
1777
|
+
}
|
|
1778
|
+
buildIdMap(obj, idMap, idMap2, globalOffset = 0, offsetMap = new Map()) {
|
|
1779
|
+
if (this.isComponentObj(obj)) {
|
|
1780
|
+
const offset = (offsetMap.get(obj.component) ?? 0) + 1;
|
|
1781
|
+
const res = this.genNewComponentId(obj.component, offset, new Set(idMap.values()));
|
|
1782
|
+
offsetMap.set(obj.component, res.offset);
|
|
1783
|
+
const tempId = `__temp__id__${globalOffset++}`;
|
|
1784
|
+
idMap.set(obj.id, tempId);
|
|
1785
|
+
idMap2.set(tempId, res.id);
|
|
1786
|
+
}
|
|
1787
|
+
if (obj) {
|
|
1788
|
+
if (Array.isArray(obj)) {
|
|
1789
|
+
for (let i = 0; i < obj.length; i++) {
|
|
1790
|
+
globalOffset = this.buildIdMap(obj[i], idMap, idMap2, globalOffset, offsetMap);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
else if (typeof obj == "object") {
|
|
1794
|
+
for (const en of Object.entries(obj)) {
|
|
1795
|
+
globalOffset = this.buildIdMap(en[1], idMap, idMap2, globalOffset, offsetMap);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
return globalOffset;
|
|
1800
|
+
}
|
|
1801
|
+
isComponentObj(obj) {
|
|
1802
|
+
return obj && obj.hasOwnProperty("id") && obj.hasOwnProperty("component");
|
|
1803
|
+
}
|
|
1804
|
+
onNodesMove(nodeIds) {
|
|
1805
|
+
if (this.tree.selectListSelection.selected.length == 1) {
|
|
1806
|
+
this.tree.addNodeForSelected(nodeIds.map(id => this.optionsNodes.get(id)), true, `粘贴${nodeIds.length}个组件`);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
onEditorChange(optionsStr) {
|
|
1810
|
+
try {
|
|
1811
|
+
const options = JSON.parse(optionsStr);
|
|
1812
|
+
this.onSettingChange(options);
|
|
1813
|
+
}
|
|
1814
|
+
catch (_) { }
|
|
1815
|
+
}
|
|
1816
|
+
syncToSetting() {
|
|
1817
|
+
if (this.settingOptionsNodeId) {
|
|
1818
|
+
const optionsNode = this.optionsNodes.get(this.settingOptionsNodeId);
|
|
1819
|
+
if (optionsNode) {
|
|
1820
|
+
if (optionsNode.canSetting && this.settingRef?.componentType == optionsNode.settingType) {
|
|
1821
|
+
this.settingRef?.instance?.writeValue(optionsNode.options);
|
|
1822
|
+
}
|
|
1823
|
+
else {
|
|
1824
|
+
this.loadSetting(optionsNode.id, true);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
syncToCode() {
|
|
1830
|
+
if (this.settingOptionsNodeId) {
|
|
1831
|
+
const optionsNode = this.optionsNodes.get(this.settingOptionsNodeId);
|
|
1832
|
+
if (optionsNode) {
|
|
1833
|
+
this.settingOptionsStr.set(JSON.stringify(optionsNode.options, null, " "));
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
setTimeout(() => {
|
|
1837
|
+
this.layoutEditor();
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
layoutEditor(e) {
|
|
1841
|
+
if (e) {
|
|
1842
|
+
if (e[0] > 0) {
|
|
1843
|
+
this.cacheSized[0] = e[0];
|
|
1844
|
+
}
|
|
1845
|
+
if (e[2] > 0) {
|
|
1846
|
+
this.cacheSized[1] = e[2];
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
this.codeEditor?.onEvents?.({
|
|
1850
|
+
target: "component",
|
|
1851
|
+
name: "layout",
|
|
1852
|
+
})?.subscribe();
|
|
1853
|
+
}
|
|
1854
|
+
resetSetting() {
|
|
1855
|
+
this.settingOptionsNodeId = undefined;
|
|
1856
|
+
this.setting.clear();
|
|
1857
|
+
this.settingOptionsStr.set("");
|
|
1858
|
+
}
|
|
1859
|
+
reset() {
|
|
1860
|
+
this.optionsNodes.clear();
|
|
1861
|
+
this.componentsInfo.clear();
|
|
1862
|
+
this.optionsNodeScopes.clear();
|
|
1863
|
+
this.scopeInfos.clear();
|
|
1864
|
+
this.componentsCounter.clear();
|
|
1865
|
+
}
|
|
1866
|
+
getAllParentNodes(node, parentNodes = []) {
|
|
1867
|
+
if (typeof node == "string") {
|
|
1868
|
+
node = this.optionsNodes.get(node);
|
|
1869
|
+
}
|
|
1870
|
+
if (node?.parentId) {
|
|
1871
|
+
const parent = this.optionsNodes.get(node.parentId);
|
|
1872
|
+
if (parent) {
|
|
1873
|
+
parentNodes.push(parent);
|
|
1874
|
+
this.getAllParentNodes(parent, parentNodes);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
return parentNodes;
|
|
1878
|
+
}
|
|
1879
|
+
ngOnDestroy() {
|
|
1880
|
+
super.ngOnDestroy();
|
|
1881
|
+
for (const s of this.scopInfoSubjects.values()) {
|
|
1882
|
+
s.unsubscribe();
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Design, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1886
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: Design, isStandalone: true, selector: "axis-design", inputs: { chooseComponentVisible: { classPropertyName: "chooseComponentVisible", publicName: "chooseComponentVisible", isSignal: true, isRequired: false, transformFunction: null }, settingOptionsStr: { classPropertyName: "settingOptionsStr", publicName: "settingOptionsStr", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { chooseComponentVisible: "chooseComponentVisibleChange", settingOptionsStr: "settingOptionsStrChange" }, host: { attributes: { "tabindex": "-1", "autofocus": "true" }, listeners: { "keydown": "onKeyPress($event)" } }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "setting", first: true, predicate: ["setting"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "preview", first: true, predicate: ["preview"], descendants: true, static: true }, { propertyName: "tree", first: true, predicate: ["tree"], descendants: true, static: true }, { propertyName: "codeEditor", first: true, predicate: ["codeEditor"], descendants: true }, { propertyName: "tools", first: true, predicate: ["tools"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<nz-splitter (nzResize)=\"layoutEditor($event)\">\n <nz-splitter-panel [nzCollapsible]=\"!tools.onlyPreview()\" [nzDefaultSize]=\"cacheSized[0]\" nzMin=\"15%\" nzMax=\"40%\"\n [nzSize]=\"tools.onlyPreview()?0:undefined\">\n <nz-tabs nzCentered>\n <nz-tab nzTitle=\"\u7EC4\u4EF6\u6811\">\n <axis-design-tree style=\"margin-bottom: 300px;\" #tree [node]=\"treeNode()\" [optionsNodes]=\"optionsNodes\"\n (onSelect)=\"onTreeSelect($event)\" (onChange)=\"onChangeOptionsConfig($event)\"\n (onContextMenu)=\"onContextMenu($event.event,$event.nodeId)\"></axis-design-tree>\n </nz-tab>\n <nz-tab nzTitle=\"\u7EC4\u4EF6\u5E93\">\n <axis-cmplib selectMode=\"drag\" (dragStart)=\"onCmplibDragStart($event.example,$event.element)\"\n (dragEnd)=\"onCmplibDragEnd()\"></axis-cmplib>\n </nz-tab>\n </nz-tabs>\n </nz-splitter-panel>\n <nz-splitter-panel>\n <div nz-flex nzVertical style=\"height: 100%;width: 100%;position: relative;\">\n <h2 style=\"text-align: center;margin-top: 4px;\">\u9884\u89C8</h2>\n <axis-toolbar #tools></axis-toolbar>\n <axis-design-preview #preview style=\"flex:1;overflow: auto;\" [loadAndOptions]=\"loadAndOptions()\"\n [optionsNodes]=\"optionsNodes\" [injectData]=\"injectDataObs\" [injectFunc]=\"injectFunc()\"\n [httpContextData]=\"options.httpContextData()\" [fileBaseUrl]=\"options.fileBaseUrl()\"\n (onChange)=\"onChangeOptionsConfig($event)\" (onSelect)=\"onPreviewSelect($event)\"\n (onContextMenu)=\"onContextMenu($event.event,$event.nodeId)\"></axis-design-preview>\n </div>\n </nz-splitter-panel>\n <nz-splitter-panel [nzCollapsible]=\"!tools.onlyPreview()\" [nzDefaultSize]=\"cacheSized[1]\" nzMin=\"15%\" nzMax=\"40%\"\n [nzSize]=\"tools.onlyPreview()?0:undefined\" style=\"position: relative;\">\n <nz-tabs nzCentered style=\"height: 100%;\">\n <nz-tab nzTitle=\"\u5C5E\u6027\u8BBE\u7F6E\" (nzClick)=\"syncToSetting()\">\n <ng-container #setting></ng-container>\n <div style=\"height: 300px;\"></div>\n @if (!settingOptionsStr()){\n <nz-empty style=\"height: 300px;\" nzNotFoundContent=\"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u7EC4\u4EF6\"></nz-empty>\n }\n </nz-tab>\n <nz-tab nzTitle=\"\u4EE3\u7801\" nzForceRender (nzSelect)=\"syncToCode();\">\n <ng-container #codeEditor=\"axisDynamic\"\n [axisDynamic]=\"{component:'axis-components/editor',inuse:true,mode:'json',readonly:!settingOptionsStr() && treeNode()!=null,otherOptions:{tabSize:2}}\"\n [standalone]=\"true\" [(ngModel)]=\"settingOptionsStr\"\n (ngModelChange)=\"onEditorChange($event)\"></ng-container>\n </nz-tab>\n </nz-tabs>\n </nz-splitter-panel>\n</nz-splitter>\n<ng-container #menu></ng-container>\n<nz-drawer [(nzVisible)]=\"chooseComponentVisible\" nzTitle=\"\u9009\u62E9\u7EC4\u4EF6\" [nzBodyStyle]=\"{padding:0}\"\n (nzOnClose)=\"chooseComponentVisible.set(false);chooseComponentSubject.next(undefined)\">\n <ng-container *nzDrawerContent>\n <axis-cmplib selectMode=\"click\" [tags]=\"chooseComponentTags()\"\n (clickExample)=\"chooseComponentVisible.set(false);chooseComponentSubject.next($event)\"></axis-cmplib>\n </ng-container>\n</nz-drawer>", styles: ["nz-tabs,::ng-deep .ant-tabs-content,::ng-deep .ant-tabs-tabpane{height:100%}::ng-deep .ant-tabs-content{overflow:auto}:host{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: NzSplitterModule }, { kind: "component", type: i1$3.NzSplitterComponent, selector: "nz-splitter", inputs: ["nzLayout", "nzLazy"], outputs: ["nzResizeStart", "nzResize", "nzResizeEnd"], exportAs: ["nzSplitter"] }, { kind: "component", type: i1$3.NzSplitterPanelComponent, selector: "nz-splitter-panel", inputs: ["nzDefaultSize", "nzMin", "nzMax", "nzSize", "nzCollapsible", "nzResizable"], exportAs: ["nzSplitterPanel"] }, { kind: "ngmodule", type: NzTabsModule }, { kind: "component", type: i2$3.NzTabsComponent, selector: "nz-tabs,nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact", "nzDestroyInactiveTabPane"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabs"] }, { kind: "component", type: i2$3.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { kind: "component", type: Preview, selector: "axis-design-preview", inputs: ["loadAndOptions", "optionsNodes", "injectData", "httpContextData", "fileBaseUrl", "injectFunc"], outputs: ["onChange", "onSelect", "onContextMenu"] }, { kind: "component", type: Tree, selector: "axis-design-tree", inputs: ["node", "optionsNodes"], outputs: ["onChange", "onSelect", "onContextMenu"] }, { kind: "ngmodule", type: NzFlexModule }, { kind: "directive", type: i3$1.NzFlexDirective, selector: "[nz-flex],nz-flex", inputs: ["nzVertical", "nzJustify", "nzAlign", "nzGap", "nzWrap", "nzFlex"], exportAs: ["nzFlex"] }, { kind: "component", type: Cmplib, selector: "axis-cmplib", inputs: ["cmplib", "selectMode", "tags"], outputs: ["cmplibChange", "clickExample", "dragStart", "dragEnd"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzEmptyModule }, { kind: "component", type: i10.NzEmptyComponent, selector: "nz-empty", inputs: ["nzNotFoundImage", "nzNotFoundContent", "nzNotFoundFooter"], exportAs: ["nzEmpty"] }, { kind: "directive", type: DynamicDirective, selector: "[axisDynamic]", inputs: ["axisDynamic", "standalone", "isDesign"], outputs: ["onRegisteValueAccess"], exportAs: ["axisDynamic"] }, { kind: "ngmodule", type: NzDrawerModule }, { kind: "component", type: i6$2.NzDrawerComponent, selector: "nz-drawer", inputs: ["nzContent", "nzCloseIcon", "nzClosable", "nzMaskClosable", "nzMask", "nzCloseOnNavigation", "nzNoAnimation", "nzKeyboard", "nzTitle", "nzExtra", "nzFooter", "nzPlacement", "nzSize", "nzMaskStyle", "nzBodyStyle", "nzWrapClassName", "nzWidth", "nzHeight", "nzZIndex", "nzOffsetX", "nzOffsetY", "nzVisible"], outputs: ["nzOnViewInit", "nzOnClose", "nzVisibleChange"], exportAs: ["nzDrawer"] }, { kind: "directive", type: i6$2.NzDrawerContentDirective, selector: "[nzDrawerContent]", exportAs: ["nzDrawerContent"] }, { kind: "component", type: Toolbar, selector: "axis-toolbar", inputs: ["shortcutKeysModal"], outputs: ["shortcutKeysModalChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1887
|
+
}
|
|
1888
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: Design, decorators: [{
|
|
1889
|
+
type: Component,
|
|
1890
|
+
args: [{ selector: 'axis-design', imports: [NzSplitterModule, NzTabsModule, Preview, Tree, NzFlexModule, Cmplib, FormsModule, NzEmptyModule, DynamicDirective, NzDrawerModule, Toolbar], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1891
|
+
tabindex: "-1",
|
|
1892
|
+
autofocus: "true",
|
|
1893
|
+
}, template: "<nz-splitter (nzResize)=\"layoutEditor($event)\">\n <nz-splitter-panel [nzCollapsible]=\"!tools.onlyPreview()\" [nzDefaultSize]=\"cacheSized[0]\" nzMin=\"15%\" nzMax=\"40%\"\n [nzSize]=\"tools.onlyPreview()?0:undefined\">\n <nz-tabs nzCentered>\n <nz-tab nzTitle=\"\u7EC4\u4EF6\u6811\">\n <axis-design-tree style=\"margin-bottom: 300px;\" #tree [node]=\"treeNode()\" [optionsNodes]=\"optionsNodes\"\n (onSelect)=\"onTreeSelect($event)\" (onChange)=\"onChangeOptionsConfig($event)\"\n (onContextMenu)=\"onContextMenu($event.event,$event.nodeId)\"></axis-design-tree>\n </nz-tab>\n <nz-tab nzTitle=\"\u7EC4\u4EF6\u5E93\">\n <axis-cmplib selectMode=\"drag\" (dragStart)=\"onCmplibDragStart($event.example,$event.element)\"\n (dragEnd)=\"onCmplibDragEnd()\"></axis-cmplib>\n </nz-tab>\n </nz-tabs>\n </nz-splitter-panel>\n <nz-splitter-panel>\n <div nz-flex nzVertical style=\"height: 100%;width: 100%;position: relative;\">\n <h2 style=\"text-align: center;margin-top: 4px;\">\u9884\u89C8</h2>\n <axis-toolbar #tools></axis-toolbar>\n <axis-design-preview #preview style=\"flex:1;overflow: auto;\" [loadAndOptions]=\"loadAndOptions()\"\n [optionsNodes]=\"optionsNodes\" [injectData]=\"injectDataObs\" [injectFunc]=\"injectFunc()\"\n [httpContextData]=\"options.httpContextData()\" [fileBaseUrl]=\"options.fileBaseUrl()\"\n (onChange)=\"onChangeOptionsConfig($event)\" (onSelect)=\"onPreviewSelect($event)\"\n (onContextMenu)=\"onContextMenu($event.event,$event.nodeId)\"></axis-design-preview>\n </div>\n </nz-splitter-panel>\n <nz-splitter-panel [nzCollapsible]=\"!tools.onlyPreview()\" [nzDefaultSize]=\"cacheSized[1]\" nzMin=\"15%\" nzMax=\"40%\"\n [nzSize]=\"tools.onlyPreview()?0:undefined\" style=\"position: relative;\">\n <nz-tabs nzCentered style=\"height: 100%;\">\n <nz-tab nzTitle=\"\u5C5E\u6027\u8BBE\u7F6E\" (nzClick)=\"syncToSetting()\">\n <ng-container #setting></ng-container>\n <div style=\"height: 300px;\"></div>\n @if (!settingOptionsStr()){\n <nz-empty style=\"height: 300px;\" nzNotFoundContent=\"\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u7EC4\u4EF6\"></nz-empty>\n }\n </nz-tab>\n <nz-tab nzTitle=\"\u4EE3\u7801\" nzForceRender (nzSelect)=\"syncToCode();\">\n <ng-container #codeEditor=\"axisDynamic\"\n [axisDynamic]=\"{component:'axis-components/editor',inuse:true,mode:'json',readonly:!settingOptionsStr() && treeNode()!=null,otherOptions:{tabSize:2}}\"\n [standalone]=\"true\" [(ngModel)]=\"settingOptionsStr\"\n (ngModelChange)=\"onEditorChange($event)\"></ng-container>\n </nz-tab>\n </nz-tabs>\n </nz-splitter-panel>\n</nz-splitter>\n<ng-container #menu></ng-container>\n<nz-drawer [(nzVisible)]=\"chooseComponentVisible\" nzTitle=\"\u9009\u62E9\u7EC4\u4EF6\" [nzBodyStyle]=\"{padding:0}\"\n (nzOnClose)=\"chooseComponentVisible.set(false);chooseComponentSubject.next(undefined)\">\n <ng-container *nzDrawerContent>\n <axis-cmplib selectMode=\"click\" [tags]=\"chooseComponentTags()\"\n (clickExample)=\"chooseComponentVisible.set(false);chooseComponentSubject.next($event)\"></axis-cmplib>\n </ng-container>\n</nz-drawer>", styles: ["nz-tabs,::ng-deep .ant-tabs-content,::ng-deep .ant-tabs-tabpane{height:100%}::ng-deep .ant-tabs-content{overflow:auto}:host{display:block;width:100%;height:100%}\n"] }]
|
|
1894
|
+
}], ctorParameters: () => [], propDecorators: { menu: [{
|
|
1895
|
+
type: ViewChild,
|
|
1896
|
+
args: ["menu", { static: true, read: ViewContainerRef }]
|
|
1897
|
+
}], setting: [{
|
|
1898
|
+
type: ViewChild,
|
|
1899
|
+
args: ["setting", { static: true, read: ViewContainerRef }]
|
|
1900
|
+
}], preview: [{
|
|
1901
|
+
type: ViewChild,
|
|
1902
|
+
args: ["preview", { static: true }]
|
|
1903
|
+
}], tree: [{
|
|
1904
|
+
type: ViewChild,
|
|
1905
|
+
args: ["tree", { static: true }]
|
|
1906
|
+
}], codeEditor: [{
|
|
1907
|
+
type: ViewChild,
|
|
1908
|
+
args: ["codeEditor"]
|
|
1909
|
+
}], tools: [{
|
|
1910
|
+
type: ViewChild,
|
|
1911
|
+
args: ["tools", { static: true }]
|
|
1912
|
+
}], onKeyPress: [{
|
|
1913
|
+
type: HostListener,
|
|
1914
|
+
args: ["keydown", ['$event']]
|
|
1915
|
+
}] } });
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* Generated bundle index. Do not edit.
|
|
1919
|
+
*/
|
|
1920
|
+
|
|
1921
|
+
export { Design };
|
|
1922
|
+
//# sourceMappingURL=ngx-axis-appforge-axis-components-design.mjs.map
|