@aplus-frontend/ui 7.7.3 → 7.7.5
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/es/src/ap-action/group/index.vue.d.ts +1 -0
- package/es/src/ap-action/group/index.vue.mjs +28 -28
- package/es/src/ap-action/item-popconfirm/index.vue.d.ts +25 -1
- package/es/src/ap-button/ap-action-button.vue.d.ts +2 -1
- package/es/src/ap-button/ap-button.vue.d.ts +2 -1
- package/es/src/ap-field/checkbox/index.vue.mjs +18 -8
- package/es/src/ap-field/number/index.vue.d.ts +20 -0
- package/es/src/ap-field/number/index.vue.mjs +24 -23
- package/es/src/ap-field/number/read.vue2.mjs +3 -2
- package/es/src/ap-field/radio/index.vue.mjs +24 -24
- package/es/src/ap-field/rate/index.vue.mjs +10 -10
- package/es/src/ap-field/select/index.vue.d.ts +12 -4
- package/es/src/ap-field/select/index.vue.mjs +74 -71
- package/es/src/ap-field/slider/index.vue.d.ts +4 -2
- package/es/src/ap-field/slider/index.vue.mjs +12 -12
- package/es/src/ap-field/switch/index.vue.mjs +20 -20
- package/es/src/ap-field/text/index.vue2.mjs +23 -23
- package/es/src/ap-field/text/password.vue.mjs +9 -9
- package/es/src/ap-field/text-area/index.vue.mjs +24 -20
- package/es/src/ap-field/tree-select/index.vue.d.ts +2 -0
- package/es/src/ap-field/tree-select/index.vue.mjs +17 -17
- package/es/src/ap-form/ap-form.vue2.mjs +64 -64
- package/es/src/ap-form/drawer-form/index.vue.mjs +41 -41
- package/es/src/ap-form/item/index.vue.mjs +64 -64
- package/es/src/ap-form/items/number/index.vue.d.ts +22 -0
- package/es/src/ap-form/items/number/index.vue.mjs +10 -10
- package/es/src/ap-form/items/radio/index.vue.mjs +3 -3
- package/es/src/ap-form/items/select/index.vue.d.ts +18 -6
- package/es/src/ap-form/items/select/index.vue.mjs +5 -5
- package/es/src/ap-form/items/text/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/text/index.vue2.mjs +6 -6
- package/es/src/ap-form/items/text/password.vue.mjs +7 -7
- package/es/src/ap-form/items/text-area/index.vue.mjs +5 -5
- package/es/src/ap-form/items/tree-select/index.vue.d.ts +2 -0
- package/es/src/ap-form/items/tree-select/index.vue.mjs +7 -7
- package/es/src/ap-form/modal-form/index.vue.d.ts +25 -1
- package/es/src/ap-form/search-form/components/popover-filter.vue.d.ts +19 -1
- package/es/src/ap-form/search-form/index.vue.mjs +63 -63
- package/es/src/ap-form/style/item.mjs +8 -7
- package/es/src/ap-list/index.vue.mjs +6 -6
- package/es/src/ap-table/constants.d.ts +23 -4
- package/es/src/business/ap-batch-action-group/index.d.ts +34 -4
- package/es/src/business/ap-descriptions/ap-descriptions.vue.d.ts +3 -10
- package/es/src/business/ap-descriptions/ap-descriptions.vue.mjs +58 -79
- package/es/src/business/ap-descriptions/interface.d.ts +2 -3
- package/es/src/business/ap-upload/apUpload.vue.d.ts +9 -0
- package/es/src/business/ap-upload/apUpload.vue.mjs +33 -29
- package/es/src/business/ap-upload/apUploadTypes.d.ts +4 -0
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +50 -49
- package/es/src/business/ap-upload/components/Picture.vue2.mjs +66 -65
- package/es/src/business/ap-upload/components/SingleFile.vue2.mjs +95 -94
- package/es/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/es/src/business/ap-upload/hooks/useOss.mjs +26 -24
- package/es/src/business/batch-input-group/index.vue.d.ts +1 -1
- package/es/src/editable-table/form-item.vue.mjs +64 -64
- package/es/src/editable-table/index.vue.mjs +66 -66
- package/es/src/scroll-bar/index.vue.d.ts +7 -7
- package/es/src/scroll-bar/index.vue.mjs +21 -21
- package/es/src/scroll-bar/internal.vue.d.ts +4 -4
- package/es/src/scroll-bar/internal.vue.mjs +20 -20
- package/es/src/scroll-view/hooks/use-scroll-wrapper.d.ts +4 -4
- package/es/src/scroll-view/hooks/use-scroll-wrapper.mjs +13 -13
- package/es/src/scroll-view/index.vue.d.ts +25 -25
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-action/group/index.vue.d.ts +1 -0
- package/lib/src/ap-action/group/index.vue.js +1 -1
- package/lib/src/ap-action/item-popconfirm/index.vue.d.ts +25 -1
- package/lib/src/ap-button/ap-action-button.vue.d.ts +2 -1
- package/lib/src/ap-button/ap-button.vue.d.ts +2 -1
- package/lib/src/ap-field/checkbox/index.vue.js +1 -1
- package/lib/src/ap-field/number/index.vue.d.ts +20 -0
- package/lib/src/ap-field/number/index.vue.js +1 -1
- package/lib/src/ap-field/number/read.vue2.js +1 -1
- package/lib/src/ap-field/radio/index.vue.js +1 -1
- package/lib/src/ap-field/rate/index.vue.js +1 -1
- package/lib/src/ap-field/select/index.vue.d.ts +12 -4
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-field/slider/index.vue.d.ts +4 -2
- package/lib/src/ap-field/slider/index.vue.js +1 -1
- package/lib/src/ap-field/switch/index.vue.js +1 -1
- package/lib/src/ap-field/text/index.vue2.js +1 -1
- package/lib/src/ap-field/text/password.vue.js +1 -1
- package/lib/src/ap-field/text-area/index.vue.js +1 -1
- package/lib/src/ap-field/tree-select/index.vue.d.ts +2 -0
- package/lib/src/ap-field/tree-select/index.vue.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
- package/lib/src/ap-form/item/index.vue.js +1 -1
- package/lib/src/ap-form/items/number/index.vue.d.ts +22 -0
- package/lib/src/ap-form/items/number/index.vue.js +1 -1
- package/lib/src/ap-form/items/radio/index.vue.js +1 -1
- package/lib/src/ap-form/items/select/index.vue.d.ts +18 -6
- package/lib/src/ap-form/items/select/index.vue.js +1 -1
- package/lib/src/ap-form/items/text/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/text/index.vue2.js +1 -1
- package/lib/src/ap-form/items/text/password.vue.js +1 -1
- package/lib/src/ap-form/items/text-area/index.vue.js +1 -1
- package/lib/src/ap-form/items/tree-select/index.vue.d.ts +2 -0
- package/lib/src/ap-form/items/tree-select/index.vue.js +1 -1
- package/lib/src/ap-form/modal-form/index.vue.d.ts +25 -1
- package/lib/src/ap-form/search-form/components/popover-filter.vue.d.ts +19 -1
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-form/style/item.js +1 -1
- package/lib/src/ap-list/index.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +23 -4
- package/lib/src/business/ap-batch-action-group/index.d.ts +34 -4
- package/lib/src/business/ap-descriptions/ap-descriptions.vue.d.ts +3 -10
- package/lib/src/business/ap-descriptions/ap-descriptions.vue.js +1 -1
- package/lib/src/business/ap-descriptions/interface.d.ts +2 -3
- package/lib/src/business/ap-upload/apUpload.vue.d.ts +9 -0
- package/lib/src/business/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/business/ap-upload/apUploadTypes.d.ts +4 -0
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/lib/src/business/ap-upload/hooks/useOss.js +1 -1
- package/lib/src/business/batch-input-group/index.vue.d.ts +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/scroll-bar/index.vue.d.ts +7 -7
- package/lib/src/scroll-bar/index.vue.js +1 -1
- package/lib/src/scroll-bar/internal.vue.d.ts +4 -4
- package/lib/src/scroll-bar/internal.vue.js +1 -1
- package/lib/src/scroll-view/hooks/use-scroll-wrapper.d.ts +4 -4
- package/lib/src/scroll-view/hooks/use-scroll-wrapper.js +1 -1
- package/lib/src/scroll-view/index.vue.d.ts +25 -25
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +5 -5
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as W, useSlots as H, shallowRef as $, ref as q, watch as b, unref as s, createBlock as J, openBlock as Q, withCtx as p, createVNode as w, mergeProps as X, createSlots as Y, renderList as Z, renderSlot as M, normalizeProps as ee, guardReactiveProps as te } from "vue";
|
|
2
|
+
import { Table as ae } from "@aplus-frontend/antdv";
|
|
3
3
|
import { ApForm as m } from "../ap-form/index.mjs";
|
|
4
|
-
import { isEqual as
|
|
4
|
+
import { isEqual as ne, isArray as c, isUndefined as oe, isNumber as h, cloneDeep as le, omit as v } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
7
|
import "../utils/index.mjs";
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
10
|
-
import { useDevWarning as
|
|
11
|
-
import
|
|
12
|
-
import { useNamespace as
|
|
13
|
-
import { useControllableValue as
|
|
14
|
-
import { useGlobalConfig as
|
|
15
|
-
import { isDef as
|
|
16
|
-
const
|
|
8
|
+
import { scrollToRowIndex as se } from "./utils.mjs";
|
|
9
|
+
import re from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { useDevWarning as ue } from "../utils/warning.mjs";
|
|
11
|
+
import ie from "./style/index.mjs";
|
|
12
|
+
import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
import { useControllableValue as fe } from "../hooks/useControllableValue.mjs";
|
|
14
|
+
import { useGlobalConfig as pe } from "../config-provider/hooks/use-global-config.mjs";
|
|
15
|
+
import { isDef as x } from "../utils/is.mjs";
|
|
16
|
+
const Se = /* @__PURE__ */ W({
|
|
17
17
|
name: "EditableTable",
|
|
18
18
|
__name: "index",
|
|
19
19
|
props: {
|
|
@@ -113,41 +113,41 @@ const Ve = /* @__PURE__ */ H({
|
|
|
113
113
|
onFieldChange: {}
|
|
114
114
|
},
|
|
115
115
|
emits: ["update:value"],
|
|
116
|
-
setup(
|
|
117
|
-
expose:
|
|
118
|
-
emit:
|
|
116
|
+
setup(y, {
|
|
117
|
+
expose: C,
|
|
118
|
+
emit: R
|
|
119
119
|
}) {
|
|
120
|
-
const t =
|
|
121
|
-
|
|
120
|
+
const t = y;
|
|
121
|
+
ue("EditableTable")(!1, "breaking", "EditableTable has been EOL, Please use EditableAgGrid(https://aplus.aplnk.com/aplus-ui/components/ag-grid/editable/) instead.");
|
|
122
122
|
const {
|
|
123
|
-
b:
|
|
124
|
-
} =
|
|
123
|
+
b: F
|
|
124
|
+
} = de("editable-table"), B = ie("editable-table"), T = H(), E = R, g = $(), {
|
|
125
125
|
value: i,
|
|
126
|
-
updateValue:
|
|
127
|
-
} =
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
updateValue: V
|
|
127
|
+
} = fe(t, E), r = q(), S = pe("valueTypeMap"), f = m.useWatch(t.name, r);
|
|
128
|
+
b(() => f.value, (e) => {
|
|
129
|
+
V(e), t.onChange?.(e);
|
|
130
130
|
}, {
|
|
131
131
|
deep: !0,
|
|
132
132
|
flush: "post"
|
|
133
|
-
}),
|
|
134
|
-
e !== s(f) && (
|
|
133
|
+
}), b(i, (e) => {
|
|
134
|
+
e !== s(f) && (ne(e, s(f)) || r.value?.setFieldValue(t.name, e));
|
|
135
135
|
}, {
|
|
136
136
|
deep: !0
|
|
137
137
|
});
|
|
138
|
-
const
|
|
139
|
-
function
|
|
138
|
+
const D = re(t, S);
|
|
139
|
+
function L() {
|
|
140
140
|
r.value?.resetFields();
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function _(e) {
|
|
143
143
|
return e ? (c(e) ? e : [e]).map((n) => c(n) ? [t.name, ...n] : [t.name, n]) : void 0;
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
146
|
-
return (await r.value?.validateFields(
|
|
145
|
+
async function k(e, l) {
|
|
146
|
+
return (await r.value?.validateFields(_(e), l))?.[t.name];
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function N(e, l) {
|
|
149
149
|
const n = s(i)?.length || 0;
|
|
150
|
-
if (
|
|
150
|
+
if (x(t.maxLength) && n >= t.maxLength)
|
|
151
151
|
return;
|
|
152
152
|
const a = {
|
|
153
153
|
...e || {}
|
|
@@ -157,14 +157,14 @@ const Ve = /* @__PURE__ */ H({
|
|
|
157
157
|
o[u] = [a];
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
oe(l) ? o[u].push(a) : o[u].splice(l, 0, a);
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function A(e, l = "suffix") {
|
|
164
164
|
const n = s(i)?.length || 0, a = h(e) ? e : e.length;
|
|
165
|
-
if (
|
|
165
|
+
if (x(t.maxLength) && n + a > t.maxLength)
|
|
166
166
|
return;
|
|
167
|
-
const o = h(e) ? new Array(e).fill(0).map(() => ({})) :
|
|
167
|
+
const o = h(e) ? new Array(e).fill(0).map(() => ({})) : le(e);
|
|
168
168
|
r.value?.setFieldValue?.(t.name, o, !0, (u, d) => {
|
|
169
169
|
if (!u[d]) {
|
|
170
170
|
u[d] = [...o];
|
|
@@ -173,28 +173,28 @@ const Ve = /* @__PURE__ */ H({
|
|
|
173
173
|
l === "suffix" ? u[d].push(...o) : u[d].unshift(...o);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function I(e) {
|
|
177
177
|
const l = new Set(h(e) ? [e] : e);
|
|
178
178
|
r.value?.setFieldValue?.(t.name, void 0, !0, (n, a) => {
|
|
179
179
|
n[a] = n[a].filter((o, u) => !l.has(u));
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function P(e) {
|
|
183
183
|
const l = new Set(c(e) ? e : [e]);
|
|
184
184
|
l.size !== 0 && r.value?.setFieldValue?.(t.name, void 0, !0, (n, a) => {
|
|
185
185
|
n[a] = n[a].filter((o) => !l.has(o[t.rowKey]));
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function z() {
|
|
189
189
|
return s(i);
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function K(e) {
|
|
192
192
|
r.value?.setFieldValue(t.name, e);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function O(e) {
|
|
195
195
|
return s(i)?.[e];
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function j(e, l, n = !0) {
|
|
198
198
|
r.value?.setFieldValue?.(t.name, void 0, !0, (a, o) => {
|
|
199
199
|
!a[o] || !a[o][e] || (a[o][e] = {
|
|
200
200
|
...n ? a[o][e] : {},
|
|
@@ -202,27 +202,27 @@ const Ve = /* @__PURE__ */ H({
|
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function G(e, l) {
|
|
206
206
|
const n = e === "end" ? i.value.length - 1 : e;
|
|
207
|
-
|
|
207
|
+
se(n, g.value?.$el, l);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function U() {
|
|
210
210
|
r.value?.setFieldValue?.(t.name, []);
|
|
211
211
|
}
|
|
212
|
-
return
|
|
213
|
-
resetFields:
|
|
214
|
-
validateFields:
|
|
215
|
-
add:
|
|
216
|
-
remove:
|
|
217
|
-
getRowData:
|
|
218
|
-
getRowsData:
|
|
219
|
-
setRowData:
|
|
220
|
-
addMultiple:
|
|
221
|
-
scrollTo:
|
|
222
|
-
clear:
|
|
223
|
-
setTableData:
|
|
224
|
-
removeByKey:
|
|
225
|
-
}), (e, l) => (
|
|
212
|
+
return C({
|
|
213
|
+
resetFields: L,
|
|
214
|
+
validateFields: k,
|
|
215
|
+
add: N,
|
|
216
|
+
remove: I,
|
|
217
|
+
getRowData: O,
|
|
218
|
+
getRowsData: z,
|
|
219
|
+
setRowData: j,
|
|
220
|
+
addMultiple: A,
|
|
221
|
+
scrollTo: G,
|
|
222
|
+
clear: U,
|
|
223
|
+
setTableData: K,
|
|
224
|
+
removeByKey: P
|
|
225
|
+
}), (e, l) => (Q(), J(s(m), {
|
|
226
226
|
ref_key: "formRef",
|
|
227
227
|
ref: r,
|
|
228
228
|
"initial-values": {
|
|
@@ -233,17 +233,17 @@ const Ve = /* @__PURE__ */ H({
|
|
|
233
233
|
name: e.name,
|
|
234
234
|
"no-style": ""
|
|
235
235
|
}, {
|
|
236
|
-
default: p(() => [w(s(
|
|
236
|
+
default: p(() => [w(s(ae), X(s(v)(t, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
237
237
|
ref_key: "tableRef",
|
|
238
238
|
ref: g,
|
|
239
|
-
class: [s(
|
|
240
|
-
columns: s(
|
|
239
|
+
class: [s(F)(), s(B)],
|
|
240
|
+
columns: s(D),
|
|
241
241
|
"data-source": s(i)
|
|
242
|
-
}),
|
|
242
|
+
}), Y({
|
|
243
243
|
_: 2
|
|
244
|
-
}, [
|
|
244
|
+
}, [Z(s(v)(T, ["headerCell"]), (n, a) => ({
|
|
245
245
|
name: a,
|
|
246
|
-
fn: p((o) => [
|
|
246
|
+
fn: p((o) => [M(e.$slots, a, ee(te(o || {})))])
|
|
247
247
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
248
248
|
_: 3
|
|
249
249
|
}, 8, ["name"])]),
|
|
@@ -252,5 +252,5 @@ const Ve = /* @__PURE__ */ H({
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
export {
|
|
255
|
-
|
|
255
|
+
Se as default
|
|
256
256
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScrollBarProps, ScrollBarDirection, InternalScrollBarProps } from './interface';
|
|
2
|
-
import { DefineComponent, ComputedRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, CreateComponentPublicInstanceWithMixins, Ref, GlobalComponents, GlobalDirectives } from 'vue';
|
|
2
|
+
import { DefineComponent, ComputedRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, CreateComponentPublicInstanceWithMixins, Ref, ShallowRef, GlobalComponents, GlobalDirectives } from 'vue';
|
|
3
3
|
declare function handleBarScroll(percent: number): void;
|
|
4
4
|
declare const _default: DefineComponent<ScrollBarProps, {
|
|
5
5
|
currentScroll: ComputedRef<number | undefined>;
|
|
@@ -16,9 +16,9 @@ declare const _default: DefineComponent<ScrollBarProps, {
|
|
|
16
16
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
17
17
|
barRef: CreateComponentPublicInstanceWithMixins<Readonly< InternalScrollBarProps> & Readonly<{}>, {
|
|
18
18
|
currentScroll: Ref<number, number>;
|
|
19
|
-
container:
|
|
20
|
-
bar:
|
|
21
|
-
track:
|
|
19
|
+
container: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
20
|
+
bar: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
21
|
+
track: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
22
22
|
scroll: (percent: number) => void;
|
|
23
23
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
24
24
|
scroll: number;
|
|
@@ -40,9 +40,9 @@ declare const _default: DefineComponent<ScrollBarProps, {
|
|
|
40
40
|
Defaults: {};
|
|
41
41
|
}, Readonly< InternalScrollBarProps> & Readonly<{}>, {
|
|
42
42
|
currentScroll: Ref<number, number>;
|
|
43
|
-
container:
|
|
44
|
-
bar:
|
|
45
|
-
track:
|
|
43
|
+
container: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
44
|
+
bar: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
45
|
+
track: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
46
46
|
scroll: (percent: number) => void;
|
|
47
47
|
}, {}, {}, {}, {
|
|
48
48
|
scroll: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, toRef as z, shallowRef as g, ref as x, watchEffect as _, unref as a, watch as k, computed as s, createBlock as C, createCommentVNode as R, openBlock as B, mergeProps as L } from "vue";
|
|
2
2
|
import "./internal.vue2.mjs";
|
|
3
|
-
import { omit as
|
|
4
|
-
import { getScrollable as u, ensureRangeValue as
|
|
5
|
-
import { useResizeObserver as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
3
|
+
import { omit as w } from "lodash-unified";
|
|
4
|
+
import { getScrollable as u, ensureRangeValue as y } from "./utils/index.mjs";
|
|
5
|
+
import { useResizeObserver as E } from "@vueuse/core";
|
|
6
|
+
import N from "./internal.vue.mjs";
|
|
7
|
+
const j = /* @__PURE__ */ b({
|
|
8
8
|
name: "ScrollBar",
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: {
|
|
@@ -24,9 +24,9 @@ const W = /* @__PURE__ */ z({
|
|
|
24
24
|
onScroll: {},
|
|
25
25
|
onScrollEnd: {}
|
|
26
26
|
},
|
|
27
|
-
setup(
|
|
28
|
-
const r =
|
|
29
|
-
function
|
|
27
|
+
setup(p, { expose: S }) {
|
|
28
|
+
const r = p, o = z(r, "scrollContainer"), l = g(), n = x(r.barLength);
|
|
29
|
+
function m() {
|
|
30
30
|
if (!o.value || !l.value) return;
|
|
31
31
|
const { totalSize: e, visibleSize: t, distance: c } = u(
|
|
32
32
|
o.value,
|
|
@@ -39,19 +39,19 @@ const W = /* @__PURE__ */ z({
|
|
|
39
39
|
o.value,
|
|
40
40
|
r.direction
|
|
41
41
|
);
|
|
42
|
-
n.value =
|
|
42
|
+
n.value = y(
|
|
43
43
|
e / (t + r.extraSize || 1) * 100
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
E(o, () => {
|
|
47
47
|
f();
|
|
48
|
-
}),
|
|
48
|
+
}), _(
|
|
49
49
|
() => {
|
|
50
50
|
const e = a(o.value);
|
|
51
|
-
e && (f(), e.addEventListener("scroll",
|
|
51
|
+
e && (f(), e.addEventListener("scroll", m));
|
|
52
52
|
},
|
|
53
53
|
{ flush: "post" }
|
|
54
|
-
),
|
|
54
|
+
), k(
|
|
55
55
|
() => r.barLength,
|
|
56
56
|
(e) => {
|
|
57
57
|
n.value = e;
|
|
@@ -60,29 +60,29 @@ const W = /* @__PURE__ */ z({
|
|
|
60
60
|
function d(e) {
|
|
61
61
|
const t = a(o);
|
|
62
62
|
if (!t) return;
|
|
63
|
-
const { totalSize: c, visibleSize: i, topOrLeft:
|
|
63
|
+
const { totalSize: c, visibleSize: i, topOrLeft: v } = u(
|
|
64
64
|
t,
|
|
65
65
|
r.direction
|
|
66
66
|
);
|
|
67
67
|
if (c <= i) return;
|
|
68
|
-
const h = `scroll${
|
|
68
|
+
const h = `scroll${v}`;
|
|
69
69
|
t[h] = e * (c + r.extraSize - i) / 100;
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return S({
|
|
72
72
|
currentScroll: s(() => a(l.value?.currentScroll)),
|
|
73
73
|
scroll: d,
|
|
74
74
|
visible: s(() => n.value < 100),
|
|
75
75
|
rootElement: s(() => a(l.value?.container))
|
|
76
|
-
}), (e, t) => n.value !== 100 ? (B(),
|
|
76
|
+
}), (e, t) => n.value !== 100 ? (B(), C(N, L({
|
|
77
77
|
key: 0,
|
|
78
78
|
ref_key: "barRef",
|
|
79
79
|
ref: l
|
|
80
|
-
}, a(
|
|
80
|
+
}, a(w)(r, ["onScroll", "extraSize", "scrollContainer"]), {
|
|
81
81
|
"bar-length": n.value,
|
|
82
82
|
onScroll: d
|
|
83
|
-
}), null, 16, ["bar-length"])) :
|
|
83
|
+
}), null, 16, ["bar-length"])) : R("", !0);
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
export {
|
|
87
|
-
|
|
87
|
+
j as default
|
|
88
88
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { InternalScrollBarProps, ScrollBarDirection } from './interface';
|
|
2
|
-
import { DefineComponent, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
import { DefineComponent, Ref, ShallowRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
3
|
declare function scroll(percent: number): void;
|
|
4
4
|
declare const _default: DefineComponent<InternalScrollBarProps, {
|
|
5
5
|
currentScroll: Ref<number, number>;
|
|
6
|
-
container:
|
|
7
|
-
bar:
|
|
8
|
-
track:
|
|
6
|
+
container: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
7
|
+
bar: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
8
|
+
track: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
9
9
|
scroll: typeof scroll;
|
|
10
10
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<InternalScrollBarProps> & Readonly<{}>, {
|
|
11
11
|
scroll: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as V, ref as
|
|
1
|
+
import { defineComponent as V, shallowRef as h, ref as W, toRef as f, watch as z, watchEffect as A, unref as o, createElementBlock as N, openBlock as U, normalizeStyle as X, normalizeClass as b, createElementVNode as E } from "vue";
|
|
2
2
|
import "../config-provider/index.mjs";
|
|
3
|
-
import { useTrack as
|
|
3
|
+
import { useTrack as Y } from "./hooks/use-track.mjs";
|
|
4
4
|
import { ensureRangeValue as L } from "./utils/index.mjs";
|
|
5
|
-
import
|
|
6
|
-
import { useNamespace as
|
|
7
|
-
const
|
|
5
|
+
import I from "./style/index.mjs";
|
|
6
|
+
import { useNamespace as j } from "../config-provider/hooks/use-namespace.mjs";
|
|
7
|
+
const O = /* @__PURE__ */ V({
|
|
8
8
|
__name: "internal",
|
|
9
9
|
props: {
|
|
10
10
|
direction: { default: "vertical" },
|
|
@@ -22,14 +22,14 @@ const K = /* @__PURE__ */ V({
|
|
|
22
22
|
onScrollEnd: {}
|
|
23
23
|
},
|
|
24
24
|
setup(C, { expose: D }) {
|
|
25
|
-
const t = C, m =
|
|
25
|
+
const t = C, m = h(), i = h(), l = h(), { b: M, e: k, m: R, em: c, cssVar: B } = j("scroll-bar"), P = I("scroll-bar"), n = W(t.scroll), { handleMouseDown: v } = Y({
|
|
26
26
|
currentScroll: n,
|
|
27
27
|
track: i,
|
|
28
28
|
bar: l,
|
|
29
|
-
type:
|
|
30
|
-
trackSpeed:
|
|
31
|
-
barLength:
|
|
32
|
-
disabled:
|
|
29
|
+
type: f(t, "direction"),
|
|
30
|
+
trackSpeed: f(t, "trackSpeed"),
|
|
31
|
+
barLength: f(t, "barLength"),
|
|
32
|
+
disabled: f(t, "disabled"),
|
|
33
33
|
onDown: (e) => {
|
|
34
34
|
t.onScrollStart?.(e);
|
|
35
35
|
},
|
|
@@ -40,17 +40,17 @@ const K = /* @__PURE__ */ V({
|
|
|
40
40
|
t.onScroll?.(e);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
z(
|
|
44
44
|
() => t.scroll,
|
|
45
45
|
(e) => {
|
|
46
46
|
n.value = e;
|
|
47
47
|
}
|
|
48
|
-
),
|
|
48
|
+
), A(() => {
|
|
49
49
|
if (!o(l)) return;
|
|
50
50
|
const e = `${(100 - t.barLength) * n.value / t.barLength}%`, r = `${t.barLength}%`;
|
|
51
51
|
t.direction === "vertical" ? (l.value.style.height = r, l.value.style.transform = `translate3d(0, ${e}, 0)`) : (l.value.style.width = r, l.value.style.transform = `translate3d(${e}, 0, 0)`);
|
|
52
52
|
});
|
|
53
|
-
let
|
|
53
|
+
let p, s, d;
|
|
54
54
|
function T(e) {
|
|
55
55
|
if (t.disabled || e.button !== 0) return;
|
|
56
56
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -59,13 +59,13 @@ const K = /* @__PURE__ */ V({
|
|
|
59
59
|
return;
|
|
60
60
|
document.addEventListener("pointermove", g), document.addEventListener("pointerup", S);
|
|
61
61
|
const u = r.getBoundingClientRect(), y = a.getBoundingClientRect();
|
|
62
|
-
t.direction === "vertical" ? (
|
|
62
|
+
t.direction === "vertical" ? (p = u.height, s = y.top - u.top, d = e.clientY) : (p = u.width, s = y.left - u.left, d = e.clientX), t.onScrollStart?.(o(n));
|
|
63
63
|
}
|
|
64
64
|
function g(e) {
|
|
65
65
|
e.stopPropagation(), e.preventDefault();
|
|
66
66
|
let r;
|
|
67
67
|
t.direction === "vertical" ? r = s + e.clientY - d : r = s + e.clientX - d;
|
|
68
|
-
const a = r /
|
|
68
|
+
const a = r / p / (100 - t.barLength) * 1e4;
|
|
69
69
|
n.value = L(a), t.onScroll?.(o(n));
|
|
70
70
|
}
|
|
71
71
|
function S(e) {
|
|
@@ -83,12 +83,12 @@ const K = /* @__PURE__ */ V({
|
|
|
83
83
|
bar: l,
|
|
84
84
|
track: i,
|
|
85
85
|
scroll: $
|
|
86
|
-
}), (e, r) => (
|
|
86
|
+
}), (e, r) => (U(), N("div", {
|
|
87
87
|
ref_key: "container",
|
|
88
88
|
ref: m,
|
|
89
|
-
class: b([o(M)(), o(
|
|
90
|
-
style:
|
|
91
|
-
o(
|
|
89
|
+
class: b([o(M)(), o(R)(e.direction), o(P)]),
|
|
90
|
+
style: X(
|
|
91
|
+
o(B)(
|
|
92
92
|
{
|
|
93
93
|
"bar-color": e.barColor,
|
|
94
94
|
"track-color": e.trackColor,
|
|
@@ -126,5 +126,5 @@ const K = /* @__PURE__ */ V({
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
export {
|
|
129
|
-
|
|
129
|
+
O as default
|
|
130
130
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InternalScrollBarExpose } from '../../scroll-bar';
|
|
2
|
-
import {
|
|
2
|
+
import { ShallowRef } from 'vue';
|
|
3
3
|
declare const useScrollWrapper: () => {
|
|
4
4
|
maxScrollDistance: {
|
|
5
5
|
x: number;
|
|
@@ -9,11 +9,11 @@ declare const useScrollWrapper: () => {
|
|
|
9
9
|
x: number;
|
|
10
10
|
y: number;
|
|
11
11
|
};
|
|
12
|
-
xBarRef:
|
|
13
|
-
yBarRef:
|
|
12
|
+
xBarRef: ShallowRef<InternalScrollBarExpose | undefined, InternalScrollBarExpose | undefined>;
|
|
13
|
+
yBarRef: ShallowRef<InternalScrollBarExpose | undefined, InternalScrollBarExpose | undefined>;
|
|
14
14
|
scrollYBar: () => void;
|
|
15
15
|
scrollXBar: () => void;
|
|
16
|
-
containerRef:
|
|
16
|
+
containerRef: ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
17
17
|
updateMaxScrollDistance: () => void;
|
|
18
18
|
};
|
|
19
19
|
export default useScrollWrapper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getScrollable as r } from "../../scroll-bar/utils/index.mjs";
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
const t =
|
|
2
|
+
import { shallowRef as n, reactive as f, watch as p, unref as b } from "vue";
|
|
3
|
+
const h = () => {
|
|
4
|
+
const t = n(), c = f({ x: 0, y: 0 }), a = f({ x: 0, y: 0 }), i = n(), s = n();
|
|
5
5
|
p(
|
|
6
6
|
() => t.value,
|
|
7
7
|
() => {
|
|
@@ -12,33 +12,33 @@ const B = () => {
|
|
|
12
12
|
const e = b(t);
|
|
13
13
|
if (!e)
|
|
14
14
|
return;
|
|
15
|
-
const { visibleSize:
|
|
15
|
+
const { visibleSize: l, totalSize: o } = r(
|
|
16
16
|
e,
|
|
17
17
|
"horizontal"
|
|
18
18
|
), { visibleSize: z, totalSize: x } = r(e, "vertical");
|
|
19
|
-
c.x =
|
|
19
|
+
c.x = o - l, c.y = x - z;
|
|
20
20
|
}
|
|
21
21
|
function v() {
|
|
22
22
|
if (!t.value)
|
|
23
23
|
return;
|
|
24
|
-
const { totalSize: e, visibleSize:
|
|
24
|
+
const { totalSize: e, visibleSize: l } = r(
|
|
25
25
|
t.value,
|
|
26
26
|
"vertical"
|
|
27
|
-
),
|
|
28
|
-
s.value?.scroll(
|
|
27
|
+
), o = a.y / (e - l || 1) * 100;
|
|
28
|
+
s.value?.scroll(o);
|
|
29
29
|
}
|
|
30
30
|
function S() {
|
|
31
31
|
if (!t.value)
|
|
32
32
|
return;
|
|
33
|
-
const { totalSize: e, visibleSize:
|
|
33
|
+
const { totalSize: e, visibleSize: l } = r(
|
|
34
34
|
t.value,
|
|
35
35
|
"horizontal"
|
|
36
|
-
),
|
|
37
|
-
i.value?.scroll(
|
|
36
|
+
), o = a.x / (e - l || 1) * 100;
|
|
37
|
+
i.value?.scroll(o);
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
maxScrollDistance: c,
|
|
41
|
-
scrollOffset:
|
|
41
|
+
scrollOffset: a,
|
|
42
42
|
xBarRef: i,
|
|
43
43
|
yBarRef: s,
|
|
44
44
|
scrollYBar: v,
|
|
@@ -48,5 +48,5 @@ const B = () => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
h as default
|
|
52
52
|
};
|