@thelacanians/vue-native-runtime 0.4.10 → 0.4.12
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.cjs +43 -12
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +43 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1268,7 +1268,9 @@ var VAlertDialog = (0, import_runtime_core15.defineComponent)({
|
|
|
1268
1268
|
visible: { type: Boolean, default: false },
|
|
1269
1269
|
title: { type: String, default: "" },
|
|
1270
1270
|
message: { type: String, default: "" },
|
|
1271
|
-
buttons: { type: Array, default: () => [] }
|
|
1271
|
+
buttons: { type: Array, default: () => [] },
|
|
1272
|
+
confirmText: { type: String, default: "" },
|
|
1273
|
+
cancelText: { type: String, default: "" }
|
|
1272
1274
|
},
|
|
1273
1275
|
emits: ["confirm", "cancel", "action"],
|
|
1274
1276
|
setup(props, { emit }) {
|
|
@@ -1286,15 +1288,27 @@ var VAlertDialog = (0, import_runtime_core15.defineComponent)({
|
|
|
1286
1288
|
(0, import_runtime_core15.onUnmounted)(() => {
|
|
1287
1289
|
if (visibleTimer) clearTimeout(visibleTimer);
|
|
1288
1290
|
});
|
|
1289
|
-
return () =>
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1291
|
+
return () => {
|
|
1292
|
+
let resolvedButtons = props.buttons;
|
|
1293
|
+
if (resolvedButtons.length === 0 && (props.confirmText || props.cancelText)) {
|
|
1294
|
+
resolvedButtons = [];
|
|
1295
|
+
if (props.cancelText) {
|
|
1296
|
+
resolvedButtons.push({ label: props.cancelText, style: "cancel" });
|
|
1297
|
+
}
|
|
1298
|
+
if (props.confirmText) {
|
|
1299
|
+
resolvedButtons.push({ label: props.confirmText, style: "default" });
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
return (0, import_runtime_core15.h)("VAlertDialog", {
|
|
1303
|
+
visible: debouncedVisible.value,
|
|
1304
|
+
title: props.title,
|
|
1305
|
+
message: props.message,
|
|
1306
|
+
buttons: resolvedButtons,
|
|
1307
|
+
onConfirm: (e) => emit("confirm", e),
|
|
1308
|
+
onCancel: () => emit("cancel"),
|
|
1309
|
+
onAction: (e) => emit("action", e)
|
|
1310
|
+
});
|
|
1311
|
+
};
|
|
1298
1312
|
}
|
|
1299
1313
|
});
|
|
1300
1314
|
|
|
@@ -2426,14 +2440,31 @@ function useHttp(config = {}) {
|
|
|
2426
2440
|
}
|
|
2427
2441
|
}
|
|
2428
2442
|
}
|
|
2443
|
+
function buildUrl(url, params) {
|
|
2444
|
+
if (!params || Object.keys(params).length === 0) return url;
|
|
2445
|
+
const qs = Object.entries(params).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join("&");
|
|
2446
|
+
return url.includes("?") ? `${url}&${qs}` : `${url}?${qs}`;
|
|
2447
|
+
}
|
|
2429
2448
|
return {
|
|
2430
2449
|
loading,
|
|
2431
2450
|
error,
|
|
2432
|
-
get: (url,
|
|
2451
|
+
get: (url, options) => {
|
|
2452
|
+
if (options && !("params" in options) && !("headers" in options)) {
|
|
2453
|
+
return request("GET", url, { headers: options });
|
|
2454
|
+
}
|
|
2455
|
+
const opts = options;
|
|
2456
|
+
return request("GET", buildUrl(url, opts?.params), { headers: opts?.headers });
|
|
2457
|
+
},
|
|
2433
2458
|
post: (url, body, headers) => request("POST", url, { body, headers }),
|
|
2434
2459
|
put: (url, body, headers) => request("PUT", url, { body, headers }),
|
|
2435
2460
|
patch: (url, body, headers) => request("PATCH", url, { body, headers }),
|
|
2436
|
-
delete: (url,
|
|
2461
|
+
delete: (url, options) => {
|
|
2462
|
+
if (options && !("params" in options) && !("headers" in options)) {
|
|
2463
|
+
return request("DELETE", url, { headers: options });
|
|
2464
|
+
}
|
|
2465
|
+
const opts = options;
|
|
2466
|
+
return request("DELETE", buildUrl(url, opts?.params), { headers: opts?.headers });
|
|
2467
|
+
}
|
|
2437
2468
|
};
|
|
2438
2469
|
}
|
|
2439
2470
|
|
package/dist/index.d.cts
CHANGED
|
@@ -335,6 +335,10 @@ interface VAlertDialogProps {
|
|
|
335
335
|
label: string;
|
|
336
336
|
style?: 'default' | 'cancel' | 'destructive';
|
|
337
337
|
}>;
|
|
338
|
+
/** Shorthand: confirm button label. Used when `buttons` is empty. */
|
|
339
|
+
confirmText?: string;
|
|
340
|
+
/** Shorthand: cancel button label. Used when `buttons` is empty. */
|
|
341
|
+
cancelText?: string;
|
|
338
342
|
}
|
|
339
343
|
interface VStatusBarProps {
|
|
340
344
|
barStyle?: 'default' | 'light-content' | 'dark-content';
|
|
@@ -1246,6 +1250,14 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1246
1250
|
type: () => AlertButton[];
|
|
1247
1251
|
default: () => never[];
|
|
1248
1252
|
};
|
|
1253
|
+
confirmText: {
|
|
1254
|
+
type: StringConstructor;
|
|
1255
|
+
default: string;
|
|
1256
|
+
};
|
|
1257
|
+
cancelText: {
|
|
1258
|
+
type: StringConstructor;
|
|
1259
|
+
default: string;
|
|
1260
|
+
};
|
|
1249
1261
|
}>, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
|
|
1250
1262
|
[key: string]: any;
|
|
1251
1263
|
}>, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, ("confirm" | "cancel" | "action")[], "confirm" | "cancel" | "action", _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
|
|
@@ -1265,6 +1277,14 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1265
1277
|
type: () => AlertButton[];
|
|
1266
1278
|
default: () => never[];
|
|
1267
1279
|
};
|
|
1280
|
+
confirmText: {
|
|
1281
|
+
type: StringConstructor;
|
|
1282
|
+
default: string;
|
|
1283
|
+
};
|
|
1284
|
+
cancelText: {
|
|
1285
|
+
type: StringConstructor;
|
|
1286
|
+
default: string;
|
|
1287
|
+
};
|
|
1268
1288
|
}>> & Readonly<{
|
|
1269
1289
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
1270
1290
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
@@ -1274,6 +1294,8 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1274
1294
|
title: string;
|
|
1275
1295
|
message: string;
|
|
1276
1296
|
buttons: AlertButton[];
|
|
1297
|
+
confirmText: string;
|
|
1298
|
+
cancelText: string;
|
|
1277
1299
|
}, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
|
|
1278
1300
|
|
|
1279
1301
|
type StatusBarStyle = 'default' | 'light-content' | 'dark-content';
|
|
@@ -2662,11 +2684,17 @@ interface HttpResponse<T = any> {
|
|
|
2662
2684
|
declare function useHttp(config?: HttpRequestConfig): {
|
|
2663
2685
|
loading: _vue_reactivity.Ref<boolean, boolean>;
|
|
2664
2686
|
error: _vue_reactivity.Ref<string | null, string | null>;
|
|
2665
|
-
get: <T = any>(url: string,
|
|
2687
|
+
get: <T = any>(url: string, options?: {
|
|
2688
|
+
params?: Record<string, string>;
|
|
2689
|
+
headers?: Record<string, string>;
|
|
2690
|
+
} | Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2666
2691
|
post: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2667
2692
|
put: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2668
2693
|
patch: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2669
|
-
delete: <T = any>(url: string,
|
|
2694
|
+
delete: <T = any>(url: string, options?: {
|
|
2695
|
+
params?: Record<string, string>;
|
|
2696
|
+
headers?: Record<string, string>;
|
|
2697
|
+
} | Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2670
2698
|
};
|
|
2671
2699
|
|
|
2672
2700
|
type ColorScheme = 'light' | 'dark';
|
package/dist/index.d.ts
CHANGED
|
@@ -335,6 +335,10 @@ interface VAlertDialogProps {
|
|
|
335
335
|
label: string;
|
|
336
336
|
style?: 'default' | 'cancel' | 'destructive';
|
|
337
337
|
}>;
|
|
338
|
+
/** Shorthand: confirm button label. Used when `buttons` is empty. */
|
|
339
|
+
confirmText?: string;
|
|
340
|
+
/** Shorthand: cancel button label. Used when `buttons` is empty. */
|
|
341
|
+
cancelText?: string;
|
|
338
342
|
}
|
|
339
343
|
interface VStatusBarProps {
|
|
340
344
|
barStyle?: 'default' | 'light-content' | 'dark-content';
|
|
@@ -1246,6 +1250,14 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1246
1250
|
type: () => AlertButton[];
|
|
1247
1251
|
default: () => never[];
|
|
1248
1252
|
};
|
|
1253
|
+
confirmText: {
|
|
1254
|
+
type: StringConstructor;
|
|
1255
|
+
default: string;
|
|
1256
|
+
};
|
|
1257
|
+
cancelText: {
|
|
1258
|
+
type: StringConstructor;
|
|
1259
|
+
default: string;
|
|
1260
|
+
};
|
|
1249
1261
|
}>, () => _vue_runtime_core.VNode<_vue_runtime_core.RendererNode, _vue_runtime_core.RendererElement, {
|
|
1250
1262
|
[key: string]: any;
|
|
1251
1263
|
}>, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, ("confirm" | "cancel" | "action")[], "confirm" | "cancel" | "action", _vue_runtime_core.PublicProps, Readonly<_vue_runtime_core.ExtractPropTypes<{
|
|
@@ -1265,6 +1277,14 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1265
1277
|
type: () => AlertButton[];
|
|
1266
1278
|
default: () => never[];
|
|
1267
1279
|
};
|
|
1280
|
+
confirmText: {
|
|
1281
|
+
type: StringConstructor;
|
|
1282
|
+
default: string;
|
|
1283
|
+
};
|
|
1284
|
+
cancelText: {
|
|
1285
|
+
type: StringConstructor;
|
|
1286
|
+
default: string;
|
|
1287
|
+
};
|
|
1268
1288
|
}>> & Readonly<{
|
|
1269
1289
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
1270
1290
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
@@ -1274,6 +1294,8 @@ declare const VAlertDialog: _vue_runtime_core.DefineComponent<_vue_runtime_core.
|
|
|
1274
1294
|
title: string;
|
|
1275
1295
|
message: string;
|
|
1276
1296
|
buttons: AlertButton[];
|
|
1297
|
+
confirmText: string;
|
|
1298
|
+
cancelText: string;
|
|
1277
1299
|
}, {}, {}, {}, string, _vue_runtime_core.ComponentProvideOptions, true, {}, any>;
|
|
1278
1300
|
|
|
1279
1301
|
type StatusBarStyle = 'default' | 'light-content' | 'dark-content';
|
|
@@ -2662,11 +2684,17 @@ interface HttpResponse<T = any> {
|
|
|
2662
2684
|
declare function useHttp(config?: HttpRequestConfig): {
|
|
2663
2685
|
loading: _vue_reactivity.Ref<boolean, boolean>;
|
|
2664
2686
|
error: _vue_reactivity.Ref<string | null, string | null>;
|
|
2665
|
-
get: <T = any>(url: string,
|
|
2687
|
+
get: <T = any>(url: string, options?: {
|
|
2688
|
+
params?: Record<string, string>;
|
|
2689
|
+
headers?: Record<string, string>;
|
|
2690
|
+
} | Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2666
2691
|
post: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2667
2692
|
put: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2668
2693
|
patch: <T = any>(url: string, body?: any, headers?: Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2669
|
-
delete: <T = any>(url: string,
|
|
2694
|
+
delete: <T = any>(url: string, options?: {
|
|
2695
|
+
params?: Record<string, string>;
|
|
2696
|
+
headers?: Record<string, string>;
|
|
2697
|
+
} | Record<string, string>) => Promise<HttpResponse<T>>;
|
|
2670
2698
|
};
|
|
2671
2699
|
|
|
2672
2700
|
type ColorScheme = 'light' | 'dark';
|
package/dist/index.js
CHANGED
|
@@ -1164,7 +1164,9 @@ var VAlertDialog = defineComponent14({
|
|
|
1164
1164
|
visible: { type: Boolean, default: false },
|
|
1165
1165
|
title: { type: String, default: "" },
|
|
1166
1166
|
message: { type: String, default: "" },
|
|
1167
|
-
buttons: { type: Array, default: () => [] }
|
|
1167
|
+
buttons: { type: Array, default: () => [] },
|
|
1168
|
+
confirmText: { type: String, default: "" },
|
|
1169
|
+
cancelText: { type: String, default: "" }
|
|
1168
1170
|
},
|
|
1169
1171
|
emits: ["confirm", "cancel", "action"],
|
|
1170
1172
|
setup(props, { emit }) {
|
|
@@ -1182,15 +1184,27 @@ var VAlertDialog = defineComponent14({
|
|
|
1182
1184
|
onUnmounted2(() => {
|
|
1183
1185
|
if (visibleTimer) clearTimeout(visibleTimer);
|
|
1184
1186
|
});
|
|
1185
|
-
return () =>
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1187
|
+
return () => {
|
|
1188
|
+
let resolvedButtons = props.buttons;
|
|
1189
|
+
if (resolvedButtons.length === 0 && (props.confirmText || props.cancelText)) {
|
|
1190
|
+
resolvedButtons = [];
|
|
1191
|
+
if (props.cancelText) {
|
|
1192
|
+
resolvedButtons.push({ label: props.cancelText, style: "cancel" });
|
|
1193
|
+
}
|
|
1194
|
+
if (props.confirmText) {
|
|
1195
|
+
resolvedButtons.push({ label: props.confirmText, style: "default" });
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return h14("VAlertDialog", {
|
|
1199
|
+
visible: debouncedVisible.value,
|
|
1200
|
+
title: props.title,
|
|
1201
|
+
message: props.message,
|
|
1202
|
+
buttons: resolvedButtons,
|
|
1203
|
+
onConfirm: (e) => emit("confirm", e),
|
|
1204
|
+
onCancel: () => emit("cancel"),
|
|
1205
|
+
onAction: (e) => emit("action", e)
|
|
1206
|
+
});
|
|
1207
|
+
};
|
|
1194
1208
|
}
|
|
1195
1209
|
});
|
|
1196
1210
|
|
|
@@ -2322,14 +2336,31 @@ function useHttp(config = {}) {
|
|
|
2322
2336
|
}
|
|
2323
2337
|
}
|
|
2324
2338
|
}
|
|
2339
|
+
function buildUrl(url, params) {
|
|
2340
|
+
if (!params || Object.keys(params).length === 0) return url;
|
|
2341
|
+
const qs = Object.entries(params).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join("&");
|
|
2342
|
+
return url.includes("?") ? `${url}&${qs}` : `${url}?${qs}`;
|
|
2343
|
+
}
|
|
2325
2344
|
return {
|
|
2326
2345
|
loading,
|
|
2327
2346
|
error,
|
|
2328
|
-
get: (url,
|
|
2347
|
+
get: (url, options) => {
|
|
2348
|
+
if (options && !("params" in options) && !("headers" in options)) {
|
|
2349
|
+
return request("GET", url, { headers: options });
|
|
2350
|
+
}
|
|
2351
|
+
const opts = options;
|
|
2352
|
+
return request("GET", buildUrl(url, opts?.params), { headers: opts?.headers });
|
|
2353
|
+
},
|
|
2329
2354
|
post: (url, body, headers) => request("POST", url, { body, headers }),
|
|
2330
2355
|
put: (url, body, headers) => request("PUT", url, { body, headers }),
|
|
2331
2356
|
patch: (url, body, headers) => request("PATCH", url, { body, headers }),
|
|
2332
|
-
delete: (url,
|
|
2357
|
+
delete: (url, options) => {
|
|
2358
|
+
if (options && !("params" in options) && !("headers" in options)) {
|
|
2359
|
+
return request("DELETE", url, { headers: options });
|
|
2360
|
+
}
|
|
2361
|
+
const opts = options;
|
|
2362
|
+
return request("DELETE", buildUrl(url, opts?.params), { headers: opts?.headers });
|
|
2363
|
+
}
|
|
2333
2364
|
};
|
|
2334
2365
|
}
|
|
2335
2366
|
|