@tongfun/ui 0.0.0-alpha.3 → 0.0.1-alpha.2
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/.claude/settings.local.json +7 -0
- package/.hermes/plans/datapicker-object-mode.md +57 -0
- package/.hermes/plans/design-spec-fusion-5175-v2.md +146 -0
- package/.hermes/plans/design-spec-fusion-5175.md +88 -0
- package/.hermes/plans/file-upload-chip-redesign.md +66 -0
- package/.hermes/plans/form-image-upload-modelvalue-fix.md +38 -0
- package/.hermes/plans/form-layout-responsive-span-plan.md +137 -0
- package/.hermes/plans/global-audit-report.md +728 -0
- package/.hermes/plans/global-audit-report.v1.md +604 -0
- package/.hermes/plans/global-audit-report.v3.md +777 -0
- package/.hermes/plans/image-file-erp-redesign.md +173 -0
- package/.hermes/plans/location-picker-baidu-modal.md +173 -0
- package/.hermes/plans/new-document-3b-color-componentization-plan.md +155 -0
- package/.hermes/plans/new-document-form-layout-rebuild-plan.md +150 -0
- package/.hermes/plans/new-document-fullwidth-3col-plan.md +177 -0
- package/.hermes/plans/picker-quick-options-range-mode.md +143 -0
- package/.hermes/plans/region-picker-mock-contract.md +202 -0
- package/.hermes/plans/zero-div-component-contracts.md +466 -0
- package/README.md +110 -0
- package/components.json +19 -0
- package/docs/DEVELOPMENT.md +315 -0
- package/docs/PRD.md +170 -0
- package/docs/ai-api-layering.md +141 -0
- package/docs/anchor-component-plan.md +165 -0
- package/docs/components-analysis.md +2911 -0
- package/docs/demo-scan-report.md +142 -0
- package/docs/editable-table-research.md +8 -0
- package/docs/form-panorama-plan.md +141 -0
- package/docs/lowcode-agent-component-registry.sample.json +36364 -0
- package/docs/tf-form-table-modification-plan.md +503 -0
- package/docs/token-compliance-audit-report.md +542 -0
- package/env.d.ts +5 -0
- package/eslint.config.js +66 -0
- package/package.json +85 -38
- package/packages/ui/__tests__/package-exports.test.ts +23 -0
- package/packages/ui/components/affix/README.md +78 -0
- package/packages/ui/components/affix/__tests__/affix.test.ts +204 -0
- package/packages/ui/components/affix/index.ts +13 -0
- package/packages/ui/components/affix/src/affix.vue +216 -0
- package/packages/ui/components/affix/src/types.ts +47 -0
- package/packages/ui/components/affix/styles/affix.css +17 -0
- package/packages/ui/components/ai-overlay/README.md +180 -0
- package/packages/ui/components/ai-overlay/__tests__/ai-action-menu.test.ts +133 -0
- package/packages/ui/components/ai-overlay/__tests__/ai-overlay.test.ts +117 -0
- package/packages/ui/components/ai-overlay/index.ts +32 -0
- package/packages/ui/components/ai-overlay/src/ai-action-menu-types.ts +22 -0
- package/packages/ui/components/ai-overlay/src/ai-action-menu.vue +200 -0
- package/packages/ui/components/ai-overlay/src/ai-overlay.vue +329 -0
- package/packages/ui/components/ai-overlay/src/types.ts +84 -0
- package/packages/ui/components/ai-overlay/styles/ai-overlay.css +306 -0
- package/packages/ui/components/ai-state-flow/README.md +111 -0
- package/packages/ui/components/ai-state-flow/__tests__/ai-state-flow.test.ts +69 -0
- package/packages/ui/components/ai-state-flow/ai-state-flow.ts +16 -0
- package/packages/ui/components/ai-state-flow/ai-state-flow.vue +67 -0
- package/packages/ui/components/ai-state-flow/index.ts +24 -0
- package/packages/ui/components/ai-state-flow/styles/ai-state-flow.css +144 -0
- package/packages/ui/components/alert/README.md +83 -0
- package/packages/ui/components/alert/__tests__/alert.test.ts +155 -0
- package/packages/ui/components/alert/index.ts +13 -0
- package/packages/ui/components/alert/src/alert.ts +90 -0
- package/packages/ui/components/alert/src/alert.vue +87 -0
- package/packages/ui/components/alert/styles/alert.css +158 -0
- package/packages/ui/components/anchor/README.md +50 -0
- package/packages/ui/components/anchor/__tests__/anchor.test.ts +284 -0
- package/packages/ui/components/anchor/index.ts +13 -0
- package/packages/ui/components/anchor/src/anchor.vue +94 -0
- package/packages/ui/components/anchor/src/types.ts +55 -0
- package/packages/ui/components/anchor/src/use-anchor.ts +253 -0
- package/packages/ui/components/anchor/styles/anchor.css +90 -0
- package/packages/ui/components/avatar/README.md +118 -0
- package/packages/ui/components/avatar/__tests__/avatar.test.ts +83 -0
- package/packages/ui/components/avatar/index.ts +12 -0
- package/packages/ui/components/avatar/src/avatar.ts +62 -0
- package/packages/ui/components/avatar/src/avatar.vue +106 -0
- package/packages/ui/components/back-top/README.md +63 -0
- package/packages/ui/components/back-top/__tests__/back-top.test.ts +215 -0
- package/packages/ui/components/back-top/index.ts +13 -0
- package/packages/ui/components/back-top/src/back-top.ts +51 -0
- package/packages/ui/components/back-top/src/back-top.vue +104 -0
- package/packages/ui/components/back-top/styles/back-top.css +24 -0
- package/packages/ui/components/badge/README.md +71 -0
- package/packages/ui/components/badge/__tests__/badge.test.ts +142 -0
- package/packages/ui/components/badge/index.ts +13 -0
- package/packages/ui/components/badge/src/badge.ts +64 -0
- package/packages/ui/components/badge/src/badge.vue +76 -0
- package/packages/ui/components/badge/styles/badge.css +45 -0
- package/packages/ui/components/batch-action-button/README.md +68 -0
- package/packages/ui/components/batch-action-button/__tests__/batch-action-button.test.ts +30 -0
- package/packages/ui/components/batch-action-button/index.ts +11 -0
- package/packages/ui/components/batch-action-button/src/batch-action-button.vue +59 -0
- package/packages/ui/components/batch-action-button/src/types.ts +9 -0
- package/packages/ui/components/breadcrumb/README.md +115 -0
- package/packages/ui/components/breadcrumb/__tests__/breadcrumb.test.ts +168 -0
- package/packages/ui/components/breadcrumb/index.ts +13 -0
- package/packages/ui/components/breadcrumb/src/breadcrumb.ts +60 -0
- package/packages/ui/components/breadcrumb/src/breadcrumb.vue +86 -0
- package/packages/ui/components/business/document/action-header/index.ts +14 -0
- package/packages/ui/components/business/document/action-header/src/context.ts +10 -0
- package/packages/ui/components/business/document/action-header/src/document-action-header.vue +296 -0
- package/packages/ui/components/business/document/action-header/src/types.ts +100 -0
- package/packages/ui/components/business/document/ai-toolbar/index.ts +12 -0
- package/packages/ui/components/business/document/ai-toolbar/src/document-ai-toolbar.vue +72 -0
- package/packages/ui/components/business/document/form-page/index.ts +16 -0
- package/packages/ui/components/business/document/form-page/src/composables/use-document-ai-toolbar.ts +37 -0
- package/packages/ui/components/business/document/form-page/src/composables/use-document-layout-mode.ts +24 -0
- package/packages/ui/components/business/document/form-page/src/composables/use-document-recognition.ts +55 -0
- package/packages/ui/components/business/document/form-page/src/composables/use-document-save.ts +243 -0
- package/packages/ui/components/business/document/form-page/src/composables/use-document-sections.ts +234 -0
- package/packages/ui/components/business/document/form-page/src/context.ts +15 -0
- package/packages/ui/components/business/document/form-page/src/document-form-page.vue +251 -0
- package/packages/ui/components/business/document/form-page/src/document-section-card.vue +187 -0
- package/packages/ui/components/business/document/form-page/src/types.ts +245 -0
- package/packages/ui/components/business/document/form-page/styles/document-form-page.css +40 -0
- package/packages/ui/components/business/enum-select/index.ts +18 -0
- package/packages/ui/components/business/enum-select/src/enum-select.vue +171 -0
- package/packages/ui/components/business/enum-select/src/types.ts +33 -0
- package/packages/ui/components/button/README.md +155 -0
- package/packages/ui/components/button/__tests__/button.test.ts +261 -0
- package/packages/ui/components/button/index.ts +14 -0
- package/packages/ui/components/button/src/button.ts +168 -0
- package/packages/ui/components/button/src/button.vue +341 -0
- package/packages/ui/components/button/styles/button.css +149 -0
- package/packages/ui/components/carousel/README.md +48 -0
- package/packages/ui/components/carousel/__tests__/carousel.test.ts +82 -0
- package/packages/ui/components/carousel/index.ts +11 -0
- package/packages/ui/components/carousel/src/carousel.ts +38 -0
- package/packages/ui/components/carousel/src/carousel.vue +101 -0
- package/packages/ui/components/carousel/styles/carousel.css +40 -0
- package/packages/ui/components/chart/README.md +120 -0
- package/packages/ui/components/chart/__tests__/chart.test.ts +86 -0
- package/packages/ui/components/chart/__tests__/simple-charts.test.ts +130 -0
- package/packages/ui/components/chart/index.ts +22 -0
- package/packages/ui/components/chart/src/bar-chart.vue +83 -0
- package/packages/ui/components/chart/src/chart.ts +135 -0
- package/packages/ui/components/chart/src/chart.vue +147 -0
- package/packages/ui/components/chart/src/donut-chart.vue +96 -0
- package/packages/ui/components/chart/src/line-chart.vue +101 -0
- package/packages/ui/components/chart/src/metric-grid.vue +55 -0
- package/packages/ui/components/chart/src/types.ts +91 -0
- package/packages/ui/components/chart/src/utils.ts +68 -0
- package/packages/ui/components/chart/styles/bar-chart.css +134 -0
- package/packages/ui/components/chart/styles/chart.css +48 -0
- package/packages/ui/components/chart/styles/donut-chart.css +114 -0
- package/packages/ui/components/chart/styles/line-chart.css +61 -0
- package/packages/ui/components/chart/styles/metric-grid.css +115 -0
- package/packages/ui/components/code-block/README.md +56 -0
- package/packages/ui/components/code-block/__tests__/code-block.test.ts +166 -0
- package/packages/ui/components/code-block/index.ts +13 -0
- package/packages/ui/components/code-block/src/code-block.vue +216 -0
- package/packages/ui/components/code-block/src/types.ts +31 -0
- package/packages/ui/components/code-block/styles/code-block.css +192 -0
- package/packages/ui/components/data-grid/CellRendererActions.vue +77 -0
- package/packages/ui/components/data-grid/CellRendererButton.vue +51 -0
- package/packages/ui/components/data-grid/CellRendererCsCheckbox.vue +16 -0
- package/packages/ui/components/data-grid/CellRendererCsInput.vue +29 -0
- package/packages/ui/components/data-grid/CellRendererCsSelect.vue +19 -0
- package/packages/ui/components/data-grid/CellRendererInput.vue +120 -0
- package/packages/ui/components/data-grid/CellRendererText.vue +94 -0
- package/packages/ui/components/data-grid/ColumnSettings.vue +40 -0
- package/packages/ui/components/data-grid/ColumnSettingsDialog.vue +367 -0
- package/packages/ui/components/data-grid/DataGrid.vue +850 -0
- package/packages/ui/components/data-grid/DataGridFilter.vue +242 -0
- package/packages/ui/components/data-grid/column-settings-api.ts +62 -0
- package/packages/ui/components/data-grid/index.ts +29 -0
- package/packages/ui/components/data-grid/props.ts +246 -0
- package/packages/ui/components/data-grid/variants.ts +26 -0
- package/packages/ui/components/divider/README.md +84 -0
- package/packages/ui/components/divider/__tests__/divider.test.ts +105 -0
- package/packages/ui/components/divider/index.ts +13 -0
- package/packages/ui/components/divider/src/divider.ts +50 -0
- package/packages/ui/components/divider/src/divider.vue +76 -0
- package/packages/ui/components/divider/styles/divider.css +65 -0
- package/packages/ui/components/drawer/README.md +90 -0
- package/packages/ui/components/drawer/__tests__/drawer.test.ts +218 -0
- package/packages/ui/components/drawer/index.ts +13 -0
- package/packages/ui/components/drawer/src/drawer.ts +88 -0
- package/packages/ui/components/drawer/src/drawer.vue +157 -0
- package/packages/ui/components/drawer/styles/drawer.css +164 -0
- package/packages/ui/components/dropdown/README.md +51 -0
- package/packages/ui/components/dropdown/__tests__/dropdown.test.ts +143 -0
- package/packages/ui/components/dropdown/index.ts +11 -0
- package/packages/ui/components/dropdown/src/dropdown.ts +47 -0
- package/packages/ui/components/dropdown/src/dropdown.vue +75 -0
- package/packages/ui/components/dropdown/styles/dropdown.css +16 -0
- package/packages/ui/components/dropdown-button/README.md +78 -0
- package/packages/ui/components/dropdown-button/__tests__/dropdown-button.test.ts +75 -0
- package/packages/ui/components/dropdown-button/index.ts +11 -0
- package/packages/ui/components/dropdown-button/src/dropdown-button-menu-items.vue +79 -0
- package/packages/ui/components/dropdown-button/src/dropdown-button.vue +152 -0
- package/packages/ui/components/dropdown-button/src/types.ts +98 -0
- package/packages/ui/components/dropdown-button/styles/dropdown-button.css +171 -0
- package/packages/ui/components/empty/README.md +48 -0
- package/packages/ui/components/empty/__tests__/empty.test.ts +37 -0
- package/packages/ui/components/empty/index.ts +13 -0
- package/packages/ui/components/empty/src/empty.vue +73 -0
- package/packages/ui/components/empty/src/types.ts +32 -0
- package/packages/ui/components/empty/styles/empty.css +69 -0
- package/packages/ui/components/error/README.md +44 -0
- package/packages/ui/components/error/__tests__/error.test.ts +34 -0
- package/packages/ui/components/error/index.ts +13 -0
- package/packages/ui/components/error/src/error.vue +65 -0
- package/packages/ui/components/error/src/types.ts +28 -0
- package/packages/ui/components/error/styles/error.css +69 -0
- package/packages/ui/components/filter-button/README.md +68 -0
- package/packages/ui/components/filter-button/__tests__/filter-button.test.ts +30 -0
- package/packages/ui/components/filter-button/index.ts +11 -0
- package/packages/ui/components/filter-button/src/filter-button.vue +59 -0
- package/packages/ui/components/filter-button/src/types.ts +9 -0
- package/packages/ui/components/form/README.md +750 -0
- package/packages/ui/components/form/__tests__/form-ai-registry-integration.test.ts +214 -0
- package/packages/ui/components/form/__tests__/form-field.test.ts +377 -0
- package/packages/ui/components/form/__tests__/form-item-ai-actions.test.ts +299 -0
- package/packages/ui/components/form/__tests__/form-item.test.ts +110 -0
- package/packages/ui/components/form/__tests__/form-wrapper-reject-forward.test.ts +269 -0
- package/packages/ui/components/form/__tests__/form.test.ts +148 -0
- package/packages/ui/components/form/base/cascader/README.md +75 -0
- package/packages/ui/components/form/base/cascader/__tests__/ai-capability.test.ts +507 -0
- package/packages/ui/components/form/base/cascader/__tests__/cascader.test.ts +203 -0
- package/packages/ui/components/form/base/cascader/index.ts +14 -0
- package/packages/ui/components/form/base/cascader/src/cascader.vue +505 -0
- package/packages/ui/components/form/base/cascader/src/types.ts +168 -0
- package/packages/ui/components/form/base/cascader/styles/cascader.css +186 -0
- package/packages/ui/components/form/base/checkbox/README.md +110 -0
- package/packages/ui/components/form/base/checkbox/__tests__/ai-capability.test.ts +465 -0
- package/packages/ui/components/form/base/checkbox/__tests__/checkbox.test.ts +98 -0
- package/packages/ui/components/form/base/checkbox/__tests__/group-integration.test.ts +192 -0
- package/packages/ui/components/form/base/checkbox/index.ts +18 -0
- package/packages/ui/components/form/base/checkbox/src/checkbox-group.vue +311 -0
- package/packages/ui/components/form/base/checkbox/src/checkbox.ts +210 -0
- package/packages/ui/components/form/base/checkbox/src/checkbox.vue +368 -0
- package/packages/ui/components/form/base/checkbox/styles/checkbox.css +24 -0
- package/packages/ui/components/form/base/data-picker/README.md +192 -0
- package/packages/ui/components/form/base/data-picker/__tests__/ai-capability.test.ts +566 -0
- package/packages/ui/components/form/base/data-picker/__tests__/data-picker.test.ts +628 -0
- package/packages/ui/components/form/base/data-picker/index.ts +23 -0
- package/packages/ui/components/form/base/data-picker/src/data-picker.ts +192 -0
- package/packages/ui/components/form/base/data-picker/src/data-picker.vue +1267 -0
- package/packages/ui/components/form/base/data-picker/styles/data-picker.css +174 -0
- package/packages/ui/components/form/base/date-picker/README.md +94 -0
- package/packages/ui/components/form/base/date-picker/__tests__/ai-capability.test.ts +462 -0
- package/packages/ui/components/form/base/date-picker/__tests__/date-picker.test.ts +115 -0
- package/packages/ui/components/form/base/date-picker/index.ts +13 -0
- package/packages/ui/components/form/base/date-picker/src/date-picker.ts +212 -0
- package/packages/ui/components/form/base/date-picker/src/date-picker.vue +871 -0
- package/packages/ui/components/form/base/date-picker/styles/date-picker.css +210 -0
- package/packages/ui/components/form/base/datetime-picker/README.md +197 -0
- package/packages/ui/components/form/base/datetime-picker/__tests__/ai-capability.test.ts +368 -0
- package/packages/ui/components/form/base/datetime-picker/__tests__/datetime-picker.test.ts +445 -0
- package/packages/ui/components/form/base/datetime-picker/index.ts +13 -0
- package/packages/ui/components/form/base/datetime-picker/src/datetime-picker.ts +149 -0
- package/packages/ui/components/form/base/datetime-picker/src/datetime-picker.vue +1158 -0
- package/packages/ui/components/form/base/datetime-picker/styles/datetime-picker.css +570 -0
- package/packages/ui/components/form/base/file-upload/README.md +73 -0
- package/packages/ui/components/form/base/file-upload/__tests__/ai-capability.test.ts +223 -0
- package/packages/ui/components/form/base/file-upload/__tests__/file-upload.spec.ts +199 -0
- package/packages/ui/components/form/base/file-upload/index.ts +11 -0
- package/packages/ui/components/form/base/file-upload/src/file-upload.ts +95 -0
- package/packages/ui/components/form/base/file-upload/src/file-upload.vue +451 -0
- package/packages/ui/components/form/base/file-upload/styles/file-upload.css +57 -0
- package/packages/ui/components/form/base/image-upload/README.md +70 -0
- package/packages/ui/components/form/base/image-upload/__tests__/ai-capability.test.ts +149 -0
- package/packages/ui/components/form/base/image-upload/__tests__/image-upload.spec.ts +282 -0
- package/packages/ui/components/form/base/image-upload/index.ts +11 -0
- package/packages/ui/components/form/base/image-upload/src/image-upload.ts +76 -0
- package/packages/ui/components/form/base/image-upload/src/image-upload.vue +657 -0
- package/packages/ui/components/form/base/index.ts +24 -0
- package/packages/ui/components/form/base/input/README.md +63 -0
- package/packages/ui/components/form/base/input/__tests__/ai-capability.test.ts +143 -0
- package/packages/ui/components/form/base/input/__tests__/input.test.ts +195 -0
- package/packages/ui/components/form/base/input/index.ts +37 -0
- package/packages/ui/components/form/base/input/src/input.ts +104 -0
- package/packages/ui/components/form/base/input/src/input.vue +384 -0
- package/packages/ui/components/form/base/input/styles/input.css +198 -0
- package/packages/ui/components/form/base/location-picker/README.md +92 -0
- package/packages/ui/components/form/base/location-picker/__tests__/ai-capability.test.ts +147 -0
- package/packages/ui/components/form/base/location-picker/__tests__/location-picker.test.ts +161 -0
- package/packages/ui/components/form/base/location-picker/index.ts +13 -0
- package/packages/ui/components/form/base/location-picker/src/location-picker.ts +99 -0
- package/packages/ui/components/form/base/location-picker/src/location-picker.vue +558 -0
- package/packages/ui/components/form/base/radio/README.md +95 -0
- package/packages/ui/components/form/base/radio/__tests__/ai-capability.test.ts +578 -0
- package/packages/ui/components/form/base/radio/__tests__/group-integration.test.ts +191 -0
- package/packages/ui/components/form/base/radio/__tests__/radio.test.ts +64 -0
- package/packages/ui/components/form/base/radio/index.ts +18 -0
- package/packages/ui/components/form/base/radio/src/radio-group.vue +270 -0
- package/packages/ui/components/form/base/radio/src/radio.ts +154 -0
- package/packages/ui/components/form/base/radio/src/radio.vue +141 -0
- package/packages/ui/components/form/base/radio/styles/radio.css +12 -0
- package/packages/ui/components/form/base/region-picker/README.md +166 -0
- package/packages/ui/components/form/base/region-picker/__tests__/ai-capability.test.ts +147 -0
- package/packages/ui/components/form/base/region-picker/__tests__/region-picker.spec.ts +556 -0
- package/packages/ui/components/form/base/region-picker/index.ts +19 -0
- package/packages/ui/components/form/base/region-picker/src/region-picker.ts +333 -0
- package/packages/ui/components/form/base/region-picker/src/region-picker.vue +552 -0
- package/packages/ui/components/form/base/select/README.md +66 -0
- package/packages/ui/components/form/base/select/__tests__/ai-capability.test.ts +463 -0
- package/packages/ui/components/form/base/select/__tests__/select.test.ts +167 -0
- package/packages/ui/components/form/base/select/index.ts +15 -0
- package/packages/ui/components/form/base/select/src/select.ts +173 -0
- package/packages/ui/components/form/base/select/src/select.vue +534 -0
- package/packages/ui/components/form/base/select/styles/select.css +206 -0
- package/packages/ui/components/form/base/signature/README.md +96 -0
- package/packages/ui/components/form/base/signature/__tests__/ai-capability.test.ts +147 -0
- package/packages/ui/components/form/base/signature/__tests__/signature.spec.ts +156 -0
- package/packages/ui/components/form/base/signature/index.ts +14 -0
- package/packages/ui/components/form/base/signature/src/signature.ts +100 -0
- package/packages/ui/components/form/base/signature/src/signature.vue +871 -0
- package/packages/ui/components/form/base/switch/README.md +102 -0
- package/packages/ui/components/form/base/switch/__tests__/ai-capability.test.ts +545 -0
- package/packages/ui/components/form/base/switch/__tests__/switch.test.ts +105 -0
- package/packages/ui/components/form/base/switch/index.ts +12 -0
- package/packages/ui/components/form/base/switch/src/switch.ts +133 -0
- package/packages/ui/components/form/base/switch/src/switch.vue +385 -0
- package/packages/ui/components/form/base/switch/styles/switch.css +35 -0
- package/packages/ui/components/form/base/text-area/README.md +89 -0
- package/packages/ui/components/form/base/text-area/__tests__/ai-capability.test.ts +176 -0
- package/packages/ui/components/form/base/text-area/__tests__/text-area.test.ts +152 -0
- package/packages/ui/components/form/base/text-area/index.ts +37 -0
- package/packages/ui/components/form/base/text-area/src/text-area.ts +137 -0
- package/packages/ui/components/form/base/text-area/src/text-area.vue +405 -0
- package/packages/ui/components/form/base/text-area/styles/text-area.css +137 -0
- package/packages/ui/components/form/base/time-picker/README.md +75 -0
- package/packages/ui/components/form/base/time-picker/__tests__/ai-capability.test.ts +135 -0
- package/packages/ui/components/form/base/time-picker/__tests__/time-picker.test.ts +258 -0
- package/packages/ui/components/form/base/time-picker/index.ts +13 -0
- package/packages/ui/components/form/base/time-picker/src/time-picker.ts +141 -0
- package/packages/ui/components/form/base/time-picker/src/time-picker.vue +844 -0
- package/packages/ui/components/form/base/time-picker/styles/time-picker.css +124 -0
- package/packages/ui/components/form/base/upload/README.md +126 -0
- package/packages/ui/components/form/base/upload/__tests__/ai-capability.test.ts +145 -0
- package/packages/ui/components/form/base/upload/__tests__/upload.spec.ts +288 -0
- package/packages/ui/components/form/base/upload/index.ts +11 -0
- package/packages/ui/components/form/base/upload/src/upload.ts +171 -0
- package/packages/ui/components/form/base/upload/src/upload.vue +890 -0
- package/packages/ui/components/form/base/upload/styles/upload.css +116 -0
- package/packages/ui/components/form/index.ts +138 -0
- package/packages/ui/components/form/items/form-array/README.md +61 -0
- package/packages/ui/components/form/items/form-array/__tests__/form-array.test.ts +122 -0
- package/packages/ui/components/form/items/form-array/index.ts +2 -0
- package/packages/ui/components/form/items/form-array/src/form-array.vue +80 -0
- package/packages/ui/components/form/items/form-array/src/types.ts +27 -0
- package/packages/ui/components/form/items/form-array/styles/form-array.css +99 -0
- package/packages/ui/components/form/items/form-cascader/README.md +132 -0
- package/packages/ui/components/form/items/form-cascader/__tests__/form-cascader.test.ts +99 -0
- package/packages/ui/components/form/items/form-cascader/index.ts +1 -0
- package/packages/ui/components/form/items/form-cascader/src/form-cascader.ts +7 -0
- package/packages/ui/components/form/items/form-cascader/src/form-cascader.vue +15 -0
- package/packages/ui/components/form/items/form-checkbox/README.md +121 -0
- package/packages/ui/components/form/items/form-checkbox/__tests__/form-checkbox.test.ts +93 -0
- package/packages/ui/components/form/items/form-checkbox/index.ts +1 -0
- package/packages/ui/components/form/items/form-checkbox/src/form-checkbox.ts +7 -0
- package/packages/ui/components/form/items/form-checkbox/src/form-checkbox.vue +15 -0
- package/packages/ui/components/form/items/form-data-picker/README.md +111 -0
- package/packages/ui/components/form/items/form-data-picker/__tests__/form-data-picker.test.ts +98 -0
- package/packages/ui/components/form/items/form-data-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-data-picker/src/form-data-picker.ts +7 -0
- package/packages/ui/components/form/items/form-data-picker/src/form-data-picker.vue +17 -0
- package/packages/ui/components/form/items/form-date-picker/README.md +119 -0
- package/packages/ui/components/form/items/form-date-picker/__tests__/form-date-picker.test.ts +104 -0
- package/packages/ui/components/form/items/form-date-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-date-picker/src/form-date-picker.ts +7 -0
- package/packages/ui/components/form/items/form-date-picker/src/form-date-picker.vue +17 -0
- package/packages/ui/components/form/items/form-datetime-picker/README.md +112 -0
- package/packages/ui/components/form/items/form-datetime-picker/__tests__/form-datetime-picker.test.ts +105 -0
- package/packages/ui/components/form/items/form-datetime-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-datetime-picker/src/form-datetime-picker.ts +7 -0
- package/packages/ui/components/form/items/form-datetime-picker/src/form-datetime-picker.vue +17 -0
- package/packages/ui/components/form/items/form-dynamic/README.md +105 -0
- package/packages/ui/components/form/items/form-dynamic/__tests__/form-dynamic.test.ts +172 -0
- package/packages/ui/components/form/items/form-dynamic/index.ts +2 -0
- package/packages/ui/components/form/items/form-dynamic/src/form-dynamic.vue +222 -0
- package/packages/ui/components/form/items/form-dynamic/src/types.ts +63 -0
- package/packages/ui/components/form/items/form-file-upload/README.md +92 -0
- package/packages/ui/components/form/items/form-file-upload/__tests__/form-file-upload.test.ts +99 -0
- package/packages/ui/components/form/items/form-file-upload/index.ts +1 -0
- package/packages/ui/components/form/items/form-file-upload/src/form-file-upload.ts +7 -0
- package/packages/ui/components/form/items/form-file-upload/src/form-file-upload.vue +15 -0
- package/packages/ui/components/form/items/form-group/README.md +57 -0
- package/packages/ui/components/form/items/form-group/__tests__/form-group.test.ts +108 -0
- package/packages/ui/components/form/items/form-group/index.ts +2 -0
- package/packages/ui/components/form/items/form-group/src/form-group.vue +85 -0
- package/packages/ui/components/form/items/form-group/src/types.ts +37 -0
- package/packages/ui/components/form/items/form-group/styles/form-group.css +92 -0
- package/packages/ui/components/form/items/form-image-upload/README.md +92 -0
- package/packages/ui/components/form/items/form-image-upload/__tests__/form-image-upload.test.ts +109 -0
- package/packages/ui/components/form/items/form-image-upload/index.ts +1 -0
- package/packages/ui/components/form/items/form-image-upload/src/form-image-upload.ts +7 -0
- package/packages/ui/components/form/items/form-image-upload/src/form-image-upload.vue +37 -0
- package/packages/ui/components/form/items/form-input/README.md +110 -0
- package/packages/ui/components/form/items/form-input/__tests__/form-input.test.ts +87 -0
- package/packages/ui/components/form/items/form-input/index.ts +1 -0
- package/packages/ui/components/form/items/form-input/src/form-input.ts +7 -0
- package/packages/ui/components/form/items/form-input/src/form-input.vue +15 -0
- package/packages/ui/components/form/items/form-location-picker/README.md +119 -0
- package/packages/ui/components/form/items/form-location-picker/__tests__/form-location-picker.test.ts +98 -0
- package/packages/ui/components/form/items/form-location-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-location-picker/src/form-location-picker.ts +7 -0
- package/packages/ui/components/form/items/form-location-picker/src/form-location-picker.vue +15 -0
- package/packages/ui/components/form/items/form-radio/README.md +125 -0
- package/packages/ui/components/form/items/form-radio/__tests__/form-radio.test.ts +104 -0
- package/packages/ui/components/form/items/form-radio/index.ts +1 -0
- package/packages/ui/components/form/items/form-radio/src/form-radio.ts +7 -0
- package/packages/ui/components/form/items/form-radio/src/form-radio.vue +15 -0
- package/packages/ui/components/form/items/form-region-picker/README.md +111 -0
- package/packages/ui/components/form/items/form-region-picker/__tests__/form-region-picker.test.ts +95 -0
- package/packages/ui/components/form/items/form-region-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-region-picker/src/form-region-picker.ts +7 -0
- package/packages/ui/components/form/items/form-region-picker/src/form-region-picker.vue +15 -0
- package/packages/ui/components/form/items/form-select/README.md +117 -0
- package/packages/ui/components/form/items/form-select/__tests__/form-select.test.ts +80 -0
- package/packages/ui/components/form/items/form-select/index.ts +1 -0
- package/packages/ui/components/form/items/form-select/src/form-select.ts +7 -0
- package/packages/ui/components/form/items/form-select/src/form-select.vue +15 -0
- package/packages/ui/components/form/items/form-signature/README.md +89 -0
- package/packages/ui/components/form/items/form-signature/__tests__/form-signature.test.ts +109 -0
- package/packages/ui/components/form/items/form-signature/index.ts +1 -0
- package/packages/ui/components/form/items/form-signature/src/form-signature.ts +7 -0
- package/packages/ui/components/form/items/form-signature/src/form-signature.vue +15 -0
- package/packages/ui/components/form/items/form-slider/README.md +125 -0
- package/packages/ui/components/form/items/form-slider/__tests__/form-slider.test.ts +95 -0
- package/packages/ui/components/form/items/form-slider/index.ts +1 -0
- package/packages/ui/components/form/items/form-slider/src/form-slider.ts +7 -0
- package/packages/ui/components/form/items/form-slider/src/form-slider.vue +15 -0
- package/packages/ui/components/form/items/form-subform/README.md +71 -0
- package/packages/ui/components/form/items/form-subform/__tests__/form-subform.test.ts +116 -0
- package/packages/ui/components/form/items/form-subform/index.ts +2 -0
- package/packages/ui/components/form/items/form-subform/src/form-subform.vue +92 -0
- package/packages/ui/components/form/items/form-subform/src/types.ts +32 -0
- package/packages/ui/components/form/items/form-subform/styles/form-subform.css +127 -0
- package/packages/ui/components/form/items/form-switch/README.md +118 -0
- package/packages/ui/components/form/items/form-switch/__tests__/form-switch.test.ts +88 -0
- package/packages/ui/components/form/items/form-switch/index.ts +1 -0
- package/packages/ui/components/form/items/form-switch/src/form-switch.ts +7 -0
- package/packages/ui/components/form/items/form-switch/src/form-switch.vue +15 -0
- package/packages/ui/components/form/items/form-table/OPTIMIZATION_REPORT.md +205 -0
- package/packages/ui/components/form/items/form-table/README.md +144 -0
- package/packages/ui/components/form/items/form-table/__tests__/form-table.test.ts +373 -0
- package/packages/ui/components/form/items/form-table/index.ts +3 -0
- package/packages/ui/components/form/items/form-table/src/column-filter-popover.vue +149 -0
- package/packages/ui/components/form/items/form-table/src/form-table.vue +1315 -0
- package/packages/ui/components/form/items/form-table/src/types.ts +165 -0
- package/packages/ui/components/form/items/form-table/styles/column-filter-popover.css +138 -0
- package/packages/ui/components/form/items/form-table/styles/form-table.css +393 -0
- package/packages/ui/components/form/items/form-textarea/README.md +123 -0
- package/packages/ui/components/form/items/form-textarea/__tests__/form-textarea.test.ts +93 -0
- package/packages/ui/components/form/items/form-textarea/index.ts +1 -0
- package/packages/ui/components/form/items/form-textarea/src/form-textarea.ts +7 -0
- package/packages/ui/components/form/items/form-textarea/src/form-textarea.vue +15 -0
- package/packages/ui/components/form/items/form-time-picker/README.md +117 -0
- package/packages/ui/components/form/items/form-time-picker/__tests__/form-time-picker.test.ts +105 -0
- package/packages/ui/components/form/items/form-time-picker/index.ts +1 -0
- package/packages/ui/components/form/items/form-time-picker/src/form-time-picker.ts +7 -0
- package/packages/ui/components/form/items/form-time-picker/src/form-time-picker.vue +17 -0
- package/packages/ui/components/form/items/form-upload/README.md +92 -0
- package/packages/ui/components/form/items/form-upload/__tests__/form-upload.test.ts +137 -0
- package/packages/ui/components/form/items/form-upload/index.ts +1 -0
- package/packages/ui/components/form/items/form-upload/src/form-upload.ts +7 -0
- package/packages/ui/components/form/items/form-upload/src/form-upload.vue +15 -0
- package/packages/ui/components/form/shared/types.ts +82 -0
- package/packages/ui/components/form/src/form-field.ts +96 -0
- package/packages/ui/components/form/src/form-field.vue +404 -0
- package/packages/ui/components/form/src/form-item.vue +646 -0
- package/packages/ui/components/form/src/form.ts +11 -0
- package/packages/ui/components/form/src/form.vue +156 -0
- package/packages/ui/components/form/src/types.ts +337 -0
- package/packages/ui/components/form/src/use-form-field.ts +190 -0
- package/packages/ui/components/form/styles/form-ai-actions.css +41 -0
- package/packages/ui/components/form/styles/form-field.css +123 -0
- package/packages/ui/components/form/styles/form-item-ai-status.css +212 -0
- package/packages/ui/components/form/styles/form-item.css +218 -0
- package/packages/ui/components/form/styles/form.css +132 -0
- package/packages/ui/components/form-ai-status/README.md +86 -0
- package/packages/ui/components/form-ai-status/__tests__/form-ai-status.test.ts +183 -0
- package/packages/ui/components/form-ai-status/index.ts +12 -0
- package/packages/ui/components/form-ai-status/src/form-ai-status.vue +254 -0
- package/packages/ui/components/form-ai-status/src/types.ts +36 -0
- package/packages/ui/components/form-ai-status/styles/form-ai-status.css +238 -0
- package/packages/ui/components/form-ai-toolbar/README.md +100 -0
- package/packages/ui/components/form-ai-toolbar/__tests__/form-ai-toolbar.test.ts +344 -0
- package/packages/ui/components/form-ai-toolbar/index.ts +13 -0
- package/packages/ui/components/form-ai-toolbar/src/form-ai-toolbar.vue +598 -0
- package/packages/ui/components/form-ai-toolbar/src/types.ts +130 -0
- package/packages/ui/components/form-ai-toolbar/styles/form-ai-toolbar.css +281 -0
- package/packages/ui/components/icon/README.md +137 -0
- package/packages/ui/components/icon/__tests__/icon.test.ts +125 -0
- package/packages/ui/components/icon/index.ts +13 -0
- package/packages/ui/components/icon/src/icon.ts +67 -0
- package/packages/ui/components/icon/src/icon.vue +69 -0
- package/packages/ui/components/icon/styles/icon.css +41 -0
- package/packages/ui/components/image-preview/README.md +90 -0
- package/packages/ui/components/image-preview/__tests__/image-preview.test.ts +183 -0
- package/packages/ui/components/image-preview/index.ts +13 -0
- package/packages/ui/components/image-preview/src/image-preview.vue +71 -0
- package/packages/ui/components/image-preview/src/index.ts +11 -0
- package/packages/ui/components/image-preview/src/preview-layer.vue +90 -0
- package/packages/ui/components/image-preview/src/types.ts +63 -0
- package/packages/ui/components/image-preview/styles/image-preview.css +39 -0
- package/packages/ui/components/layout/app-bar/README.md +59 -0
- package/packages/ui/components/layout/app-bar/__tests__/app-bar.test.ts +124 -0
- package/packages/ui/components/layout/app-bar/index.ts +13 -0
- package/packages/ui/components/layout/app-bar/src/app-bar.vue +106 -0
- package/packages/ui/components/layout/app-bar/src/types.ts +43 -0
- package/packages/ui/components/layout/app-bar/styles/app-bar.css +175 -0
- package/packages/ui/components/layout/card/README.md +90 -0
- package/packages/ui/components/layout/card/__tests__/card.test.ts +321 -0
- package/packages/ui/components/layout/card/index.ts +13 -0
- package/packages/ui/components/layout/card/src/card.vue +210 -0
- package/packages/ui/components/layout/card/src/types.ts +79 -0
- package/packages/ui/components/layout/card/styles/card.css +334 -0
- package/packages/ui/components/layout/container/README.md +29 -0
- package/packages/ui/components/layout/container/__tests__/container.test.ts +74 -0
- package/packages/ui/components/layout/container/index.ts +13 -0
- package/packages/ui/components/layout/container/src/container.vue +35 -0
- package/packages/ui/components/layout/container/src/types.ts +15 -0
- package/packages/ui/components/layout/container/styles/container.css +50 -0
- package/packages/ui/components/layout/detail-layout/README.md +30 -0
- package/packages/ui/components/layout/detail-layout/__tests__/detail-layout.test.ts +75 -0
- package/packages/ui/components/layout/detail-layout/index.ts +13 -0
- package/packages/ui/components/layout/detail-layout/src/detail-layout.vue +53 -0
- package/packages/ui/components/layout/detail-layout/src/types.ts +22 -0
- package/packages/ui/components/layout/detail-layout/styles/detail-layout.css +71 -0
- package/packages/ui/components/layout/form-layout/README.md +59 -0
- package/packages/ui/components/layout/form-layout/__tests__/form-layout.test.ts +140 -0
- package/packages/ui/components/layout/form-layout/index.ts +13 -0
- package/packages/ui/components/layout/form-layout/src/form-layout.vue +93 -0
- package/packages/ui/components/layout/form-layout/src/types.ts +64 -0
- package/packages/ui/components/layout/form-layout/styles/form-layout.css +98 -0
- package/packages/ui/components/layout/grid/README.md +41 -0
- package/packages/ui/components/layout/grid/__tests__/grid.test.ts +77 -0
- package/packages/ui/components/layout/grid/index.ts +13 -0
- package/packages/ui/components/layout/grid/src/grid.vue +79 -0
- package/packages/ui/components/layout/grid/src/types.ts +44 -0
- package/packages/ui/components/layout/grid/styles/grid.css +46 -0
- package/packages/ui/components/layout/hero/README.md +59 -0
- package/packages/ui/components/layout/hero/__tests__/hero.test.ts +112 -0
- package/packages/ui/components/layout/hero/index.ts +13 -0
- package/packages/ui/components/layout/hero/src/hero.vue +143 -0
- package/packages/ui/components/layout/hero/src/types.ts +44 -0
- package/packages/ui/components/layout/hero/styles/hero.css +129 -0
- package/packages/ui/components/layout/inline/README.md +30 -0
- package/packages/ui/components/layout/inline/__tests__/inline.test.ts +154 -0
- package/packages/ui/components/layout/inline/index.ts +13 -0
- package/packages/ui/components/layout/inline/src/inline.vue +99 -0
- package/packages/ui/components/layout/inline/src/types.ts +23 -0
- package/packages/ui/components/layout/inline/styles/inline.css +150 -0
- package/packages/ui/components/layout/master-detail/README.md +36 -0
- package/packages/ui/components/layout/master-detail/__tests__/master-detail.test.ts +104 -0
- package/packages/ui/components/layout/master-detail/index.ts +13 -0
- package/packages/ui/components/layout/master-detail/src/master-detail.vue +72 -0
- package/packages/ui/components/layout/master-detail/src/types.ts +28 -0
- package/packages/ui/components/layout/master-detail/styles/master-detail.css +82 -0
- package/packages/ui/components/layout/page/README.md +35 -0
- package/packages/ui/components/layout/page/__tests__/page.test.ts +136 -0
- package/packages/ui/components/layout/page/index.ts +13 -0
- package/packages/ui/components/layout/page/src/page.vue +85 -0
- package/packages/ui/components/layout/page/src/types.ts +39 -0
- package/packages/ui/components/layout/page/styles/page.css +177 -0
- package/packages/ui/components/layout/page-header/README.md +39 -0
- package/packages/ui/components/layout/page-header/__tests__/page-header.test.ts +198 -0
- package/packages/ui/components/layout/page-header/index.ts +13 -0
- package/packages/ui/components/layout/page-header/src/page-header.vue +133 -0
- package/packages/ui/components/layout/page-header/src/types.ts +56 -0
- package/packages/ui/components/layout/page-header/styles/page-header.css +155 -0
- package/packages/ui/components/layout/section/README.md +40 -0
- package/packages/ui/components/layout/section/__tests__/section.test.ts +121 -0
- package/packages/ui/components/layout/section/index.ts +13 -0
- package/packages/ui/components/layout/section/src/section.vue +79 -0
- package/packages/ui/components/layout/section/src/types.ts +28 -0
- package/packages/ui/components/layout/section/styles/section.css +103 -0
- package/packages/ui/components/layout/sidebar-layout/README.md +60 -0
- package/packages/ui/components/layout/sidebar-layout/__tests__/sidebar-layout.test.ts +220 -0
- package/packages/ui/components/layout/sidebar-layout/index.ts +13 -0
- package/packages/ui/components/layout/sidebar-layout/src/sidebar-layout.vue +113 -0
- package/packages/ui/components/layout/sidebar-layout/src/types.ts +54 -0
- package/packages/ui/components/layout/sidebar-layout/styles/sidebar-layout.css +211 -0
- package/packages/ui/components/layout/split/README.md +40 -0
- package/packages/ui/components/layout/split/__tests__/split.test.ts +99 -0
- package/packages/ui/components/layout/split/index.ts +13 -0
- package/packages/ui/components/layout/split/src/split.vue +65 -0
- package/packages/ui/components/layout/split/src/types.ts +49 -0
- package/packages/ui/components/layout/split/styles/split.css +40 -0
- package/packages/ui/components/layout/stack/README.md +29 -0
- package/packages/ui/components/layout/stack/__tests__/stack.test.ts +66 -0
- package/packages/ui/components/layout/stack/index.ts +13 -0
- package/packages/ui/components/layout/stack/src/stack.vue +31 -0
- package/packages/ui/components/layout/stack/src/types.ts +14 -0
- package/packages/ui/components/layout/stack/styles/stack.css +61 -0
- package/packages/ui/components/layout/state-container/README.md +45 -0
- package/packages/ui/components/layout/state-container/__tests__/state-container.test.ts +123 -0
- package/packages/ui/components/layout/state-container/index.ts +13 -0
- package/packages/ui/components/layout/state-container/src/state-container.vue +72 -0
- package/packages/ui/components/layout/state-container/src/types.ts +46 -0
- package/packages/ui/components/layout/state-container/styles/state-container.css +71 -0
- package/packages/ui/components/layout/toolbar/README.md +34 -0
- package/packages/ui/components/layout/toolbar/__tests__/toolbar.test.ts +90 -0
- package/packages/ui/components/layout/toolbar/index.ts +13 -0
- package/packages/ui/components/layout/toolbar/src/toolbar.vue +50 -0
- package/packages/ui/components/layout/toolbar/src/types.ts +19 -0
- package/packages/ui/components/layout/toolbar/styles/toolbar.css +80 -0
- package/packages/ui/components/loading/README.md +39 -0
- package/packages/ui/components/loading/__tests__/loading.test.ts +37 -0
- package/packages/ui/components/loading/index.ts +13 -0
- package/packages/ui/components/loading/src/loading.vue +59 -0
- package/packages/ui/components/loading/src/types.ts +27 -0
- package/packages/ui/components/loading/styles/loading.css +59 -0
- package/packages/ui/components/menu/README.md +51 -0
- package/packages/ui/components/menu/__tests__/menu.test.ts +80 -0
- package/packages/ui/components/menu/index.ts +11 -0
- package/packages/ui/components/menu/src/menu.ts +49 -0
- package/packages/ui/components/menu/src/menu.vue +103 -0
- package/packages/ui/components/menu/styles/menu.css +19 -0
- package/packages/ui/components/message/README.md +69 -0
- package/packages/ui/components/message/__tests__/message.test.ts +98 -0
- package/packages/ui/components/message/index.ts +13 -0
- package/packages/ui/components/message/src/message.ts +87 -0
- package/packages/ui/components/message/src/message.vue +88 -0
- package/packages/ui/components/message/styles/message.css +70 -0
- package/packages/ui/components/metric/README.md +63 -0
- package/packages/ui/components/metric/__tests__/metric.test.ts +166 -0
- package/packages/ui/components/metric/index.ts +13 -0
- package/packages/ui/components/metric/src/metric.vue +107 -0
- package/packages/ui/components/metric/src/types.ts +50 -0
- package/packages/ui/components/metric/styles/metric.css +233 -0
- package/packages/ui/components/modal/README.md +91 -0
- package/packages/ui/components/modal/__tests__/modal.test.ts +145 -0
- package/packages/ui/components/modal/index.ts +13 -0
- package/packages/ui/components/modal/src/modal.ts +153 -0
- package/packages/ui/components/modal/src/modal.vue +234 -0
- package/packages/ui/components/modal/styles/modal.css +104 -0
- package/packages/ui/components/more-action-button/README.md +68 -0
- package/packages/ui/components/more-action-button/__tests__/more-action-button.test.ts +30 -0
- package/packages/ui/components/more-action-button/index.ts +11 -0
- package/packages/ui/components/more-action-button/src/more-action-button.vue +59 -0
- package/packages/ui/components/more-action-button/src/types.ts +9 -0
- package/packages/ui/components/navigation/side-nav/README.md +59 -0
- package/packages/ui/components/navigation/side-nav/__tests__/side-nav.test.ts +105 -0
- package/packages/ui/components/navigation/side-nav/index.ts +13 -0
- package/packages/ui/components/navigation/side-nav/src/side-nav.vue +147 -0
- package/packages/ui/components/navigation/side-nav/src/types.ts +50 -0
- package/packages/ui/components/navigation/side-nav/styles/side-nav.css +171 -0
- package/packages/ui/components/notification/README.md +82 -0
- package/packages/ui/components/notification/__tests__/notification.test.ts +150 -0
- package/packages/ui/components/notification/index.ts +30 -0
- package/packages/ui/components/notification/src/notification.vue +114 -0
- package/packages/ui/components/notification/src/types.ts +67 -0
- package/packages/ui/components/notification/src/use-notification.ts +136 -0
- package/packages/ui/components/notification/styles/notification.css +4 -0
- package/packages/ui/components/pagination/README.md +82 -0
- package/packages/ui/components/pagination/__tests__/pagination.test.ts +210 -0
- package/packages/ui/components/pagination/index.ts +13 -0
- package/packages/ui/components/pagination/src/pagination.ts +86 -0
- package/packages/ui/components/pagination/src/pagination.vue +270 -0
- package/packages/ui/components/pagination/styles/pagination.css +143 -0
- package/packages/ui/components/progress/README.md +132 -0
- package/packages/ui/components/progress/__tests__/progress.test.ts +81 -0
- package/packages/ui/components/progress/index.ts +12 -0
- package/packages/ui/components/progress/src/progress.ts +80 -0
- package/packages/ui/components/progress/src/progress.vue +202 -0
- package/packages/ui/components/skeleton/README.md +71 -0
- package/packages/ui/components/skeleton/__tests__/skeleton.test.ts +138 -0
- package/packages/ui/components/skeleton/index.ts +13 -0
- package/packages/ui/components/skeleton/src/skeleton.ts +46 -0
- package/packages/ui/components/skeleton/src/skeleton.vue +67 -0
- package/packages/ui/components/skeleton/styles/skeleton.css +75 -0
- package/packages/ui/components/slider/README.md +87 -0
- package/packages/ui/components/slider/__tests__/ai-capability.test.ts +469 -0
- package/packages/ui/components/slider/__tests__/slider.test.ts +235 -0
- package/packages/ui/components/slider/index.ts +26 -0
- package/packages/ui/components/slider/src/slider.ts +192 -0
- package/packages/ui/components/slider/src/slider.vue +504 -0
- package/packages/ui/components/slider/src/use-slider.ts +399 -0
- package/packages/ui/components/slider/styles/slider.css +344 -0
- package/packages/ui/components/split-button/README.md +71 -0
- package/packages/ui/components/split-button/__tests__/split-button.test.ts +32 -0
- package/packages/ui/components/split-button/index.ts +11 -0
- package/packages/ui/components/split-button/src/split-button.vue +69 -0
- package/packages/ui/components/split-button/src/types.ts +34 -0
- package/packages/ui/components/split-button/styles/split-button.css +15 -0
- package/packages/ui/components/status-dot/README.md +42 -0
- package/packages/ui/components/status-dot/__tests__/status-dot.test.ts +53 -0
- package/packages/ui/components/status-dot/index.ts +13 -0
- package/packages/ui/components/status-dot/src/status-dot.vue +39 -0
- package/packages/ui/components/status-dot/src/types.ts +23 -0
- package/packages/ui/components/status-dot/styles/status-dot.css +65 -0
- package/packages/ui/components/steps/README.md +101 -0
- package/packages/ui/components/steps/__tests__/steps.test.ts +261 -0
- package/packages/ui/components/steps/index.ts +15 -0
- package/packages/ui/components/steps/src/step.vue +99 -0
- package/packages/ui/components/steps/src/steps.ts +93 -0
- package/packages/ui/components/steps/src/steps.vue +143 -0
- package/packages/ui/components/steps/styles/step.css +116 -0
- package/packages/ui/components/steps/styles/steps.css +200 -0
- package/packages/ui/components/table/README.md +81 -0
- package/packages/ui/components/table/__tests__/table.test.ts +162 -0
- package/packages/ui/components/table/index.ts +13 -0
- package/packages/ui/components/table/src/table.ts +195 -0
- package/packages/ui/components/table/src/table.vue +453 -0
- package/packages/ui/components/table/styles/table.css +88 -0
- package/packages/ui/components/tabs/README.md +88 -0
- package/packages/ui/components/tabs/__tests__/tabs.test.ts +161 -0
- package/packages/ui/components/tabs/index.ts +19 -0
- package/packages/ui/components/tabs/src/tab-pane.ts +18 -0
- package/packages/ui/components/tabs/src/tab-pane.vue +11 -0
- package/packages/ui/components/tabs/src/tabs-content.vue +58 -0
- package/packages/ui/components/tabs/src/tabs-list.vue +36 -0
- package/packages/ui/components/tabs/src/tabs-trigger.vue +70 -0
- package/packages/ui/components/tabs/src/tabs.ts +94 -0
- package/packages/ui/components/tabs/src/tabs.vue +101 -0
- package/packages/ui/components/tabs/src/types.ts +126 -0
- package/packages/ui/components/tabs/styles/tabs.css +239 -0
- package/packages/ui/components/tag/README.md +67 -0
- package/packages/ui/components/tag/__tests__/tag.test.ts +222 -0
- package/packages/ui/components/tag/index.ts +13 -0
- package/packages/ui/components/tag/src/tag.ts +87 -0
- package/packages/ui/components/tag/src/tag.vue +163 -0
- package/packages/ui/components/tag/styles/tag.css +47 -0
- package/packages/ui/components/timeline/README.md +80 -0
- package/packages/ui/components/timeline/__tests__/timeline.test.ts +78 -0
- package/packages/ui/components/timeline/index.ts +15 -0
- package/packages/ui/components/timeline/src/timeline-item.vue +38 -0
- package/packages/ui/components/timeline/src/timeline.ts +76 -0
- package/packages/ui/components/timeline/src/timeline.vue +30 -0
- package/packages/ui/components/timeline/styles/timeline-item.css +49 -0
- package/packages/ui/components/timeline/styles/timeline.css +43 -0
- package/packages/ui/components/tooltip/README.md +134 -0
- package/packages/ui/components/tooltip/__tests__/tooltip.test.ts +125 -0
- package/packages/ui/components/tooltip/index.ts +12 -0
- package/packages/ui/components/tooltip/src/tooltip.ts +66 -0
- package/packages/ui/components/tooltip/src/tooltip.vue +189 -0
- package/packages/ui/components/tree/README.md +54 -0
- package/packages/ui/components/tree/__tests__/tree.test.ts +80 -0
- package/packages/ui/components/tree/index.ts +11 -0
- package/packages/ui/components/tree/src/tree.ts +51 -0
- package/packages/ui/components/tree/src/tree.vue +242 -0
- package/packages/ui/components/tree/styles/tree.css +31 -0
- package/packages/ui/components/typography/README.md +120 -0
- package/packages/ui/components/typography/__tests__/typography.test.ts +164 -0
- package/packages/ui/components/typography/index.ts +13 -0
- package/packages/ui/components/typography/src/typography.ts +95 -0
- package/packages/ui/components/typography/src/typography.vue +94 -0
- package/packages/ui/components/typography/styles/typography.css +47 -0
- package/packages/ui/components/upload/README.md +103 -0
- package/packages/ui/components/upload/__tests__/upload.test.ts +181 -0
- package/packages/ui/components/upload/index.ts +11 -0
- package/packages/ui/components/upload/src/upload.ts +92 -0
- package/packages/ui/components/upload/src/upload.vue +382 -0
- package/packages/ui/components/upload/styles/upload.css +283 -0
- package/packages/ui/components/watermark/README.md +94 -0
- package/packages/ui/components/watermark/__tests__/watermark.test.ts +252 -0
- package/packages/ui/components/watermark/index.ts +13 -0
- package/packages/ui/components/watermark/src/index.ts +13 -0
- package/packages/ui/components/watermark/src/types.ts +86 -0
- package/packages/ui/components/watermark/src/use-watermark.ts +132 -0
- package/packages/ui/components/watermark/src/watermark.vue +181 -0
- package/packages/ui/components/watermark/styles/watermark.css +27 -0
- package/packages/ui/index.ts +338 -0
- package/packages/ui/lib/utils.ts +6 -0
- package/packages/ui/lowcode-agent/icons.ts +148 -0
- package/packages/ui/lowcode-agent/index.ts +26 -0
- package/packages/ui/lowcode-agent/registry.json +37004 -0
- package/packages/ui/lowcode-agent/types.ts +312 -0
- package/packages/ui/src/composables/__tests__/use-floating-popup.test.ts +275 -0
- package/packages/ui/src/composables/__tests__/use-form-ai-actions.test.ts +101 -0
- package/packages/ui/src/composables/__tests__/use-form-ai-registry.test.ts +92 -0
- package/packages/ui/src/composables/__tests__/use-form-ai.test.ts +116 -0
- package/packages/ui/src/composables/index.ts +10 -0
- package/packages/ui/src/composables/use-ai-state-machine.ts +142 -0
- package/packages/ui/src/composables/use-floating-popup.ts +237 -0
- package/packages/ui/src/composables/use-form-ai-registry.ts +198 -0
- package/packages/ui/src/composables/use-form-ai.ts +280 -0
- package/packages/ui/src/composables/useLightbox.ts +51 -0
- package/packages/ui/src/request/document.ts +53 -0
- package/packages/ui/src/request/enum.ts +18 -0
- package/packages/ui/src/request/index.ts +4 -0
- package/packages/ui/src/request/request.ts +200 -0
- package/packages/ui/src/request/types.ts +27 -0
- package/packages/ui/src/types/form-ai-registry.ts +70 -0
- package/packages/ui/src/types/form-ai.ts +84 -0
- package/packages/ui/src/utils/date-format.ts +60 -0
- package/packages/ui/styles/design-tokens.css +383 -0
- package/packages/ui/styles/tailwind.css +76 -0
- package/packages/ui/styles/tokens.css +7 -0
- package/playground/index.html +12 -0
- package/playground/postcss.config.cjs +5 -0
- package/playground/src/App.vue +3 -0
- package/playground/src/__tests__/__debug-input.test.ts +29 -0
- package/playground/src/__tests__/button-ai-confirm.test.ts +41 -0
- package/playground/src/__tests__/home-render.test.ts +87 -0
- package/playground/src/__tests__/icon-library.test.ts +107 -0
- package/playground/src/__tests__/input-ai-confirm.test.ts +113 -0
- package/playground/src/__tests__/textarea-ai-button.test.ts +87 -0
- package/playground/src/__tests__/textarea-wordlimit.test.ts +66 -0
- package/playground/src/chart-theme.ts +22 -0
- package/playground/src/components/AiStateFlow.vue +59 -0
- package/playground/src/components/ComponentShowcase.vue +180 -0
- package/playground/src/composables/useAiStateMachine.ts +111 -0
- package/playground/src/data/component-api.ts +187 -0
- package/playground/src/data/component-meta.ts +84 -0
- package/playground/src/layouts/DefaultLayout.vue +318 -0
- package/playground/src/main.ts +18 -0
- package/playground/src/router/index.ts +101 -0
- package/playground/src/views/AffixDemo.vue +133 -0
- package/playground/src/views/AiStateFlowDemo.vue +170 -0
- package/playground/src/views/AlertDemo.vue +554 -0
- package/playground/src/views/AnchorDemo.vue +150 -0
- package/playground/src/views/AppBarDemo.vue +722 -0
- package/playground/src/views/AvatarDemo.vue +266 -0
- package/playground/src/views/BackTopDemo.vue +71 -0
- package/playground/src/views/BadgeDemo.vue +109 -0
- package/playground/src/views/BatchActionButtonDemo.vue +65 -0
- package/playground/src/views/BreadcrumbDemo.vue +248 -0
- package/playground/src/views/ButtonDemo.vue +344 -0
- package/playground/src/views/CardDemo.vue +254 -0
- package/playground/src/views/CarouselDemo.vue +158 -0
- package/playground/src/views/CascaderDemo.vue +425 -0
- package/playground/src/views/ChartDemo.vue +232 -0
- package/playground/src/views/CheckboxDemo.vue +339 -0
- package/playground/src/views/DataGridDemo.vue +518 -0
- package/playground/src/views/DataPickerDemo.vue +240 -0
- package/playground/src/views/DatePickerDemo.vue +292 -0
- package/playground/src/views/DateTimePickerDemo.vue +208 -0
- package/playground/src/views/DesignSpecDemo.vue +1647 -0
- package/playground/src/views/DividerDemo.vue +77 -0
- package/playground/src/views/DocumentActionHeaderDemo.vue +113 -0
- package/playground/src/views/DocumentFormPageDemo.vue +200 -0
- package/playground/src/views/DrawerDemo.vue +166 -0
- package/playground/src/views/DropdownButtonDemo.vue +74 -0
- package/playground/src/views/DropdownDemo.vue +306 -0
- package/playground/src/views/EmptyDemo.vue +104 -0
- package/playground/src/views/ErrorDemo.vue +111 -0
- package/playground/src/views/FileUploadDemo.vue +241 -0
- package/playground/src/views/FilterButtonDemo.vue +65 -0
- package/playground/src/views/FormFieldAiDemo.vue +364 -0
- package/playground/src/views/FormFieldBasicDemo.vue +174 -0
- package/playground/src/views/FormFieldBusinessDemo.vue +245 -0
- package/playground/src/views/FormFieldDemo.vue +178 -0
- package/playground/src/views/FormFieldLayoutDemo.vue +183 -0
- package/playground/src/views/FormFieldValidationDemo.vue +163 -0
- package/playground/src/views/FormItemAiDemo.vue +371 -0
- package/playground/src/views/FormSelectDemo.vue +519 -0
- package/playground/src/views/FormUploadDemo.vue +536 -0
- package/playground/src/views/HeroDemo.vue +836 -0
- package/playground/src/views/Home.vue +213 -0
- package/playground/src/views/IconDemo.vue +186 -0
- package/playground/src/views/IconLibraryView.vue +370 -0
- package/playground/src/views/IconRenderTest.vue +86 -0
- package/playground/src/views/ImagePreviewDemo.vue +368 -0
- package/playground/src/views/ImageUploadDemo.vue +199 -0
- package/playground/src/views/InputDemo.vue +348 -0
- package/playground/src/views/LayoutDemo.vue +946 -0
- package/playground/src/views/LoadingDemo.vue +95 -0
- package/playground/src/views/LocationPickerDemo.vue +218 -0
- package/playground/src/views/MenuDemo.vue +283 -0
- package/playground/src/views/MessageDemo.vue +201 -0
- package/playground/src/views/MetricDemo.vue +535 -0
- package/playground/src/views/ModalDemo.vue +291 -0
- package/playground/src/views/MoreActionButtonDemo.vue +65 -0
- package/playground/src/views/NewDocumentDemo.vue +973 -0
- package/playground/src/views/NotificationDemo.vue +255 -0
- package/playground/src/views/PaginationDemo.vue +292 -0
- package/playground/src/views/ProgressDemo.vue +356 -0
- package/playground/src/views/RadioDemo.vue +414 -0
- package/playground/src/views/RegionPickerDemo.vue +249 -0
- package/playground/src/views/ScalingRulesDemo.vue +333 -0
- package/playground/src/views/SelectDemo.vue +453 -0
- package/playground/src/views/SideNavDemo.vue +769 -0
- package/playground/src/views/SignatureDemo.vue +205 -0
- package/playground/src/views/SkeletonDemo.vue +109 -0
- package/playground/src/views/SliderDemo.vue +312 -0
- package/playground/src/views/SplitButtonDemo.vue +65 -0
- package/playground/src/views/StatusDotDemo.vue +131 -0
- package/playground/src/views/StepsDemo.vue +587 -0
- package/playground/src/views/SwitchDemo.vue +442 -0
- package/playground/src/views/TableDemo.vue +438 -0
- package/playground/src/views/TabsDemo.vue +246 -0
- package/playground/src/views/TagDemo.vue +113 -0
- package/playground/src/views/TextAreaDemo.vue +317 -0
- package/playground/src/views/TimePickerDemo.vue +291 -0
- package/playground/src/views/TimelineDemo.vue +133 -0
- package/playground/src/views/TooltipDemo.vue +102 -0
- package/playground/src/views/TreeDemo.vue +521 -0
- package/playground/src/views/TypographyDemo.vue +175 -0
- package/playground/src/views/UploadDemo.vue +331 -0
- package/playground/src/views/WatermarkDemo.vue +112 -0
- package/playground/src/views/_mocks/new-document.mock.ts +506 -0
- package/playground/src/views/data/form-field-events-table.ts +243 -0
- package/playground/src/views/data/form-field-options.ts +77 -0
- package/playground/src/views/data/form-field-props-table.ts +227 -0
- package/playground/src/views/data/form-field-snippets.ts +149 -0
- package/playground/src/views/data/slider-snippets.ts +100 -0
- package/playground/src/views/inner/FormFieldEventsDoc.vue +147 -0
- package/playground/src/views/inner/FormFieldPropsDoc.vue +138 -0
- package/playground/vite.config.ts +25 -0
- package/pnpm-workspace.yaml +3 -0
- package/postcss.config.cjs +5 -0
- package/scripts/check-design-token-compliance.mjs +223 -0
- package/scripts/generate-package-dts.mjs +105 -0
- package/tsconfig.json +35 -0
- package/tsconfig.node.json +13 -0
- package/vite.config.ts +68 -0
- package/Button/button-props.d.ts +0 -9
- package/Button/button-variants.d.ts +0 -5
- package/Button/index.d.ts +0 -20
- package/Button/index.js +0 -111
- package/index.css +0 -596
- package/index.d.ts +0 -15
- package/index.js +0 -19
- package/utils/forward-attrs.d.ts +0 -6
- package/utils/install.d.ts +0 -6
- package/utils/utils.d.ts +0 -2
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* TfDateTimePicker 日期时间选择组件 (YYYY-MM-DD HH:mm:ss)
|
|
4
|
+
*
|
|
5
|
+
* 实现策略: 单面板内联布局 — 日历 + HH:mm 时间两列 + 确定按钮
|
|
6
|
+
*
|
|
7
|
+
* 业务场景:
|
|
8
|
+
* - 浇筑申请提交时间
|
|
9
|
+
* - 实际浇筑开始时间
|
|
10
|
+
* - 试块送检时间
|
|
11
|
+
*
|
|
12
|
+
* AI 增强: 传 :ai="{...}" 即可获得状态机/徽章/触发按钮/确认按钮 (与 date-picker 一致)
|
|
13
|
+
*/
|
|
14
|
+
import { ref, computed, watch, nextTick } from 'vue'
|
|
15
|
+
import type { PropType } from 'vue'
|
|
16
|
+
import { cva } from 'class-variance-authority'
|
|
17
|
+
import { CalendarDays, X, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight } from 'lucide-vue-next'
|
|
18
|
+
import { cn } from '../../../../../lib/utils'
|
|
19
|
+
import { useAiStateMachine } from '../../../../../src/composables/use-ai-state-machine'
|
|
20
|
+
import type { AiState } from '../../../../../src/composables/use-ai-state-machine'
|
|
21
|
+
import { useFloatingPopup } from '../../../../../src/composables/use-floating-popup'
|
|
22
|
+
import { formatDate as formatDateStr } from '../../../../../src/utils/date-format'
|
|
23
|
+
import type {
|
|
24
|
+
AiConfig,
|
|
25
|
+
DateTimePickerEmits,
|
|
26
|
+
DateTimePickerSize,
|
|
27
|
+
DateTimeShortcut,
|
|
28
|
+
DateTimeShortcutGroup,
|
|
29
|
+
DateTimeShortcutKind
|
|
30
|
+
} from './datetime-picker'
|
|
31
|
+
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: [String, Date, Array] as PropType<string | Date | null | string[]>,
|
|
35
|
+
default: null
|
|
36
|
+
},
|
|
37
|
+
format: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'YYYY-MM-DD HH:mm:ss'
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
type: String as PropType<DateTimePickerSize>,
|
|
43
|
+
default: 'md'
|
|
44
|
+
},
|
|
45
|
+
placeholder: String,
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
clearable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
54
|
+
bordered: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
showSeconds: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
range: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
rangePlaceholder: Array as unknown as PropType<[string, string]>,
|
|
67
|
+
rangeMin: String,
|
|
68
|
+
rangeMax: String,
|
|
69
|
+
rangeMinSpan: Number,
|
|
70
|
+
rangeMaxSpan: Number,
|
|
71
|
+
shortcuts: {
|
|
72
|
+
type: [Boolean, Array] as PropType<boolean | DateTimeShortcutGroup[]>,
|
|
73
|
+
default: true
|
|
74
|
+
},
|
|
75
|
+
ai: Object as PropType<AiConfig>
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits<DateTimePickerEmits>()
|
|
79
|
+
defineSlots<{
|
|
80
|
+
prefix?: (_: any) => any
|
|
81
|
+
clearIcon?: (_: any) => any
|
|
82
|
+
aiPrefix?: (_: any) => any
|
|
83
|
+
}>()
|
|
84
|
+
|
|
85
|
+
const inputWrapperRef = ref<HTMLDivElement | null>(null)
|
|
86
|
+
const isOpen = ref(false)
|
|
87
|
+
|
|
88
|
+
const showSeconds = computed(() => props.showSeconds && props.format.includes('ss'))
|
|
89
|
+
|
|
90
|
+
const effectiveFormat = computed(() => {
|
|
91
|
+
if (showSeconds.value) return props.format
|
|
92
|
+
return props.format.replace(/:ss/g, '')
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
// 拆分: 日期部分 (YYYY-MM-DD) 和时间部分 (HH:mm:ss / HH:mm)
|
|
96
|
+
const datePart = ref<string>('')
|
|
97
|
+
const timePart = ref<string>('')
|
|
98
|
+
|
|
99
|
+
// range 区间选择模式
|
|
100
|
+
const rangeStartDate = ref<string>('')
|
|
101
|
+
const rangeStartTime = ref<string>('')
|
|
102
|
+
const rangeEndDate = ref<string>('')
|
|
103
|
+
const rangeEndTime = ref<string>('')
|
|
104
|
+
|
|
105
|
+
// ============== 内联日历状态 ==============
|
|
106
|
+
const weekDays = ['日', '一', '二', '三', '四', '五', '六']
|
|
107
|
+
const calendarCurrentDate = ref(new Date())
|
|
108
|
+
|
|
109
|
+
// 内联时间选择 (弹窗内临时状态)
|
|
110
|
+
const tempHour = ref<number | null>(null)
|
|
111
|
+
const tempMinute = ref<number | null>(null)
|
|
112
|
+
const tempSecond = ref<number | null>(null)
|
|
113
|
+
|
|
114
|
+
// 输入框 CVA
|
|
115
|
+
const inputVariants = cva(
|
|
116
|
+
'tf-datetime-picker__input w-full rounded-lg outline-none transition-all duration-200',
|
|
117
|
+
{
|
|
118
|
+
variants: {
|
|
119
|
+
size: {
|
|
120
|
+
sm: 'pl-9 pr-8 h-[var(--tf-form-control-h-sm)]',
|
|
121
|
+
md: 'pl-10 pr-9 py-2 h-[var(--tf-form-control-h-md)]',
|
|
122
|
+
lg: 'pl-11 pr-10 py-2.5 h-[var(--tf-form-control-h-lg)]'
|
|
123
|
+
},
|
|
124
|
+
bordered: {
|
|
125
|
+
true: 'border tf-datetime-picker__input--bordered',
|
|
126
|
+
false: 'border-b tf-datetime-picker__input--underlined'
|
|
127
|
+
},
|
|
128
|
+
disabled: {
|
|
129
|
+
true: 'tf-datetime-picker__input--disabled cursor-not-allowed',
|
|
130
|
+
false: 'cursor-pointer'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
defaultVariants: {
|
|
134
|
+
size: 'md',
|
|
135
|
+
bordered: true,
|
|
136
|
+
disabled: false
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
// 字体大小 (引用设计令牌 CSS 变量)
|
|
142
|
+
const dateTimePickerFontSizes: Record<string, string> = {
|
|
143
|
+
sm: 'var(--tf-font-size-xs)',
|
|
144
|
+
md: 'var(--tf-font-size-sm)',
|
|
145
|
+
lg: 'var(--tf-font-size-md)'
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const pad = (n: number) => String(n).padStart(2, '0')
|
|
149
|
+
|
|
150
|
+
const formatDateObject = (date: Date): string => {
|
|
151
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const formatTimeObject = (date: Date): string => {
|
|
155
|
+
const hh = pad(date.getHours())
|
|
156
|
+
const mm = pad(date.getMinutes())
|
|
157
|
+
const ss = pad(date.getSeconds())
|
|
158
|
+
return showSeconds.value ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const todayString = () => formatDateObject(new Date())
|
|
162
|
+
|
|
163
|
+
const dateOffsetString = (offset: number) => {
|
|
164
|
+
const date = new Date()
|
|
165
|
+
date.setDate(date.getDate() + offset)
|
|
166
|
+
return formatDateObject(date)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const dateMonthOffsetString = (offset: number) => {
|
|
170
|
+
const date = new Date()
|
|
171
|
+
date.setMonth(date.getMonth() + offset)
|
|
172
|
+
return formatDateObject(date)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const dateTimeForOffset = (offset: number, time: string) => `${dateOffsetString(offset)} ${time}`
|
|
176
|
+
|
|
177
|
+
const defaultShortcutGroups = computed<DateTimeShortcutGroup[]>(() => [
|
|
178
|
+
{
|
|
179
|
+
title: '日期',
|
|
180
|
+
kind: 'date',
|
|
181
|
+
items: [
|
|
182
|
+
{ label: '三天前', value: () => dateOffsetString(-3) },
|
|
183
|
+
{ label: '一周前', value: () => dateOffsetString(-7) },
|
|
184
|
+
{ label: '一月前', value: () => dateMonthOffsetString(-1) },
|
|
185
|
+
{ label: '三月前', value: () => dateMonthOffsetString(-3) },
|
|
186
|
+
{ label: '今天', value: () => dateOffsetString(0), tone: 'primary' },
|
|
187
|
+
{ label: '明天', value: () => dateOffsetString(1) },
|
|
188
|
+
{ label: '后天', value: () => dateOffsetString(2) }
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: '时间',
|
|
193
|
+
kind: 'time',
|
|
194
|
+
items: ['00:00', '08:00', '09:00', '12:00', '18:00', '23:59'].map((time) => ({ label: time, value: time }))
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
title: '组合',
|
|
198
|
+
kind: 'datetime',
|
|
199
|
+
items: [
|
|
200
|
+
{ label: '此刻', value: () => new Date(), tone: 'primary' },
|
|
201
|
+
{ label: '今天 09:00', value: () => dateTimeForOffset(0, '09:00') },
|
|
202
|
+
{ label: '今天 18:00', value: () => dateTimeForOffset(0, '18:00') },
|
|
203
|
+
{ label: '明天 09:00', value: () => dateTimeForOffset(1, '09:00') }
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
])
|
|
207
|
+
|
|
208
|
+
const normalizeShortcutGroup = (group: DateTimeShortcutGroup): DateTimeShortcutGroup | null => {
|
|
209
|
+
if (!group || !Array.isArray(group.items) || !group.items.length) return null
|
|
210
|
+
const kind = group.kind
|
|
211
|
+
if (kind !== 'date' && kind !== 'time' && kind !== 'datetime') return null
|
|
212
|
+
return {
|
|
213
|
+
title: group.title || (kind === 'date' ? '日期' : kind === 'time' ? '时间' : '组合'),
|
|
214
|
+
kind,
|
|
215
|
+
items: group.items.map((item) => ({ ...item, kind: item.kind ?? kind })).filter((item) => !!item.label)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const normalizedShortcutGroups = computed<DateTimeShortcutGroup[]>(() => {
|
|
220
|
+
if (props.shortcuts === false) return []
|
|
221
|
+
if (props.shortcuts === true || typeof props.shortcuts === 'undefined') return defaultShortcutGroups.value
|
|
222
|
+
return props.shortcuts.map(normalizeShortcutGroup).filter((group): group is DateTimeShortcutGroup => !!group)
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
const toStringValue = (val: string | Date | null | undefined): string => {
|
|
226
|
+
if (val == null) return ''
|
|
227
|
+
if (val instanceof Date) {
|
|
228
|
+
if (isNaN(val.getTime())) return ''
|
|
229
|
+
return formatDateStr(val, effectiveFormat.value)
|
|
230
|
+
}
|
|
231
|
+
return String(val)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 拆分字符串
|
|
235
|
+
const splitValue = (s: string): { date: string; time: string } => {
|
|
236
|
+
if (!s) return { date: '', time: '' }
|
|
237
|
+
const trimmed = s.trim()
|
|
238
|
+
// 支持 "YYYY-MM-DD HH:mm:ss" 或 "YYYY-MM-DDTHH:mm:ss"
|
|
239
|
+
const m = trimmed.match(/^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2}(?::\d{2})?)/)
|
|
240
|
+
if (m) {
|
|
241
|
+
return { date: m[1], time: m[2] }
|
|
242
|
+
}
|
|
243
|
+
// 仅日期
|
|
244
|
+
const dm = trimmed.match(/^(\d{4}-\d{2}-\d{2})$/)
|
|
245
|
+
if (dm) return { date: dm[1], time: '' }
|
|
246
|
+
// 仅时间
|
|
247
|
+
const tm = trimmed.match(/^(\d{2}:\d{2}(?::\d{2})?)$/)
|
|
248
|
+
if (tm) return { date: '', time: tm[1] }
|
|
249
|
+
return { date: '', time: '' }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const composeValue = (d: string, t: string): string => {
|
|
253
|
+
if (!d) return ''
|
|
254
|
+
if (!t) return d
|
|
255
|
+
let time = t
|
|
256
|
+
const parts = time.split(':')
|
|
257
|
+
if (showSeconds.value && parts.length === 2) {
|
|
258
|
+
time = `${time}:00`
|
|
259
|
+
} else if (!showSeconds.value && parts.length === 3) {
|
|
260
|
+
time = `${parts[0]}:${parts[1]}`
|
|
261
|
+
}
|
|
262
|
+
const date = new Date(`${d}T${time}`)
|
|
263
|
+
if (isNaN(date.getTime())) return `${d} ${time}`
|
|
264
|
+
return formatDateStr(date, effectiveFormat.value)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const displayValue = computed(() => {
|
|
268
|
+
return composeValue(datePart.value, timePart.value)
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
// range 单输入框显示值
|
|
272
|
+
const rangeDisplayStart = computed(() => {
|
|
273
|
+
return composeValue(rangeStartDate.value, rangeStartTime.value)
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
const rangeDisplayEnd = computed(() => {
|
|
277
|
+
return composeValue(rangeEndDate.value, rangeEndTime.value)
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
const rangeDisplayValue = computed(() => {
|
|
281
|
+
const s = composeValue(rangeStartDate.value, rangeStartTime.value)
|
|
282
|
+
const e = composeValue(rangeEndDate.value, rangeEndTime.value)
|
|
283
|
+
if (s && e) return `${s} ~ ${e}`
|
|
284
|
+
if (s) return `${s} ~ ...`
|
|
285
|
+
return ''
|
|
286
|
+
})
|
|
287
|
+
const rangePlaceholder = computed(() => {
|
|
288
|
+
const [s, e] = props.rangePlaceholder ?? ['开始日期时间', '结束日期时间']
|
|
289
|
+
return `${s} ~ ${e}`
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
// ============== 日历计算 ==============
|
|
293
|
+
const currentYear = computed(() => calendarCurrentDate.value.getFullYear())
|
|
294
|
+
const currentMonth = computed(() => calendarCurrentDate.value.getMonth())
|
|
295
|
+
|
|
296
|
+
const getDaysInMonth = (year: number, month: number) => new Date(year, month + 1, 0).getDate()
|
|
297
|
+
const getFirstDayOfMonth = (year: number, month: number) => new Date(year, month, 1).getDay()
|
|
298
|
+
|
|
299
|
+
const formatCalendarDate = (year: number, month: number, day: number): string => {
|
|
300
|
+
return `${year}-${pad(month + 1)}-${pad(day)}`
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const calendarDays = computed(() => {
|
|
304
|
+
const year = currentYear.value
|
|
305
|
+
const month = currentMonth.value
|
|
306
|
+
const daysInMonth = getDaysInMonth(year, month)
|
|
307
|
+
const firstDay = getFirstDayOfMonth(year, month)
|
|
308
|
+
|
|
309
|
+
interface CalendarDay {
|
|
310
|
+
day: number
|
|
311
|
+
isCurrentMonth: boolean
|
|
312
|
+
isSelected: boolean
|
|
313
|
+
isToday: boolean
|
|
314
|
+
isDisabled: boolean
|
|
315
|
+
isRangeStart: boolean
|
|
316
|
+
isRangeEnd: boolean
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const days: CalendarDay[] = []
|
|
320
|
+
|
|
321
|
+
// 上月的天数
|
|
322
|
+
const prevMonth = month === 0 ? 11 : month - 1
|
|
323
|
+
const prevYear = month === 0 ? year - 1 : year
|
|
324
|
+
const daysInPrevMonth = getDaysInMonth(prevYear, prevMonth)
|
|
325
|
+
|
|
326
|
+
for (let i = firstDay - 1; i >= 0; i--) {
|
|
327
|
+
const day = daysInPrevMonth - i
|
|
328
|
+
days.push({ day, isCurrentMonth: false, isSelected: false, isToday: false, isDisabled: false, isRangeStart: false, isRangeEnd: false })
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// 当月的天数
|
|
332
|
+
const today = new Date()
|
|
333
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
334
|
+
const dStr = formatCalendarDate(year, month, i)
|
|
335
|
+
const dateObj = new Date(year, month, i)
|
|
336
|
+
|
|
337
|
+
const isSelected = dStr === datePart.value
|
|
338
|
+
|
|
339
|
+
const isToday = dateObj.getFullYear() === today.getFullYear() &&
|
|
340
|
+
dateObj.getMonth() === today.getMonth() &&
|
|
341
|
+
dateObj.getDate() === today.getDate()
|
|
342
|
+
|
|
343
|
+
const isRangeStart = !!(props.range && dStr === rangeStartDate.value)
|
|
344
|
+
const isRangeEnd = !!(props.range && dStr === rangeEndDate.value)
|
|
345
|
+
|
|
346
|
+
// rangeMin/rangeMax 范围禁用 (仅日期部分)
|
|
347
|
+
let isDisabled = false
|
|
348
|
+
if (props.rangeMin) {
|
|
349
|
+
const minDateStr = props.rangeMin.substring(0, 10) // take date part only
|
|
350
|
+
if (dStr < minDateStr) isDisabled = true
|
|
351
|
+
}
|
|
352
|
+
if (props.rangeMax) {
|
|
353
|
+
const maxDateStr = props.rangeMax.substring(0, 10)
|
|
354
|
+
if (dStr > maxDateStr) isDisabled = true
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
days.push({ day: i, isCurrentMonth: true, isSelected, isToday, isDisabled, isRangeStart, isRangeEnd })
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// 下月的天数 (补齐到 42 格 = 6 行 × 7 列)
|
|
361
|
+
const remaining = 42 - days.length
|
|
362
|
+
for (let i = 1; i <= remaining; i++) {
|
|
363
|
+
days.push({ day: i, isCurrentMonth: false, isSelected: false, isToday: false, isDisabled: false, isRangeStart: false, isRangeEnd: false })
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return days
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
// 日历导航
|
|
370
|
+
const prevMonth = () => {
|
|
371
|
+
calendarCurrentDate.value = new Date(currentYear.value, currentMonth.value - 1, 1)
|
|
372
|
+
}
|
|
373
|
+
const nextMonth = () => {
|
|
374
|
+
calendarCurrentDate.value = new Date(currentYear.value, currentMonth.value + 1, 1)
|
|
375
|
+
}
|
|
376
|
+
const prevYear = () => {
|
|
377
|
+
calendarCurrentDate.value = new Date(currentYear.value - 1, currentMonth.value, 1)
|
|
378
|
+
}
|
|
379
|
+
const nextYear = () => {
|
|
380
|
+
calendarCurrentDate.value = new Date(currentYear.value + 1, currentMonth.value, 1)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// 日期选择
|
|
384
|
+
const selectCalendarDate = (day: number, isCurrentMonth: boolean, isDisabled: boolean) => {
|
|
385
|
+
if (!isCurrentMonth || isDisabled || props.disabled) return
|
|
386
|
+
const dStr = formatCalendarDate(currentYear.value, currentMonth.value, day)
|
|
387
|
+
datePart.value = dStr
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// ============== 时间选择 ==============
|
|
391
|
+
const hours = computed(() => {
|
|
392
|
+
const arr: number[] = []
|
|
393
|
+
for (let i = 0; i <= 23; i++) arr.push(i)
|
|
394
|
+
return arr
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
const minutes = computed(() => {
|
|
398
|
+
const arr: number[] = []
|
|
399
|
+
for (let i = 0; i < 60; i++) arr.push(i)
|
|
400
|
+
return arr
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
const seconds = computed(() => {
|
|
404
|
+
const arr: number[] = []
|
|
405
|
+
for (let i = 0; i < 60; i++) arr.push(i)
|
|
406
|
+
return arr
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
const pendingValue = computed(() => {
|
|
410
|
+
if (!datePart.value) return ''
|
|
411
|
+
const h = tempHour.value ?? 0
|
|
412
|
+
const m = tempMinute.value ?? 0
|
|
413
|
+
const s = tempSecond.value ?? 0
|
|
414
|
+
const t = showSeconds.value ? `${pad(h)}:${pad(m)}:${pad(s)}` : `${pad(h)}:${pad(m)}`
|
|
415
|
+
return composeValue(datePart.value, t)
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
const footerSelectionText = computed(() => {
|
|
419
|
+
if (props.range) {
|
|
420
|
+
const step = rangeStartDate.value ? '结束' : '开始'
|
|
421
|
+
return pendingValue.value ? `${step}: ${pendingValue.value}` : `请选择${step}时间`
|
|
422
|
+
}
|
|
423
|
+
return pendingValue.value || displayValue.value || '未选择'
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
const selectHour = (h: number) => {
|
|
427
|
+
tempHour.value = h
|
|
428
|
+
}
|
|
429
|
+
const selectMinute = (m: number) => {
|
|
430
|
+
tempMinute.value = m
|
|
431
|
+
}
|
|
432
|
+
const selectSecond = (s: number) => {
|
|
433
|
+
tempSecond.value = s
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const normalizeTimeString = (time: string): string => {
|
|
437
|
+
const match = time.trim().match(/^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/)
|
|
438
|
+
if (!match) return ''
|
|
439
|
+
const h = Math.min(Math.max(Number.parseInt(match[1], 10) || 0, 0), 23)
|
|
440
|
+
const m = Math.min(Math.max(Number.parseInt(match[2], 10) || 0, 0), 59)
|
|
441
|
+
const s = Math.min(Math.max(Number.parseInt(match[3] ?? '0', 10) || 0, 0), 59)
|
|
442
|
+
return `${pad(h)}:${pad(m)}:${pad(s)}`
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const getEffectiveTime = (): string => {
|
|
446
|
+
if (tempHour.value != null || tempMinute.value != null || tempSecond.value != null) {
|
|
447
|
+
return `${pad(tempHour.value ?? 0)}:${pad(tempMinute.value ?? 0)}:${pad(tempSecond.value ?? 0)}`
|
|
448
|
+
}
|
|
449
|
+
return normalizeTimeString(timePart.value) || '00:00:00'
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const setTempTime = (time: string) => {
|
|
453
|
+
const normalized = normalizeTimeString(time) || '00:00:00'
|
|
454
|
+
const [h, m, s] = normalized.split(':').map((part) => Number.parseInt(part, 10) || 0)
|
|
455
|
+
tempHour.value = h
|
|
456
|
+
tempMinute.value = m
|
|
457
|
+
tempSecond.value = showSeconds.value ? s : 0
|
|
458
|
+
nextTick(() => scrollActiveTimeIntoView())
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const scrollActiveTimeIntoView = () => {
|
|
462
|
+
const panel = document.querySelector('.tf-datetime-picker__time-panel')
|
|
463
|
+
if (!panel) return
|
|
464
|
+
const activeBtn = panel.querySelector('.tf-datetime-picker__time-item.is-active')
|
|
465
|
+
if (activeBtn) {
|
|
466
|
+
activeBtn.scrollIntoView({ block: 'center', behavior: 'smooth' })
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const setCurrentCalendarMonth = (date: string) => {
|
|
471
|
+
const parsed = new Date(`${date}T00:00:00`)
|
|
472
|
+
if (!isNaN(parsed.getTime())) {
|
|
473
|
+
calendarCurrentDate.value = new Date(parsed.getFullYear(), parsed.getMonth(), 1)
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const resolveShortcutValue = (item: DateTimeShortcut): { date: string; time: string } => {
|
|
478
|
+
const raw = typeof item.value === 'function' ? item.value() : item.value
|
|
479
|
+
if (raw instanceof Date) {
|
|
480
|
+
if (isNaN(raw.getTime())) return { date: '', time: '' }
|
|
481
|
+
return { date: formatDateObject(raw), time: formatTimeObject(raw) }
|
|
482
|
+
}
|
|
483
|
+
return splitValue(String(raw))
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
const shortcutClasses = (item: DateTimeShortcut) => {
|
|
487
|
+
const tone = item.tone && /^[a-z0-9_-]+$/i.test(item.tone) ? item.tone : ''
|
|
488
|
+
return [
|
|
489
|
+
'tf-datetime-picker__shortcut',
|
|
490
|
+
tone ? `tf-datetime-picker__shortcut--${tone}` : ''
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const applyShortcut = (group: DateTimeShortcutGroup, item: DateTimeShortcut) => {
|
|
495
|
+
if (props.disabled) return
|
|
496
|
+
const kind: DateTimeShortcutKind = item.kind ?? group.kind
|
|
497
|
+
const { date, time } = resolveShortcutValue(item)
|
|
498
|
+
|
|
499
|
+
if (kind === 'date') {
|
|
500
|
+
if (!date) return
|
|
501
|
+
datePart.value = date
|
|
502
|
+
setCurrentCalendarMonth(date)
|
|
503
|
+
setTempTime(getEffectiveTime())
|
|
504
|
+
return
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (kind === 'time') {
|
|
508
|
+
if (!time) return
|
|
509
|
+
if (!datePart.value) {
|
|
510
|
+
datePart.value = todayString()
|
|
511
|
+
setCurrentCalendarMonth(datePart.value)
|
|
512
|
+
}
|
|
513
|
+
setTempTime(time)
|
|
514
|
+
return
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (!date && !time) return
|
|
518
|
+
const nextDate = date || datePart.value || todayString()
|
|
519
|
+
datePart.value = nextDate
|
|
520
|
+
setCurrentCalendarMonth(nextDate)
|
|
521
|
+
setTempTime(time || getEffectiveTime())
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// ============== 弹窗打开时初始化 ==============
|
|
525
|
+
const initCalendarDate = () => {
|
|
526
|
+
if (datePart.value) {
|
|
527
|
+
const d = new Date(datePart.value)
|
|
528
|
+
if (!isNaN(d.getTime())) {
|
|
529
|
+
calendarCurrentDate.value = new Date(d.getFullYear(), d.getMonth(), 1)
|
|
530
|
+
return
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
calendarCurrentDate.value = new Date()
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const initTime = () => {
|
|
537
|
+
if (timePart.value) {
|
|
538
|
+
const parts = timePart.value.split(':')
|
|
539
|
+
tempHour.value = parseInt(parts[0], 10) || 0
|
|
540
|
+
tempMinute.value = parseInt(parts[1], 10) || 0
|
|
541
|
+
tempSecond.value = parseInt(parts[2], 10) || 0
|
|
542
|
+
} else {
|
|
543
|
+
tempHour.value = 0
|
|
544
|
+
tempMinute.value = 0
|
|
545
|
+
tempSecond.value = 0
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// ============== 初始化 ==============
|
|
550
|
+
const syncFromModelValue = (val: string | Date | null | undefined | string[]) => {
|
|
551
|
+
if (props.range && Array.isArray(val)) {
|
|
552
|
+
const s1 = toStringValue(val[0] as string | Date | null | undefined)
|
|
553
|
+
const { date: d1, time: t1 } = splitValue(s1)
|
|
554
|
+
rangeStartDate.value = d1
|
|
555
|
+
rangeStartTime.value = t1
|
|
556
|
+
const s2 = val.length > 1 ? toStringValue(val[1] as string | Date | null | undefined) : ''
|
|
557
|
+
const { date: d2, time: t2 } = splitValue(s2)
|
|
558
|
+
rangeEndDate.value = d2
|
|
559
|
+
rangeEndTime.value = t2
|
|
560
|
+
} else {
|
|
561
|
+
const s = toStringValue(val as string | Date | null | undefined)
|
|
562
|
+
const { date, time } = splitValue(s)
|
|
563
|
+
datePart.value = date
|
|
564
|
+
timePart.value = time
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
syncFromModelValue(props.modelValue)
|
|
569
|
+
|
|
570
|
+
watch(() => props.modelValue, (val) => {
|
|
571
|
+
if (props.range) {
|
|
572
|
+
if (Array.isArray(val) && val.length === 2) {
|
|
573
|
+
const [start, end] = val
|
|
574
|
+
if (start) {
|
|
575
|
+
const parts = String(start).split(' ')
|
|
576
|
+
rangeStartDate.value = parts[0] ?? ''
|
|
577
|
+
rangeStartTime.value = parts[1] ?? ''
|
|
578
|
+
}
|
|
579
|
+
if (end) {
|
|
580
|
+
const parts = String(end).split(' ')
|
|
581
|
+
rangeEndDate.value = parts[0] ?? ''
|
|
582
|
+
rangeEndTime.value = parts[1] ?? ''
|
|
583
|
+
}
|
|
584
|
+
} else if (!val) {
|
|
585
|
+
rangeStartDate.value = ''
|
|
586
|
+
rangeStartTime.value = ''
|
|
587
|
+
rangeEndDate.value = ''
|
|
588
|
+
rangeEndTime.value = ''
|
|
589
|
+
}
|
|
590
|
+
return
|
|
591
|
+
}
|
|
592
|
+
// 原有单值逻辑不变
|
|
593
|
+
const next = toStringValue(val as string | Date | null | undefined)
|
|
594
|
+
if (next !== displayValue.value) {
|
|
595
|
+
syncFromModelValue(val)
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
|
|
599
|
+
const inputClasses = computed(() => cn(
|
|
600
|
+
inputVariants({ size: props.size, bordered: props.bordered, disabled: props.disabled })
|
|
601
|
+
))
|
|
602
|
+
|
|
603
|
+
const toggleDropdown = () => {
|
|
604
|
+
if (props.disabled) return
|
|
605
|
+
isOpen.value = !isOpen.value
|
|
606
|
+
if (isOpen.value) {
|
|
607
|
+
initCalendarDate()
|
|
608
|
+
initTime()
|
|
609
|
+
emit('open')
|
|
610
|
+
} else {
|
|
611
|
+
emit('close')
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const handleOutsideClick = () => {
|
|
616
|
+
if (isOpen.value) {
|
|
617
|
+
isOpen.value = false
|
|
618
|
+
emit('close')
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// 浮层定位 + 点击外部关闭:统一由 useFloatingPopup 处理
|
|
623
|
+
const { popupStyle, popupRef } = useFloatingPopup({
|
|
624
|
+
anchor: inputWrapperRef,
|
|
625
|
+
open: isOpen,
|
|
626
|
+
placement: 'bottom-start',
|
|
627
|
+
offset: 8,
|
|
628
|
+
matchWidth: false,
|
|
629
|
+
onClickOutside: handleOutsideClick
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
const emitChange = () => {
|
|
633
|
+
if (props.range) {
|
|
634
|
+
const start = rangeDisplayStart.value
|
|
635
|
+
const end = rangeDisplayEnd.value
|
|
636
|
+
if (start && end) {
|
|
637
|
+
emit('update:modelValue', [start, end] as any)
|
|
638
|
+
emit('change', [start, end] as any)
|
|
639
|
+
}
|
|
640
|
+
} else {
|
|
641
|
+
const v = pendingValue.value || displayValue.value
|
|
642
|
+
emit('update:modelValue', v)
|
|
643
|
+
emit('change', v)
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const clear = (e: MouseEvent) => {
|
|
648
|
+
e.stopPropagation()
|
|
649
|
+
if (props.disabled || !props.clearable) return
|
|
650
|
+
if (props.range) {
|
|
651
|
+
rangeStartDate.value = ''
|
|
652
|
+
rangeStartTime.value = ''
|
|
653
|
+
rangeEndDate.value = ''
|
|
654
|
+
rangeEndTime.value = ''
|
|
655
|
+
datePart.value = ''
|
|
656
|
+
timePart.value = ''
|
|
657
|
+
emit('update:modelValue', [] as any)
|
|
658
|
+
emit('change', [] as any)
|
|
659
|
+
} else {
|
|
660
|
+
datePart.value = ''
|
|
661
|
+
timePart.value = ''
|
|
662
|
+
emit('update:modelValue', '')
|
|
663
|
+
emit('change', '')
|
|
664
|
+
}
|
|
665
|
+
emit('clear')
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const applyNow = () => {
|
|
669
|
+
applyShortcut(
|
|
670
|
+
{ title: '组合', kind: 'datetime', items: [] },
|
|
671
|
+
{ label: '此刻', kind: 'datetime', value: () => new Date(), tone: 'primary' }
|
|
672
|
+
)
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const handleFooterClear = (e: MouseEvent) => {
|
|
676
|
+
const wasOpen = isOpen.value
|
|
677
|
+
clear(e)
|
|
678
|
+
if (wasOpen) {
|
|
679
|
+
isOpen.value = false
|
|
680
|
+
emit('close')
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const confirm = () => {
|
|
685
|
+
if (datePart.value) {
|
|
686
|
+
const h = tempHour.value ?? 0
|
|
687
|
+
const m = tempMinute.value ?? 0
|
|
688
|
+
const s = tempSecond.value ?? 0
|
|
689
|
+
timePart.value = showSeconds.value ? `${pad(h)}:${pad(m)}:${pad(s)}` : `${pad(h)}:${pad(m)}`
|
|
690
|
+
emitChange()
|
|
691
|
+
}
|
|
692
|
+
isOpen.value = false
|
|
693
|
+
emit('close')
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// 辅助: datetime 字符串 → 时间戳
|
|
697
|
+
const parseDateTime = (date: string, time: string): number => {
|
|
698
|
+
const dt = `${date}T${time || '00:00:00'}`
|
|
699
|
+
return new Date(dt).getTime()
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const applyRange = () => {
|
|
703
|
+
if (!datePart.value) return
|
|
704
|
+
|
|
705
|
+
// 组装当前选中的时间
|
|
706
|
+
const h = tempHour.value ?? 0
|
|
707
|
+
const m = tempMinute.value ?? 0
|
|
708
|
+
const curTime = showSeconds.value ? `${pad(h)}:${pad(m)}:${pad(tempSecond.value ?? 0)}` : `${pad(h)}:${pad(m)}`
|
|
709
|
+
const dt = `${datePart.value} ${curTime}`
|
|
710
|
+
|
|
711
|
+
// 检查范围约束
|
|
712
|
+
if (props.rangeMin && dt < props.rangeMin) return
|
|
713
|
+
if (props.rangeMax && dt > props.rangeMax) return
|
|
714
|
+
|
|
715
|
+
if (!rangeStartDate.value) {
|
|
716
|
+
rangeStartDate.value = datePart.value
|
|
717
|
+
rangeStartTime.value = curTime
|
|
718
|
+
// 重置供第二次选择
|
|
719
|
+
datePart.value = ''
|
|
720
|
+
timePart.value = ''
|
|
721
|
+
tempHour.value = 0
|
|
722
|
+
tempMinute.value = 0
|
|
723
|
+
tempSecond.value = 0
|
|
724
|
+
initCalendarDate()
|
|
725
|
+
} else {
|
|
726
|
+
rangeEndDate.value = datePart.value
|
|
727
|
+
rangeEndTime.value = curTime
|
|
728
|
+
|
|
729
|
+
// 跨度校验
|
|
730
|
+
const startMs = parseDateTime(rangeStartDate.value, rangeStartTime.value || '00:00:00')
|
|
731
|
+
const endMs = parseDateTime(rangeEndDate.value, rangeEndTime.value || '00:00:00')
|
|
732
|
+
const spanMin = Math.abs(Math.round((endMs - startMs) / 60000))
|
|
733
|
+
|
|
734
|
+
if (props.rangeMinSpan && props.rangeMinSpan > 0 && spanMin < props.rangeMinSpan) {
|
|
735
|
+
rangeEndDate.value = ''
|
|
736
|
+
rangeEndTime.value = ''
|
|
737
|
+
return // 不关闭弹窗
|
|
738
|
+
}
|
|
739
|
+
if (props.rangeMaxSpan && props.rangeMaxSpan > 0 && spanMin > props.rangeMaxSpan) {
|
|
740
|
+
rangeEndDate.value = ''
|
|
741
|
+
rangeEndTime.value = ''
|
|
742
|
+
return
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
const start = `${rangeStartDate.value} ${rangeStartTime.value || '00:00:00'}`
|
|
746
|
+
const end = `${rangeEndDate.value} ${rangeEndTime.value || '00:00:00'}`
|
|
747
|
+
const rangeVal: [string, string] = [start, end]
|
|
748
|
+
emit('update:modelValue', rangeVal as any)
|
|
749
|
+
emit('change', rangeVal as any)
|
|
750
|
+
isOpen.value = false
|
|
751
|
+
emit('close')
|
|
752
|
+
// 重置
|
|
753
|
+
datePart.value = ''
|
|
754
|
+
timePart.value = ''
|
|
755
|
+
rangeStartDate.value = ''
|
|
756
|
+
rangeStartTime.value = ''
|
|
757
|
+
rangeEndDate.value = ''
|
|
758
|
+
rangeEndTime.value = ''
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// ============== AI 增强 (与 date-picker 完全一致的接入方式) ==============
|
|
763
|
+
const aiEnabled = computed(() => !!props.ai)
|
|
764
|
+
const preset = computed(() => props.ai?.preset ?? 'complete')
|
|
765
|
+
|
|
766
|
+
const defaultLabels = computed(() => {
|
|
767
|
+
switch (preset.value) {
|
|
768
|
+
case 'check':
|
|
769
|
+
return { trigger: 'AI 校验时间', retry: '重新校验', confirm: '✓ 应用推荐' }
|
|
770
|
+
case 'anomaly':
|
|
771
|
+
return { trigger: 'AI 检测异常', retry: '再次检测', confirm: '✓ 确认结果' }
|
|
772
|
+
case 'complete':
|
|
773
|
+
default:
|
|
774
|
+
return { trigger: 'AI 智能推荐', retry: '重新推荐', confirm: '✓ 应用时间' }
|
|
775
|
+
}
|
|
776
|
+
})
|
|
777
|
+
|
|
778
|
+
const triggerLabel = computed(() => props.ai?.triggerLabel ?? defaultLabels.value.trigger)
|
|
779
|
+
const retryLabel = computed(() => props.ai?.retryLabel ?? defaultLabels.value.retry)
|
|
780
|
+
const confirmLabel = computed(() => props.ai?.confirmLabel ?? defaultLabels.value.confirm)
|
|
781
|
+
|
|
782
|
+
const ai = useAiStateMachine({
|
|
783
|
+
needConfirm: props.ai?.needConfirm ?? true,
|
|
784
|
+
errorRate: props.ai?.errorRate ?? 0,
|
|
785
|
+
runningDuration: props.ai?.runningDuration ?? 1500,
|
|
786
|
+
autoReset: props.ai?.autoReset ?? 0
|
|
787
|
+
})
|
|
788
|
+
|
|
789
|
+
const aiStateLabels: Record<AiState, string> = {
|
|
790
|
+
idle: '空闲',
|
|
791
|
+
running: 'AI 处理中',
|
|
792
|
+
confirming: '⚠ 等待确认',
|
|
793
|
+
done: '✓ 已完成',
|
|
794
|
+
error: '✗ 失败'
|
|
795
|
+
}
|
|
796
|
+
const aiStateClasses: Record<AiState, string> = {
|
|
797
|
+
idle: 'is-idle',
|
|
798
|
+
running: 'is-running animate-pulse',
|
|
799
|
+
confirming: 'is-confirming',
|
|
800
|
+
done: 'is-done',
|
|
801
|
+
error: 'is-error'
|
|
802
|
+
}
|
|
803
|
+
const aiStateLabel = computed(() => aiStateLabels[ai.state.value])
|
|
804
|
+
const aiStateClass = computed(() => aiStateClasses[ai.state.value])
|
|
805
|
+
|
|
806
|
+
const currentTriggerLabel = computed(() => {
|
|
807
|
+
const s = ai.state.value
|
|
808
|
+
if (s === 'error' || s === 'done') return retryLabel.value
|
|
809
|
+
return triggerLabel.value
|
|
810
|
+
})
|
|
811
|
+
|
|
812
|
+
const defaultApply = (result: any, _current: string | Date | undefined): string | Date | undefined => {
|
|
813
|
+
if (result == null) return _current
|
|
814
|
+
if (result instanceof Date) return result
|
|
815
|
+
if (typeof result === 'string') return result
|
|
816
|
+
if (typeof result === 'object') {
|
|
817
|
+
if (typeof result.value !== 'undefined') return result.value
|
|
818
|
+
if (typeof result.datetime !== 'undefined') return result.datetime
|
|
819
|
+
if (typeof result.date !== 'undefined') return result.date
|
|
820
|
+
}
|
|
821
|
+
return _current
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const applyAndConfirm = () => {
|
|
825
|
+
const result = ai.result.value
|
|
826
|
+
const applyFn = props.ai?.applyResult ?? defaultApply
|
|
827
|
+
const next = applyFn(result, props.modelValue as string | Date | undefined)
|
|
828
|
+
if (next !== undefined) {
|
|
829
|
+
const emitVal = toStringValue(next as string | Date)
|
|
830
|
+
// 同步内部 datePart / timePart
|
|
831
|
+
const { date, time } = splitValue(emitVal)
|
|
832
|
+
datePart.value = date
|
|
833
|
+
timePart.value = time
|
|
834
|
+
emit('update:modelValue', emitVal)
|
|
835
|
+
emit('change', emitVal)
|
|
836
|
+
}
|
|
837
|
+
ai.confirm()
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
const handleTrigger = () => {
|
|
841
|
+
if (typeof props.ai?.onTrigger === 'function') {
|
|
842
|
+
ai.trigger(() => props.ai!.onTrigger(props.modelValue as string | Date | undefined))
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const formatAiHint = (result: any): string => {
|
|
847
|
+
if (result == null) return ''
|
|
848
|
+
if (result instanceof Date) return toStringValue(result)
|
|
849
|
+
if (typeof result === 'object') {
|
|
850
|
+
const dt = typeof result.value !== 'undefined' ? String(result.value)
|
|
851
|
+
: typeof result.datetime !== 'undefined' ? String(result.datetime)
|
|
852
|
+
: typeof result.date !== 'undefined' ? String(result.date) : null
|
|
853
|
+
const label = typeof result.label !== 'undefined' ? String(result.label) : null
|
|
854
|
+
if (dt && label && dt !== label) return `${dt} (${label})`
|
|
855
|
+
if (dt) return dt
|
|
856
|
+
if (label) return label
|
|
857
|
+
}
|
|
858
|
+
return String(result)
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
const calendarDayClasses = (item: {
|
|
862
|
+
isCurrentMonth: boolean
|
|
863
|
+
isSelected: boolean
|
|
864
|
+
isToday: boolean
|
|
865
|
+
isDisabled: boolean
|
|
866
|
+
isRangeStart: boolean
|
|
867
|
+
isRangeEnd: boolean
|
|
868
|
+
}) => [
|
|
869
|
+
'tf-datetime-picker__calendar-day',
|
|
870
|
+
!item.isCurrentMonth ? 'is-outside' : '',
|
|
871
|
+
item.isDisabled ? 'is-disabled' : '',
|
|
872
|
+
item.isSelected && item.isCurrentMonth ? 'is-selected' : '',
|
|
873
|
+
item.isRangeStart && item.isCurrentMonth && !item.isSelected ? 'is-range-boundary' : '',
|
|
874
|
+
item.isRangeEnd && item.isCurrentMonth && !item.isSelected ? 'is-range-boundary' : '',
|
|
875
|
+
item.isToday && !item.isSelected && !item.isRangeStart && !item.isRangeEnd && item.isCurrentMonth ? 'is-today' : ''
|
|
876
|
+
]
|
|
877
|
+
|
|
878
|
+
const timeItemClasses = (active: boolean) => [
|
|
879
|
+
'tf-datetime-picker__time-item',
|
|
880
|
+
active ? 'is-active' : ''
|
|
881
|
+
]
|
|
882
|
+
|
|
883
|
+
watch(
|
|
884
|
+
() => ai.state.value,
|
|
885
|
+
(s) => {
|
|
886
|
+
if (!aiEnabled.value) return
|
|
887
|
+
emit('ai-state-change', s, ai.result.value, ai.error.value)
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
</script>
|
|
891
|
+
|
|
892
|
+
<template>
|
|
893
|
+
<div class="tf-datetime-picker tf-form-control relative inline-block w-full">
|
|
894
|
+
<!-- ============== 输入区域 ============== -->
|
|
895
|
+
<div ref="inputWrapperRef" class="relative" @click="toggleDropdown">
|
|
896
|
+
<!-- 区间模式输入框 -->
|
|
897
|
+
<template v-if="range">
|
|
898
|
+
<input
|
|
899
|
+
type="text"
|
|
900
|
+
readonly
|
|
901
|
+
:class="inputClasses"
|
|
902
|
+
:style="{ fontSize: dateTimePickerFontSizes[props.size] }"
|
|
903
|
+
:value="rangeDisplayValue"
|
|
904
|
+
:placeholder="rangePlaceholder"
|
|
905
|
+
:disabled="disabled"
|
|
906
|
+
/>
|
|
907
|
+
</template>
|
|
908
|
+
<!-- 单日期模式输入框 -->
|
|
909
|
+
<template v-else>
|
|
910
|
+
<slot name="prefix">
|
|
911
|
+
<CalendarDays class="tf-datetime-picker__input-icon" aria-hidden="true" />
|
|
912
|
+
</slot>
|
|
913
|
+
<input
|
|
914
|
+
type="text"
|
|
915
|
+
readonly
|
|
916
|
+
:class="inputClasses"
|
|
917
|
+
:style="{ fontSize: dateTimePickerFontSizes[props.size] }"
|
|
918
|
+
:value="displayValue"
|
|
919
|
+
:placeholder="placeholder || `请选择日期时间 (${effectiveFormat})`"
|
|
920
|
+
:disabled="disabled"
|
|
921
|
+
/>
|
|
922
|
+
<button
|
|
923
|
+
v-if="clearable && displayValue && !disabled"
|
|
924
|
+
type="button"
|
|
925
|
+
class="tf-datetime-picker__clear"
|
|
926
|
+
@click="clear"
|
|
927
|
+
>
|
|
928
|
+
<slot name="clearIcon">
|
|
929
|
+
<X class="tf-datetime-picker__clear-icon" aria-hidden="true" />
|
|
930
|
+
</slot>
|
|
931
|
+
</button>
|
|
932
|
+
</template>
|
|
933
|
+
<!-- 区间模式清除按钮 -->
|
|
934
|
+
<button
|
|
935
|
+
v-if="range && clearable && rangeDisplayValue && !disabled"
|
|
936
|
+
type="button"
|
|
937
|
+
class="tf-datetime-picker__clear is-range"
|
|
938
|
+
@click="clear"
|
|
939
|
+
>
|
|
940
|
+
<slot name="clearIcon">
|
|
941
|
+
<X class="tf-datetime-picker__clear-icon is-small" aria-hidden="true" />
|
|
942
|
+
</slot>
|
|
943
|
+
</button>
|
|
944
|
+
</div>
|
|
945
|
+
|
|
946
|
+
<!-- AI 状态行 -->
|
|
947
|
+
<div
|
|
948
|
+
v-if="aiEnabled"
|
|
949
|
+
class="tf-datetime-picker__ai-bar flex items-center gap-2 mt-1.5 text-[10px] h-5"
|
|
950
|
+
>
|
|
951
|
+
<div class="flex items-center gap-2 min-w-0 flex-1 overflow-hidden h-5">
|
|
952
|
+
<slot name="aiPrefix" />
|
|
953
|
+
<span
|
|
954
|
+
:class="cn('px-2 py-0.5 rounded-full font-medium whitespace-nowrap shrink-0 inline-flex items-center leading-none h-5', aiStateClass)"
|
|
955
|
+
>
|
|
956
|
+
{{ aiStateLabel }}
|
|
957
|
+
</span>
|
|
958
|
+
<span
|
|
959
|
+
v-if="ai.state.value === 'error' && ai.error.value"
|
|
960
|
+
class="tf-datetime-picker__ai-error truncate min-w-0"
|
|
961
|
+
:title="ai.error.value"
|
|
962
|
+
>
|
|
963
|
+
{{ ai.error.value }}
|
|
964
|
+
</span>
|
|
965
|
+
<span
|
|
966
|
+
v-else-if="ai.state.value === 'confirming' && ai.result.value != null"
|
|
967
|
+
class="tf-datetime-picker__ai-hint truncate min-w-0"
|
|
968
|
+
>
|
|
969
|
+
推荐: {{ formatAiHint(ai.result.value) }}
|
|
970
|
+
</span>
|
|
971
|
+
</div>
|
|
972
|
+
<div class="flex items-center gap-1.5 shrink-0 h-5">
|
|
973
|
+
<button
|
|
974
|
+
v-if="ai.state.value === 'idle' || ai.state.value === 'error' || ai.state.value === 'done'"
|
|
975
|
+
type="button"
|
|
976
|
+
:disabled="disabled"
|
|
977
|
+
class="tf-datetime-picker__ai-button tf-datetime-picker__ai-button--primary px-2 py-0.5 rounded disabled:opacity-50 disabled:cursor-not-allowed transition inline-flex items-center leading-none h-5"
|
|
978
|
+
@click="handleTrigger"
|
|
979
|
+
>
|
|
980
|
+
{{ currentTriggerLabel }}
|
|
981
|
+
</button>
|
|
982
|
+
<button
|
|
983
|
+
v-else-if="ai.state.value === 'confirming'"
|
|
984
|
+
type="button"
|
|
985
|
+
:disabled="disabled"
|
|
986
|
+
class="tf-datetime-picker__ai-button tf-datetime-picker__ai-button--success px-2 py-0.5 rounded disabled:opacity-50 disabled:cursor-not-allowed transition inline-flex items-center leading-none h-5"
|
|
987
|
+
@click="applyAndConfirm"
|
|
988
|
+
>
|
|
989
|
+
{{ confirmLabel }}
|
|
990
|
+
</button>
|
|
991
|
+
<button
|
|
992
|
+
v-else-if="ai.state.value === 'running'"
|
|
993
|
+
type="button"
|
|
994
|
+
:disabled="disabled"
|
|
995
|
+
class="tf-datetime-picker__ai-button tf-datetime-picker__ai-button--muted px-2 py-0.5 rounded disabled:opacity-50 disabled:cursor-not-allowed transition inline-flex items-center leading-none h-5"
|
|
996
|
+
@click="ai.reset()"
|
|
997
|
+
>
|
|
998
|
+
取消
|
|
999
|
+
</button>
|
|
1000
|
+
</div>
|
|
1001
|
+
</div>
|
|
1002
|
+
|
|
1003
|
+
<!-- ============== 弹层 (单面板: 日历 + 时间 + 确定) ============== -->
|
|
1004
|
+
<Teleport to="body">
|
|
1005
|
+
<Transition name="tf-fade">
|
|
1006
|
+
<div
|
|
1007
|
+
v-if="isOpen"
|
|
1008
|
+
ref="popupRef"
|
|
1009
|
+
:style="popupStyle"
|
|
1010
|
+
class="tf-datetime-picker__dropdown"
|
|
1011
|
+
@click.stop
|
|
1012
|
+
>
|
|
1013
|
+
<section class="tf-datetime-picker__panel" aria-label="日期时间选择">
|
|
1014
|
+
<header class="tf-datetime-picker__header">
|
|
1015
|
+
<div class="tf-datetime-picker__title">
|
|
1016
|
+
{{ currentYear }}年 {{ currentMonth + 1 }}月
|
|
1017
|
+
</div>
|
|
1018
|
+
<div v-if="range" class="tf-datetime-picker__range-step-indicator">
|
|
1019
|
+
{{ rangeStartDate ? '选择结束时间' : '选择开始时间' }}
|
|
1020
|
+
</div>
|
|
1021
|
+
</header>
|
|
1022
|
+
|
|
1023
|
+
<div class="tf-datetime-picker__body">
|
|
1024
|
+
<div class="tf-datetime-picker__calendar" aria-label="日期选择">
|
|
1025
|
+
<div class="tf-datetime-picker__calendar-header">
|
|
1026
|
+
<button type="button" class="tf-datetime-picker__nav-button" aria-label="上一年" @click="prevYear">
|
|
1027
|
+
<ChevronsLeft class="tf-datetime-picker__nav-icon" aria-hidden="true" />
|
|
1028
|
+
</button>
|
|
1029
|
+
<button type="button" class="tf-datetime-picker__nav-button" aria-label="上个月" @click="prevMonth">
|
|
1030
|
+
<ChevronLeft class="tf-datetime-picker__nav-icon" aria-hidden="true" />
|
|
1031
|
+
</button>
|
|
1032
|
+
<span class="tf-datetime-picker__month-label">
|
|
1033
|
+
{{ currentYear }}年 {{ currentMonth + 1 }}月
|
|
1034
|
+
</span>
|
|
1035
|
+
<button type="button" class="tf-datetime-picker__nav-button" aria-label="下个月" @click="nextMonth">
|
|
1036
|
+
<ChevronRight class="tf-datetime-picker__nav-icon" aria-hidden="true" />
|
|
1037
|
+
</button>
|
|
1038
|
+
<button type="button" class="tf-datetime-picker__nav-button" aria-label="下一年" @click="nextYear">
|
|
1039
|
+
<ChevronsRight class="tf-datetime-picker__nav-icon" aria-hidden="true" />
|
|
1040
|
+
</button>
|
|
1041
|
+
</div>
|
|
1042
|
+
|
|
1043
|
+
<div class="tf-datetime-picker__weekdays">
|
|
1044
|
+
<div v-for="wd in weekDays" :key="wd" class="tf-datetime-picker__weekday">
|
|
1045
|
+
{{ wd }}
|
|
1046
|
+
</div>
|
|
1047
|
+
</div>
|
|
1048
|
+
|
|
1049
|
+
<div class="tf-datetime-picker__days">
|
|
1050
|
+
<button
|
|
1051
|
+
v-for="(item, idx) in calendarDays"
|
|
1052
|
+
:key="idx"
|
|
1053
|
+
type="button"
|
|
1054
|
+
:disabled="item.isDisabled"
|
|
1055
|
+
:class="calendarDayClasses(item)"
|
|
1056
|
+
@click="selectCalendarDate(item.day, item.isCurrentMonth, item.isDisabled)"
|
|
1057
|
+
>
|
|
1058
|
+
{{ item.day }}
|
|
1059
|
+
</button>
|
|
1060
|
+
</div>
|
|
1061
|
+
</div>
|
|
1062
|
+
|
|
1063
|
+
<aside class="tf-datetime-picker__time-panel" aria-label="时间选择">
|
|
1064
|
+
<div class="tf-datetime-picker__time-title">时间</div>
|
|
1065
|
+
<div class="tf-datetime-picker__time-columns" :class="showSeconds ? 'has-seconds' : ''">
|
|
1066
|
+
<div class="tf-datetime-picker__time-col" aria-label="小时">
|
|
1067
|
+
<button
|
|
1068
|
+
v-for="h in hours"
|
|
1069
|
+
:key="h"
|
|
1070
|
+
type="button"
|
|
1071
|
+
:class="timeItemClasses(tempHour === h)"
|
|
1072
|
+
@click="selectHour(h)"
|
|
1073
|
+
>
|
|
1074
|
+
{{ pad(h) }}
|
|
1075
|
+
</button>
|
|
1076
|
+
</div>
|
|
1077
|
+
|
|
1078
|
+
<span class="tf-datetime-picker__time-separator">:</span>
|
|
1079
|
+
|
|
1080
|
+
<div class="tf-datetime-picker__time-col" aria-label="分钟">
|
|
1081
|
+
<button
|
|
1082
|
+
v-for="m in minutes"
|
|
1083
|
+
:key="m"
|
|
1084
|
+
type="button"
|
|
1085
|
+
:class="timeItemClasses(tempMinute === m)"
|
|
1086
|
+
@click="selectMinute(m)"
|
|
1087
|
+
>
|
|
1088
|
+
{{ pad(m) }}
|
|
1089
|
+
</button>
|
|
1090
|
+
</div>
|
|
1091
|
+
|
|
1092
|
+
<template v-if="showSeconds">
|
|
1093
|
+
<span class="tf-datetime-picker__time-separator">:</span>
|
|
1094
|
+
<div class="tf-datetime-picker__time-col" aria-label="秒">
|
|
1095
|
+
<button
|
|
1096
|
+
v-for="s in seconds"
|
|
1097
|
+
:key="s"
|
|
1098
|
+
type="button"
|
|
1099
|
+
:class="timeItemClasses(tempSecond === s)"
|
|
1100
|
+
@click="selectSecond(s)"
|
|
1101
|
+
>
|
|
1102
|
+
{{ pad(s) }}
|
|
1103
|
+
</button>
|
|
1104
|
+
</div>
|
|
1105
|
+
</template>
|
|
1106
|
+
</div>
|
|
1107
|
+
</aside>
|
|
1108
|
+
</div>
|
|
1109
|
+
|
|
1110
|
+
<section v-if="normalizedShortcutGroups.length" class="tf-datetime-picker__shortcuts" aria-label="快捷选择">
|
|
1111
|
+
<div
|
|
1112
|
+
v-for="group in normalizedShortcutGroups"
|
|
1113
|
+
:key="`${group.kind}-${group.title}`"
|
|
1114
|
+
class="tf-datetime-picker__shortcut-group"
|
|
1115
|
+
>
|
|
1116
|
+
<div class="tf-datetime-picker__shortcut-title">{{ group.title }}</div>
|
|
1117
|
+
<div class="tf-datetime-picker__shortcut-list">
|
|
1118
|
+
<button
|
|
1119
|
+
v-for="item in group.items"
|
|
1120
|
+
:key="`${group.kind}-${item.label}`"
|
|
1121
|
+
type="button"
|
|
1122
|
+
:class="shortcutClasses(item)"
|
|
1123
|
+
:title="item.description"
|
|
1124
|
+
@click="applyShortcut(group, item)"
|
|
1125
|
+
>
|
|
1126
|
+
{{ item.label }}
|
|
1127
|
+
</button>
|
|
1128
|
+
</div>
|
|
1129
|
+
</div>
|
|
1130
|
+
</section>
|
|
1131
|
+
|
|
1132
|
+
<footer class="tf-datetime-picker__footer">
|
|
1133
|
+
<div class="tf-datetime-picker__selection">
|
|
1134
|
+
<span class="tf-datetime-picker__selection-label">当前选择</span>
|
|
1135
|
+
<span class="tf-datetime-picker__selection-value">{{ footerSelectionText }}</span>
|
|
1136
|
+
</div>
|
|
1137
|
+
<div class="tf-datetime-picker__actions">
|
|
1138
|
+
<button type="button" class="tf-datetime-picker__button" @click="applyNow">此刻</button>
|
|
1139
|
+
<button type="button" class="tf-datetime-picker__button" @click="handleFooterClear">清空</button>
|
|
1140
|
+
<button
|
|
1141
|
+
type="button"
|
|
1142
|
+
class="tf-datetime-picker__button tf-datetime-picker__confirm"
|
|
1143
|
+
@click="range ? applyRange() : confirm()"
|
|
1144
|
+
>
|
|
1145
|
+
确定
|
|
1146
|
+
</button>
|
|
1147
|
+
</div>
|
|
1148
|
+
</footer>
|
|
1149
|
+
</section>
|
|
1150
|
+
</div>
|
|
1151
|
+
</Transition>
|
|
1152
|
+
</Teleport>
|
|
1153
|
+
</div>
|
|
1154
|
+
</template>
|
|
1155
|
+
|
|
1156
|
+
<style>
|
|
1157
|
+
@import '../styles/datetime-picker.css';
|
|
1158
|
+
</style>
|