@hairy/vue-lib 1.49.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE.md → LICENSE} +1 -1
- package/README.md +186 -21
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/{LICENSE.md → LICENSE}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025-PRESENT Hairyf <https://github.com/
|
|
3
|
+
Copyright (c) 2025-PRESENT Hairyf <https://github.com/hairyf>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,36 +1,201 @@
|
|
|
1
1
|
# @hairy/vue-lib
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://npmjs.com/package/@hairy/vue-lib)
|
|
6
|
+
[](https://npm.chart.dev/@hairy/vue-lib)
|
|
7
|
+
[](https://bundlephobia.com/package/@hairy/vue-lib)
|
|
8
|
+
[](https://github.com/hairyf/hairylib/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
<!-- /automd -->
|
|
11
|
+
|
|
12
|
+
Vue 2/3 composables and helpers built on top of `vue-demi`.
|
|
8
13
|
|
|
9
14
|
## Install
|
|
10
15
|
|
|
16
|
+
<!-- automd:pm-install name="@hairy/vue-lib" -->
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
# ✨ Auto-detect
|
|
20
|
+
npx nypm install @hairy/vue-lib
|
|
21
|
+
|
|
22
|
+
# npm
|
|
23
|
+
npm install @hairy/vue-lib
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @hairy/vue-lib
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm add @hairy/vue-lib
|
|
30
|
+
|
|
31
|
+
# bun
|
|
32
|
+
bun install @hairy/vue-lib
|
|
33
|
+
|
|
34
|
+
# deno
|
|
35
|
+
deno install npm:@hairy/vue-lib
|
|
11
36
|
```
|
|
12
|
-
|
|
37
|
+
|
|
38
|
+
<!-- /automd -->
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
<!-- automd:jsdocs src="./src/index.ts" -->
|
|
43
|
+
|
|
44
|
+
### `CollapseTransition`
|
|
45
|
+
|
|
46
|
+
#### `name`
|
|
47
|
+
|
|
48
|
+
- **Type**: `string`
|
|
49
|
+
- **Default**: `"CollapseTransition"`
|
|
50
|
+
|
|
51
|
+
#### `setup()`
|
|
52
|
+
|
|
53
|
+
### `ehr(component, tag?)`
|
|
54
|
+
|
|
55
|
+
Directly render the incoming function components
|
|
56
|
+
|
|
57
|
+
### `Field`
|
|
58
|
+
|
|
59
|
+
#### `name`
|
|
60
|
+
|
|
61
|
+
- **Type**: `string`
|
|
62
|
+
- **Default**: `"Field"`
|
|
63
|
+
|
|
64
|
+
#### `props`
|
|
65
|
+
|
|
66
|
+
##### `is`
|
|
67
|
+
|
|
68
|
+
###### `default`
|
|
69
|
+
|
|
70
|
+
- **Type**: `string`
|
|
71
|
+
- **Default**: `""`
|
|
72
|
+
|
|
73
|
+
###### `type`
|
|
74
|
+
|
|
75
|
+
- **Type**: `array`
|
|
76
|
+
- **Default**: `[null,null,null]`
|
|
77
|
+
|
|
78
|
+
#### `setup()`
|
|
79
|
+
|
|
80
|
+
### `propertyToRef(data, prop)`
|
|
81
|
+
|
|
82
|
+
Convert the properties of an object to ref
|
|
83
|
+
|
|
84
|
+
### `syncElementSize(fromTarget, toTarget, options)`
|
|
85
|
+
|
|
86
|
+
Synchronize the width or height of from DOM to the specified to DOM
|
|
87
|
+
|
|
88
|
+
### `syncElementSyncScroll(fromTarget, toTarget, options)`
|
|
89
|
+
|
|
90
|
+
Synchronize scrolling between two DOM with the same scrollbar
|
|
91
|
+
|
|
92
|
+
### `useChecked(target, checked, unchecked)`
|
|
93
|
+
|
|
94
|
+
Get the status of checked and customize the value of checked | unchecked
|
|
95
|
+
|
|
96
|
+
### `useSelectedMultiple(array, options)`
|
|
97
|
+
|
|
98
|
+
### `useSelectedSingle(array, options)`
|
|
99
|
+
|
|
100
|
+
### `useServerPagination(options)`
|
|
101
|
+
|
|
102
|
+
<!-- /automd -->
|
|
103
|
+
|
|
104
|
+
## Directory structure
|
|
105
|
+
|
|
106
|
+
<!-- automd:dir-tree imports=""maxDepth=2 -->
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
├── src/
|
|
110
|
+
│ ├── components/
|
|
111
|
+
│ │ ├── c-field.ts
|
|
112
|
+
│ │ ├── collapse-transition.ts
|
|
113
|
+
│ │ └── index.ts
|
|
114
|
+
│ ├── hooks/
|
|
115
|
+
│ │ ├── syncElementScroll/
|
|
116
|
+
│ │ │ └── index.ts
|
|
117
|
+
│ │ ├── syncElementSize/
|
|
118
|
+
│ │ │ └── index.ts
|
|
119
|
+
│ │ ├── useChecked/
|
|
120
|
+
│ │ │ └── index.ts
|
|
121
|
+
│ │ ├── usePaginationServer/
|
|
122
|
+
│ │ │ └── index.ts
|
|
123
|
+
│ │ ├── useSelectedMultiple/
|
|
124
|
+
│ │ │ └── index.ts
|
|
125
|
+
│ │ ├── useSelectedSingle/
|
|
126
|
+
│ │ │ └── index.ts
|
|
127
|
+
│ │ ├── utils/
|
|
128
|
+
│ │ │ └── extendSelected.ts
|
|
129
|
+
│ │ └── index.ts
|
|
130
|
+
│ ├── utils/
|
|
131
|
+
│ │ └── index.ts
|
|
132
|
+
│ └── index.ts
|
|
133
|
+
├── test/
|
|
134
|
+
│ └── index.test.ts
|
|
135
|
+
├── package.json
|
|
136
|
+
├── README.md
|
|
137
|
+
└── tsdown.config.ts
|
|
13
138
|
```
|
|
14
139
|
|
|
15
|
-
|
|
140
|
+
<!-- /automd -->
|
|
141
|
+
|
|
142
|
+
## Source
|
|
16
143
|
|
|
17
|
-
|
|
18
|
-
|
|
144
|
+
<!-- automd:file src="./src/index.ts" code lang="ts" -->
|
|
145
|
+
|
|
146
|
+
```ts [index.ts]
|
|
147
|
+
export * from './components'
|
|
148
|
+
export * from './hooks'
|
|
149
|
+
export * from './utils'
|
|
19
150
|
```
|
|
20
151
|
|
|
152
|
+
<!-- /automd -->
|
|
153
|
+
|
|
154
|
+
## Contributors
|
|
155
|
+
|
|
156
|
+
<!-- automd:contributors github="hairyf/hairylib" author="Hairyf" license="MIT" -->
|
|
157
|
+
|
|
158
|
+
Published under the [MIT](https://github.com/hairyf/hairylib/blob/main/LICENSE) license.
|
|
159
|
+
Made by [@Hairyf](https://github.com/Hairyf) and [community](https://github.com/hairyf/hairylib/graphs/contributors) 💛
|
|
160
|
+
<br><br>
|
|
161
|
+
<a href="https://github.com/hairyf/hairylib/graphs/contributors">
|
|
162
|
+
<img src="https://contrib.rocks/image?repo=hairyf/hairylib" />
|
|
163
|
+
</a>
|
|
164
|
+
|
|
165
|
+
<!-- /automd -->
|
|
166
|
+
|
|
21
167
|
## License
|
|
22
168
|
|
|
23
|
-
|
|
169
|
+
<!-- automd:fetch url="gh:hairyf/hairylib/main/LICENSE" -->
|
|
170
|
+
|
|
171
|
+
MIT License
|
|
172
|
+
|
|
173
|
+
Copyright (c) 2025-PRESENT Hairyf <https://github.com/hairyf>
|
|
174
|
+
|
|
175
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
176
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
177
|
+
in the Software without restriction, including without limitation the rights
|
|
178
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
179
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
180
|
+
furnished to do so, subject to the following conditions:
|
|
181
|
+
|
|
182
|
+
The above copyright notice and this permission notice shall be included in all
|
|
183
|
+
copies or substantial portions of the Software.
|
|
184
|
+
|
|
185
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
186
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
187
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
188
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
189
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
190
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
191
|
+
SOFTWARE.
|
|
192
|
+
|
|
193
|
+
<!-- /automd -->
|
|
194
|
+
|
|
195
|
+
<!-- automd:with-automd -->
|
|
196
|
+
|
|
197
|
+
---
|
|
24
198
|
|
|
25
|
-
|
|
199
|
+
_🤖 auto updated with [automd](https://automd.unjs.io)_
|
|
26
200
|
|
|
27
|
-
|
|
28
|
-
[npm-version-href]: https://npmjs.com/package/@hairy/vue-lib
|
|
29
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/@hairy/vue-lib?style=flat&colorA=080f12&colorB=1fa669
|
|
30
|
-
[npm-downloads-href]: https://npmjs.com/package/@hairy/vue-lib
|
|
31
|
-
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@hairy/vue-lib?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
32
|
-
[bundle-href]: https://bundlephobia.com/result?p=@hairy/vue-lib
|
|
33
|
-
[license-src]: https://img.shields.io/github/license/hairyf/hairylib.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
34
|
-
[license-href]: https://github.com/hairyf/hairylib/blob/main/LICENSE
|
|
35
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
36
|
-
[jsdocs-href]: https://www.jsdocs.io/package/@hairy/vue-lib
|
|
201
|
+
<!-- /automd -->
|
package/dist/index.cjs
CHANGED
|
@@ -58,10 +58,11 @@ const Field = (0, vue_demi.defineComponent)({
|
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/components/collapse-transition.ts
|
|
61
|
-
const { c } = (0, css_render.default)();
|
|
62
61
|
const CollapseTransition = (0, vue_demi.defineComponent)({
|
|
63
62
|
name: "CollapseTransition",
|
|
64
63
|
setup(_, { slots }) {
|
|
64
|
+
const { c } = (0, css_render.default)();
|
|
65
|
+
const style = c(".collapse-transition", { transition: "0.2s height ease-in-out, 0.2s padding-top ease-in-out,0.2s padding-bottom ease-in-out" });
|
|
65
66
|
const on = {
|
|
66
67
|
onBeforeEnter(el) {
|
|
67
68
|
el.classList.add("collapse-transition");
|
|
@@ -119,7 +120,6 @@ const CollapseTransition = (0, vue_demi.defineComponent)({
|
|
|
119
120
|
return () => (0, vue_demi.h)(vue_demi.Transition, on, slots);
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
|
-
const style = c(".collapse-transition", { transition: "0.2s height ease-in-out, 0.2s padding-top ease-in-out,0.2s padding-bottom ease-in-out" });
|
|
123
123
|
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/hooks/syncElementScroll/index.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -173,7 +173,7 @@ declare function useSelectedSingle<T extends SelectedSingleArray>(array: T, opti
|
|
|
173
173
|
* @param component
|
|
174
174
|
* @param tag Rendering container (default div)
|
|
175
175
|
*/
|
|
176
|
-
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K):
|
|
176
|
+
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K): HTMLElement;
|
|
177
177
|
/**
|
|
178
178
|
* Convert the properties of an object to ref
|
|
179
179
|
* @param data
|
package/dist/index.d.mts
CHANGED
|
@@ -173,7 +173,7 @@ declare function useSelectedSingle<T extends SelectedSingleArray>(array: T, opti
|
|
|
173
173
|
* @param component
|
|
174
174
|
* @param tag Rendering container (default div)
|
|
175
175
|
*/
|
|
176
|
-
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K):
|
|
176
|
+
declare function ehr<K extends keyof HTMLElementTagNameMap = 'div'>(component: FunctionalComponent, tag?: K): HTMLElement;
|
|
177
177
|
/**
|
|
178
178
|
* Convert the properties of an object to ref
|
|
179
179
|
* @param data
|
package/dist/index.mjs
CHANGED
|
@@ -27,10 +27,11 @@ const Field = defineComponent({
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/components/collapse-transition.ts
|
|
30
|
-
const { c } = CssRender();
|
|
31
30
|
const CollapseTransition = defineComponent({
|
|
32
31
|
name: "CollapseTransition",
|
|
33
32
|
setup(_, { slots }) {
|
|
33
|
+
const { c } = CssRender();
|
|
34
|
+
const style = c(".collapse-transition", { transition: "0.2s height ease-in-out, 0.2s padding-top ease-in-out,0.2s padding-bottom ease-in-out" });
|
|
34
35
|
const on = {
|
|
35
36
|
onBeforeEnter(el) {
|
|
36
37
|
el.classList.add("collapse-transition");
|
|
@@ -88,7 +89,6 @@ const CollapseTransition = defineComponent({
|
|
|
88
89
|
return () => h(Transition, on, slots);
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
|
-
const style = c(".collapse-transition", { transition: "0.2s height ease-in-out, 0.2s padding-top ease-in-out,0.2s padding-bottom ease-in-out" });
|
|
92
92
|
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/hooks/syncElementScroll/index.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/vue-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.50.0",
|
|
5
5
|
"description": "Library for vue",
|
|
6
6
|
"author": "Hairyf <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"css-render": "^0.15.14",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"vue-demi": "latest",
|
|
47
|
-
"@hairy/utils": "1.
|
|
47
|
+
"@hairy/utils": "1.50.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/lodash": "^4.17.16",
|