From 073865d0ffed51980922479f205f84428af4b51e Mon Sep 17 00:00:00 2001 From: pxq <1456889284@qq.com> Date: Thu, 11 Jan 2024 09:56:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/shared/styles/markdown.scss | 4 - app/.vitepress/theme/index.ts | 2 - opendesign/checkbox/index.ts | 13 -- .../checkbox/src/checkbox-group-types.ts | 28 ---- opendesign/checkbox/src/checkbox-group.scss | 7 - opendesign/checkbox/src/checkbox-group.tsx | 28 ---- opendesign/checkbox/src/checkbox-types.ts | 27 ---- opendesign/checkbox/src/checkbox.scss | 49 ------ opendesign/checkbox/src/checkbox.tsx | 102 ------------ opendesign/collapse/OCollapse.vue | 64 -------- opendesign/collapse/OCollapseItem.vue | 16 -- opendesign/collapse/index.ts | 10 -- opendesign/container/index.ts | 8 - opendesign/container/src/container-types.ts | 18 --- opendesign/container/src/container.scss | 31 ---- opendesign/container/src/container.tsx | 17 -- opendesign/container/src/var.scss | 17 -- opendesign/data-picker/ODatePicker.vue | 41 ----- opendesign/data-picker/index.ts | 7 - opendesign/dialog/ODialog.vue | 33 ---- opendesign/dialog/index.ts | 7 - opendesign/drawer/ODrawer.vue | 54 ------- opendesign/drawer/index.ts | 7 - opendesign/index.ts | 46 +----- opendesign/input/OInput.vue | 62 -------- opendesign/input/index.ts | 7 - opendesign/radio/index.ts | 13 -- opendesign/radio/src/radio-group-types.ts | 26 --- opendesign/radio/src/radio-group.scss | 7 - opendesign/radio/src/radio-group.tsx | 28 ---- opendesign/radio/src/radio-types.ts | 22 --- opendesign/radio/src/radio.scss | 72 --------- opendesign/radio/src/radio.tsx | 79 ---------- opendesign/radio/src/var.scss | 6 - opendesign/search/OSearch.vue | 69 -------- opendesign/search/index.ts | 7 - opendesign/switch/OSwitch.vue | 30 ---- opendesign/switch/index.ts | 7 - opendesign/table/OTable.vue | 81 ---------- opendesign/table/OTableColumn.vue | 11 -- opendesign/table/index.ts | 10 -- opendesign/tabs/OTabPane.vue | 11 -- opendesign/tabs/OTabs.vue | 53 ------- opendesign/tabs/index.ts | 11 -- opendesign/time-select/OTimeSelect.vue | 41 ----- opendesign/time-select/index.ts | 7 - opendesign/timeline/index.ts | 8 - opendesign/timeline/src/timeline-types.ts | 18 --- opendesign/timeline/src/timeline.scss | 73 --------- opendesign/timeline/src/timeline.tsx | 148 ------------------ opendesign/timeline/src/var.scss | 22 --- opendesign/tree/OTree.vue | 23 --- opendesign/tree/index.ts | 7 - package.json | 1 - pnpm-lock.yaml | 31 +--- 55 files changed, 2 insertions(+), 1625 deletions(-) delete mode 100644 opendesign/checkbox/index.ts delete mode 100644 opendesign/checkbox/src/checkbox-group-types.ts delete mode 100644 opendesign/checkbox/src/checkbox-group.scss delete mode 100644 opendesign/checkbox/src/checkbox-group.tsx delete mode 100644 opendesign/checkbox/src/checkbox-types.ts delete mode 100644 opendesign/checkbox/src/checkbox.scss delete mode 100644 opendesign/checkbox/src/checkbox.tsx delete mode 100644 opendesign/collapse/OCollapse.vue delete mode 100644 opendesign/collapse/OCollapseItem.vue delete mode 100644 opendesign/collapse/index.ts delete mode 100644 opendesign/container/index.ts delete mode 100644 opendesign/container/src/container-types.ts delete mode 100644 opendesign/container/src/container.scss delete mode 100644 opendesign/container/src/container.tsx delete mode 100644 opendesign/container/src/var.scss delete mode 100644 opendesign/data-picker/ODatePicker.vue delete mode 100644 opendesign/data-picker/index.ts delete mode 100644 opendesign/dialog/ODialog.vue delete mode 100644 opendesign/dialog/index.ts delete mode 100644 opendesign/drawer/ODrawer.vue delete mode 100644 opendesign/drawer/index.ts delete mode 100644 opendesign/input/OInput.vue delete mode 100644 opendesign/input/index.ts delete mode 100644 opendesign/radio/index.ts delete mode 100644 opendesign/radio/src/radio-group-types.ts delete mode 100644 opendesign/radio/src/radio-group.scss delete mode 100644 opendesign/radio/src/radio-group.tsx delete mode 100644 opendesign/radio/src/radio-types.ts delete mode 100644 opendesign/radio/src/radio.scss delete mode 100644 opendesign/radio/src/radio.tsx delete mode 100644 opendesign/radio/src/var.scss delete mode 100644 opendesign/search/OSearch.vue delete mode 100644 opendesign/search/index.ts delete mode 100644 opendesign/switch/OSwitch.vue delete mode 100644 opendesign/switch/index.ts delete mode 100644 opendesign/table/OTable.vue delete mode 100644 opendesign/table/OTableColumn.vue delete mode 100644 opendesign/table/index.ts delete mode 100644 opendesign/tabs/OTabPane.vue delete mode 100644 opendesign/tabs/OTabs.vue delete mode 100644 opendesign/tabs/index.ts delete mode 100644 opendesign/time-select/OTimeSelect.vue delete mode 100644 opendesign/time-select/index.ts delete mode 100644 opendesign/timeline/index.ts delete mode 100644 opendesign/timeline/src/timeline-types.ts delete mode 100644 opendesign/timeline/src/timeline.scss delete mode 100644 opendesign/timeline/src/timeline.tsx delete mode 100644 opendesign/timeline/src/var.scss delete mode 100644 opendesign/tree/OTree.vue delete mode 100644 opendesign/tree/index.ts diff --git a/app/.vitepress/src/shared/styles/markdown.scss b/app/.vitepress/src/shared/styles/markdown.scss index 15892cd7..dc13edb5 100644 --- a/app/.vitepress/src/shared/styles/markdown.scss +++ b/app/.vitepress/src/shared/styles/markdown.scss @@ -187,10 +187,6 @@ width: 100% !important; } } - - a[href^='#'] { - display: none; - } code, pre { text-align: left; diff --git a/app/.vitepress/theme/index.ts b/app/.vitepress/theme/index.ts index 04945129..0fa9d688 100644 --- a/app/.vitepress/theme/index.ts +++ b/app/.vitepress/theme/index.ts @@ -1,5 +1,4 @@ import type { App } from 'vue'; -import { createPinia } from 'pinia'; import '@/shared/styles/element-plus/index.scss'; import '@/shared/styles/index.scss'; @@ -19,7 +18,6 @@ export default { // @ts-ignore global.window = {}; } - app.use(createPinia()); app.use(ElementPlus); app.use(OpenDesign); diff --git a/opendesign/checkbox/index.ts b/opendesign/checkbox/index.ts deleted file mode 100644 index 49923701..00000000 --- a/opendesign/checkbox/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { App } from 'vue'; -import Checkbox from './src/checkbox'; -import CheckboxGroup from './src/checkbox-group'; - -Checkbox.install = function (app: App) { - app.component(Checkbox.name, Checkbox); -}; - -CheckboxGroup.install = function (app: App) { - app.component(CheckboxGroup.name, CheckboxGroup); -}; - -export { Checkbox, CheckboxGroup }; diff --git a/opendesign/checkbox/src/checkbox-group-types.ts b/opendesign/checkbox/src/checkbox-group-types.ts deleted file mode 100644 index 608fe1a1..00000000 --- a/opendesign/checkbox/src/checkbox-group-types.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ExtractDefaultPropTypes, InjectionKey, PropType, Ref } from 'vue'; - -export const checkboxGroupProps = { - // 双向绑定值 - modelValue: { - type: Array as PropType>, - default: null, - }, - // 是否禁用 - disabled: { - type: Boolean, - default: false, - }, -}; - -export type CheckboxGroupProps = ExtractDefaultPropTypes< - typeof checkboxGroupProps ->; - -interface CheckboxGroupInjection { - modelValue: Ref>; - disabled: Ref; - // eslint-disable-next-line no-unused-vars - onChange: (val: Array) => void; -} - -export const checkboxGroupKey: InjectionKey = - Symbol('OCheckboxGroup'); diff --git a/opendesign/checkbox/src/checkbox-group.scss b/opendesign/checkbox/src/checkbox-group.scss deleted file mode 100644 index 4b7bd0f3..00000000 --- a/opendesign/checkbox/src/checkbox-group.scss +++ /dev/null @@ -1,7 +0,0 @@ -.o-checkbox-group { - display: flex; - align-items: center; - .o-checkbox + .o-checkbox { - margin-left: 24px; - } -} diff --git a/opendesign/checkbox/src/checkbox-group.tsx b/opendesign/checkbox/src/checkbox-group.tsx deleted file mode 100644 index 62bd5f34..00000000 --- a/opendesign/checkbox/src/checkbox-group.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { defineComponent, provide, toRefs } from 'vue'; -import { - checkboxGroupKey, - checkboxGroupProps, - CheckboxGroupProps, -} from './checkbox-group-types'; -import './checkbox-group.scss'; - -export default defineComponent({ - name: 'OCheckboxGroup', - props: checkboxGroupProps, - emits: ['update:modelValue', 'change'], - setup(props: CheckboxGroupProps, { emit, slots }) { - const { modelValue, disabled } = toRefs(props); - - const onChange = (val: Array) => { - emit('update:modelValue', val); - emit('change', val); - }; - - // 注入 - provide(checkboxGroupKey, { modelValue, disabled, onChange }); - - return () => { - return
{slots.default?.()}
; - }; - }, -}); diff --git a/opendesign/checkbox/src/checkbox-types.ts b/opendesign/checkbox/src/checkbox-types.ts deleted file mode 100644 index 695189bf..00000000 --- a/opendesign/checkbox/src/checkbox-types.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ExtractDefaultPropTypes, PropType } from 'vue'; - -export const checkboxProps = { - // 双向绑定值 - modelValue: { - type: [String, Number, Boolean] as PropType, - default: null, - }, - // value - value: { - type: [String, Number, Boolean] as PropType, - required: true, - default: null, - }, - // 是否禁用 - disabled: { - type: Boolean, - default: false, - }, - // name - name: { - type: String, - default: '', - }, -}; - -export type CheckboxProps = ExtractDefaultPropTypes; diff --git a/opendesign/checkbox/src/checkbox.scss b/opendesign/checkbox/src/checkbox.scss deleted file mode 100644 index e4fbfd13..00000000 --- a/opendesign/checkbox/src/checkbox.scss +++ /dev/null @@ -1,49 +0,0 @@ -.o-checkbox { - display: inline-flex; - align-items: center; - position: relative; - font-size: var(--o-font-size-text); - line-height: var(--o-line-height-text); - cursor: pointer; - - input[type='checkbox'] { - position: absolute; - outline: none; - z-index: -1; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; - } - - &-icon { - width: 16px; - height: 16px; - border: 1px solid var(--o-color-division1); - display: inline-flex; - justify-content: center; - align-items: center; - color: var(--o-color-white); - // transition: border-color 0.25s cubic-bezier(0.645, 0.045, 0.355, 1), - // background-color 0.25s cubic-bezier(0.645, 0.045, 0.355, 1); - } - - &-label { - margin-left: 8px; - color: var(--o-color-text1); - } - - &:hover { - .o-checkbox-icon { - border-color: var(--o-color-brand1); - } - } - - &.o-checkbox-checked { - .o-checkbox-icon { - background-color: var(--o-color-brand1); - border-color: var(--o-color-brand1); - } - } -} diff --git a/opendesign/checkbox/src/checkbox.tsx b/opendesign/checkbox/src/checkbox.tsx deleted file mode 100644 index 9b69eb12..00000000 --- a/opendesign/checkbox/src/checkbox.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { computed, defineComponent, inject } from 'vue'; -import { checkboxGroupKey } from './checkbox-group-types'; -import { checkboxProps, CheckboxProps } from './checkbox-types'; -import './checkbox.scss'; - -export default defineComponent({ - name: 'OCheckbox', - props: checkboxProps, - emits: ['update:modelValue', 'change'], - setup(props: CheckboxProps, { emit, slots }) { - const checkboxGroupInjection = inject(checkboxGroupKey, null); - - // 是否禁用 - const isDisabled = computed( - () => checkboxGroupInjection?.disabled.value || props.disabled - ); - - // 是否选中 - const isChecked = computed(() => - checkboxGroupInjection - ? checkboxGroupInjection.modelValue.value.includes(props.value) - : props.value === props.modelValue - ); - - const onClick = (e: Event) => { - e.stopPropagation(); - }; - - const onChange = (e: Event) => { - if (isDisabled.value) { - return; - } - const { checked } = e.target as HTMLInputElement; - let newValue; - if (checkboxGroupInjection) { - newValue = [...checkboxGroupInjection.modelValue.value]; - if (checked) { - newValue.push(props.value); - } else { - newValue = newValue.filter((item) => item !== props.value); - } - - checkboxGroupInjection?.onChange(newValue); - } else { - newValue = props.value; - } - - emit('update:modelValue', newValue); - emit('change', newValue); - }; - - const getContent = () => { - if (slots.checkbox) { - return slots.checkbox({ - checked: isChecked.value, - disabled: isDisabled.value, - }); - } else { - return ( - <> - - {isChecked.value ? ( - - - - ) : ( - '' - )} - - {slots.default?.()} - - ); - } - }; - - return () => { - return ( - - ); - }; - }, -}); diff --git a/opendesign/collapse/OCollapse.vue b/opendesign/collapse/OCollapse.vue deleted file mode 100644 index ec3b1ed9..00000000 --- a/opendesign/collapse/OCollapse.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - diff --git a/opendesign/collapse/OCollapseItem.vue b/opendesign/collapse/OCollapseItem.vue deleted file mode 100644 index 263ccfb9..00000000 --- a/opendesign/collapse/OCollapseItem.vue +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/opendesign/collapse/index.ts b/opendesign/collapse/index.ts deleted file mode 100644 index bccdd918..00000000 --- a/opendesign/collapse/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { App } from 'vue'; -import Collapse from './OCollapse.vue'; -import CollapseItem from './OCollapseItem.vue'; -Collapse.install = function (app: App) { - app.component('OCollapse', Collapse); -}; -CollapseItem.install = function (app: App) { - app.component('OCollapseItem', CollapseItem); -}; -export { Collapse, CollapseItem }; diff --git a/opendesign/container/index.ts b/opendesign/container/index.ts deleted file mode 100644 index d4355f5b..00000000 --- a/opendesign/container/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { App } from 'vue'; -import Container from './src/container'; - -Container.install = function (app: App) { - app.component(Container.name, Container); -}; - -export { Container }; diff --git a/opendesign/container/src/container-types.ts b/opendesign/container/src/container-types.ts deleted file mode 100644 index 8f97141f..00000000 --- a/opendesign/container/src/container-types.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ExtractDefaultPropTypes, PropType } from 'vue'; - -type ContainerLevelIndex = 1 | 2 | 3 | 4 | 5; - -export const containerProps = { - // 层级 - levelIndex: { - type: Number as PropType, - default: 2, - }, - // 是否有阴影 - shadow: { - type: Boolean, - default: true, - }, -}; - -export type ContainerProps = ExtractDefaultPropTypes; diff --git a/opendesign/container/src/container.scss b/opendesign/container/src/container.scss deleted file mode 100644 index b6a8bcd5..00000000 --- a/opendesign/container/src/container.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import './var.scss'; - -.o-container { - &-level1 { - background-color: var(--o-container-bg-color-level1); - box-shadow: var(--o-container-shadow-level1); - } - &-level2 { - background-color: var(--o-container-bg-color-level2); - box-shadow: var(--o-container-shadow-level2); - - &:hover { - @media screen and (min-width: 1100px) { - background-color: var(--o-container-bg-color-level2_hover); - box-shadow: var(--o-container-shadow-level2_hover); - } - } - } - &-level3 { - background-color: var(--o-container-bg-color-level3); - box-shadow: var(--o-container-shadow-level3); - } - &-level4 { - background-color: var(--o-container-bg-color-level4); - box-shadow: var(--o-container-shadow-level4); - } - &-level5 { - background-color: var(--o-container-bg-color-level5); - box-shadow: var(--o-container-shadow-level5); - } -} diff --git a/opendesign/container/src/container.tsx b/opendesign/container/src/container.tsx deleted file mode 100644 index bba10b22..00000000 --- a/opendesign/container/src/container.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { defineComponent } from 'vue'; -import { containerProps, ContainerProps } from './container-types'; -import './container.scss'; - -export default defineComponent({ - name: 'OContainer', - props: containerProps, - setup(props: ContainerProps, { slots }) { - return () => { - return ( -
- {slots.default?.()} -
- ); - }; - }, -}); diff --git a/opendesign/container/src/var.scss b/opendesign/container/src/var.scss deleted file mode 100644 index 31dbca79..00000000 --- a/opendesign/container/src/var.scss +++ /dev/null @@ -1,17 +0,0 @@ -.o-container { - // 背景颜色 - --o-container-bg-color-level1: var(--o-color-fill1); - --o-container-bg-color-level2: var(--o-color-fill2); - --o-container-bg-color-level2_hover: var(--o-color-fill2_hover); - --o-container-bg-color-level3: var(--o-color-fill3); - --o-container-bg-color-level4: var(--o-color-fill4); - --o-container-bg-color-level5: var(--o-color-fill5); - - // 阴影 - --o-container-shadow-level1: var(--o-shadow-l1); - --o-container-shadow-level2: var(--o-shadow-l2); - --o-container-shadow-level2_hover: var(--o-shadow-l2_hover); - --o-container-shadow-level3: var(--o-shadow-l3); - --o-container-shadow-level4: var(--o-shadow-l4); - --o-container-shadow-level5: var(--o-shadow-l5); -} diff --git a/opendesign/data-picker/ODatePicker.vue b/opendesign/data-picker/ODatePicker.vue deleted file mode 100644 index 0b63fde2..00000000 --- a/opendesign/data-picker/ODatePicker.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/opendesign/data-picker/index.ts b/opendesign/data-picker/index.ts deleted file mode 100644 index a8990ef6..00000000 --- a/opendesign/data-picker/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import DatePicker from './ODatePicker.vue'; -DatePicker.install = function (app: App) { - app.component('ODatePicker', DatePicker); -}; - -export { DatePicker }; diff --git a/opendesign/dialog/ODialog.vue b/opendesign/dialog/ODialog.vue deleted file mode 100644 index 5b718eca..00000000 --- a/opendesign/dialog/ODialog.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/opendesign/dialog/index.ts b/opendesign/dialog/index.ts deleted file mode 100644 index 7d58df2b..00000000 --- a/opendesign/dialog/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Dialog from './ODialog.vue'; -Dialog.install = function (app: App) { - app.component('ODialog', Dialog); -}; - -export { Dialog }; diff --git a/opendesign/drawer/ODrawer.vue b/opendesign/drawer/ODrawer.vue deleted file mode 100644 index 136ac536..00000000 --- a/opendesign/drawer/ODrawer.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - - - diff --git a/opendesign/drawer/index.ts b/opendesign/drawer/index.ts deleted file mode 100644 index fb09bdd3..00000000 --- a/opendesign/drawer/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Drawer from './ODrawer.vue'; - -Drawer.install = function (app: App) { - app.component('ODrawer', Drawer); -}; -export { Drawer }; diff --git a/opendesign/index.ts b/opendesign/index.ts index f78abbc7..328ba900 100644 --- a/opendesign/index.ts +++ b/opendesign/index.ts @@ -3,57 +3,13 @@ import type { App } from 'vue'; import './style/variable.scss'; import { Button } from './button'; -import { Radio, RadioGroup } from './radio'; -import { Checkbox, CheckboxGroup } from './checkbox'; import { Select, Option } from './select'; -import { DatePicker } from './data-picker'; -import { TimeSelect } from './time-select'; - import { Icon } from './icon'; import { Card } from './card'; -import { Dialog } from './dialog'; import { Tag } from './tag'; -import { Tabs, TabPane } from './tabs'; -import { Input } from './input'; -import { Tree } from './tree'; import { Pagination } from './pagination'; -import { Table, TableColumn } from './table'; -import { Timeline } from './timeline'; -import { Search } from './search'; -import { Drawer } from './drawer'; -import { Switch } from './switch'; -import { Collapse, CollapseItem } from './collapse'; -import { Container } from './container'; -const components = [ - Button, - Radio, - RadioGroup, - Checkbox, - CheckboxGroup, - Select, - Option, - DatePicker, - TimeSelect, - Icon, - Card, - Dialog, - Pagination, - Table, - TableColumn, - Tag, - Timeline, - Input, - Tabs, - TabPane, - Tree, - Search, - Drawer, - Switch, - Collapse, - CollapseItem, - Container, -]; +const components = [Button, Select, Option, Icon, Card, Pagination, Tag]; export default { install(app: App): void { components.forEach((component) => { diff --git a/opendesign/input/OInput.vue b/opendesign/input/OInput.vue deleted file mode 100644 index f4fa7015..00000000 --- a/opendesign/input/OInput.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - - diff --git a/opendesign/input/index.ts b/opendesign/input/index.ts deleted file mode 100644 index dd41787e..00000000 --- a/opendesign/input/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Input from './OInput.vue'; -Input.install = function (app: App) { - app.component('OInput', Input); -}; - -export { Input }; diff --git a/opendesign/radio/index.ts b/opendesign/radio/index.ts deleted file mode 100644 index 35f2f2c3..00000000 --- a/opendesign/radio/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { App } from 'vue'; -import Radio from './src/radio'; -import RadioGroup from './src/radio-group'; - -Radio.install = function (app: App) { - app.component(Radio.name, Radio); -}; - -RadioGroup.install = function (app: App) { - app.component(RadioGroup.name, RadioGroup); -}; - -export { Radio, RadioGroup }; diff --git a/opendesign/radio/src/radio-group-types.ts b/opendesign/radio/src/radio-group-types.ts deleted file mode 100644 index 2085a688..00000000 --- a/opendesign/radio/src/radio-group-types.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ExtractDefaultPropTypes, InjectionKey, PropType, Ref } from 'vue'; - -export const radioGroupProps = { - // 双向绑定值 - modelValue: { - type: [String, Number, Boolean] as PropType, - default: null, - }, - // 是否禁用 - disabled: { - type: Boolean, - default: false, - }, -}; - -export type RadioGroupProps = ExtractDefaultPropTypes; - -interface RadioGroupInjection { - modelValue: Ref; - disabled: Ref; - // eslint-disable-next-line no-unused-vars - onChange: (val: string | number | boolean) => void; -} - -export const radioGroupKey: InjectionKey = - Symbol('ORadioGroup'); diff --git a/opendesign/radio/src/radio-group.scss b/opendesign/radio/src/radio-group.scss deleted file mode 100644 index e74b34fd..00000000 --- a/opendesign/radio/src/radio-group.scss +++ /dev/null @@ -1,7 +0,0 @@ -.o-radio-group { - display: flex; - align-items: center; - .o-radio + .o-radio { - margin-left: 24px; - } -} diff --git a/opendesign/radio/src/radio-group.tsx b/opendesign/radio/src/radio-group.tsx deleted file mode 100644 index 1dd0aa01..00000000 --- a/opendesign/radio/src/radio-group.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { defineComponent, provide, toRefs } from 'vue'; -import { - radioGroupKey, - radioGroupProps, - RadioGroupProps, -} from './radio-group-types'; -import './radio-group.scss'; - -export default defineComponent({ - name: 'ORadioGroup', - props: radioGroupProps, - emits: ['update:modelValue', 'change'], - setup(props: RadioGroupProps, { emit, slots }) { - const { modelValue, disabled } = toRefs(props); - - const onChange = (val: string | number | boolean) => { - emit('update:modelValue', val); - emit('change', val); - }; - - // 注入 - provide(radioGroupKey, { modelValue, disabled, onChange }); - - return () => { - return
{slots.default?.()}
; - }; - }, -}); diff --git a/opendesign/radio/src/radio-types.ts b/opendesign/radio/src/radio-types.ts deleted file mode 100644 index 19920b69..00000000 --- a/opendesign/radio/src/radio-types.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ExtractDefaultPropTypes, PropType } from 'vue'; - -export const radioProps = { - // 双向绑定值 - modelValue: { - type: [String, Number, Boolean] as PropType, - default: null, - }, - // value - value: { - type: [String, Number, Boolean] as PropType, - required: true, - default: null, - }, - // 是否禁用 - disabled: { - type: Boolean, - default: false, - }, -}; - -export type RadioProps = ExtractDefaultPropTypes; diff --git a/opendesign/radio/src/radio.scss b/opendesign/radio/src/radio.scss deleted file mode 100644 index 3fc31dc5..00000000 --- a/opendesign/radio/src/radio.scss +++ /dev/null @@ -1,72 +0,0 @@ -.o-radio { - display: inline-flex; - align-items: center; - position: relative; - font-size: var(--o-font-size-text); - line-height: var(--o-line-height-text); - cursor: pointer; - - input[type='radio'] { - position: absolute; - outline: none; - z-index: -1; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; - } - - &-icon { - position: relative; - display: inline-block; - border-radius: 50%; - width: 18px; - height: 18px; - background: var(--o-color-bg2); - border: 1px solid var(--o-color-border1); - - &::after { - content: ''; - position: absolute; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - width: 12px; - height: 12px; - border-radius: 50%; - background-color: transparent; - transition: background-color 0.3s; - } - } - - &-label { - margin-left: 8px; - color: var(--o-color-text1); - } - - &.o-radio-checked { - .o-radio-icon { - &::after { - background-color: var(--o-color-brand1); - } - } - } - - &.o-radio-disabled { - cursor: not-allowed; - .o-radio-label { - color: var(--o-color-text5); - } - .o-radio-icon { - border-color: var(--o-color-border2); - } - &.o-radio-checked { - .o-radio-icon { - &::after { - background-color: var(--o-color-brand5); - } - } - } - } -} diff --git a/opendesign/radio/src/radio.tsx b/opendesign/radio/src/radio.tsx deleted file mode 100644 index fb2b4d29..00000000 --- a/opendesign/radio/src/radio.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { computed, defineComponent, inject } from 'vue'; -import { radioGroupKey } from './radio-group-types'; -import { radioProps, RadioProps } from './radio-types'; -import './radio.scss'; - -export default defineComponent({ - name: 'ORadio', - props: radioProps, - emits: ['update:modelValue', 'change'], - setup(props: RadioProps, { emit, slots }) { - const radioGroupInjection = inject(radioGroupKey, null); - - // 是否禁用 - const isDisabled = computed( - () => radioGroupInjection?.disabled.value || props.disabled - ); - - // 是否选中 - const isChecked = computed( - () => - props.value === - (radioGroupInjection - ? radioGroupInjection.modelValue.value - : props.modelValue) - ); - - const onClick = (e: Event) => { - e.stopPropagation(); - }; - - const onChange = () => { - if (isDisabled.value) { - return; - } - - const val = props.value; - radioGroupInjection?.onChange(val); - emit('update:modelValue', val); - emit('change', val); - }; - - const getContent = () => { - if (slots.radio) { - return slots.radio({ - checked: isChecked.value, - disabled: isDisabled.value, - }); - } else { - return ( - <> - - {slots.default?.()} - - ); - } - }; - - return () => { - return ( - - ); - }; - }, -}); diff --git a/opendesign/radio/src/var.scss b/opendesign/radio/src/var.scss deleted file mode 100644 index ad6c1046..00000000 --- a/opendesign/radio/src/var.scss +++ /dev/null @@ -1,6 +0,0 @@ -.o-radio { - --o-radio-font-size: var(--o-font-size-text); - --o-radio-line-height: var(--o-line-height-text); - --o-radio-icon-width: 18px; - --o-radio-icon-height: 18px; -} diff --git a/opendesign/search/OSearch.vue b/opendesign/search/OSearch.vue deleted file mode 100644 index f0f5fffe..00000000 --- a/opendesign/search/OSearch.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/opendesign/search/index.ts b/opendesign/search/index.ts deleted file mode 100644 index 119d1b73..00000000 --- a/opendesign/search/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Search from './OSearch.vue'; -Search.install = function (app: App) { - app.component('OSearch', Search); -}; - -export { Search }; diff --git a/opendesign/switch/OSwitch.vue b/opendesign/switch/OSwitch.vue deleted file mode 100644 index ee3fea99..00000000 --- a/opendesign/switch/OSwitch.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - - - diff --git a/opendesign/switch/index.ts b/opendesign/switch/index.ts deleted file mode 100644 index ae6cb447..00000000 --- a/opendesign/switch/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Switch from './OSwitch.vue'; -Switch.install = function (app: App) { - app.component('OSwitch', Switch); -}; - -export { Switch }; diff --git a/opendesign/table/OTable.vue b/opendesign/table/OTable.vue deleted file mode 100644 index c3298f45..00000000 --- a/opendesign/table/OTable.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - - - diff --git a/opendesign/table/OTableColumn.vue b/opendesign/table/OTableColumn.vue deleted file mode 100644 index 982cabee..00000000 --- a/opendesign/table/OTableColumn.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/opendesign/table/index.ts b/opendesign/table/index.ts deleted file mode 100644 index 839f04b1..00000000 --- a/opendesign/table/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { App } from 'vue'; -import Table from './OTable.vue'; -import TableColumn from './OTableColumn.vue'; -Table.install = function (app: App) { - app.component('OTable', Table); -}; -TableColumn.install = function (app: App) { - app.component('OTableColumn', TableColumn); -}; -export { Table, TableColumn }; diff --git a/opendesign/tabs/OTabPane.vue b/opendesign/tabs/OTabPane.vue deleted file mode 100644 index 074a678f..00000000 --- a/opendesign/tabs/OTabPane.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - diff --git a/opendesign/tabs/OTabs.vue b/opendesign/tabs/OTabs.vue deleted file mode 100644 index 512563e9..00000000 --- a/opendesign/tabs/OTabs.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - - - diff --git a/opendesign/tabs/index.ts b/opendesign/tabs/index.ts deleted file mode 100644 index 7de648bb..00000000 --- a/opendesign/tabs/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { App } from 'vue'; -import Tabs from './OTabs.vue'; -import TabPane from './OTabPane.vue'; -Tabs.install = function (app: App) { - app.component('OTabs', Tabs); -}; -TabPane.install = function (app: App) { - app.component('OTabPane', TabPane); -}; - -export { Tabs, TabPane }; diff --git a/opendesign/time-select/OTimeSelect.vue b/opendesign/time-select/OTimeSelect.vue deleted file mode 100644 index c29dffb0..00000000 --- a/opendesign/time-select/OTimeSelect.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/opendesign/time-select/index.ts b/opendesign/time-select/index.ts deleted file mode 100644 index 85804f6a..00000000 --- a/opendesign/time-select/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import TimeSelect from './OTimeSelect.vue'; -TimeSelect.install = function (app: App) { - app.component('OTimeSelect', TimeSelect); -}; - -export { TimeSelect }; diff --git a/opendesign/timeline/index.ts b/opendesign/timeline/index.ts deleted file mode 100644 index 742ea80c..00000000 --- a/opendesign/timeline/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { App } from 'vue'; -import Timeline from './src/timeline'; - -Timeline.install = function (app: App) { - app.component(Timeline.name, Timeline); -}; - -export { Timeline }; diff --git a/opendesign/timeline/src/timeline-types.ts b/opendesign/timeline/src/timeline-types.ts deleted file mode 100644 index 6b400ff1..00000000 --- a/opendesign/timeline/src/timeline-types.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ExtractDefaultPropTypes } from 'vue'; - -export const timelineProps = { - leftArrow: { - type: Boolean, - default: true, - }, - rightArrow: { - type: Boolean, - default: true, - }, - modelValue: { - type: String, - default: '', - }, -}; - -export type TimelineProps = ExtractDefaultPropTypes; diff --git a/opendesign/timeline/src/timeline.scss b/opendesign/timeline/src/timeline.scss deleted file mode 100644 index f019985e..00000000 --- a/opendesign/timeline/src/timeline.scss +++ /dev/null @@ -1,73 +0,0 @@ -@import './var.scss'; -.o-timeline { - position: relative; - - &-list { - display: flex; - justify-content: space-evenly; - position: relative; - - &::after { - width: 100%; - height: 2px; - background-color: var(--o-timeline-background-color); - content: ''; - display: block; - position: absolute; - top: 43px; - z-index: 2; - } - } - - &-item { - position: relative; - z-index: 3; - list-style: none; - text-align: center; - cursor: pointer; - } - - &-day { - font-size: var(--o-timeline-font-size); - color: var(--o-timeline-font-color); - line-height: var(--o-timeline-line-height); - margin-bottom: var(--o-timeline-spacing-word); - transition: var(--o-timeline-transition); - } - &-icon { - cursor: pointer; - width: var(--o-timeline-font-size-icon); - height: var(--o-timeline-font-size-icon); - color: var(--o-timeline-font-color); - display: inline-block; - background-color: var(--o-timeline-background-icon); - transition: var(--o-timeline-transition); - } - .active { - .o-timeline-day { - color: var(--o-timeline-font-color-active); - } - .o-timeline-icon { - color: var(--o-timeline-font-color-active); - } - } - - &-left-arrow { - cursor: pointer; - position: absolute; - top: 28px; - left: -10px; - z-index: 4; - color: var(--o-timeline-background-color); - font-size: var(--o-timeline-font-size-icon); - } - &-right-arrow { - cursor: pointer; - position: absolute; - top: 28px; - right: -10px; - z-index: 4; - color: var(--o-timeline-background-color); - font-size: var(--o-timeline-font-size-icon); - } -} diff --git a/opendesign/timeline/src/timeline.tsx b/opendesign/timeline/src/timeline.tsx deleted file mode 100644 index 3484334a..00000000 --- a/opendesign/timeline/src/timeline.tsx +++ /dev/null @@ -1,148 +0,0 @@ -import { defineComponent, ref, Ref, toRefs, onMounted } from 'vue'; -import { timelineProps, TimelineProps } from './timeline-types'; -import IconLeft from '~icons/app/icon-chevron-left.svg'; -import IconRight from '~icons/app/icon-chevron-right'; -import IconChecked from '~icons/app/icon-checked.svg'; -import IconUnchecked from '~icons/app/icon-unchecked.svg'; -import './timeline.scss'; - -export default defineComponent({ - name: 'OTimeline', - props: timelineProps, - emits: ['update:modelValue'], - setup(props: TimelineProps, { emit }) { - const { leftArrow, rightArrow, modelValue } = toRefs(props); - // 六月 - const SPLITEMONTH = 6; - // 时间线列表 - const timeList: Ref = ref([]); - // 命中的tab - const activeTab = ref(5); - // 最左与最右阈值 - const leftThreshold = '2020-10'; - const rightThreshold: Ref = ref(''); - // 时间线列表赋值 - const changeDate = (year: number, month: number): Array => { - const result: Array = []; - if (month >= SPLITEMONTH) { - for (let i = 0; i < 6; i++) { - result.push( - year + - '-' + - (month - (6 - i - 1) >= 10 - ? month - (6 - i - 1) - : '0' + (month - (6 - i - 1))) - ); - } - } else { - // last year - for (let i = 1; i <= 6 - month; i++) { - result.push( - year - - 1 + - '-' + - (6 + i + month >= 10 ? 6 + i + month : '0' + (6 + i + month)) - ); - } - // this year - for (let i = 1; i < month + 1; i++) { - result.push(year + '-0' + i); - } - } - return result; - }; - // 初始化时间线列表赋值 - const initDate = () => { - const modelDate = !isNaN(new Date(modelValue.value).getTime()) - ? new Date(modelValue.value) - : new Date(); - const modelYear = modelDate.getFullYear(); - const _modelYear = - modelDate.getFullYear() === 2020 ? 2021 : modelDate.getFullYear(); - const modelMonth = - (modelYear === 2021 && modelDate.getMonth() + 1 < 3) || - modelYear === 2020 - ? 3 - : modelDate.getMonth() + 1; - const year = new Date().getFullYear(); - const month = new Date().getMonth() + 1; - rightThreshold.value = year + '-' + (month >= 10 ? month : '0' + month); - timeList.value = changeDate(_modelYear, modelMonth); - emit('update:modelValue', timeList.value[activeTab.value]); - }; - // 点击时间线tab - const useClickTab = (index: number): void => { - activeTab.value = index; - emit('update:modelValue', timeList.value[activeTab.value]); - }; - // 点击左侧按钮 - const useClickLeft = () => { - const date = new Date(timeList.value[4]); - const year = date.getFullYear(); - const month = date.getMonth() + 1; - timeList.value = changeDate(year, month); - emit('update:modelValue', timeList.value[activeTab.value]); - }; - // 点击右侧按钮 - const useClickRight = () => { - const date = new Date(timeList.value[5]); - const year = date.getFullYear(); - const month = date.getMonth() + 2; - timeList.value = - month <= 12 ? changeDate(year, month) : changeDate(year + 1, 1); - emit('update:modelValue', timeList.value[activeTab.value]); - }; - - onMounted(() => { - initDate(); - }); - - return () => { - return ( -
- {leftArrow && - leftArrow.value && - timeList.value[0] !== leftThreshold ? ( - useClickLeft()} - class="o-timeline-left-arrow" - > - ) : ( - '' - )} -
    - {timeList.value && - timeList.value.map((item, index) => { - return ( -
  • useClickTab(index)} - > -

    {item}

    - {index === activeTab.value ? ( - - ) : ( - - )} -
  • - ); - })} -
- {rightArrow && - rightArrow.value && - timeList.value[5] !== rightThreshold.value ? ( - useClickRight()} - > - ) : ( - '' - )} -
- ); - }; - }, -}); diff --git a/opendesign/timeline/src/var.scss b/opendesign/timeline/src/var.scss deleted file mode 100644 index d75006df..00000000 --- a/opendesign/timeline/src/var.scss +++ /dev/null @@ -1,22 +0,0 @@ -.o-timeline { - // 背景颜色 - --o-timeline-background-color: var(--o-color-neutral11); - --o-timeline-background-icon: var(--o-color-bg1); - - // 文字颜色 - --o-timeline-font-color-active: var(--o-color-brand1); - --o-timeline-font-color: var(--o-color-text4); - - // font-size - --o-timeline-font-size: var(--o-font-size-h6); - --o-timeline-font-size-icon: var(--o-font-size-h5); - - // line-height - --o-timeline-line-height: var(--o-line-height-h6); - - // 动画 - --o-timeline-transition: all 0.2s; - - // 间距 - --o-timeline-spacing-word: var(--o-spacing-h10); -} diff --git a/opendesign/tree/OTree.vue b/opendesign/tree/OTree.vue deleted file mode 100644 index 31034f60..00000000 --- a/opendesign/tree/OTree.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/opendesign/tree/index.ts b/opendesign/tree/index.ts deleted file mode 100644 index f1d3c756..00000000 --- a/opendesign/tree/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { App } from 'vue'; -import Tree from './OTree.vue'; -Tree.install = function (app: App) { - app.component('OTree', Tree); -}; - -export { Tree }; diff --git a/package.json b/package.json index 4e1129ba..856c5513 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "element-plus": "2.2.34", "lodash": "4.17.21", "opendesign": "./opendesign", - "pinia": "2.0.33", "vue": "3.2.47" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11c77eba..08423142 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,9 +17,6 @@ dependencies: opendesign: specifier: ./opendesign version: link:opendesign - pinia: - specifier: 2.0.33 - version: registry.npmmirror.com/pinia@2.0.33(typescript@4.9.4)(vue@3.2.47) vue: specifier: 3.2.47 version: registry.npmmirror.com/vue@3.2.47 @@ -1193,12 +1190,6 @@ packages: '@vue/compiler-dom': registry.npmmirror.com/@vue/compiler-dom@3.2.47 '@vue/shared': registry.npmmirror.com/@vue/shared@3.2.47 - registry.npmmirror.com/@vue/devtools-api@6.5.0: - resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.0.tgz} - name: '@vue/devtools-api' - version: 6.5.0 - dev: false - registry.npmmirror.com/@vue/reactivity-transform@3.2.47: resolution: {integrity: sha512-m8lGXw8rdnPVVIdIFhf0LeQ/ixyHkH5plYuS83yop5n7ggVJU+z5v0zecwEnX7fa7HNLBhh2qngJJkxpwEEmYA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.47.tgz} name: '@vue/reactivity-transform' @@ -3075,27 +3066,6 @@ packages: engines: {node: '>=8.6'} dev: true - registry.npmmirror.com/pinia@2.0.33(typescript@4.9.4)(vue@3.2.47): - resolution: {integrity: sha512-HOj1yVV2itw6rNIrR2f7+MirGNxhORjrULL8GWgRwXsGSvEqIQ+SE0MYt6cwtpegzCda3i+rVTZM+AM7CG+kRg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pinia/-/pinia-2.0.33.tgz} - id: registry.npmmirror.com/pinia/2.0.33 - name: pinia - version: 2.0.33 - peerDependencies: - '@vue/composition-api': ^1.4.0 - typescript: '>=4.4.4' - vue: ^2.6.14 || ^3.2.0 - peerDependenciesMeta: - '@vue/composition-api': - optional: true - typescript: - optional: true - dependencies: - '@vue/devtools-api': registry.npmmirror.com/@vue/devtools-api@6.5.0 - typescript: registry.npmmirror.com/typescript@4.9.4 - vue: registry.npmmirror.com/vue@3.2.47 - vue-demi: registry.npmmirror.com/vue-demi@0.14.5(vue@3.2.47) - dev: false - registry.npmmirror.com/pkg-types@1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/pkg-types/-/pkg-types-1.0.3.tgz} name: pkg-types @@ -3436,6 +3406,7 @@ packages: version: 4.9.4 engines: {node: '>=4.2.0'} hasBin: true + dev: true registry.npmmirror.com/ufo@1.3.1: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/ufo/-/ufo-1.3.1.tgz} -- Gitee