@tekkare/auriga 0.2.59 → 0.2.61

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/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.2.59"
7
+ "version": "0.2.61"
8
8
  }
@@ -86,7 +86,7 @@
86
86
  class="complex_input"
87
87
  :placeholder="getPlaceholderAdd"
88
88
  v-model="searchNameAdd"
89
- id="complex_search_input"
89
+ :id="`complex_search_input_${complex_label}`"
90
90
  />
91
91
  <div
92
92
  v-if="searchNameAdd.length > 0"
@@ -337,7 +337,9 @@ export default defineComponent({
337
337
  };
338
338
  }
339
339
  onMounted(() => {
340
- searchBar.value = document.getElementById("complex_search_input");
340
+ searchBar.value = document.getElementById(
341
+ `complex_search_input_${props.complex_label}`
342
+ );
341
343
  searchBar.value?.addEventListener("input", debounce(changeInput, 500));
342
344
  del_table.value = Object.assign([], [...new Set(props.already_selected)]);
343
345
  add_table.value = Object.assign(
@@ -61,7 +61,7 @@
61
61
  <input
62
62
  class="oip_search_name"
63
63
  v-model="searchName"
64
- id="dropdown_search_input"
64
+ :id="`dropdown_search_input_${dropdown_label}`"
65
65
  :placeholder="getPlaceholder"
66
66
  />
67
67
  <div
@@ -226,7 +226,9 @@ export default defineComponent({
226
226
  };
227
227
  }
228
228
  onMounted(() => {
229
- searchBar.value = document.getElementById("dropdown_search_input");
229
+ searchBar.value = document.getElementById(
230
+ `dropdown_search_input_${props.dropdown_label}`
231
+ );
230
232
  searchBar.value?.addEventListener("input", debounce(changeInput, 500));
231
233
  table_values.value = props.element_table;
232
234
  selected_item.value = props.default_select !== null ? props.element_table[props.default_select] : null;
@@ -49,7 +49,7 @@
49
49
  v-model="searchName"
50
50
  class="oip_search_name"
51
51
  :placeholder="getPlaceholder"
52
- id="multiple_search_input"
52
+ :id="`multiple_search_input_${multiple_label}`"
53
53
  />
54
54
  <div
55
55
  v-if="searchName.length > 0"
@@ -438,7 +438,9 @@ export default defineComponent({
438
438
  };
439
439
  }
440
440
  onMounted(() => {
441
- searchBar.value = document.getElementById("multiple_search_input");
441
+ searchBar.value = document.getElementById(
442
+ `multiple_search_input_${props.multiple_label}`
443
+ );
442
444
  searchBar.value?.addEventListener("input", debounce(changeInput, 500));
443
445
  element_table_copy.value = props.element_table;
444
446
  if (props.preselection_all) {
@@ -97,6 +97,10 @@ export default defineComponent({
97
97
  return [null, "percentage", "price"].includes(value);
98
98
  }
99
99
  },
100
+ hasPercentages: {
101
+ type: Boolean,
102
+ default: false
103
+ },
100
104
  currency: {
101
105
  type: String,
102
106
  default: null
@@ -248,9 +252,32 @@ export default defineComponent({
248
252
  borderRadius: 2
249
253
  },
250
254
  formatter: function(value, opt) {
251
- const numValue = Math.round(value * 10) / 10;
252
- const returnValue = new Intl.NumberFormat("fr-FR").format(numValue).replace(",", ".");
253
- return value === null ? "" : `${returnValue}${props.dataType === "price" ? ` ${props.currency}` : props.dataType === "percentage" ? " %" : ""}`;
255
+ const seriesData = props.series;
256
+ if (props.hasPercentages && value !== null) {
257
+ const formatValue = new Intl.NumberFormat("fr-FR", {
258
+ maximumFractionDigits: 1
259
+ }).format(value).replace(",", ".");
260
+ let returnValue = props.dataType === "price" ? `${formatValue} ${props.currency}` : formatValue;
261
+ if (opt.dataPointIndex > 0 && seriesData[opt.seriesIndex].data[opt.dataPointIndex - 1] !== null && seriesData[opt.seriesIndex].data[opt.dataPointIndex] !== null) {
262
+ const previousVal = seriesData[opt.seriesIndex].data[opt.dataPointIndex - 1];
263
+ const plainPercent = (value - previousVal) / previousVal * 100;
264
+ const formatPercent = new Intl.NumberFormat("fr-FR", {
265
+ maximumFractionDigits: 1
266
+ }).format((value - previousVal) / previousVal * 100).replace(",", ".");
267
+ if (previousVal === 0) {
268
+ returnValue = "-";
269
+ } else if (Number(plainPercent) > 0) {
270
+ returnValue = `${returnValue} (+${formatPercent}%)`;
271
+ } else {
272
+ returnValue = returnValue + " (" + formatPercent + "%)";
273
+ }
274
+ }
275
+ return returnValue;
276
+ } else {
277
+ const numValue = Math.round(value * 10) / 10;
278
+ const returnValue = new Intl.NumberFormat("fr-FR").format(numValue).replace(",", ".");
279
+ return value === null ? "" : `${returnValue}${props.dataType === "price" ? ` ${props.currency}` : props.dataType === "percentage" ? " %" : ""}`;
280
+ }
254
281
  }
255
282
  };
256
283
  options.value["xaxis"] = {
@@ -46,6 +46,10 @@ declare const _default: import("vue").DefineComponent<{
46
46
  default: null;
47
47
  validator: (value: string | null) => boolean;
48
48
  };
49
+ hasPercentages: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
49
53
  currency: {
50
54
  type: StringConstructor;
51
55
  default: null;
@@ -104,6 +108,10 @@ declare const _default: import("vue").DefineComponent<{
104
108
  default: null;
105
109
  validator: (value: string | null) => boolean;
106
110
  };
111
+ hasPercentages: {
112
+ type: BooleanConstructor;
113
+ default: boolean;
114
+ };
107
115
  currency: {
108
116
  type: StringConstructor;
109
117
  default: null;
@@ -118,6 +126,7 @@ declare const _default: import("vue").DefineComponent<{
118
126
  tooltipOptions: Record<string, any>;
119
127
  formatDate: boolean;
120
128
  dataType: string;
129
+ hasPercentages: boolean;
121
130
  currency: string;
122
131
  }, {}>;
123
132
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.2.59",
3
+ "version": "0.2.61",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",