From 1fbdfaff98454b78319bd06adbf19d8f184579cc Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Thu, 18 Jan 2024 14:04:03 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E2=9C=A8=20feat:=20icon=E6=9C=89h?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=94=B9=E4=B8=BAtsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ivy-design-wc/src/utils/icons.tsx | 182 +++++++++++---------- 1 file changed, 94 insertions(+), 88 deletions(-) diff --git a/packages/ivy-design-wc/src/utils/icons.tsx b/packages/ivy-design-wc/src/utils/icons.tsx index 2c214fe..6299837 100644 --- a/packages/ivy-design-wc/src/utils/icons.tsx +++ b/packages/ivy-design-wc/src/utils/icons.tsx @@ -1,4 +1,3 @@ -import { h } from 'vue' const svgBaseStyle = { width: '1em', height: '1em', lineHeight: '1em' } const svgBaseProp = { xmlns: 'http://www.w3.org/2000/svg', @@ -6,95 +5,102 @@ const svgBaseProp = { class: 'ivy-icon', style: { ...svgBaseStyle } } -export const ArrowRight = (props: Record = {}) => - h( - 'svg', - { - ...svgBaseProp, - class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' - }, - h('path', { - fill: 'currentColor', - d: 'M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z' - }) - ) -export const ArrowLeft = (props: Record = {}) => - h( - 'svg', - { - ...svgBaseProp, - class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' - }, - h('path', { - fill: 'currentColor', - d: 'M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z' - }) - ) -export const Loading = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z' - }) - ) -export const Success = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z' - }) - ) -export const Warning = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z' - }) - ) -export const Error = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z' - }) - ) -export const Info = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z' - }) - ) +export const ArrowRight = (props: Record = {}) => ( + + + +) -export const Star = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'm512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z' - }) - ) +export const ArrowLeft = (props: Record = {}) => ( + + + +) -export const StarFilled = (props: Record = {}) => - h( - 'svg', - { ...svgBaseProp, class: props?.class ? `ivy-icon ${props.class}` : 'ivy-icon' }, - h('path', { - fill: 'currentColor', - d: 'M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z' - }) - ) +export const Loading = (props: Record = {}) => ( + + + +) + +export const Success = (props: Record = {}) => ( + + + +) + +export const Warning = (props: Record = {}) => ( + + + +) + +export const Error = (props: Record = {}) => ( + + + +) + +export const Info = (props: Record = {}) => ( + + + +) + +export const Star = (props: Record = {}) => ( + + + +) + +export const StarFilled = (props: Record = {}) => ( + + + +) export const CaretRight = (props: Record = {}) => { return ( From 5c61206a79cb53a87ca5164f26b5192abeb2c622 Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Thu, 18 Jan 2024 14:04:47 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20MessageBox=20=E7=BB=84=E4=BB=B6=20type=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dialog/index.ce.vue | 6 ++- .../src/components/dialog/index.ts | 8 ++-- .../src/components/message-box/index.ce.vue | 44 ++++++++++++++----- .../src/components/message-box/index.ts | 3 +- 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/packages/ivy-design-wc/src/components/dialog/index.ce.vue b/packages/ivy-design-wc/src/components/dialog/index.ce.vue index 12a5158..66df04c 100644 --- a/packages/ivy-design-wc/src/components/dialog/index.ce.vue +++ b/packages/ivy-design-wc/src/components/dialog/index.ce.vue @@ -70,7 +70,7 @@ watch(
-
+
{{ props.header }}
@@ -130,7 +130,9 @@ watch( border-radius: var(--border-radius, 8px); position: relative; animation: zoomIn 0.3s forwards; - box-shadow: 0 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08); + box-shadow: + 0 12px 32px 4px rgba(0, 0, 0, 0.04), + 0px 8px 20px rgba(0, 0, 0, 0.08); border: 1px solid var(--ivy-border-color, #dcdfe6); } .ivy-modal-header { diff --git a/packages/ivy-design-wc/src/components/dialog/index.ts b/packages/ivy-design-wc/src/components/dialog/index.ts index b5b85d0..c2ff769 100644 --- a/packages/ivy-design-wc/src/components/dialog/index.ts +++ b/packages/ivy-design-wc/src/components/dialog/index.ts @@ -1,12 +1,12 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import indexCeVue from './index.ce.vue' +import Comp from './index.ce.vue' -const Dialog = defineCustomElement(indexCeVue) +const Dialog = defineCustomElement(Comp) const registerComponent = (prefix = 'Ivy') => { - const key = `${prefix}${indexCeVue.name}` - install(key, indexCeVue) + const key = `${prefix}${Comp.name}` + install(key, Comp) } export { Dialog, registerComponent as registerDialogComponent } diff --git a/packages/ivy-design-wc/src/components/message-box/index.ce.vue b/packages/ivy-design-wc/src/components/message-box/index.ce.vue index 4e6311f..12931bc 100644 --- a/packages/ivy-design-wc/src/components/message-box/index.ce.vue +++ b/packages/ivy-design-wc/src/components/message-box/index.ce.vue @@ -1,6 +1,6 @@ - - - - diff --git a/packages/ivy-design-wc/src/components/message/index.ts b/packages/ivy-design-wc/src/components/message/index.ts index 74db119..3ae9332 100644 --- a/packages/ivy-design-wc/src/components/message/index.ts +++ b/packages/ivy-design-wc/src/components/message/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Message = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/message/index.vue b/packages/ivy-design-wc/src/components/message/index.vue new file mode 100644 index 0000000..895a144 --- /dev/null +++ b/packages/ivy-design-wc/src/components/message/index.vue @@ -0,0 +1,191 @@ + + + + + diff --git a/packages/ivy-design-wc/src/components/pagination/index.ts b/packages/ivy-design-wc/src/components/pagination/index.ts index b42be77..638b95a 100644 --- a/packages/ivy-design-wc/src/components/pagination/index.ts +++ b/packages/ivy-design-wc/src/components/pagination/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Pagination = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/pagination/index.ce.vue b/packages/ivy-design-wc/src/components/pagination/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/pagination/index.ce.vue rename to packages/ivy-design-wc/src/components/pagination/index.vue diff --git a/packages/ivy-design-wc/src/components/progress/index.ts b/packages/ivy-design-wc/src/components/progress/index.ts index 5fb037d..795d996 100644 --- a/packages/ivy-design-wc/src/components/progress/index.ts +++ b/packages/ivy-design-wc/src/components/progress/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Progress = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/progress/index.ce.vue b/packages/ivy-design-wc/src/components/progress/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/progress/index.ce.vue rename to packages/ivy-design-wc/src/components/progress/index.vue diff --git a/packages/ivy-design-wc/src/components/radio/group.ce.vue b/packages/ivy-design-wc/src/components/radio/group.vue similarity index 100% rename from packages/ivy-design-wc/src/components/radio/group.ce.vue rename to packages/ivy-design-wc/src/components/radio/group.vue diff --git a/packages/ivy-design-wc/src/components/radio/index.ts b/packages/ivy-design-wc/src/components/radio/index.ts index 776e26c..ab22281 100644 --- a/packages/ivy-design-wc/src/components/radio/index.ts +++ b/packages/ivy-design-wc/src/components/radio/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import groupCeVue from './group.ce.vue' +import comp from './index.vue' +import groupCeVue from './group.vue' const Radio = defineCustomElement(comp) const registerRadioComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/radio/index.ce.vue b/packages/ivy-design-wc/src/components/radio/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/radio/index.ce.vue rename to packages/ivy-design-wc/src/components/radio/index.vue diff --git a/packages/ivy-design-wc/src/components/rate/index.ts b/packages/ivy-design-wc/src/components/rate/index.ts index 51238ee..3f7faf6 100644 --- a/packages/ivy-design-wc/src/components/rate/index.ts +++ b/packages/ivy-design-wc/src/components/rate/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Rate = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/rate/index.ce.vue b/packages/ivy-design-wc/src/components/rate/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/rate/index.ce.vue rename to packages/ivy-design-wc/src/components/rate/index.vue diff --git a/packages/ivy-design-wc/src/components/result/index.ts b/packages/ivy-design-wc/src/components/result/index.ts index 43353e1..cdf5cb0 100644 --- a/packages/ivy-design-wc/src/components/result/index.ts +++ b/packages/ivy-design-wc/src/components/result/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Result = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/result/index.ce.vue b/packages/ivy-design-wc/src/components/result/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/result/index.ce.vue rename to packages/ivy-design-wc/src/components/result/index.vue diff --git a/packages/ivy-design-wc/src/components/scrollbar/index.ts b/packages/ivy-design-wc/src/components/scrollbar/index.ts index b283941..817d3fc 100644 --- a/packages/ivy-design-wc/src/components/scrollbar/index.ts +++ b/packages/ivy-design-wc/src/components/scrollbar/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Scrollbar = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/scrollbar/index.ce.vue b/packages/ivy-design-wc/src/components/scrollbar/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/scrollbar/index.ce.vue rename to packages/ivy-design-wc/src/components/scrollbar/index.vue diff --git a/packages/ivy-design-wc/src/components/select/index.ts b/packages/ivy-design-wc/src/components/select/index.ts index 41e874b..1599768 100644 --- a/packages/ivy-design-wc/src/components/select/index.ts +++ b/packages/ivy-design-wc/src/components/select/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import optionCeVue from './option.ce.vue' +import comp from './index.vue' +import optionCeVue from './option.vue' const Select = defineCustomElement(comp) const registerSelectComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/select/index.ce.vue b/packages/ivy-design-wc/src/components/select/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/select/index.ce.vue rename to packages/ivy-design-wc/src/components/select/index.vue diff --git a/packages/ivy-design-wc/src/components/select/option.ce.vue b/packages/ivy-design-wc/src/components/select/option.vue similarity index 100% rename from packages/ivy-design-wc/src/components/select/option.ce.vue rename to packages/ivy-design-wc/src/components/select/option.vue diff --git a/packages/ivy-design-wc/src/components/space/index.ts b/packages/ivy-design-wc/src/components/space/index.ts index 838181c..e7582f0 100644 --- a/packages/ivy-design-wc/src/components/space/index.ts +++ b/packages/ivy-design-wc/src/components/space/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Space = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/space/index.ce.vue b/packages/ivy-design-wc/src/components/space/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/space/index.ce.vue rename to packages/ivy-design-wc/src/components/space/index.vue diff --git a/packages/ivy-design-wc/src/components/split/index.ts b/packages/ivy-design-wc/src/components/split/index.ts index f7b62c7..eb4b939 100644 --- a/packages/ivy-design-wc/src/components/split/index.ts +++ b/packages/ivy-design-wc/src/components/split/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Split = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/split/index.ce.vue b/packages/ivy-design-wc/src/components/split/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/split/index.ce.vue rename to packages/ivy-design-wc/src/components/split/index.vue diff --git a/packages/ivy-design-wc/src/components/steps/index.ts b/packages/ivy-design-wc/src/components/steps/index.ts index 949fcc3..2e1c944 100644 --- a/packages/ivy-design-wc/src/components/steps/index.ts +++ b/packages/ivy-design-wc/src/components/steps/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import stepCeVue from './step.ce.vue' +import comp from './index.vue' +import stepCeVue from './step.vue' const Steps = defineCustomElement(comp) const registerStepsComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/steps/index.ce.vue b/packages/ivy-design-wc/src/components/steps/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/steps/index.ce.vue rename to packages/ivy-design-wc/src/components/steps/index.vue diff --git a/packages/ivy-design-wc/src/components/steps/step.ce.vue b/packages/ivy-design-wc/src/components/steps/step.vue similarity index 100% rename from packages/ivy-design-wc/src/components/steps/step.ce.vue rename to packages/ivy-design-wc/src/components/steps/step.vue diff --git a/packages/ivy-design-wc/src/components/switch/index.ts b/packages/ivy-design-wc/src/components/switch/index.ts index d5fcaf7..dfdfa94 100644 --- a/packages/ivy-design-wc/src/components/switch/index.ts +++ b/packages/ivy-design-wc/src/components/switch/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Switch = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/switch/index.ce.vue b/packages/ivy-design-wc/src/components/switch/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/switch/index.ce.vue rename to packages/ivy-design-wc/src/components/switch/index.vue diff --git a/packages/ivy-design-wc/src/components/table/column.ce.vue b/packages/ivy-design-wc/src/components/table/column.vue similarity index 100% rename from packages/ivy-design-wc/src/components/table/column.ce.vue rename to packages/ivy-design-wc/src/components/table/column.vue diff --git a/packages/ivy-design-wc/src/components/table/index.ts b/packages/ivy-design-wc/src/components/table/index.ts index 6f17f25..85aacc6 100644 --- a/packages/ivy-design-wc/src/components/table/index.ts +++ b/packages/ivy-design-wc/src/components/table/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import columnCeVue from './column.ce.vue' +import comp from './index.vue' +import columnCeVue from './column.vue' const Table = defineCustomElement(comp) const registerTableComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/table/index.ce.vue b/packages/ivy-design-wc/src/components/table/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/table/index.ce.vue rename to packages/ivy-design-wc/src/components/table/index.vue diff --git a/packages/ivy-design-wc/src/components/tabs/index.ts b/packages/ivy-design-wc/src/components/tabs/index.ts index af16870..b74d2cd 100644 --- a/packages/ivy-design-wc/src/components/tabs/index.ts +++ b/packages/ivy-design-wc/src/components/tabs/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import paneCeVue from './pane.ce.vue' +import comp from './index.vue' +import paneCeVue from './pane.vue' const Tabs = defineCustomElement(comp) const registerTabsComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/tabs/index.ce.vue b/packages/ivy-design-wc/src/components/tabs/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tabs/index.ce.vue rename to packages/ivy-design-wc/src/components/tabs/index.vue diff --git a/packages/ivy-design-wc/src/components/tabs/pane.ce.vue b/packages/ivy-design-wc/src/components/tabs/pane.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tabs/pane.ce.vue rename to packages/ivy-design-wc/src/components/tabs/pane.vue diff --git a/packages/ivy-design-wc/src/components/tag/index.ts b/packages/ivy-design-wc/src/components/tag/index.ts index 1f50f39..043fdbb 100644 --- a/packages/ivy-design-wc/src/components/tag/index.ts +++ b/packages/ivy-design-wc/src/components/tag/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Tag = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/tag/index.ce.vue b/packages/ivy-design-wc/src/components/tag/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tag/index.ce.vue rename to packages/ivy-design-wc/src/components/tag/index.vue diff --git a/packages/ivy-design-wc/src/components/text/index.ts b/packages/ivy-design-wc/src/components/text/index.ts index 42a4aea..8e5027d 100644 --- a/packages/ivy-design-wc/src/components/text/index.ts +++ b/packages/ivy-design-wc/src/components/text/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Text = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/text/index.ce.vue b/packages/ivy-design-wc/src/components/text/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/text/index.ce.vue rename to packages/ivy-design-wc/src/components/text/index.vue diff --git a/packages/ivy-design-wc/src/components/timeline/index.ts b/packages/ivy-design-wc/src/components/timeline/index.ts index bc10f13..7dca14c 100644 --- a/packages/ivy-design-wc/src/components/timeline/index.ts +++ b/packages/ivy-design-wc/src/components/timeline/index.ts @@ -1,7 +1,7 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' -import itemCeVue from './item.ce.vue' +import comp from './index.vue' +import itemCeVue from './item.vue' const Timeline = defineCustomElement(comp) const registerTimelineComponent = (prefix = 'Ivy') => { diff --git a/packages/ivy-design-wc/src/components/timeline/index.ce.vue b/packages/ivy-design-wc/src/components/timeline/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/timeline/index.ce.vue rename to packages/ivy-design-wc/src/components/timeline/index.vue diff --git a/packages/ivy-design-wc/src/components/timeline/item.ce.vue b/packages/ivy-design-wc/src/components/timeline/item.vue similarity index 100% rename from packages/ivy-design-wc/src/components/timeline/item.ce.vue rename to packages/ivy-design-wc/src/components/timeline/item.vue diff --git a/packages/ivy-design-wc/src/components/tip/index.ts b/packages/ivy-design-wc/src/components/tip/index.ts index cb5d3ca..e5e2484 100644 --- a/packages/ivy-design-wc/src/components/tip/index.ts +++ b/packages/ivy-design-wc/src/components/tip/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Tip = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/tip/index.ce.vue b/packages/ivy-design-wc/src/components/tip/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tip/index.ce.vue rename to packages/ivy-design-wc/src/components/tip/index.vue diff --git a/packages/ivy-design-wc/src/components/tooltip/index.ts b/packages/ivy-design-wc/src/components/tooltip/index.ts index 80694c7..cdb86c1 100644 --- a/packages/ivy-design-wc/src/components/tooltip/index.ts +++ b/packages/ivy-design-wc/src/components/tooltip/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Tooltip = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/tooltip/index.ce.vue b/packages/ivy-design-wc/src/components/tooltip/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tooltip/index.ce.vue rename to packages/ivy-design-wc/src/components/tooltip/index.vue diff --git a/packages/ivy-design-wc/src/components/tree/index.ts b/packages/ivy-design-wc/src/components/tree/index.ts index 758650a..37548d4 100644 --- a/packages/ivy-design-wc/src/components/tree/index.ts +++ b/packages/ivy-design-wc/src/components/tree/index.ts @@ -1,6 +1,6 @@ import { defineCustomElement } from 'vue' import { install } from '@/utils/index' -import comp from './index.ce.vue' +import comp from './index.vue' const Tree = defineCustomElement(comp) diff --git a/packages/ivy-design-wc/src/components/tree/index.ce.vue b/packages/ivy-design-wc/src/components/tree/index.vue similarity index 100% rename from packages/ivy-design-wc/src/components/tree/index.ce.vue rename to packages/ivy-design-wc/src/components/tree/index.vue diff --git a/packages/ivy-design-wc/src/utils/utils.ts b/packages/ivy-design-wc/src/utils/utils.ts index 060a581..3f62556 100644 --- a/packages/ivy-design-wc/src/utils/utils.ts +++ b/packages/ivy-design-wc/src/utils/utils.ts @@ -1,5 +1,21 @@ import { ref } from 'vue' +export const getType = (val: T): string => { + return Object.prototype.toString.call(val).slice(8, -1).toLowerCase() +} + +export const isArray = (val: T): boolean => { + if ('isArray' in Array) { + return Array.isArray(val) + } else { + return getType(val) === 'array' + } +} + +export const isFunction = (val: T): boolean => { + return getType(val) === 'function' +} + export interface MessageConfig { content?: string duration?: number @@ -11,9 +27,9 @@ const curMessageIndex = ref(0) const createMessage = (Message: CustomElementConstructor) => { const parseMessageConfig = (config: MessageConfig | string): MessageConfig => { let conf: MessageConfig = {} - const type = Object.prototype.toString.call(config).slice(8, -1) + const type = getType(config) - if (type === 'Object') { + if (type === 'object') { conf = { ...(config as MessageConfig) } } else { conf = { @@ -42,6 +58,7 @@ const createMessage = (Message: CustomElementConstructor) => { instance.setAttribute('content', conf.content || '') ;(parent as any).appendChild(instance) instance.setAttribute('content', conf.content) + instance.open() return instance } @@ -68,23 +85,7 @@ const createMessage = (Message: CustomElementConstructor) => { const curNotificationIndex = ref(0) -const getType = (val: T): string => { - return Object.prototype.toString.call(val).slice(8, -1).toLowerCase() -} - -const isArray = (val: T): boolean => { - if ('isArray' in Array) { - return Array.isArray(val) - } else { - return getType(val) === 'array' - } -} - -const isFunction = (val: T): boolean => { - return getType(val) === 'function' -} - -export { createMessage, curMessageIndex, curNotificationIndex, getType, isArray, isFunction } +export { createMessage, curMessageIndex, curNotificationIndex } export default { createMessage, curMessageIndex, diff --git a/packages/ivy-design-wc/vite.config.ts b/packages/ivy-design-wc/vite.config.ts index 8a2d1f9..ff181e7 100644 --- a/packages/ivy-design-wc/vite.config.ts +++ b/packages/ivy-design-wc/vite.config.ts @@ -27,7 +27,8 @@ export default defineConfig({ compilerOptions: { isCustomElement: (tag) => tag.startsWith('ivy-') } - } + }, + customElement: true }), vueJsx(), dts({ From 99dd15664570198a6c70cf594bec1199861123ba Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Thu, 18 Jan 2024 16:33:59 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=A7=AA=20test:=20utils=E4=B8=8B?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- .../ivy-design-wc/test/utils/index.test.ts | 23 +++++++ .../ivy-design-wc/test/utils/utils.test.ts | 66 +++++++++++++++++++ packages/ivy-design-wc/vitest.config.ts | 22 +++---- 4 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 packages/ivy-design-wc/test/utils/index.test.ts create mode 100644 packages/ivy-design-wc/test/utils/utils.test.ts diff --git a/package.json b/package.json index 9421dd9..dc89cd2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "dev": "run-p docs:dev dev:comp", + "dev": "run-p dev:comp docs:dev", "docs:dev": "pnpm --filter docs run dev", "docs:build": "pnpm --filter docs run build", "docs:preview": "pnpm --filter docs run preview", @@ -17,7 +17,8 @@ "lint": "pnpm --filter @ivy-design/ce run lint", "format": "pnpm --filter @ivy-design/ce run format", "publish": "pnpm --filter @ivy-design/ce publish --access public --no-git-checks --registry https://registry.npmjs.org/", - "publish:preview": "pnpm --filter @ivy-design/ce publish --access public --dry-run --no-git-checks --registry https://registry.npmjs.org/" + "publish:preview": "pnpm --filter @ivy-design/ce publish --access public --dry-run --no-git-checks --registry https://registry.npmjs.org/", + "npm": "run-s build-only publish" }, "keywords": [ "front-end", diff --git a/packages/ivy-design-wc/test/utils/index.test.ts b/packages/ivy-design-wc/test/utils/index.test.ts new file mode 100644 index 0000000..ff1a654 --- /dev/null +++ b/packages/ivy-design-wc/test/utils/index.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, test } from 'vitest' + +import { hasOwn } from '@/utils/index' + +describe('utils/index.ts', () => { + test('hasOwn success', () => { + expect(hasOwn({ a: 1 }, 'a')).toEqual(true) + }) + test('hasOwn fail', () => { + expect(hasOwn({ a: 1 }, 'b')).toEqual(false) + }) + + test('hasOwn success', () => { + function Person() { + this.a = 1 + this.b = 2 + } + Person.prototype.c = 3 + const target = new Person() + + expect(hasOwn(target, 'c')).toEqual(false) + }) +}) diff --git a/packages/ivy-design-wc/test/utils/utils.test.ts b/packages/ivy-design-wc/test/utils/utils.test.ts new file mode 100644 index 0000000..f52133f --- /dev/null +++ b/packages/ivy-design-wc/test/utils/utils.test.ts @@ -0,0 +1,66 @@ +import { describe, expect, test } from 'vitest' + +import { getType } from '@/utils/utils' + +describe('utils/utils.ts', () => { + test('type number success', () => { + expect(getType(123)).toEqual('number') + }) + test('NaN is number', () => { + expect(getType(NaN)).toEqual('number') + }) + test('type string success', () => { + expect(getType(123)).toEqual('number') + }) + test('type boolean success', () => { + expect(getType(123)).toEqual('number') + }) + test('type object success', () => { + expect(getType({})).toEqual('object') + }) + test('type array success', () => { + expect(getType([])).toEqual('array') + }) + test('type function success', () => { + expect(getType(() => {})).toEqual('function') + }) + test('type null success', () => { + expect(getType(null)).toEqual('null') + }) + test('type undefined success', () => { + expect(getType(undefined)).toEqual('undefined') + }) + test('type symbol success', () => { + expect(getType(Symbol())).toEqual('symbol') + }) + test('type bigint success', () => { + expect(getType(BigInt(123))).toEqual('bigint') + }) + test('type date success', () => { + expect(getType(new Date())).toEqual('date') + }) + test('type regexp success', () => { + expect(getType(new RegExp(''))).toEqual('regexp') + }) + test('type error success', () => { + expect(getType(new Error())).toEqual('error') + }) + test('type math success', () => { + expect(getType(Math)).toEqual('math') + }) + test('type json success', () => { + expect(getType(JSON)).toEqual('json') + }) + test('type map success', () => { + expect(getType(new Map())).toEqual('map') + }) + test('type set success', () => { + expect(getType(new Set())).toEqual('set') + }) + test('type weakmap success', () => { + expect(getType(new WeakMap())).toEqual('weakmap') + }) + test('type weakset success', () => { + expect(getType(new WeakSet())).toEqual('weakset') + }) +}) diff --git a/packages/ivy-design-wc/vitest.config.ts b/packages/ivy-design-wc/vitest.config.ts index 36c6643..80caa59 100644 --- a/packages/ivy-design-wc/vitest.config.ts +++ b/packages/ivy-design-wc/vitest.config.ts @@ -4,15 +4,15 @@ import { configDefaults, defineConfig } from 'vitest/config' import viteConfig from './vite.config' export default mergeConfig( - viteConfig, - defineConfig({ - test: { - environment: 'jsdom', - exclude: [...configDefaults.exclude, 'e2e/*'], - root: fileURLToPath(new URL('./', import.meta.url)), - transformMode: { - web: [/\.[jt]sx$/] - } - } - }) + viteConfig, + defineConfig({ + test: { + environment: 'jsdom', + exclude: [...configDefaults.exclude, 'e2e/*'], + root: fileURLToPath(new URL('./', import.meta.url)), + testTransformMode: { + web: ['\\.[jt]sx$'] + } + } + }) as never ) From ba349ae68bd7acdbeb18024bda986f3e6f8e769d Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Fri, 19 Jan 2024 17:21:50 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=90=9E=20fix(types):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dts=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/select/index.vue | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/ivy-design-wc/src/components/select/index.vue b/packages/ivy-design-wc/src/components/select/index.vue index 55acef7..99c01ed 100644 --- a/packages/ivy-design-wc/src/components/select/index.vue +++ b/packages/ivy-design-wc/src/components/select/index.vue @@ -31,7 +31,7 @@ const emit = defineEmits(['change', 'update:value']) const dropEl = ref(null) -const value = ref(null) +const curValue = ref(null) const inputEl = ref(null) const handlerClick = (e: MouseEvent) => { @@ -39,21 +39,21 @@ const handlerClick = (e: MouseEvent) => { const tagName = target.nodeName.toLowerCase() if (tagName === 'ivy-option') { const optionValue = target.getAttribute('value') - if (optionValue !== value.value) { - value.value = optionValue - emit('change', value.value) + if (optionValue !== curValue.value) { + curValue.value = optionValue + emit('change', curValue.value) ;(inputEl.value as HTMLElement).setAttribute('value', target.label) - getHostElement().setAttribute('value', value.value as string) + getHostElement().setAttribute('value', curValue.value as string) } } - visible.value = false + curVisible.value = false } -const visible = ref(false) +const curVisible = ref(false) const handlerInputClick = () => { if (!props.disabled) { - if (!visible.value) { - visible.value = true + if (!curVisible.value) { + curVisible.value = true } } } @@ -64,16 +64,16 @@ const handlerHideDrop = (e: MouseEvent) => { const isContains = hostElement.contains(target) if (!isContains) { - visible.value = false + curVisible.value = false } } const handlerScroll = () => { - visible.value = false + curVisible.value = false } onMounted(() => { - value.value = props.value + curValue.value = props.value nextTick(() => { const children = getHostElement().children @@ -82,7 +82,7 @@ onMounted(() => { if (child.nodeName.toLowerCase() === 'ivy-option') { const optionValue = child.getAttribute('value') - if (optionValue === value.value) { + if (optionValue === curValue.value) { ;(inputEl.value as HTMLElement).setAttribute('value', child.label as string) break } From caaa280558e23af47a3529bdbee02b2f03e0b376 Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Fri, 19 Jan 2024 17:36:42 +0800 Subject: [PATCH 07/11] wip: timeSelect --- .markdownlint.json | 5 +- .../docs/src/.vitepress/config/sidebar.js | 4 + packages/docs/src/components/time-select.md | 13 + packages/ivy-design-wc/package.json | 1 + .../src/components/time-select/index.ts | 13 + .../src/components/time-select/src/index.vue | 241 ++++++++++++++++++ packages/ivy-design-wc/src/hooks/usePopper.ts | 98 +++---- packages/ivy-design-wc/src/index.ts | 5 +- pnpm-lock.yaml | 7 + 9 files changed, 336 insertions(+), 51 deletions(-) create mode 100644 packages/docs/src/components/time-select.md create mode 100644 packages/ivy-design-wc/src/components/time-select/index.ts create mode 100644 packages/ivy-design-wc/src/components/time-select/src/index.vue diff --git a/.markdownlint.json b/.markdownlint.json index 1a06b57..f6c801e 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -46,7 +46,10 @@ "ivy-link", "ivy-tag", "ivy-text", - "ivy-affix" + "ivy-affix", + "ivy-time-select", + "ivy-date-picker", + "ivy-time-picker" ] } } diff --git a/packages/docs/src/.vitepress/config/sidebar.js b/packages/docs/src/.vitepress/config/sidebar.js index ff1956e..2234746 100644 --- a/packages/docs/src/.vitepress/config/sidebar.js +++ b/packages/docs/src/.vitepress/config/sidebar.js @@ -102,6 +102,10 @@ const components = [ text: "Switch 开关", link: "/components/switch", }, + { + text: "TimeSelect 时间选择", + link: "/components/time-select", + }, ], }, { diff --git a/packages/docs/src/components/time-select.md b/packages/docs/src/components/time-select.md new file mode 100644 index 0000000..a94201b --- /dev/null +++ b/packages/docs/src/components/time-select.md @@ -0,0 +1,13 @@ +# TimeSelect 时间选择 + +用于选择或输入日期 + +可用时间范围是 00:00-23:59 + +## 固定时间点 + +提供几个固定的时间点供用户选择 + +使用 el-time-select 标签,然后通过 start、end 和 step 指定起始时间,结束时间和步长。 + + diff --git a/packages/ivy-design-wc/package.json b/packages/ivy-design-wc/package.json index 7910d94..4c87c18 100644 --- a/packages/ivy-design-wc/package.json +++ b/packages/ivy-design-wc/package.json @@ -53,6 +53,7 @@ }, "dependencies": { "@vueuse/core": "^10.6.1", + "dayjs": "^1.11.10", "vue": "^3.3.8" }, "devDependencies": { diff --git a/packages/ivy-design-wc/src/components/time-select/index.ts b/packages/ivy-design-wc/src/components/time-select/index.ts new file mode 100644 index 0000000..80daaf6 --- /dev/null +++ b/packages/ivy-design-wc/src/components/time-select/index.ts @@ -0,0 +1,13 @@ +import { defineCustomElement } from 'vue' +import { install } from '@/utils' +import comp from './src/index.vue' + +const TimeSelect = defineCustomElement(comp) + +const registerComponent = (prefix = 'Ivy') => { + const key = `${prefix}${comp.name}` + install(key, comp) +} +export { TimeSelect, registerComponent as registerTimeSelectComponent } + +export default registerComponent diff --git a/packages/ivy-design-wc/src/components/time-select/src/index.vue b/packages/ivy-design-wc/src/components/time-select/src/index.vue new file mode 100644 index 0000000..ccb8b65 --- /dev/null +++ b/packages/ivy-design-wc/src/components/time-select/src/index.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/packages/ivy-design-wc/src/hooks/usePopper.ts b/packages/ivy-design-wc/src/hooks/usePopper.ts index 66e5fa8..0c8d1d2 100644 --- a/packages/ivy-design-wc/src/hooks/usePopper.ts +++ b/packages/ivy-design-wc/src/hooks/usePopper.ts @@ -1,56 +1,56 @@ -import { ref, shallowRef } from "vue"; -import { createPopper, type Instance } from "@popperjs/core"; +import { ref, shallowRef } from 'vue' +import { createPopper, type Instance } from '@popperjs/core' export default (conf = {}) => { - const visible = ref(false); - const triggerRef = ref(null); - const targetRef = ref(null); - const arrowRef = ref(null); + const visible = ref(false) + const triggerRef = ref(null) + const targetRef = ref(null) + const arrowRef = ref(null) - const Instance = shallowRef(null); + const Instance = shallowRef(null) - const initPopper = () => { - Instance.value = createPopper( - triggerRef.value as Element, - targetRef.value as HTMLElement, + const initPopper = () => { + Instance.value = createPopper( + triggerRef.value as Element, + targetRef.value as HTMLElement, - { - placement: "bottom", - modifiers: [ - { - name: "offset", - options: { - offset: [0, 8], - }, - }, - { - name: "arrow", - options: { - element: arrowRef.value, - }, - }, - { - name: "computeStyles", - options: { - gpuAcceleration: true, - }, - }, - ], - ...conf, - } - ); - }; + { + placement: 'bottom', + modifiers: [ + { + name: 'offset', + options: { + offset: [0, 8] + } + }, + { + name: 'arrow', + options: { + element: arrowRef.value + } + }, + { + name: 'computeStyles', + options: { + gpuAcceleration: true + } + } + ], + ...conf + } + ) + } - const updatePopper = () => { - Instance.value?.update(); - }; + const updatePopper = () => { + Instance.value?.update() + } - return { - visible, - triggerRef, - targetRef, - arrowRef, - initPopper, - updatePopper, - }; -}; + return { + visible, + triggerRef, + targetRef, + arrowRef, + initPopper, + updatePopper + } +} diff --git a/packages/ivy-design-wc/src/index.ts b/packages/ivy-design-wc/src/index.ts index 8a67af0..d896021 100644 --- a/packages/ivy-design-wc/src/index.ts +++ b/packages/ivy-design-wc/src/index.ts @@ -62,6 +62,7 @@ import { Text } from './components/text/index' import { Affix } from './components/affix/index' import { MessageBox, msgBox } from './components/message-box/index' +import { TimeSelect } from './components/time-select/index' import { createMessage } from './utils/utils' @@ -127,7 +128,8 @@ const comp: Record = { Link, Text, Affix, - MessageBox + MessageBox, + TimeSelect } const registerComponents = async (prefix = 'Ivy') => { @@ -231,5 +233,6 @@ declare module 'vue' { Text: typeof comp.Text Affix: typeof comp.Affix MessageBox: typeof comp.MessageBox + TimeSelect: typeof comp.TimeSelect } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74be1f9..4b47c3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,6 +33,9 @@ importers: '@vueuse/core': specifier: ^10.6.1 version: 10.6.1(vue@3.3.8) + dayjs: + specifier: ^1.11.10 + version: 1.11.10 vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.3.2) @@ -2496,6 +2499,10 @@ packages: whatwg-url: 12.0.1 dev: true + /dayjs@1.11.10: + resolution: {integrity: sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==} + dev: false + /de-indent@1.0.2: resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} dev: true From b578f5d30a38f58000f4b35642804c617114ea36 Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Mon, 22 Jan 2024 10:02:13 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E2=9C=A8=20feat:=20dropdown=E5=92=8Csele?= =?UTF-8?q?ct=E5=A2=9E=E5=8A=A0=E4=B8=8B=E6=8B=89=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dropdown/index.vue | 21 +++++++++++++++-- .../src/components/select/index.vue | 23 ++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/packages/ivy-design-wc/src/components/dropdown/index.vue b/packages/ivy-design-wc/src/components/dropdown/index.vue index eff3bb1..55f3982 100644 --- a/packages/ivy-design-wc/src/components/dropdown/index.vue +++ b/packages/ivy-design-wc/src/components/dropdown/index.vue @@ -67,13 +67,13 @@ onBeforeUnmount(() => {
- + - + diff --git a/packages/ivy-design-wc/src/components/select/index.vue b/packages/ivy-design-wc/src/components/select/index.vue index 99c01ed..5ca3b28 100644 --- a/packages/ivy-design-wc/src/components/select/index.vue +++ b/packages/ivy-design-wc/src/components/select/index.vue @@ -112,8 +112,8 @@ onBeforeUnmount(() => { />
- -
+ +
@@ -121,7 +121,7 @@ onBeforeUnmount(() => {
-
+ From 1146c5c57187897659a59e94ee8852b5e49eab21 Mon Sep 17 00:00:00 2001 From: GuoJikun Date: Mon, 22 Jan 2024 13:57:18 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=A2=9E=E5=8A=A0tim?= =?UTF-8?q?eSelect=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/time-select/src/index.vue | 274 ++++++++++++------ 1 file changed, 189 insertions(+), 85 deletions(-) diff --git a/packages/ivy-design-wc/src/components/time-select/src/index.vue b/packages/ivy-design-wc/src/components/time-select/src/index.vue index ccb8b65..db83be3 100644 --- a/packages/ivy-design-wc/src/components/time-select/src/index.vue +++ b/packages/ivy-design-wc/src/components/time-select/src/index.vue @@ -1,8 +1,9 @@