Skip to content

Commit

Permalink
feat(pull-down-refresh): emit change event
Browse files Browse the repository at this point in the history
  • Loading branch information
novlan1 committed Dec 19, 2024
1 parent a43fed8 commit 957b2d7
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.2.12",
"version": "2.2.14",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"private": true,
"repository": {
Expand Down
30 changes: 30 additions & 0 deletions packages/press-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.2.14](https://github.com/novlan1/press-ui/compare/v2.2.13...v2.2.14) (2024-12-19)


### ✨ Features | 新功能

* add change event ([b675a5f](https://github.com/novlan1/press-ui/commit/b675a5fb6793644b3b2caeb8569d8b0d0c22ce20))

### [2.2.13](https://github.com/novlan1/press-ui/compare/v2.2.12...v2.2.13) (2024-12-17)


### ✏️ Documentation | 文档

* update docs ([8c42f9e](https://github.com/novlan1/press-ui/commit/8c42f9e5733c0e420fb0530bfdc1fc40af7e9ce6))


### ♻️ Code Refactoring | 代码重构

* **button:** 消除hoverClass的警告 ([ee9724e](https://github.com/novlan1/press-ui/commit/ee9724ebce183910c873a50089939e50da47d5ca))


### 🚀 Chore | 构建/工程依赖/工具

* hide sass warning ([673bd15](https://github.com/novlan1/press-ui/commit/673bd1515f8713a030162d8b83bb846bd0c521b4))
* lint ([c64d598](https://github.com/novlan1/press-ui/commit/c64d598b2671ea73f6c73f2654bc362784f93c3d))


### ✨ Features | 新功能

* **dialog:** add customClass ([5ee6193](https://github.com/novlan1/press-ui/commit/5ee61930fb7d606e5ab6d03a51b1c3018ee5fb9a))

### [2.2.12](https://github.com/novlan1/press-ui/compare/v2.2.11...v2.2.12) (2024-12-12)


Expand Down
30 changes: 30 additions & 0 deletions packages/press-ui/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# 更新日志

### [2.2.14](https://github.com/novlan1/press-ui/compare/v2.2.13...v2.2.14) (2024-12-19)


### Features 🎉

* add change event ([b675a5f](https://github.com/novlan1/press-ui/commit/b675a5fb6793644b3b2caeb8569d8b0d0c22ce20))

### [2.2.13](https://github.com/novlan1/press-ui/compare/v2.2.12...v2.2.13) (2024-12-17)


### Documentation 📖

* update docs ([8c42f9e](https://github.com/novlan1/press-ui/commit/8c42f9e5733c0e420fb0530bfdc1fc40af7e9ce6))


### Code Refactoring ♻️

* **button:** 消除hoverClass的警告 ([ee9724e](https://github.com/novlan1/press-ui/commit/ee9724ebce183910c873a50089939e50da47d5ca))


### Chore 🚀

* hide sass warning ([673bd15](https://github.com/novlan1/press-ui/commit/673bd1515f8713a030162d8b83bb846bd0c521b4))
* lint ([c64d598](https://github.com/novlan1/press-ui/commit/c64d598b2671ea73f6c73f2654bc362784f93c3d))


### Features 🎉

* **dialog:** add customClass ([5ee6193](https://github.com/novlan1/press-ui/commit/5ee61930fb7d606e5ab6d03a51b1c3018ee5fb9a))

### [2.2.12](https://github.com/novlan1/press-ui/compare/v2.2.11...v2.2.12) (2024-12-12)


Expand Down
2 changes: 1 addition & 1 deletion packages/press-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.2.12",
"version": "2.2.14",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"private": true,
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/press-ui/script/build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const nodeExternals = require('webpack-node-externals');
const Components = require('../../config/components.json');
const POSTCSS_CONFIG_FILE = path.resolve(__dirname, 'postcss.config.js');

const { LOADER: CROSS_GAME_STYLE_LOADER} = '@plugin-light/webpack-loader-cross-game-style';
const { LOADER: IF_DEF_LOADER} = '@plugin-light/webpack-loader-ifdef';
const { LOADER: CROSS_GAME_STYLE_LOADER } = '@plugin-light/webpack-loader-cross-game-style';
const { LOADER: IF_DEF_LOADER } = '@plugin-light/webpack-loader-ifdef';
// const utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
// const mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
// const transitionList = fs.readdirSync(path.resolve(__dirname, '../src/transitions'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ declare class Scheduler {
* }
* ```
*/
constructor(maxConcurrency?: number);
add: (promiseCreator: any) => Promise<unknown>;
doJob: () => void;
constructor(maxConcurrency?: number);
}
export { Scheduler };
2 changes: 1 addition & 1 deletion packages/press-ui/src/packages/common/vue3/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export const createApp: any;
export const provide: any;
export const inject: any;
export const getCurrentInstance: any;
export const isVue3: () => boolean;
export const isVue3: () => boolean;
4 changes: 2 additions & 2 deletions packages/press-ui/src/packages/common/vue3/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export {
export const isVue3 = () => {
let result = false;
// #ifdef VUE3
result = true
result = true;
// #endif
return result;
}
};

8 changes: 4 additions & 4 deletions packages/press-ui/src/packages/mixins/uni-page-meta.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export declare const uniSystemInfoMixin: {
computed: {};
methods: {
onSetFontSize(): void;
};
data(): {
mixinRootFontSize: number;
};
computed: {};
mounted(): void;
beforeDestroy(): void;
methods: {
onSetFontSize(): void;
};
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export declare const visibilityChangeMixin: (callback: Function) => {
mounted(this: any): void;
destroyed(this: any): void;
methods: {
_watchVisibleChange(): void;
};
mounted(this: any): void;
destroyed(this: any): void;
};
2 changes: 1 addition & 1 deletion packages/press-ui/src/packages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "press-ui",
"version": "2.2.12",
"version": "2.2.14",
"description": "简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目",
"main": "index.js",
"id": "press-ui",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export default {
width: addUnit(size),
height: addUnit(size),
});
console.log('res', res);
return res;
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/press-ui/src/packages/press-avatar/computed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ declare const innerDefault: {
};
colorIndex: {
type: (NumberConstructor | StringConstructor)[];
validator(n: any): boolean;
default: number;
validator(n: any): boolean;
};
name: {
type: StringConstructor;
Expand Down
7 changes: 5 additions & 2 deletions packages/press-ui/src/packages/press-button/press-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:id="id"
:data-detail="dataset"
:class="buttonClass"
:hover-class="['press-button--active', hoverClass]"
:hover-class="innerHoverClass"
:lang="lang"
:form-type="formType"
:style="buttonStyle"
Expand Down Expand Up @@ -34,7 +34,7 @@
:id="id"
:data-detail="dataset"
:class="buttonClass"
:hover-class="['press-button--active', hoverClass]"
:hover-class="innerHoverClass"
:lang="lang"
:form-type="formType"
:style="buttonStyle"
Expand Down Expand Up @@ -222,6 +222,9 @@ export default {
const { type, color, plain } = this;
return loadingColor({ type, color, plain });
},
innerHoverClass() {
return `press-button--active ${this.hoverClass || ''}`;
},
},
methods: {
onFakeClick(event) {
Expand Down
4 changes: 4 additions & 0 deletions packages/press-ui/src/packages/press-dialog/computed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ export declare const dialogProps: {
type: StringConstructor;
default: string;
};
customClass: {
type: StringConstructor;
default: string;
},
};
4 changes: 4 additions & 0 deletions packages/press-ui/src/packages/press-dialog/computed.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ export const dialogProps = {
type: String,
default: '',
},
customClass: {
type: String,
default: '',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div
v-if="dataShow"
class="press-dialog"
:class="dataCustomClass"
:style="{zIndex: `${dataZIndex}`}"
@click.stop="touchRemove"
@touchmove.stop="preventTouchMove"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function displayTitle(item) {
return item.title;
}

const match = item.options.filter((option) => option.value === item.value);
const match = item.options.filter(option => option.value === item.value);
const displayTitle = match.length ? match[0].text : '';
return displayTitle;
}
Expand Down
7 changes: 4 additions & 3 deletions packages/press-ui/src/packages/press-pull-refresh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ export default {

### Events

| 事件名 | 说明 | 回调参数 |
| ------- | -------------- | -------- |
| refresh | 下拉刷新时触发 | - |
| 事件名 | 说明 | 回调参数 |
| ------- | ---------------------- | -------------------------------------- |
| refresh | 下拉刷新时触发 | - |
| change | 拖动时或状态改变时触发 | _{ status: string, distance: number }_ |

### Slots

Expand Down
8 changes: 6 additions & 2 deletions packages/press-ui/src/packages/press-pull-refresh/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<div class="demo-wrap demo-pull-refresh">
<press-tabs
:active="active"
@change="onChange"
@change="onChangeTab"
>
<press-tab :title="t('basicUsage')">
<PressPullRefresh
v-model="isLoading"
@refresh="onRefresh"
@change="onChange"
>
<p class="demo-button">
{{ tips }}
Expand Down Expand Up @@ -112,7 +113,10 @@ export default {
}, 1000);
},
onChange(value) {
console.log('value', value);
console.log('[onChange]', value);
},
onChangeTab(value) {
console.log('[onChangeTab]', value);
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ export default {
if (status !== this.status) {
this.status = status;
}
this.$emit('change', {
status: this.status,
distance,
});
},
showSuccessTip() {
Expand Down
10 changes: 10 additions & 0 deletions packages/press-ui/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ module.exports = {
plugins,
},
transpileDependencies: ['@zebra-ui/swiper'],
css: {
loaderOptions: {
scss: {
sassOptions: {
silenceDeprecations: ['import', 'legacy-js-api'],
quietDeps: true,
},
},
},
},

chainWebpack(config) {
config.module
Expand Down

0 comments on commit 957b2d7

Please sign in to comment.