@honed/table 0.3.2 → 0.4.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/dist/index.d.ts +19 -5
- package/dist/index.es.js +290 -281
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,15 @@ export declare interface Table<RecordType extends Record<string, any> = any, Pag
|
|
|
105
105
|
meta: Record<string, any>;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
export declare interface TableColumn<T extends Record<string, any>> extends Column<T> {
|
|
109
|
+
toggle: (options: VisitOptions) => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare interface TableHeading<T extends Record<string, any>> extends Column<T> {
|
|
113
|
+
isSorting: boolean;
|
|
114
|
+
toggleSort: (options: VisitOptions) => void;
|
|
115
|
+
}
|
|
116
|
+
|
|
108
117
|
export declare interface TableOptions<RecordType extends Record<string, any>> {
|
|
109
118
|
/**
|
|
110
119
|
* Actions to be applied on a record in JavaScript.
|
|
@@ -114,7 +123,7 @@ export declare interface TableOptions<RecordType extends Record<string, any>> {
|
|
|
114
123
|
|
|
115
124
|
export declare interface TableRecord<RecordType extends Record<string, any>> {
|
|
116
125
|
record: RecordType;
|
|
117
|
-
default: (options
|
|
126
|
+
default: (options?: VisitOptions) => void;
|
|
118
127
|
actions: InlineAction[];
|
|
119
128
|
select: () => void;
|
|
120
129
|
deselect: () => void;
|
|
@@ -125,6 +134,8 @@ export declare interface TableRecord<RecordType extends Record<string, any>> {
|
|
|
125
134
|
extra: (column: Column<RecordType> | string) => any;
|
|
126
135
|
}
|
|
127
136
|
|
|
137
|
+
export declare type UseTable = typeof useTable;
|
|
138
|
+
|
|
128
139
|
export declare function useTable<Props extends object, Key extends Props[keyof Props] extends Refine ? keyof Props : never, RecordType extends Record<string, any> = any, Paginator extends PaginatorKind = "length-aware">(props: Props, key: Key, tableOptions?: TableOptions<RecordType>, defaultOptions?: VisitOptions): {
|
|
129
140
|
filters: {
|
|
130
141
|
apply: (value: Props, options?: Partial<Visit & VisitCallbacks> | undefined) => void;
|
|
@@ -135,6 +146,7 @@ export declare function useTable<Props extends object, Key extends Props[keyof P
|
|
|
135
146
|
} | undefined;
|
|
136
147
|
type: string;
|
|
137
148
|
value: FilterValue;
|
|
149
|
+
/** Selects this record */
|
|
138
150
|
options: Option_2[];
|
|
139
151
|
multiple: boolean;
|
|
140
152
|
name: string;
|
|
@@ -161,7 +173,9 @@ export declare function useTable<Props extends object, Key extends Props[keyof P
|
|
|
161
173
|
clear: (options?: Partial<Visit & VisitCallbacks> | undefined) => void;
|
|
162
174
|
bind: () => {
|
|
163
175
|
"onUpdate:modelValue": PromisifyFn<(value: any) => void>;
|
|
164
|
-
modelValue: boolean;
|
|
176
|
+
modelValue: boolean; /**
|
|
177
|
+
* The available bulk actions.
|
|
178
|
+
*/
|
|
165
179
|
value: string;
|
|
166
180
|
} | undefined;
|
|
167
181
|
type: string;
|
|
@@ -173,9 +187,9 @@ export declare function useTable<Props extends object, Key extends Props[keyof P
|
|
|
173
187
|
getFilter: (name: string) => Filter | undefined;
|
|
174
188
|
getSort: (name: string, direction?: Direction | undefined) => Sort | undefined;
|
|
175
189
|
getSearch: (name: string) => Search | undefined;
|
|
176
|
-
currentFilters:
|
|
177
|
-
currentSort:
|
|
178
|
-
currentSearches:
|
|
190
|
+
currentFilters: Filter[];
|
|
191
|
+
currentSort: Sort | undefined;
|
|
192
|
+
currentSearches: Search[];
|
|
179
193
|
isFiltering: (name?: string | Filter | undefined) => boolean;
|
|
180
194
|
isSorting: (name?: string | Sort | undefined) => boolean;
|
|
181
195
|
isSearching: (name?: string | Search | undefined) => boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as _, computed as
|
|
2
|
-
import { router as
|
|
1
|
+
import { ref as _, computed as p, toValue as J, reactive as Q } from "vue";
|
|
2
|
+
import { router as x } from "@inertiajs/vue3";
|
|
3
3
|
function X() {
|
|
4
4
|
const o = _({
|
|
5
5
|
all: !1,
|
|
@@ -9,274 +9,277 @@ function X() {
|
|
|
9
9
|
function m() {
|
|
10
10
|
o.value.all = !0, o.value.only.clear(), o.value.except.clear();
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function d() {
|
|
13
13
|
o.value.all = !1, o.value.only.clear(), o.value.except.clear();
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
15
|
+
function a(...c) {
|
|
16
|
+
c.forEach((g) => o.value.except.delete(g)), c.forEach((g) => o.value.only.add(g));
|
|
17
17
|
}
|
|
18
|
-
function i(...
|
|
19
|
-
|
|
18
|
+
function i(...c) {
|
|
19
|
+
c.forEach((g) => o.value.except.add(g)), c.forEach((g) => o.value.only.delete(g));
|
|
20
20
|
}
|
|
21
|
-
function u(
|
|
22
|
-
if (b(
|
|
23
|
-
return i(
|
|
24
|
-
if (!b(
|
|
25
|
-
return
|
|
21
|
+
function u(c, g) {
|
|
22
|
+
if (b(c) || g === !1)
|
|
23
|
+
return i(c);
|
|
24
|
+
if (!b(c) || g === !0)
|
|
25
|
+
return a(c);
|
|
26
26
|
}
|
|
27
|
-
function b(
|
|
28
|
-
return o.value.all ? !o.value.except.has(
|
|
27
|
+
function b(c) {
|
|
28
|
+
return o.value.all ? !o.value.except.has(c) : o.value.only.has(c);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
function
|
|
30
|
+
const f = p(() => o.value.all && o.value.except.size === 0), A = p(() => o.value.only.size > 0 || f.value);
|
|
31
|
+
function S(c) {
|
|
32
32
|
return {
|
|
33
|
-
"onUpdate:modelValue": (
|
|
34
|
-
|
|
33
|
+
"onUpdate:modelValue": (g) => {
|
|
34
|
+
g ? a(c) : i(c);
|
|
35
35
|
},
|
|
36
|
-
modelValue: b(
|
|
37
|
-
value:
|
|
36
|
+
modelValue: b(c),
|
|
37
|
+
value: c
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function k() {
|
|
41
41
|
return {
|
|
42
|
-
"onUpdate:modelValue": (
|
|
43
|
-
|
|
42
|
+
"onUpdate:modelValue": (c) => {
|
|
43
|
+
c ? m() : d();
|
|
44
44
|
},
|
|
45
|
-
modelValue:
|
|
46
|
-
value:
|
|
45
|
+
modelValue: f.value,
|
|
46
|
+
value: f.value
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
|
-
allSelected:
|
|
50
|
+
allSelected: f,
|
|
51
51
|
selection: o,
|
|
52
52
|
hasSelected: A,
|
|
53
53
|
selectAll: m,
|
|
54
|
-
deselectAll:
|
|
55
|
-
select:
|
|
54
|
+
deselectAll: d,
|
|
55
|
+
select: a,
|
|
56
56
|
deselect: i,
|
|
57
57
|
toggle: u,
|
|
58
58
|
selected: b,
|
|
59
|
-
bind:
|
|
59
|
+
bind: S,
|
|
60
60
|
bindAll: k
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function I(o, m,
|
|
64
|
-
return o.route ? (
|
|
65
|
-
...
|
|
63
|
+
function I(o, m, d = {}, a = {}) {
|
|
64
|
+
return o.route ? (x.visit(o.route.href, {
|
|
65
|
+
...a,
|
|
66
66
|
method: o.route.method
|
|
67
|
-
}), !0) : o.action && m ? (
|
|
67
|
+
}), !0) : o.action && m ? (x.post(
|
|
68
68
|
m,
|
|
69
69
|
{
|
|
70
|
-
...
|
|
70
|
+
...d,
|
|
71
71
|
name: o.name,
|
|
72
72
|
type: o.type
|
|
73
73
|
},
|
|
74
|
-
|
|
74
|
+
a
|
|
75
75
|
), !0) : !1;
|
|
76
76
|
}
|
|
77
77
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
78
78
|
const Y = () => {
|
|
79
79
|
};
|
|
80
80
|
function Z(o, m) {
|
|
81
|
-
function
|
|
81
|
+
function d(...a) {
|
|
82
82
|
return new Promise((i, u) => {
|
|
83
|
-
Promise.resolve(o(() => m.apply(this,
|
|
83
|
+
Promise.resolve(o(() => m.apply(this, a), { fn: m, thisArg: this, args: a })).then(i).catch(u);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return d;
|
|
87
87
|
}
|
|
88
88
|
function O(o, m = {}) {
|
|
89
|
-
let
|
|
90
|
-
const u = (
|
|
91
|
-
clearTimeout(
|
|
89
|
+
let d, a, i = Y;
|
|
90
|
+
const u = (f) => {
|
|
91
|
+
clearTimeout(f), i(), i = Y;
|
|
92
92
|
};
|
|
93
93
|
let b;
|
|
94
|
-
return (
|
|
95
|
-
const A = J(o),
|
|
96
|
-
return
|
|
97
|
-
i = m.rejectOnCancel ?
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
94
|
+
return (f) => {
|
|
95
|
+
const A = J(o), S = J(m.maxWait);
|
|
96
|
+
return d && u(d), A <= 0 || S !== void 0 && S <= 0 ? (a && (u(a), a = null), Promise.resolve(f())) : new Promise((k, c) => {
|
|
97
|
+
i = m.rejectOnCancel ? c : k, b = f, S && !a && (a = setTimeout(() => {
|
|
98
|
+
d && u(d), a = null, k(b());
|
|
99
|
+
}, S)), d = setTimeout(() => {
|
|
100
|
+
a && u(a), a = null, k(f());
|
|
101
101
|
}, A);
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function q(o, m = 200,
|
|
105
|
+
function q(o, m = 200, d = {}) {
|
|
106
106
|
return Z(
|
|
107
|
-
O(m,
|
|
107
|
+
O(m, d),
|
|
108
108
|
o
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
function ee(o, m,
|
|
112
|
-
const
|
|
111
|
+
function ee(o, m, d = {}) {
|
|
112
|
+
const a = p(() => o[m]), i = p(
|
|
113
113
|
() => {
|
|
114
114
|
var e;
|
|
115
|
-
return ((e =
|
|
115
|
+
return ((e = a.value.filters) == null ? void 0 : e.map((n) => ({
|
|
116
116
|
...n,
|
|
117
|
-
apply: (
|
|
118
|
-
clear: (
|
|
119
|
-
bind: () =>
|
|
117
|
+
apply: (r, v = {}) => L(n, r, v),
|
|
118
|
+
clear: (r = {}) => N(n, r),
|
|
119
|
+
bind: () => l(n.name)
|
|
120
120
|
}))) ?? [];
|
|
121
121
|
}
|
|
122
|
-
), u =
|
|
122
|
+
), u = p(
|
|
123
123
|
() => {
|
|
124
124
|
var e;
|
|
125
|
-
return ((e =
|
|
125
|
+
return ((e = a.value.sorts) == null ? void 0 : e.map((n) => ({
|
|
126
126
|
...n,
|
|
127
|
-
apply: (
|
|
128
|
-
clear: (
|
|
129
|
-
bind: () =>
|
|
127
|
+
apply: (r = {}) => M(n, n.direction, r),
|
|
128
|
+
clear: (r = {}) => z(r),
|
|
129
|
+
bind: () => s(n)
|
|
130
130
|
}))) ?? [];
|
|
131
131
|
}
|
|
132
|
-
), b =
|
|
132
|
+
), b = p(
|
|
133
133
|
() => {
|
|
134
134
|
var e;
|
|
135
|
-
return (e =
|
|
135
|
+
return (e = a.value.searches) == null ? void 0 : e.map((n) => ({
|
|
136
136
|
...n,
|
|
137
|
-
apply: (
|
|
138
|
-
clear: (
|
|
139
|
-
bind: () =>
|
|
137
|
+
apply: (r = {}) => U(n, r),
|
|
138
|
+
clear: (r = {}) => U(n, r),
|
|
139
|
+
bind: () => F(n)
|
|
140
140
|
}));
|
|
141
141
|
}
|
|
142
|
+
), f = p(
|
|
143
|
+
() => {
|
|
144
|
+
var e;
|
|
145
|
+
return ((e = a.value.filters) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
146
|
+
}
|
|
147
|
+
), A = p(
|
|
148
|
+
() => {
|
|
149
|
+
var e;
|
|
150
|
+
return (e = a.value.sorts) == null ? void 0 : e.find(({ active: n }) => n);
|
|
151
|
+
}
|
|
152
|
+
), S = p(
|
|
153
|
+
() => {
|
|
154
|
+
var e;
|
|
155
|
+
return ((e = a.value.searches) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
156
|
+
}
|
|
142
157
|
);
|
|
143
|
-
function
|
|
144
|
-
return Array.isArray(e) ? e.join(
|
|
158
|
+
function k(e) {
|
|
159
|
+
return Array.isArray(e) ? e.join(a.value.config.delimiter) : e;
|
|
145
160
|
}
|
|
146
|
-
function
|
|
161
|
+
function c(e) {
|
|
147
162
|
return typeof e != "string" ? e : e.trim().replace(/\s+/g, "+");
|
|
148
163
|
}
|
|
149
|
-
function
|
|
164
|
+
function g(e) {
|
|
150
165
|
if (!["", null, void 0, []].includes(e))
|
|
151
166
|
return e;
|
|
152
167
|
}
|
|
153
|
-
function
|
|
154
|
-
return [
|
|
155
|
-
(n,
|
|
168
|
+
function B(e) {
|
|
169
|
+
return [k, c, g].reduce(
|
|
170
|
+
(n, r) => r(n),
|
|
156
171
|
e
|
|
157
172
|
);
|
|
158
173
|
}
|
|
159
|
-
function
|
|
160
|
-
return n = Array.isArray(n) ? n : [n], n.includes(e) ? n.filter((
|
|
174
|
+
function j(e, n) {
|
|
175
|
+
return n = Array.isArray(n) ? n : [n], n.includes(e) ? n.filter((r) => r !== e) : [...n, e];
|
|
161
176
|
}
|
|
162
|
-
function
|
|
177
|
+
function C(e) {
|
|
163
178
|
var n;
|
|
164
|
-
return (n =
|
|
179
|
+
return (n = a.value.filters) == null ? void 0 : n.find((r) => r.name === e);
|
|
165
180
|
}
|
|
166
|
-
function
|
|
167
|
-
var
|
|
168
|
-
return (
|
|
169
|
-
(
|
|
181
|
+
function h(e, n = null) {
|
|
182
|
+
var r;
|
|
183
|
+
return (r = a.value.sorts) == null ? void 0 : r.find(
|
|
184
|
+
(v) => v.name === e && v.direction === n
|
|
170
185
|
);
|
|
171
186
|
}
|
|
172
|
-
function
|
|
187
|
+
function E(e) {
|
|
173
188
|
var n;
|
|
174
|
-
return (n =
|
|
175
|
-
}
|
|
176
|
-
function z() {
|
|
177
|
-
var e;
|
|
178
|
-
return ((e = l.value.filters) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
179
|
-
}
|
|
180
|
-
function g() {
|
|
181
|
-
var e;
|
|
182
|
-
return (e = l.value.sorts) == null ? void 0 : e.find(({ active: n }) => n);
|
|
183
|
-
}
|
|
184
|
-
function L() {
|
|
185
|
-
var e;
|
|
186
|
-
return ((e = l.value.searches) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
189
|
+
return (n = a.value.searches) == null ? void 0 : n.find((r) => r.name === e);
|
|
187
190
|
}
|
|
188
191
|
function y(e) {
|
|
189
|
-
return e ? typeof e == "string" ?
|
|
192
|
+
return e ? typeof e == "string" ? f.value.some((n) => n.name === e) : e.active : !!f.value.length;
|
|
190
193
|
}
|
|
191
194
|
function K(e) {
|
|
192
195
|
var n;
|
|
193
|
-
return e ? typeof e == "string" ? ((n =
|
|
196
|
+
return e ? typeof e == "string" ? ((n = A.value) == null ? void 0 : n.name) === e : e.active : !!A.value;
|
|
194
197
|
}
|
|
195
|
-
function
|
|
196
|
-
var n
|
|
197
|
-
return e ? typeof e == "string" ? (
|
|
198
|
+
function P(e) {
|
|
199
|
+
var n;
|
|
200
|
+
return e ? typeof e == "string" ? (n = S.value) == null ? void 0 : n.some((r) => r.name === e) : e.active : !!a.value.config.search;
|
|
198
201
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
201
|
-
Object.entries(e).map(([
|
|
202
|
+
function W(e, n = {}) {
|
|
203
|
+
const r = Object.fromEntries(
|
|
204
|
+
Object.entries(e).map(([v, V]) => [v, B(V)])
|
|
202
205
|
);
|
|
203
|
-
|
|
204
|
-
...
|
|
206
|
+
x.reload({
|
|
207
|
+
...d,
|
|
205
208
|
...n,
|
|
206
|
-
data:
|
|
209
|
+
data: r
|
|
207
210
|
});
|
|
208
211
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
+
function L(e, n, r = {}) {
|
|
213
|
+
const v = typeof e == "string" ? C(e) : e;
|
|
214
|
+
if (!v) {
|
|
212
215
|
console.warn(`Filter [${e}] does not exist.`);
|
|
213
216
|
return;
|
|
214
217
|
}
|
|
215
|
-
"multiple" in
|
|
216
|
-
...
|
|
217
|
-
...
|
|
218
|
+
"multiple" in v && v.multiple && n !== void 0 && (n = j(n, v.value)), x.reload({
|
|
219
|
+
...d,
|
|
220
|
+
...r,
|
|
218
221
|
data: {
|
|
219
|
-
[
|
|
222
|
+
[v.name]: B(n)
|
|
220
223
|
}
|
|
221
224
|
});
|
|
222
225
|
}
|
|
223
|
-
function M(e, n = null,
|
|
224
|
-
const
|
|
225
|
-
if (!
|
|
226
|
+
function M(e, n = null, r = {}) {
|
|
227
|
+
const v = typeof e == "string" ? h(e, n) : e;
|
|
228
|
+
if (!v) {
|
|
226
229
|
console.warn(`Sort [${e}] does not exist.`);
|
|
227
230
|
return;
|
|
228
231
|
}
|
|
229
|
-
|
|
230
|
-
...
|
|
231
|
-
...
|
|
232
|
+
x.reload({
|
|
233
|
+
...d,
|
|
234
|
+
...r,
|
|
232
235
|
data: {
|
|
233
|
-
[
|
|
236
|
+
[a.value.config.sorts]: g(v.next)
|
|
234
237
|
}
|
|
235
238
|
});
|
|
236
239
|
}
|
|
237
240
|
function T(e, n = {}) {
|
|
238
|
-
e = [
|
|
239
|
-
(
|
|
241
|
+
e = [c, g].reduce(
|
|
242
|
+
(r, v) => v(r),
|
|
240
243
|
e
|
|
241
|
-
),
|
|
242
|
-
...
|
|
244
|
+
), x.reload({
|
|
245
|
+
...d,
|
|
243
246
|
...n,
|
|
244
247
|
data: {
|
|
245
|
-
[
|
|
248
|
+
[a.value.config.searches]: e
|
|
246
249
|
}
|
|
247
250
|
});
|
|
248
251
|
}
|
|
249
252
|
function U(e, n = {}) {
|
|
250
|
-
if (!
|
|
253
|
+
if (!a.value.config.matches) {
|
|
251
254
|
console.warn("Matches key is not set.");
|
|
252
255
|
return;
|
|
253
256
|
}
|
|
254
|
-
const
|
|
255
|
-
if (!
|
|
257
|
+
const r = typeof e == "string" ? E(e) : e;
|
|
258
|
+
if (!r) {
|
|
256
259
|
console.warn(`Match [${e}] does not exist.`);
|
|
257
260
|
return;
|
|
258
261
|
}
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
const v = j(
|
|
263
|
+
r.name,
|
|
264
|
+
S.value.map(({ name: V }) => V)
|
|
262
265
|
);
|
|
263
|
-
|
|
264
|
-
...
|
|
266
|
+
x.reload({
|
|
267
|
+
...d,
|
|
265
268
|
...n,
|
|
266
269
|
data: {
|
|
267
|
-
[
|
|
270
|
+
[a.value.config.matches]: k(v)
|
|
268
271
|
}
|
|
269
272
|
});
|
|
270
273
|
}
|
|
271
274
|
function N(e, n = {}) {
|
|
272
|
-
|
|
275
|
+
L(e, void 0, n);
|
|
273
276
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
...
|
|
277
|
+
function z(e = {}) {
|
|
278
|
+
x.reload({
|
|
279
|
+
...d,
|
|
277
280
|
...e,
|
|
278
281
|
data: {
|
|
279
|
-
[
|
|
282
|
+
[a.value.config.sorts]: void 0
|
|
280
283
|
}
|
|
281
284
|
});
|
|
282
285
|
}
|
|
@@ -284,170 +287,170 @@ function ee(o, m, v = {}) {
|
|
|
284
287
|
T(void 0, e);
|
|
285
288
|
}
|
|
286
289
|
function D(e = {}) {
|
|
287
|
-
if (!
|
|
290
|
+
if (!a.value.config.matches) {
|
|
288
291
|
console.warn("Matches key is not set.");
|
|
289
292
|
return;
|
|
290
293
|
}
|
|
291
|
-
|
|
292
|
-
...
|
|
294
|
+
x.reload({
|
|
295
|
+
...d,
|
|
293
296
|
...e,
|
|
294
297
|
data: {
|
|
295
|
-
[
|
|
298
|
+
[a.value.config.matches]: void 0
|
|
296
299
|
}
|
|
297
300
|
});
|
|
298
301
|
}
|
|
299
302
|
function t(e = {}) {
|
|
300
303
|
var n;
|
|
301
|
-
|
|
302
|
-
...
|
|
304
|
+
x.reload({
|
|
305
|
+
...d,
|
|
303
306
|
...e,
|
|
304
307
|
data: {
|
|
305
|
-
[
|
|
306
|
-
[
|
|
308
|
+
[a.value.config.searches]: void 0,
|
|
309
|
+
[a.value.config.sorts]: void 0,
|
|
310
|
+
[a.value.config.matches]: void 0,
|
|
307
311
|
...Object.fromEntries(
|
|
308
|
-
((n =
|
|
309
|
-
|
|
312
|
+
((n = a.value.filters) == null ? void 0 : n.map((r) => [
|
|
313
|
+
r.name,
|
|
310
314
|
void 0
|
|
311
315
|
])) ?? []
|
|
312
|
-
)
|
|
313
|
-
...l.value.config.matches ? { [l.value.config.matches]: void 0 } : {}
|
|
316
|
+
)
|
|
314
317
|
}
|
|
315
318
|
});
|
|
316
319
|
}
|
|
317
|
-
function
|
|
318
|
-
const
|
|
319
|
-
if (!
|
|
320
|
+
function l(e, n = {}) {
|
|
321
|
+
const r = typeof e == "string" ? C(e) : e;
|
|
322
|
+
if (!r) {
|
|
320
323
|
console.warn(`Filter [${e}] does not exist.`);
|
|
321
324
|
return;
|
|
322
325
|
}
|
|
323
|
-
const
|
|
324
|
-
debounce:
|
|
325
|
-
transform:
|
|
326
|
+
const v = r.value, {
|
|
327
|
+
debounce: V = 250,
|
|
328
|
+
transform: G = (H) => H,
|
|
326
329
|
...$
|
|
327
330
|
} = n;
|
|
328
331
|
return {
|
|
329
332
|
"onUpdate:modelValue": q((H) => {
|
|
330
|
-
|
|
331
|
-
},
|
|
332
|
-
modelValue:
|
|
333
|
+
L(r, G(H), $);
|
|
334
|
+
}, V),
|
|
335
|
+
modelValue: v
|
|
333
336
|
};
|
|
334
337
|
}
|
|
335
|
-
function
|
|
336
|
-
const
|
|
337
|
-
if (!
|
|
338
|
+
function s(e, n = {}) {
|
|
339
|
+
const r = typeof e == "string" ? h(e) : e;
|
|
340
|
+
if (!r) {
|
|
338
341
|
console.warn(`Sort [${e}] does not exist.`);
|
|
339
342
|
return;
|
|
340
343
|
}
|
|
341
|
-
const { debounce:
|
|
344
|
+
const { debounce: v = 0, transform: V, ...G } = n;
|
|
342
345
|
return {
|
|
343
346
|
onClick: q(() => {
|
|
344
347
|
var $;
|
|
345
|
-
M(
|
|
346
|
-
},
|
|
348
|
+
M(r, ($ = A.value) == null ? void 0 : $.direction, G);
|
|
349
|
+
}, v)
|
|
347
350
|
};
|
|
348
351
|
}
|
|
349
352
|
function w(e = {}) {
|
|
350
|
-
const { debounce: n = 700, transform:
|
|
353
|
+
const { debounce: n = 700, transform: r, ...v } = e;
|
|
351
354
|
return {
|
|
352
355
|
"onUpdate:modelValue": q(
|
|
353
|
-
(
|
|
354
|
-
T(
|
|
356
|
+
(V) => {
|
|
357
|
+
T(V, v);
|
|
355
358
|
},
|
|
356
359
|
n
|
|
357
360
|
),
|
|
358
|
-
modelValue:
|
|
361
|
+
modelValue: a.value.config.search ?? ""
|
|
359
362
|
};
|
|
360
363
|
}
|
|
361
|
-
function
|
|
362
|
-
const
|
|
363
|
-
if (!
|
|
364
|
+
function F(e, n = {}) {
|
|
365
|
+
const r = typeof e == "string" ? E(e) : e;
|
|
366
|
+
if (!r) {
|
|
364
367
|
console.warn(`Match [${e}] does not exist.`);
|
|
365
368
|
return;
|
|
366
369
|
}
|
|
367
|
-
const { debounce:
|
|
370
|
+
const { debounce: v = 0, transform: V, ...G } = n;
|
|
368
371
|
return {
|
|
369
372
|
"onUpdate:modelValue": q(($) => {
|
|
370
|
-
U($,
|
|
371
|
-
},
|
|
372
|
-
modelValue:
|
|
373
|
-
value:
|
|
373
|
+
U($, G);
|
|
374
|
+
}, v),
|
|
375
|
+
modelValue: P(r),
|
|
376
|
+
value: r.name
|
|
374
377
|
};
|
|
375
378
|
}
|
|
376
379
|
return {
|
|
377
380
|
filters: i,
|
|
378
381
|
sorts: u,
|
|
379
382
|
searches: b,
|
|
380
|
-
getFilter:
|
|
381
|
-
getSort:
|
|
382
|
-
getSearch:
|
|
383
|
-
currentFilters:
|
|
384
|
-
currentSort:
|
|
385
|
-
currentSearches:
|
|
383
|
+
getFilter: C,
|
|
384
|
+
getSort: h,
|
|
385
|
+
getSearch: E,
|
|
386
|
+
currentFilters: f,
|
|
387
|
+
currentSort: A,
|
|
388
|
+
currentSearches: S,
|
|
386
389
|
isFiltering: y,
|
|
387
390
|
isSorting: K,
|
|
388
|
-
isSearching:
|
|
389
|
-
apply:
|
|
390
|
-
applyFilter:
|
|
391
|
+
isSearching: P,
|
|
392
|
+
apply: W,
|
|
393
|
+
applyFilter: L,
|
|
391
394
|
applySort: M,
|
|
392
395
|
applySearch: T,
|
|
393
396
|
applyMatch: U,
|
|
394
397
|
clearFilter: N,
|
|
395
|
-
clearSort:
|
|
398
|
+
clearSort: z,
|
|
396
399
|
clearSearch: R,
|
|
397
400
|
clearMatch: D,
|
|
398
401
|
reset: t,
|
|
399
|
-
bindFilter:
|
|
400
|
-
bindSort:
|
|
402
|
+
bindFilter: l,
|
|
403
|
+
bindSort: s,
|
|
401
404
|
bindSearch: w,
|
|
402
|
-
bindMatch:
|
|
403
|
-
stringValue:
|
|
404
|
-
omitValue:
|
|
405
|
-
toggleValue:
|
|
406
|
-
delimitArray:
|
|
405
|
+
bindMatch: F,
|
|
406
|
+
stringValue: c,
|
|
407
|
+
omitValue: g,
|
|
408
|
+
toggleValue: j,
|
|
409
|
+
delimitArray: k
|
|
407
410
|
};
|
|
408
411
|
}
|
|
409
|
-
function
|
|
412
|
+
function ae(o, m, d = {}, a = {}) {
|
|
410
413
|
if (!o || !m || !o[m])
|
|
411
414
|
throw new Error("Table has not been provided with valid props and key.");
|
|
412
|
-
|
|
413
|
-
...
|
|
414
|
-
only: [...
|
|
415
|
+
a = {
|
|
416
|
+
...a,
|
|
417
|
+
only: [...a.only ?? [], m.toString()]
|
|
415
418
|
};
|
|
416
|
-
const i =
|
|
419
|
+
const i = p(() => o[m]), u = X(), b = ee(o, m, a), f = p(() => i.value.config), A = p(() => i.value.meta), S = p(
|
|
417
420
|
() => {
|
|
418
421
|
var t;
|
|
419
|
-
return ((t = i.value.columns) == null ? void 0 : t.filter(({ active:
|
|
420
|
-
var
|
|
422
|
+
return ((t = i.value.columns) == null ? void 0 : t.filter(({ active: l, hidden: s }) => l && !s).map((l) => {
|
|
423
|
+
var s;
|
|
421
424
|
return {
|
|
422
|
-
...
|
|
423
|
-
isSorting: (
|
|
424
|
-
toggleSort: (w = {}) => U(
|
|
425
|
+
...l,
|
|
426
|
+
isSorting: (s = l.sort) == null ? void 0 : s.active,
|
|
427
|
+
toggleSort: (w = {}) => U(l, w)
|
|
425
428
|
};
|
|
426
429
|
})) ?? [];
|
|
427
430
|
}
|
|
428
|
-
), k =
|
|
431
|
+
), k = p(
|
|
429
432
|
() => {
|
|
430
433
|
var t;
|
|
431
|
-
return ((t = i.value.columns) == null ? void 0 : t.filter(({ hidden:
|
|
432
|
-
...
|
|
433
|
-
toggle: (
|
|
434
|
+
return ((t = i.value.columns) == null ? void 0 : t.filter(({ hidden: l }) => !l).map((l) => ({
|
|
435
|
+
...l,
|
|
436
|
+
toggle: (s = {}) => N(l, s)
|
|
434
437
|
}))) ?? [];
|
|
435
438
|
}
|
|
436
|
-
),
|
|
439
|
+
), c = p(
|
|
437
440
|
() => i.value.records.map((t) => ({
|
|
438
|
-
record: (({ actions:
|
|
441
|
+
record: (({ actions: l, ...s }) => s)(t),
|
|
439
442
|
/** Perform this action when the record is clicked */
|
|
440
|
-
default: (
|
|
441
|
-
const
|
|
443
|
+
default: (l = {}) => {
|
|
444
|
+
const s = t.actions.find(
|
|
442
445
|
(w) => w.default
|
|
443
446
|
);
|
|
444
|
-
|
|
447
|
+
s && W(s, t, l);
|
|
445
448
|
},
|
|
446
449
|
/** The actions available for the record */
|
|
447
|
-
actions: t.actions.map((
|
|
448
|
-
...
|
|
450
|
+
actions: t.actions.map((l) => ({
|
|
451
|
+
...l,
|
|
449
452
|
/** Executes this action */
|
|
450
|
-
execute: (
|
|
453
|
+
execute: (s = {}) => W(l, t, s)
|
|
451
454
|
})),
|
|
452
455
|
/** Selects this record */
|
|
453
456
|
select: () => u.select(y(t)),
|
|
@@ -460,144 +463,150 @@ function le(o, m, v = {}, l = {}) {
|
|
|
460
463
|
/** Bind the record to a checkbox */
|
|
461
464
|
bind: () => u.bind(y(t)),
|
|
462
465
|
/** Get the value of the record for the column */
|
|
463
|
-
value: (
|
|
466
|
+
value: (l) => {
|
|
467
|
+
var s;
|
|
468
|
+
return (s = t[K(l)]) == null ? void 0 : s.value;
|
|
469
|
+
},
|
|
464
470
|
/** Get the extra data of the record for the column */
|
|
465
|
-
extra: (
|
|
471
|
+
extra: (l) => {
|
|
472
|
+
var s;
|
|
473
|
+
return (s = t[K(l)]) == null ? void 0 : s.extra;
|
|
474
|
+
}
|
|
466
475
|
}))
|
|
467
|
-
),
|
|
476
|
+
), g = p(
|
|
468
477
|
() => i.value.actions.bulk.map((t) => ({
|
|
469
478
|
...t,
|
|
470
479
|
/** Executes this bulk action */
|
|
471
|
-
execute: (
|
|
480
|
+
execute: (l = {}) => L(t, l)
|
|
472
481
|
}))
|
|
473
|
-
),
|
|
482
|
+
), B = p(
|
|
474
483
|
() => i.value.actions.page.map((t) => ({
|
|
475
484
|
...t,
|
|
476
485
|
/** Executes this page action */
|
|
477
|
-
execute: (
|
|
486
|
+
execute: (l = {}) => M(t, l)
|
|
478
487
|
}))
|
|
479
|
-
),
|
|
488
|
+
), j = p(
|
|
480
489
|
() => {
|
|
481
490
|
var t;
|
|
482
|
-
return ((t = i.value.recordsPerPage) == null ? void 0 : t.map((
|
|
483
|
-
...
|
|
491
|
+
return ((t = i.value.recordsPerPage) == null ? void 0 : t.map((l) => ({
|
|
492
|
+
...l,
|
|
484
493
|
/** Changes the number of records to display per page */
|
|
485
|
-
apply: (
|
|
494
|
+
apply: (s = {}) => T(l, s)
|
|
486
495
|
}))) ?? [];
|
|
487
496
|
}
|
|
488
|
-
),
|
|
497
|
+
), C = p(
|
|
489
498
|
() => {
|
|
490
499
|
var t;
|
|
491
|
-
return (t = i.value.recordsPerPage) == null ? void 0 : t.find(({ active:
|
|
500
|
+
return (t = i.value.recordsPerPage) == null ? void 0 : t.find(({ active: l }) => l);
|
|
492
501
|
}
|
|
493
|
-
),
|
|
502
|
+
), h = p(() => ({
|
|
494
503
|
...i.value.paginator,
|
|
495
504
|
next: (t = {}) => {
|
|
496
|
-
"nextLink" in
|
|
505
|
+
"nextLink" in h.value && h.value.nextLink && P(h.value.nextLink, t);
|
|
497
506
|
},
|
|
498
507
|
previous: (t = {}) => {
|
|
499
|
-
"prevLink" in
|
|
508
|
+
"prevLink" in h.value && h.value.prevLink && P(h.value.prevLink, t);
|
|
500
509
|
},
|
|
501
510
|
first: (t = {}) => {
|
|
502
|
-
"firstLink" in
|
|
511
|
+
"firstLink" in h.value && h.value.firstLink && P(h.value.firstLink, t);
|
|
503
512
|
},
|
|
504
513
|
last: (t = {}) => {
|
|
505
|
-
"lastLink" in
|
|
514
|
+
"lastLink" in h.value && h.value.lastLink && P(h.value.lastLink, t);
|
|
506
515
|
},
|
|
507
516
|
..."links" in i.value.paginator && i.value.paginator.links ? {
|
|
508
517
|
links: i.value.paginator.links.map((t) => ({
|
|
509
518
|
...t,
|
|
510
|
-
navigate: (
|
|
519
|
+
navigate: (l = {}) => t.url && P(t.url, l)
|
|
511
520
|
}))
|
|
512
521
|
} : {}
|
|
513
|
-
})),
|
|
522
|
+
})), E = p(
|
|
514
523
|
() => i.value.records.length > 0 && i.value.records.every(
|
|
515
524
|
(t) => u.selected(y(t))
|
|
516
525
|
)
|
|
517
526
|
);
|
|
518
527
|
function y(t) {
|
|
519
|
-
return t[
|
|
528
|
+
return t[f.value.record].value;
|
|
520
529
|
}
|
|
521
530
|
function K(t) {
|
|
522
531
|
return typeof t == "string" ? t : t.name;
|
|
523
532
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
533
|
+
function P(t, l = {}) {
|
|
534
|
+
x.visit(t, {
|
|
526
535
|
preserveScroll: !0,
|
|
527
536
|
preserveState: !0,
|
|
537
|
+
...a,
|
|
528
538
|
...l,
|
|
529
|
-
...r,
|
|
530
539
|
method: "get"
|
|
531
540
|
});
|
|
532
541
|
}
|
|
533
|
-
function
|
|
534
|
-
var
|
|
542
|
+
function W(t, l, s = {}) {
|
|
543
|
+
var F, e;
|
|
535
544
|
I(
|
|
536
545
|
t,
|
|
537
|
-
|
|
546
|
+
f.value.endpoint,
|
|
538
547
|
{
|
|
539
548
|
table: i.value.id,
|
|
540
|
-
id: y(
|
|
549
|
+
id: y(l)
|
|
541
550
|
},
|
|
542
|
-
|
|
543
|
-
) || (e = (
|
|
551
|
+
s
|
|
552
|
+
) || (e = (F = d.recordActions) == null ? void 0 : F[t.name]) == null || e.call(F, l);
|
|
544
553
|
}
|
|
545
|
-
function
|
|
554
|
+
function L(t, l = {}) {
|
|
546
555
|
I(
|
|
547
556
|
t,
|
|
548
|
-
|
|
557
|
+
f.value.endpoint,
|
|
549
558
|
{
|
|
550
559
|
table: i.value.id,
|
|
551
560
|
all: u.selection.value.all,
|
|
552
561
|
only: Array.from(u.selection.value.only),
|
|
553
562
|
except: Array.from(u.selection.value.except)
|
|
554
563
|
},
|
|
555
|
-
|
|
564
|
+
l
|
|
556
565
|
);
|
|
557
566
|
}
|
|
558
|
-
function M(t,
|
|
567
|
+
function M(t, l = {}) {
|
|
559
568
|
I(
|
|
560
569
|
t,
|
|
561
|
-
|
|
570
|
+
f.value.endpoint,
|
|
562
571
|
{
|
|
563
572
|
table: i.value.id
|
|
564
573
|
},
|
|
565
|
-
|
|
574
|
+
l
|
|
566
575
|
);
|
|
567
576
|
}
|
|
568
|
-
function T(t,
|
|
569
|
-
|
|
577
|
+
function T(t, l = {}) {
|
|
578
|
+
x.reload({
|
|
579
|
+
...a,
|
|
570
580
|
...l,
|
|
571
|
-
...r,
|
|
572
581
|
data: {
|
|
573
|
-
[
|
|
574
|
-
[
|
|
582
|
+
[f.value.records]: t.value,
|
|
583
|
+
[f.value.pages]: void 0
|
|
575
584
|
}
|
|
576
585
|
});
|
|
577
586
|
}
|
|
578
|
-
function U(t,
|
|
579
|
-
t.sort &&
|
|
587
|
+
function U(t, l = {}) {
|
|
588
|
+
t.sort && x.reload({
|
|
589
|
+
...a,
|
|
580
590
|
...l,
|
|
581
|
-
...r,
|
|
582
591
|
data: {
|
|
583
|
-
[
|
|
592
|
+
[f.value.sorts]: b.omitValue(t.sort.next)
|
|
584
593
|
}
|
|
585
594
|
});
|
|
586
595
|
}
|
|
587
|
-
function N(t,
|
|
588
|
-
const
|
|
596
|
+
function N(t, l = {}) {
|
|
597
|
+
const s = b.toggleValue(
|
|
589
598
|
t.name,
|
|
590
|
-
|
|
599
|
+
S.value.map(({ name: w }) => w)
|
|
591
600
|
);
|
|
592
|
-
|
|
601
|
+
x.reload({
|
|
602
|
+
...a,
|
|
593
603
|
...l,
|
|
594
|
-
...r,
|
|
595
604
|
data: {
|
|
596
|
-
[
|
|
605
|
+
[f.value.columns]: b.delimitArray(s)
|
|
597
606
|
}
|
|
598
607
|
});
|
|
599
608
|
}
|
|
600
|
-
function
|
|
609
|
+
function z() {
|
|
601
610
|
u.select(
|
|
602
611
|
...i.value.records.map(
|
|
603
612
|
(t) => y(t)
|
|
@@ -614,9 +623,9 @@ function le(o, m, v = {}, l = {}) {
|
|
|
614
623
|
function D() {
|
|
615
624
|
return {
|
|
616
625
|
"onUpdate:modelValue": (t) => {
|
|
617
|
-
t ?
|
|
626
|
+
t ? z() : R();
|
|
618
627
|
},
|
|
619
|
-
modelValue:
|
|
628
|
+
modelValue: E.value
|
|
620
629
|
};
|
|
621
630
|
}
|
|
622
631
|
return Q({
|
|
@@ -625,25 +634,25 @@ function le(o, m, v = {}, l = {}) {
|
|
|
625
634
|
/** Table-specific metadata */
|
|
626
635
|
meta: A,
|
|
627
636
|
/** The heading columns for the table */
|
|
628
|
-
headings:
|
|
637
|
+
headings: S,
|
|
629
638
|
/** All of the table's columns */
|
|
630
639
|
columns: k,
|
|
631
640
|
/** The records of the table */
|
|
632
|
-
records:
|
|
641
|
+
records: c,
|
|
633
642
|
/** The available bulk actions */
|
|
634
|
-
bulkActions:
|
|
643
|
+
bulkActions: g,
|
|
635
644
|
/** The available page actions */
|
|
636
|
-
pageActions:
|
|
645
|
+
pageActions: B,
|
|
637
646
|
/** The available number of records to display per page */
|
|
638
|
-
rowsPerPage:
|
|
647
|
+
rowsPerPage: j,
|
|
639
648
|
/** The current record per page item */
|
|
640
|
-
currentPage:
|
|
649
|
+
currentPage: C,
|
|
641
650
|
/** The pagination metadata */
|
|
642
|
-
paginator:
|
|
651
|
+
paginator: h,
|
|
643
652
|
/** Execute an inline action */
|
|
644
|
-
executeInlineAction:
|
|
653
|
+
executeInlineAction: W,
|
|
645
654
|
/** Execute a bulk action */
|
|
646
|
-
executeBulkAction:
|
|
655
|
+
executeBulkAction: L,
|
|
647
656
|
/** Execute a page action */
|
|
648
657
|
executePageAction: M,
|
|
649
658
|
/** Apply a new page by changing the number of records to display */
|
|
@@ -655,7 +664,7 @@ function le(o, m, v = {}, l = {}) {
|
|
|
655
664
|
/** Deselect the given records */
|
|
656
665
|
deselect: (t) => u.deselect(y(t)),
|
|
657
666
|
/** Select records on the current page */
|
|
658
|
-
selectPage:
|
|
667
|
+
selectPage: z,
|
|
659
668
|
/** Deselect records on the current page */
|
|
660
669
|
deselectPage: R,
|
|
661
670
|
/** Toggle the selection of the given records */
|
|
@@ -667,7 +676,7 @@ function le(o, m, v = {}, l = {}) {
|
|
|
667
676
|
/** Deselect all records */
|
|
668
677
|
deselectAll: u.deselectAll,
|
|
669
678
|
/** Whether all records on the current page are selected */
|
|
670
|
-
isPageSelected:
|
|
679
|
+
isPageSelected: E,
|
|
671
680
|
/** Determine if any records are selected */
|
|
672
681
|
hasSelected: u.hasSelected,
|
|
673
682
|
/** Bind the given record to a checkbox */
|
|
@@ -681,5 +690,5 @@ function le(o, m, v = {}, l = {}) {
|
|
|
681
690
|
});
|
|
682
691
|
}
|
|
683
692
|
export {
|
|
684
|
-
|
|
693
|
+
ae as useTable
|
|
685
694
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(P,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],d):(P=typeof globalThis<"u"?globalThis:P||self,d(P["@honed/table"]={},P.Vue,P.Inertia))})(this,function(P,d,b){"use strict";function _(){const r=d.ref({all:!1,only:new Set,except:new Set});function m(){r.value.all=!0,r.value.only.clear(),r.value.except.clear()}function f(){r.value.all=!1,r.value.only.clear(),r.value.except.clear()}function a(...s){s.forEach(g=>r.value.except.delete(g)),s.forEach(g=>r.value.only.add(g))}function i(...s){s.forEach(g=>r.value.except.add(g)),s.forEach(g=>r.value.only.delete(g))}function u(s,g){if(x(s)||g===!1)return i(s);if(!x(s)||g===!0)return a(s)}function x(s){return r.value.all?!r.value.except.has(s):r.value.only.has(s)}const v=d.computed(()=>r.value.all&&r.value.except.size===0),A=d.computed(()=>r.value.only.size>0||v.value);function S(s){return{"onUpdate:modelValue":g=>{g?a(s):i(s)},modelValue:x(s),value:s}}function k(){return{"onUpdate:modelValue":s=>{s?m():f()},modelValue:v.value,value:v.value}}return{allSelected:v,selection:r,hasSelected:A,selectAll:m,deselectAll:f,select:a,deselect:i,toggle:u,selected:x,bind:S,bindAll:k}}function D(r,m,f={},a={}){return r.route?(b.router.visit(r.route.href,{...a,method:r.route.method}),!0):r.action&&m?(b.router.post(m,{...f,name:r.name,type:r.type},a),!0):!1}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Y=()=>{};function Q(r,m){function f(...a){return new Promise((i,u)=>{Promise.resolve(r(()=>m.apply(this,a),{fn:m,thisArg:this,args:a})).then(i).catch(u)})}return f}function X(r,m={}){let f,a,i=Y;const u=v=>{clearTimeout(v),i(),i=Y};let x;return v=>{const A=d.toValue(r),S=d.toValue(m.maxWait);return f&&u(f),A<=0||S!==void 0&&S<=0?(a&&(u(a),a=null),Promise.resolve(v())):new Promise((k,s)=>{i=m.rejectOnCancel?s:k,x=v,S&&!a&&(a=setTimeout(()=>{f&&u(f),a=null,k(x())},S)),f=setTimeout(()=>{a&&u(a),a=null,k(v())},A)})}}function I(r,m=200,f={}){return Q(X(m,f),r)}function Z(r,m,f={}){const a=d.computed(()=>r[m]),i=d.computed(()=>{var e;return((e=a.value.filters)==null?void 0:e.map(n=>({...n,apply:(l,c={})=>j(n,l,c),clear:(l={})=>N(n,l),bind:()=>o(n.name)})))??[]}),u=d.computed(()=>{var e;return((e=a.value.sorts)==null?void 0:e.map(n=>({...n,apply:(l={})=>E(n,n.direction,l),clear:(l={})=>W(l),bind:()=>p(n)})))??[]}),x=d.computed(()=>{var e;return(e=a.value.searches)==null?void 0:e.map(n=>({...n,apply:(l={})=>U(n,l),clear:(l={})=>U(n,l),bind:()=>F(n)}))});function v(e){return Array.isArray(e)?e.join(a.value.config.delimiter):e}function A(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function S(e){if(!["",null,void 0,[]].includes(e))return e}function k(e){return[v,A,S].reduce((n,l)=>l(n),e)}function s(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(l=>l!==e):[...n,e]}function g(e){var n;return(n=a.value.filters)==null?void 0:n.find(l=>l.name===e)}function C(e,n=null){var l;return(l=a.value.sorts)==null?void 0:l.find(c=>c.name===e&&c.direction===n)}function q(e){var n;return(n=a.value.searches)==null?void 0:n.find(l=>l.name===e)}function z(){var e;return((e=a.value.filters)==null?void 0:e.filter(({active:n})=>n))??[]}function h(){var e;return(e=a.value.sorts)==null?void 0:e.find(({active:n})=>n)}function T(){var e;return((e=a.value.searches)==null?void 0:e.filter(({active:n})=>n))??[]}function y(e){return e?typeof e=="string"?z().some(n=>n.name===e):e.active:!!z().length}function K(e){var n;return e?typeof e=="string"?((n=h())==null?void 0:n.name)===e:e.active:!!h()}function w(e){var n,l;return e?typeof e=="string"?(l=T())==null?void 0:l.some(c=>c.name===e):e.active:!!((n=T())!=null&&n.length)}function G(e,n={}){const l=Object.fromEntries(Object.entries(e).map(([c,V])=>[c,k(V)]));b.router.reload({...f,...n,data:l})}function j(e,n,l={}){const c=typeof e=="string"?g(e):e;if(!c){console.warn(`Filter [${e}] does not exist.`);return}"multiple"in c&&c.multiple&&n!==void 0&&(n=s(n,c.value)),b.router.reload({...f,...l,data:{[c.name]:k(n)}})}function E(e,n=null,l={}){const c=typeof e=="string"?C(e,n):e;if(!c){console.warn(`Sort [${e}] does not exist.`);return}b.router.reload({...f,...l,data:{[a.value.config.sorts]:S(c.next)}})}function M(e,n={}){e=[A,S].reduce((l,c)=>c(l),e),b.router.reload({...f,...n,data:{[a.value.config.searches]:e}})}function U(e,n={}){if(!a.value.config.matches){console.warn("Matches key is not set.");return}const l=typeof e=="string"?q(e):e;if(!l){console.warn(`Match [${e}] does not exist.`);return}const c=s(l.name,T().map(({name:V})=>V));b.router.reload({...f,...n,data:{[a.value.config.matches]:v(c)}})}function N(e,n={}){j(e,void 0,n)}function W(e={}){b.router.reload({...f,...e,data:{[a.value.config.sorts]:null}})}function R(e={}){M(void 0,e)}function H(e={}){if(!a.value.config.matches){console.warn("Matches key is not set.");return}b.router.reload({...f,...e,data:{[a.value.config.matches]:void 0}})}function t(e={}){var n;b.router.reload({...f,...e,data:{[a.value.config.searches]:void 0,[a.value.config.sorts]:void 0,...Object.fromEntries(((n=a.value.filters)==null?void 0:n.map(l=>[l.name,void 0]))??[]),...a.value.config.matches?{[a.value.config.matches]:void 0}:{}}})}function o(e,n={}){const l=typeof e=="string"?g(e):e;if(!l){console.warn(`Filter [${e}] does not exist.`);return}const c=l.value,{debounce:V=250,transform:B=J=>J,...$}=n;return{"onUpdate:modelValue":I(J=>{j(l,B(J),$)},V),modelValue:c}}function p(e,n={}){const l=typeof e=="string"?C(e):e;if(!l){console.warn(`Sort [${e}] does not exist.`);return}const{debounce:c=0,transform:V,...B}=n;return{onClick:I(()=>{var $;E(l,($=h())==null?void 0:$.direction,B)},c)}}function L(e={}){const{debounce:n=700,transform:l,...c}=e;return{"onUpdate:modelValue":I(V=>{M(V,c)},n),modelValue:a.value.config.search??""}}function F(e,n={}){const l=typeof e=="string"?q(e):e;if(!l){console.warn(`Match [${e}] does not exist.`);return}const{debounce:c=0,transform:V,...B}=n;return{"onUpdate:modelValue":I($=>{U($,B)},c),modelValue:w(l),value:l.name}}return{filters:i,sorts:u,searches:x,getFilter:g,getSort:C,getSearch:q,currentFilters:z,currentSort:h,currentSearches:T,isFiltering:y,isSorting:K,isSearching:w,apply:G,applyFilter:j,applySort:E,applySearch:M,applyMatch:U,clearFilter:N,clearSort:W,clearSearch:R,clearMatch:H,reset:t,bindFilter:o,bindSort:p,bindSearch:L,bindMatch:F,stringValue:A,omitValue:S,toggleValue:s,delimitArray:v}}function O(r,m,f={},a={}){if(!r||!m||!r[m])throw new Error("Table has not been provided with valid props and key.");a={...a,only:[...a.only??[],m.toString()]};const i=d.computed(()=>r[m]),u=_(),x=Z(r,m,a),v=d.computed(()=>i.value.config),A=d.computed(()=>i.value.meta),S=d.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({active:o,hidden:p})=>o&&!p).map(o=>{var p;return{...o,isSorting:(p=o.sort)==null?void 0:p.active,toggleSort:(L={})=>U(o,L)}}))??[]}),k=d.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({hidden:o})=>!o).map(o=>({...o,toggle:(p={})=>N(o,p)})))??[]}),s=d.computed(()=>i.value.records.map(t=>({record:(({actions:o,...p})=>p)(t),default:(o={})=>{const p=t.actions.find(L=>L.default);p&&G(p,t,o)},actions:t.actions.map(o=>({...o,execute:(p={})=>G(o,t,p)})),select:()=>u.select(y(t)),deselect:()=>u.deselect(y(t)),toggle:()=>u.toggle(y(t)),selected:u.selected(y(t)),bind:()=>u.bind(y(t)),value:o=>t[K(o)].value,extra:o=>t[K(o)].extra}))),g=d.computed(()=>i.value.actions.bulk.map(t=>({...t,execute:(o={})=>j(t,o)}))),C=d.computed(()=>i.value.actions.page.map(t=>({...t,execute:(o={})=>E(t,o)}))),q=d.computed(()=>{var t;return((t=i.value.recordsPerPage)==null?void 0:t.map(o=>({...o,apply:(p={})=>M(o,p)})))??[]}),z=d.computed(()=>{var t;return(t=i.value.recordsPerPage)==null?void 0:t.find(({active:o})=>o)}),h=d.computed(()=>({...i.value.paginator,next:(t={})=>{"nextLink"in h.value&&h.value.nextLink&&w(h.value.nextLink,t)},previous:(t={})=>{"prevLink"in h.value&&h.value.prevLink&&w(h.value.prevLink,t)},first:(t={})=>{"firstLink"in h.value&&h.value.firstLink&&w(h.value.firstLink,t)},last:(t={})=>{"lastLink"in h.value&&h.value.lastLink&&w(h.value.lastLink,t)},..."links"in i.value.paginator&&i.value.paginator.links?{links:i.value.paginator.links.map(t=>({...t,navigate:(o={})=>t.url&&w(t.url,o)}))}:{}})),T=d.computed(()=>i.value.records.length>0&&i.value.records.every(t=>u.selected(y(t))));function y(t){return t[v.value.record].value}function K(t){return typeof t=="string"?t:t.name}function w(t,o={}){b.router.visit(t,{preserveScroll:!0,preserveState:!0,...a,...o,method:"get"})}function G(t,o,p={}){var F,e;D(t,v.value.endpoint,{table:i.value.id,id:y(o)},p)||(e=(F=f.recordActions)==null?void 0:F[t.name])==null||e.call(F,o)}function j(t,o={}){D(t,v.value.endpoint,{table:i.value.id,all:u.selection.value.all,only:Array.from(u.selection.value.only),except:Array.from(u.selection.value.except)},o)}function E(t,o={}){D(t,v.value.endpoint,{table:i.value.id},o)}function M(t,o={}){b.router.reload({...a,...o,data:{[v.value.records]:t.value,[v.value.pages]:void 0}})}function U(t,o={}){t.sort&&b.router.reload({...a,...o,data:{[v.value.sorts]:x.omitValue(t.sort.next)}})}function N(t,o={}){const p=x.toggleValue(t.name,S.value.map(({name:L})=>L));b.router.reload({...a,...o,data:{[v.value.columns]:x.delimitArray(p)}})}function W(){u.select(...i.value.records.map(t=>y(t)))}function R(){u.deselect(...i.value.records.map(t=>y(t)))}function H(){return{"onUpdate:modelValue":t=>{t?W():R()},modelValue:T.value}}return d.reactive({getRecordKey:y,meta:A,headings:S,columns:k,records:s,bulkActions:g,pageActions:C,rowsPerPage:q,currentPage:z,paginator:h,executeInlineAction:G,executeBulkAction:j,executePageAction:E,applyPage:M,selection:u.selection,select:t=>u.select(y(t)),deselect:t=>u.deselect(y(t)),selectPage:W,deselectPage:R,toggle:t=>u.toggle(y(t)),selected:t=>u.selected(y(t)),selectAll:u.selectAll,deselectAll:u.deselectAll,isPageSelected:T,hasSelected:u.hasSelected,bindCheckbox:t=>u.bind(y(t)),bindPage:H,bindAll:u.bindAll,...x})}P.useTable=O,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(P,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],c):(P=typeof globalThis<"u"?globalThis:P||self,c(P["@honed/table"]={},P.Vue,P.Inertia))})(this,function(P,c,b){"use strict";function _(){const r=c.ref({all:!1,only:new Set,except:new Set});function p(){r.value.all=!0,r.value.only.clear(),r.value.except.clear()}function v(){r.value.all=!1,r.value.only.clear(),r.value.except.clear()}function a(...s){s.forEach(g=>r.value.except.delete(g)),s.forEach(g=>r.value.only.add(g))}function i(...s){s.forEach(g=>r.value.except.add(g)),s.forEach(g=>r.value.only.delete(g))}function u(s,g){if(x(s)||g===!1)return i(s);if(!x(s)||g===!0)return a(s)}function x(s){return r.value.all?!r.value.except.has(s):r.value.only.has(s)}const m=c.computed(()=>r.value.all&&r.value.except.size===0),A=c.computed(()=>r.value.only.size>0||m.value);function S(s){return{"onUpdate:modelValue":g=>{g?a(s):i(s)},modelValue:x(s),value:s}}function k(){return{"onUpdate:modelValue":s=>{s?p():v()},modelValue:m.value,value:m.value}}return{allSelected:m,selection:r,hasSelected:A,selectAll:p,deselectAll:v,select:a,deselect:i,toggle:u,selected:x,bind:S,bindAll:k}}function D(r,p,v={},a={}){return r.route?(b.router.visit(r.route.href,{...a,method:r.route.method}),!0):r.action&&p?(b.router.post(p,{...v,name:r.name,type:r.type},a),!0):!1}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Y=()=>{};function Q(r,p){function v(...a){return new Promise((i,u)=>{Promise.resolve(r(()=>p.apply(this,a),{fn:p,thisArg:this,args:a})).then(i).catch(u)})}return v}function X(r,p={}){let v,a,i=Y;const u=m=>{clearTimeout(m),i(),i=Y};let x;return m=>{const A=c.toValue(r),S=c.toValue(p.maxWait);return v&&u(v),A<=0||S!==void 0&&S<=0?(a&&(u(a),a=null),Promise.resolve(m())):new Promise((k,s)=>{i=p.rejectOnCancel?s:k,x=m,S&&!a&&(a=setTimeout(()=>{v&&u(v),a=null,k(x())},S)),v=setTimeout(()=>{a&&u(a),a=null,k(m())},A)})}}function B(r,p=200,v={}){return Q(X(p,v),r)}function Z(r,p,v={}){const a=c.computed(()=>r[p]),i=c.computed(()=>{var e;return((e=a.value.filters)==null?void 0:e.map(n=>({...n,apply:(o,f={})=>T(n,o,f),clear:(o={})=>N(n,o),bind:()=>l(n.name)})))??[]}),u=c.computed(()=>{var e;return((e=a.value.sorts)==null?void 0:e.map(n=>({...n,apply:(o={})=>M(n,n.direction,o),clear:(o={})=>z(o),bind:()=>d(n)})))??[]}),x=c.computed(()=>{var e;return(e=a.value.searches)==null?void 0:e.map(n=>({...n,apply:(o={})=>U(n,o),clear:(o={})=>U(n,o),bind:()=>j(n)}))}),m=c.computed(()=>{var e;return((e=a.value.filters)==null?void 0:e.filter(({active:n})=>n))??[]}),A=c.computed(()=>{var e;return(e=a.value.sorts)==null?void 0:e.find(({active:n})=>n)}),S=c.computed(()=>{var e;return((e=a.value.searches)==null?void 0:e.filter(({active:n})=>n))??[]});function k(e){return Array.isArray(e)?e.join(a.value.config.delimiter):e}function s(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function g(e){if(!["",null,void 0,[]].includes(e))return e}function I(e){return[k,s,g].reduce((n,o)=>o(n),e)}function C(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(o=>o!==e):[...n,e]}function W(e){var n;return(n=a.value.filters)==null?void 0:n.find(o=>o.name===e)}function h(e,n=null){var o;return(o=a.value.sorts)==null?void 0:o.find(f=>f.name===e&&f.direction===n)}function F(e){var n;return(n=a.value.searches)==null?void 0:n.find(o=>o.name===e)}function y(e){return e?typeof e=="string"?m.value.some(n=>n.name===e):e.active:!!m.value.length}function K(e){var n;return e?typeof e=="string"?((n=A.value)==null?void 0:n.name)===e:e.active:!!A.value}function w(e){var n;return e?typeof e=="string"?(n=S.value)==null?void 0:n.some(o=>o.name===e):e.active:!!a.value.config.search}function q(e,n={}){const o=Object.fromEntries(Object.entries(e).map(([f,V])=>[f,I(V)]));b.router.reload({...v,...n,data:o})}function T(e,n,o={}){const f=typeof e=="string"?W(e):e;if(!f){console.warn(`Filter [${e}] does not exist.`);return}"multiple"in f&&f.multiple&&n!==void 0&&(n=C(n,f.value)),b.router.reload({...v,...o,data:{[f.name]:I(n)}})}function M(e,n=null,o={}){const f=typeof e=="string"?h(e,n):e;if(!f){console.warn(`Sort [${e}] does not exist.`);return}b.router.reload({...v,...o,data:{[a.value.config.sorts]:g(f.next)}})}function E(e,n={}){e=[s,g].reduce((o,f)=>f(o),e),b.router.reload({...v,...n,data:{[a.value.config.searches]:e}})}function U(e,n={}){if(!a.value.config.matches){console.warn("Matches key is not set.");return}const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const f=C(o.name,S.value.map(({name:V})=>V));b.router.reload({...v,...n,data:{[a.value.config.matches]:k(f)}})}function N(e,n={}){T(e,void 0,n)}function z(e={}){b.router.reload({...v,...e,data:{[a.value.config.sorts]:void 0}})}function R(e={}){E(void 0,e)}function H(e={}){if(!a.value.config.matches){console.warn("Matches key is not set.");return}b.router.reload({...v,...e,data:{[a.value.config.matches]:void 0}})}function t(e={}){var n;b.router.reload({...v,...e,data:{[a.value.config.searches]:void 0,[a.value.config.sorts]:void 0,[a.value.config.matches]:void 0,...Object.fromEntries(((n=a.value.filters)==null?void 0:n.map(o=>[o.name,void 0]))??[])}})}function l(e,n={}){const o=typeof e=="string"?W(e):e;if(!o){console.warn(`Filter [${e}] does not exist.`);return}const f=o.value,{debounce:V=250,transform:G=J=>J,...$}=n;return{"onUpdate:modelValue":B(J=>{T(o,G(J),$)},V),modelValue:f}}function d(e,n={}){const o=typeof e=="string"?h(e):e;if(!o){console.warn(`Sort [${e}] does not exist.`);return}const{debounce:f=0,transform:V,...G}=n;return{onClick:B(()=>{var $;M(o,($=A.value)==null?void 0:$.direction,G)},f)}}function L(e={}){const{debounce:n=700,transform:o,...f}=e;return{"onUpdate:modelValue":B(V=>{E(V,f)},n),modelValue:a.value.config.search??""}}function j(e,n={}){const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const{debounce:f=0,transform:V,...G}=n;return{"onUpdate:modelValue":B($=>{U($,G)},f),modelValue:w(o),value:o.name}}return{filters:i,sorts:u,searches:x,getFilter:W,getSort:h,getSearch:F,currentFilters:m,currentSort:A,currentSearches:S,isFiltering:y,isSorting:K,isSearching:w,apply:q,applyFilter:T,applySort:M,applySearch:E,applyMatch:U,clearFilter:N,clearSort:z,clearSearch:R,clearMatch:H,reset:t,bindFilter:l,bindSort:d,bindSearch:L,bindMatch:j,stringValue:s,omitValue:g,toggleValue:C,delimitArray:k}}function O(r,p,v={},a={}){if(!r||!p||!r[p])throw new Error("Table has not been provided with valid props and key.");a={...a,only:[...a.only??[],p.toString()]};const i=c.computed(()=>r[p]),u=_(),x=Z(r,p,a),m=c.computed(()=>i.value.config),A=c.computed(()=>i.value.meta),S=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({active:l,hidden:d})=>l&&!d).map(l=>{var d;return{...l,isSorting:(d=l.sort)==null?void 0:d.active,toggleSort:(L={})=>U(l,L)}}))??[]}),k=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({hidden:l})=>!l).map(l=>({...l,toggle:(d={})=>N(l,d)})))??[]}),s=c.computed(()=>i.value.records.map(t=>({record:(({actions:l,...d})=>d)(t),default:(l={})=>{const d=t.actions.find(L=>L.default);d&&q(d,t,l)},actions:t.actions.map(l=>({...l,execute:(d={})=>q(l,t,d)})),select:()=>u.select(y(t)),deselect:()=>u.deselect(y(t)),toggle:()=>u.toggle(y(t)),selected:u.selected(y(t)),bind:()=>u.bind(y(t)),value:l=>{var d;return(d=t[K(l)])==null?void 0:d.value},extra:l=>{var d;return(d=t[K(l)])==null?void 0:d.extra}}))),g=c.computed(()=>i.value.actions.bulk.map(t=>({...t,execute:(l={})=>T(t,l)}))),I=c.computed(()=>i.value.actions.page.map(t=>({...t,execute:(l={})=>M(t,l)}))),C=c.computed(()=>{var t;return((t=i.value.recordsPerPage)==null?void 0:t.map(l=>({...l,apply:(d={})=>E(l,d)})))??[]}),W=c.computed(()=>{var t;return(t=i.value.recordsPerPage)==null?void 0:t.find(({active:l})=>l)}),h=c.computed(()=>({...i.value.paginator,next:(t={})=>{"nextLink"in h.value&&h.value.nextLink&&w(h.value.nextLink,t)},previous:(t={})=>{"prevLink"in h.value&&h.value.prevLink&&w(h.value.prevLink,t)},first:(t={})=>{"firstLink"in h.value&&h.value.firstLink&&w(h.value.firstLink,t)},last:(t={})=>{"lastLink"in h.value&&h.value.lastLink&&w(h.value.lastLink,t)},..."links"in i.value.paginator&&i.value.paginator.links?{links:i.value.paginator.links.map(t=>({...t,navigate:(l={})=>t.url&&w(t.url,l)}))}:{}})),F=c.computed(()=>i.value.records.length>0&&i.value.records.every(t=>u.selected(y(t))));function y(t){return t[m.value.record].value}function K(t){return typeof t=="string"?t:t.name}function w(t,l={}){b.router.visit(t,{preserveScroll:!0,preserveState:!0,...a,...l,method:"get"})}function q(t,l,d={}){var j,e;D(t,m.value.endpoint,{table:i.value.id,id:y(l)},d)||(e=(j=v.recordActions)==null?void 0:j[t.name])==null||e.call(j,l)}function T(t,l={}){D(t,m.value.endpoint,{table:i.value.id,all:u.selection.value.all,only:Array.from(u.selection.value.only),except:Array.from(u.selection.value.except)},l)}function M(t,l={}){D(t,m.value.endpoint,{table:i.value.id},l)}function E(t,l={}){b.router.reload({...a,...l,data:{[m.value.records]:t.value,[m.value.pages]:void 0}})}function U(t,l={}){t.sort&&b.router.reload({...a,...l,data:{[m.value.sorts]:x.omitValue(t.sort.next)}})}function N(t,l={}){const d=x.toggleValue(t.name,S.value.map(({name:L})=>L));b.router.reload({...a,...l,data:{[m.value.columns]:x.delimitArray(d)}})}function z(){u.select(...i.value.records.map(t=>y(t)))}function R(){u.deselect(...i.value.records.map(t=>y(t)))}function H(){return{"onUpdate:modelValue":t=>{t?z():R()},modelValue:F.value}}return c.reactive({getRecordKey:y,meta:A,headings:S,columns:k,records:s,bulkActions:g,pageActions:I,rowsPerPage:C,currentPage:W,paginator:h,executeInlineAction:q,executeBulkAction:T,executePageAction:M,applyPage:E,selection:u.selection,select:t=>u.select(y(t)),deselect:t=>u.deselect(y(t)),selectPage:z,deselectPage:R,toggle:t=>u.toggle(y(t)),selected:t=>u.selected(y(t)),selectAll:u.selectAll,deselectAll:u.deselectAll,isPageSelected:F,hasSelected:u.hasSelected,bindCheckbox:t=>u.bind(y(t)),bindPage:H,bindAll:u.bindAll,...x})}P.useTable=O,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honed/table",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "-",
|
|
7
7
|
"keywords": [
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@honed/action": "^0.
|
|
61
|
-
"@honed/refine": "^0.
|
|
60
|
+
"@honed/action": "^0.4.0",
|
|
61
|
+
"@honed/refine": "^0.4.0",
|
|
62
62
|
"@inertiajs/vue3": "^1.2.0||^2.0.0",
|
|
63
63
|
"@vueuse/core": "^11.0.0||^12.0.0",
|
|
64
64
|
"axios": "^1.2.0",
|