quasar-ui-danx 0.4.22 → 0.4.24

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.22",
3
+ "version": "0.4.24",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <div>
3
3
  <div class="text-xs font-bold">
4
- {{ label }}
4
+ <slot name="label">
5
+ {{ label }}
6
+ </slot>
5
7
  </div>
6
8
  <div :class="valueClass">
7
9
  <template v-if="url">
@@ -364,7 +364,7 @@ export function useListControls(name: string, options: ListControlsOptions): Act
364
364
 
365
365
  const latestNextIndex = latestCallOnly("getNextItem", async () => {
366
366
  if (!pagedItems.value?.data) return -1;
367
-
367
+
368
368
  // Load the previous page if the offset is before index 0
369
369
  if (nextIndex < 0) {
370
370
  if (pagination.value.page > 1) {
@@ -439,11 +439,21 @@ export function useListControls(name: string, options: ListControlsOptions): Act
439
439
  */
440
440
  function updateRouteParams(params: AnyObject) {
441
441
  const vueRouter = getVueRouter();
442
- const { name: routeName } = vueRouter.currentRoute.value;
443
- vueRouter.push({
444
- name: (Array.isArray(routeName) ? routeName[0] : routeName) || "home",
445
- params
446
- });
442
+ let { name: routeName } = vueRouter.currentRoute.value;
443
+ routeName = Array.isArray(routeName) ? routeName[0] : routeName;
444
+
445
+ if (!routeName) {
446
+ console.error("No route name found for list controls", name);
447
+ return;
448
+ }
449
+
450
+ const newRoutePath = vueRouter.resolve({ name: routeName, params }).href;
451
+ const currentRoutePath = vueRouter.currentRoute.value.fullPath;
452
+
453
+ // Only update the route if the route is different (or the currentRoutePath is a child of the newRoutePath)
454
+ if (currentRoutePath !== newRoutePath && !currentRoutePath.startsWith(newRoutePath)) {
455
+ vueRouter.push({ name: routeName, params });
456
+ }
447
457
  }
448
458
 
449
459
  function setPanelFromRoute(params: RouteParams, meta: AnyObject) {
@@ -234,7 +234,13 @@ export function fShortSize(value: string | number) {
234
234
  return Math.round(n / div) + " " + power.unit;
235
235
  }
236
236
 
237
- export function fBoolean(value?: boolean) {
237
+ export function fBoolean(value?: boolean | string | any) {
238
+ switch (value) {
239
+ case "Yes":
240
+ case "No":
241
+ return value;
242
+ }
243
+
238
244
  return (value === undefined || value === null) ? "-" : (value ? "Yes" : "No");
239
245
  }
240
246
 
@@ -370,7 +376,7 @@ export function parseMarkdownYAML(string: string): object | null | false {
370
376
  * Parse a markdown formatted string and return the code block content
371
377
  */
372
378
  export function parseMarkdownCode(string: string): string {
373
- return string.replace(/^```[a-z0-9]{1,6}\s/, "").replace(/```$/, "");
379
+ return string.replace(/^```[a-z0-9]{0,6}\s/, "").replace(/```$/, "");
374
380
  }
375
381
 
376
382
  /**
@@ -378,6 +384,7 @@ export function parseMarkdownCode(string: string): string {
378
384
  * ie: a valid JSON string with a ```json prefix and ``` postfix
379
385
  */
380
386
  export function fMarkdownCode(type: string, string: string | object): string {
387
+ console.log("formatting", type, string);
381
388
  if (typeof string === "object" || isJSON(string)) {
382
389
  switch (type) {
383
390
  case "yaml":
@@ -390,7 +397,9 @@ export function fMarkdownCode(type: string, string: string | object): string {
390
397
  }
391
398
 
392
399
  const regex = new RegExp(`\`\`\`${type}`, "g");
393
- if (!((string || "") as string).match(regex)) {
400
+ string = (string || "") as string;
401
+ if (!string.match(regex)) {
402
+ string = parseMarkdownCode(string as string);
394
403
  return `\`\`\`${type}\n${string}\n\`\`\``;
395
404
  }
396
405