vueless 0.0.665 → 0.0.667

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.665",
3
+ "version": "0.0.667",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -46,7 +46,9 @@ const toggleIconConfig = computed(() => {
46
46
  const nestedRow = props.row?.row;
47
47
  let isShown = false;
48
48
 
49
- if (Array.isArray(nestedRow)) {
49
+ if (props.row.nestedData) {
50
+ isShown = Boolean(props.row.nestedData.isShown);
51
+ } else if (Array.isArray(nestedRow)) {
50
52
  isShown = nestedRow.some((row) => row.isShown);
51
53
  } else {
52
54
  isShown = Boolean(nestedRow?.isShown);
@@ -76,10 +78,16 @@ const isNestedRowEmpty = computed(() => {
76
78
  return !Object.keys(mapRowColumns(props.row.row, props.columns)).length;
77
79
  });
78
80
 
81
+ const isNestedDataEmpty = computed(() => {
82
+ if (!props.row.nestedData) return true;
83
+
84
+ return !props.row.nestedData.rows || !props.row.nestedData.rows.length;
85
+ });
86
+
79
87
  const isShownToggleIcon = computed(() => {
80
88
  return (
81
89
  (props.row.row && !isNestedRowEmpty.value) ||
82
- (props.row.nestedData && hasSlotContent(slots["nested-content"]))
90
+ (props.row.nestedData && !isNestedDataEmpty.value && hasSlotContent(slots["nested-content"]))
83
91
  );
84
92
  });
85
93
 
@@ -7,7 +7,7 @@ import { hasSlotContent } from "../utils/helper.ts";
7
7
 
8
8
  import { COMPONENT_NAME } from "./constants.ts";
9
9
  import defaultConfig from "./config.ts";
10
- import { separatedMoney, MONEY_SIGN_TYPE } from "./utilMoney.ts";
10
+ import { separatedMoney, MONEY_SIGN_TYPE, MATH_SIGN } from "./utilMoney.ts";
11
11
 
12
12
  import type { Props, Config } from "./types.ts";
13
13
 
@@ -31,8 +31,10 @@ const currencySpace = computed(() => {
31
31
  const mathSign = computed(() => {
32
32
  let type = "";
33
33
 
34
- if (props.sign === MONEY_SIGN_TYPE.positive) type = "+";
35
- if (props.sign === MONEY_SIGN_TYPE.negative) type = "–";
34
+ if (props.sign === MONEY_SIGN_TYPE.unsigned) type = "";
35
+ if (props.sign === MONEY_SIGN_TYPE.positive) type = MATH_SIGN.PLUS;
36
+ if (props.sign === MONEY_SIGN_TYPE.negative) type = MATH_SIGN.MINUS;
37
+ if (props.sign === MONEY_SIGN_TYPE.auto && props.value < 0) type = MATH_SIGN.MINUS;
36
38
 
37
39
  return type;
38
40
  });
@@ -51,7 +51,7 @@ export default /*tw*/ {
51
51
  defaults: {
52
52
  color: "grayscale",
53
53
  size: "md",
54
- sign: "default",
54
+ sign: "auto",
55
55
  align: "left",
56
56
  symbolAlign: "right",
57
57
  minFractionDigits: 0,
@@ -28,7 +28,7 @@ export default {
28
28
  args: {
29
29
  value: 10,
30
30
  symbol: "$",
31
- sign: "positive",
31
+ sign: "auto",
32
32
  },
33
33
  argTypes: {
34
34
  ...getArgTypes(UMoney.__name),
@@ -95,7 +95,7 @@ Colors.args = {
95
95
  enum: "color",
96
96
  value: 0,
97
97
  symbol: "$",
98
- sign: "default",
98
+ sign: "auto",
99
99
  };
100
100
 
101
101
  export const Sizes = EnumVariantTemplate.bind({});
@@ -58,7 +58,7 @@ export interface Props {
58
58
  /**
59
59
  * Money sign.
60
60
  */
61
- sign?: "default" | "positive" | "negative";
61
+ sign?: "auto" | "positive" | "negative" | "unsigned";
62
62
 
63
63
  /**
64
64
  * Minimal number of signs after the decimal separator (fractional part of a number).
@@ -1,7 +1,13 @@
1
1
  export const MONEY_SIGN_TYPE = {
2
- default: "default",
2
+ auto: "auto",
3
3
  positive: "positive",
4
4
  negative: "negative",
5
+ unsigned: "unsigned",
6
+ };
7
+
8
+ export const MATH_SIGN = {
9
+ PLUS: "+",
10
+ MINUS: "-",
5
11
  };
6
12
 
7
13
  export const ADD_SPACE_IN_MONEY_REG_EX = /(\d)(?=(\d{3})+(\D|$))/g;