quasar-ui-danx 0.2.27 → 0.2.29
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
@@ -9,7 +9,9 @@ export interface TableColumn {
|
|
9
9
|
field: string,
|
10
10
|
format?: Function,
|
11
11
|
innerClass?: string | object,
|
12
|
-
|
12
|
+
style?: string,
|
13
|
+
headerStyle?: string,
|
14
|
+
isSaving?: boolean | Function,
|
13
15
|
label: string,
|
14
16
|
maxWidth?: number,
|
15
17
|
minWidth?: number,
|
@@ -20,7 +22,7 @@ export interface TableColumn {
|
|
20
22
|
sortable?: boolean,
|
21
23
|
sortBy?: string,
|
22
24
|
sortByExpression?: string,
|
23
|
-
titleColumns?:
|
25
|
+
titleColumns?: Function,
|
24
26
|
vnode?: Function,
|
25
27
|
}
|
26
28
|
|
package/src/helpers/formats.ts
CHANGED
@@ -166,20 +166,28 @@ export function centerTruncate(str, maxLength) {
|
|
166
166
|
}
|
167
167
|
}
|
168
168
|
|
169
|
+
interface FPercentOptions {
|
170
|
+
multiplier?: number,
|
171
|
+
maximumFractionDigits?: number,
|
172
|
+
NaN?: string
|
173
|
+
}
|
174
|
+
|
169
175
|
/**
|
170
176
|
* Formats a number into a percentage
|
171
177
|
* @param num
|
172
178
|
* @param options
|
173
179
|
* @returns {string}
|
174
180
|
*/
|
175
|
-
export function fPercent(num
|
176
|
-
|
181
|
+
export function fPercent(num: string | number, options: FPercentOptions = {}) {
|
182
|
+
options = { multiplier: 100, maximumFractionDigits: 1, NaN: "N/A", ...options };
|
183
|
+
|
184
|
+
num = parseFloat("" + num);
|
177
185
|
|
178
186
|
if (isNaN(num)) {
|
179
187
|
return options.NaN;
|
180
188
|
}
|
181
189
|
|
182
|
-
return fNumber(num * options.multiplier, options) + "%";
|
190
|
+
return fNumber(num * (options.multiplier || 100), options) + "%";
|
183
191
|
}
|
184
192
|
|
185
193
|
|