@uzum-tech/ui 1.5.1 → 1.5.3
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/README.md +0 -1
- package/dist/index.js +1333 -869
- package/dist/index.prod.js +3 -3
- package/es/_internal/checkbox/src/use-checkbox.js +3 -3
- package/es/_internal/radio/src/use-radio.js +3 -3
- package/es/_internal/typography/src/styles/text.cssr.js +0 -1
- package/es/_internal/typography/styles/light.js +1 -1
- package/es/_mixins/use-form-item.d.ts +4 -4
- package/es/_mixins/use-form-item.js +4 -4
- package/es/_styles/common/dark.js +1 -1
- package/es/_styles/common/light.d.ts +3 -0
- package/es/_styles/common/light.js +1 -1
- package/es/_utils/composable/composables.d.ts +11 -0
- package/es/_utils/composable/composables.js +40 -0
- package/es/_utils/index.d.ts +1 -1
- package/es/_utils/index.js +1 -1
- package/es/_utils/uzum/index.d.ts +1 -0
- package/es/_utils/uzum/index.js +1 -0
- package/es/_utils/uzum/value.d.ts +1 -0
- package/es/_utils/uzum/value.js +9 -0
- package/es/_utils/vue/resolve-slot.d.ts +1 -1
- package/es/alert/styles/light.js +6 -6
- package/es/auto-complete/src/AutoComplete.js +10 -10
- package/es/avatar/src/Avatar.d.ts +6 -0
- package/es/avatar/src/Avatar.js +9 -3
- package/es/card-list/src/CardList.js +1 -1
- package/es/card-list/src/CardListItem.d.ts +13 -0
- package/es/card-list/src/CardListItem.js +11 -4
- package/es/card-list/src/interface.d.ts +1 -0
- package/es/card-list/src/styles/index.cssr.js +6 -6
- package/es/card-list/styles/light.js +2 -2
- package/es/cascader/src/Cascader.js +7 -7
- package/es/checkbox/src/CheckboxGroup.js +9 -9
- package/es/color-picker/src/ColorPicker.js +6 -6
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/data-table/src/DataTable.d.ts +8 -0
- package/es/data-table/src/DataTable.js +21 -10
- package/es/data-table/src/TableParts/Body.d.ts +1 -0
- package/es/data-table/src/TableParts/Body.js +6 -5
- package/es/data-table/src/TableParts/Cell.js +85 -23
- package/es/data-table/src/interface.d.ts +13 -6
- package/es/data-table/src/interface.js +1 -1
- package/es/data-table/src/styles/index.cssr.js +5 -3
- package/es/data-table/src/use-mask.d.ts +3 -6
- package/es/data-table/src/utils.d.ts +2 -1
- package/es/data-table/src/utils.js +13 -0
- package/es/date-picker/src/DatePicker.js +7 -7
- package/es/dialog/src/DialogProvider.d.ts +6 -0
- package/es/dynamic-tags/src/DynamicTags.js +3 -3
- package/es/input/src/Input.js +8 -8
- package/es/input-number/src/InputNumber.js +7 -7
- package/es/input-otp/index.d.ts +3 -0
- package/es/input-otp/index.js +1 -0
- package/es/input-otp/src/InputOtp.d.ts +871 -0
- package/es/input-otp/src/InputOtp.js +250 -0
- package/es/input-otp/src/public-types.d.ts +25 -0
- package/es/input-otp/src/public-types.js +1 -0
- package/es/input-otp/src/styles/index.cssr.d.ts +2 -0
- package/es/input-otp/src/styles/index.cssr.js +20 -0
- package/es/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
- package/es/input-otp/src/styles/input-otp-rtl.cssr.js +5 -0
- package/es/input-otp/styles/dark.d.ts +3 -0
- package/es/input-otp/styles/dark.js +12 -0
- package/es/input-otp/styles/index.d.ts +4 -0
- package/es/input-otp/styles/index.js +3 -0
- package/es/input-otp/styles/light.d.ts +83 -0
- package/es/input-otp/styles/light.js +22 -0
- package/es/input-otp/styles/rtl.d.ts +2 -0
- package/es/input-otp/styles/rtl.js +5 -0
- package/es/legacy-transfer/src/Transfer.js +3 -3
- package/es/list/src/List.d.ts +41 -55
- package/es/list/src/List.js +6 -10
- package/es/list/src/ListItem.d.ts +84 -25
- package/es/list/src/ListItem.js +120 -98
- package/es/list/src/interface.d.ts +1 -0
- package/es/list/src/props.d.ts +70 -31
- package/es/list/src/props.js +25 -5
- package/es/list/src/styles/index.cssr.js +32 -90
- package/es/list/styles/light.d.ts +5 -8
- package/es/list/styles/light.js +6 -9
- package/es/mention/src/Mention.js +7 -7
- package/es/radio/src/RadioGroup.js +5 -5
- package/es/rate/src/Rate.js +3 -3
- package/es/select/src/Select.js +7 -7
- package/es/slider/src/Slider.js +3 -3
- package/es/styles.d.ts +1 -0
- package/es/styles.js +1 -0
- package/es/switch/src/Switch.js +7 -7
- package/es/tag/src/styles/index.cssr.js +5 -1
- package/es/tag/styles/light.js +2 -2
- package/es/theme-editor/src/ThemeEditor.d.ts +3 -0
- package/es/themes/dark.js +2 -0
- package/es/themes/light.js +2 -0
- package/es/time-picker/src/TimePicker.js +7 -7
- package/es/transfer/src/Transfer.js +3 -3
- package/es/tree-select/src/TreeSelect.js +5 -5
- package/es/upload/src/UploadFile.js +4 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/checkbox/src/use-checkbox.js +3 -3
- package/lib/_internal/radio/src/use-radio.js +3 -3
- package/lib/_internal/typography/src/styles/text.cssr.js +0 -1
- package/lib/_internal/typography/styles/light.js +1 -1
- package/lib/_mixins/use-form-item.d.ts +4 -4
- package/lib/_mixins/use-form-item.js +4 -4
- package/lib/_styles/common/dark.js +1 -1
- package/lib/_styles/common/light.d.ts +3 -0
- package/lib/_styles/common/light.js +1 -1
- package/lib/_utils/composable/composables.d.ts +11 -0
- package/lib/_utils/composable/composables.js +47 -0
- package/lib/_utils/index.d.ts +1 -1
- package/lib/_utils/index.js +2 -1
- package/lib/_utils/uzum/index.d.ts +1 -0
- package/lib/_utils/uzum/index.js +3 -1
- package/lib/_utils/uzum/value.d.ts +1 -0
- package/lib/_utils/uzum/value.js +12 -0
- package/lib/_utils/vue/resolve-slot.d.ts +1 -1
- package/lib/alert/styles/light.js +6 -6
- package/lib/auto-complete/src/AutoComplete.js +10 -10
- package/lib/avatar/src/Avatar.d.ts +6 -0
- package/lib/avatar/src/Avatar.js +9 -3
- package/lib/card-list/src/CardList.js +1 -1
- package/lib/card-list/src/CardListItem.d.ts +13 -0
- package/lib/card-list/src/CardListItem.js +11 -4
- package/lib/card-list/src/interface.d.ts +1 -0
- package/lib/card-list/src/styles/index.cssr.js +5 -5
- package/lib/card-list/styles/light.js +2 -2
- package/lib/cascader/src/Cascader.js +7 -7
- package/lib/checkbox/src/CheckboxGroup.js +9 -9
- package/lib/color-picker/src/ColorPicker.js +6 -6
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/data-table/src/DataTable.d.ts +8 -0
- package/lib/data-table/src/DataTable.js +21 -10
- package/lib/data-table/src/TableParts/Body.d.ts +1 -0
- package/lib/data-table/src/TableParts/Body.js +6 -5
- package/lib/data-table/src/TableParts/Cell.js +84 -22
- package/lib/data-table/src/interface.d.ts +13 -6
- package/lib/data-table/src/interface.js +1 -1
- package/lib/data-table/src/styles/index.cssr.js +5 -3
- package/lib/data-table/src/use-mask.d.ts +3 -6
- package/lib/data-table/src/utils.d.ts +2 -1
- package/lib/data-table/src/utils.js +14 -1
- package/lib/date-picker/src/DatePicker.js +7 -7
- package/lib/dialog/src/DialogProvider.d.ts +6 -0
- package/lib/dynamic-tags/src/DynamicTags.js +3 -3
- package/lib/input/src/Input.js +8 -8
- package/lib/input-number/src/InputNumber.js +7 -7
- package/lib/input-otp/index.d.ts +3 -0
- package/lib/input-otp/index.js +9 -0
- package/lib/input-otp/src/InputOtp.d.ts +871 -0
- package/lib/input-otp/src/InputOtp.js +256 -0
- package/lib/input-otp/src/public-types.d.ts +25 -0
- package/lib/input-otp/src/public-types.js +2 -0
- package/lib/input-otp/src/styles/index.cssr.d.ts +2 -0
- package/lib/input-otp/src/styles/index.cssr.js +25 -0
- package/lib/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
- package/lib/input-otp/src/styles/input-otp-rtl.cssr.js +10 -0
- package/lib/input-otp/styles/dark.d.ts +3 -0
- package/lib/input-otp/styles/dark.js +14 -0
- package/lib/input-otp/styles/index.d.ts +4 -0
- package/lib/input-otp/styles/index.js +12 -0
- package/lib/input-otp/styles/light.d.ts +83 -0
- package/lib/input-otp/styles/light.js +25 -0
- package/lib/input-otp/styles/rtl.d.ts +2 -0
- package/lib/input-otp/styles/rtl.js +11 -0
- package/lib/legacy-transfer/src/Transfer.js +3 -3
- package/lib/list/src/List.d.ts +41 -55
- package/lib/list/src/List.js +6 -10
- package/lib/list/src/ListItem.d.ts +84 -25
- package/lib/list/src/ListItem.js +119 -97
- package/lib/list/src/interface.d.ts +1 -0
- package/lib/list/src/props.d.ts +70 -31
- package/lib/list/src/props.js +25 -5
- package/lib/list/src/styles/index.cssr.js +32 -90
- package/lib/list/styles/light.d.ts +5 -8
- package/lib/list/styles/light.js +6 -9
- package/lib/mention/src/Mention.js +7 -7
- package/lib/radio/src/RadioGroup.js +5 -5
- package/lib/rate/src/Rate.js +3 -3
- package/lib/select/src/Select.js +7 -7
- package/lib/slider/src/Slider.js +3 -3
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +106 -103
- package/lib/switch/src/Switch.js +7 -7
- package/lib/tag/src/styles/index.cssr.js +5 -1
- package/lib/tag/styles/light.js +2 -2
- package/lib/theme-editor/src/ThemeEditor.d.ts +3 -0
- package/lib/themes/dark.js +2 -0
- package/lib/themes/light.js +2 -0
- package/lib/time-picker/src/TimePicker.js +7 -7
- package/lib/transfer/src/Transfer.js +3 -3
- package/lib/tree-select/src/TreeSelect.js +5 -5
- package/lib/upload/src/UploadFile.js +4 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +1 -0
- package/web-types.json +180 -38
|
@@ -188,7 +188,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
188
188
|
}
|
|
189
189
|
function doUpdateValue(value, option, optionPath) {
|
|
190
190
|
const { onUpdateValue, 'onUpdate:value': _onUpdateValue, onChange } = props;
|
|
191
|
-
const {
|
|
191
|
+
const { triggerFormInput, triggerFormChange } = formItem;
|
|
192
192
|
if (onUpdateValue) {
|
|
193
193
|
(0, _utils_1.call)(onUpdateValue, value, option, optionPath);
|
|
194
194
|
}
|
|
@@ -199,8 +199,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
199
199
|
(0, _utils_1.call)(onChange, value, option, optionPath);
|
|
200
200
|
}
|
|
201
201
|
uncontrolledValueRef.value = value;
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
triggerFormInput();
|
|
203
|
+
triggerFormChange();
|
|
204
204
|
}
|
|
205
205
|
function updateKeyboardKey(key) {
|
|
206
206
|
keyboardKeyRef.value = key;
|
|
@@ -377,17 +377,17 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
377
377
|
// --- methods
|
|
378
378
|
function doBlur(e) {
|
|
379
379
|
const { onBlur } = props;
|
|
380
|
-
const {
|
|
380
|
+
const { triggerFormBlur } = formItem;
|
|
381
381
|
if (onBlur)
|
|
382
382
|
(0, _utils_1.call)(onBlur, e);
|
|
383
|
-
|
|
383
|
+
triggerFormBlur();
|
|
384
384
|
}
|
|
385
385
|
function doFocus(e) {
|
|
386
386
|
const { onFocus } = props;
|
|
387
|
-
const {
|
|
387
|
+
const { triggerFormFocus } = formItem;
|
|
388
388
|
if (onFocus)
|
|
389
389
|
(0, _utils_1.call)(onFocus, e);
|
|
390
|
-
|
|
390
|
+
triggerFormFocus();
|
|
391
391
|
}
|
|
392
392
|
function focusSelectionInput() {
|
|
393
393
|
var _a;
|
|
@@ -52,7 +52,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
52
52
|
return new Set();
|
|
53
53
|
});
|
|
54
54
|
function toggleCheckbox(checked, checkboxValue) {
|
|
55
|
-
const {
|
|
55
|
+
const { triggerFormInput, triggerFormChange } = formItem;
|
|
56
56
|
const { onChange, 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
57
57
|
if (Array.isArray(mergedValueRef.value)) {
|
|
58
58
|
const groupValue = Array.from(mergedValueRef.value);
|
|
@@ -72,8 +72,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
72
72
|
value: checkboxValue
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
triggerFormInput();
|
|
76
|
+
triggerFormChange();
|
|
77
77
|
uncontrolledValueRef.value = groupValue;
|
|
78
78
|
// deprecated
|
|
79
79
|
if (onChange)
|
|
@@ -98,8 +98,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
98
98
|
if (onChange)
|
|
99
99
|
(0, _utils_1.call)(onChange, groupValue); // deprecated
|
|
100
100
|
uncontrolledValueRef.value = groupValue;
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
triggerFormInput();
|
|
102
|
+
triggerFormChange();
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -120,8 +120,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
120
120
|
if (onChange)
|
|
121
121
|
(0, _utils_1.call)(onChange, [checkboxValue]); // deprecated
|
|
122
122
|
uncontrolledValueRef.value = [checkboxValue];
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
triggerFormInput();
|
|
124
|
+
triggerFormChange();
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
127
|
if (onUpdateValue) {
|
|
@@ -139,8 +139,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
139
139
|
if (onChange)
|
|
140
140
|
(0, _utils_1.call)(onChange, []); // deprecated
|
|
141
141
|
uncontrolledValueRef.value = [];
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
triggerFormInput();
|
|
143
|
+
triggerFormChange();
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -261,14 +261,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
261
261
|
else {
|
|
262
262
|
upcomingValue = null;
|
|
263
263
|
}
|
|
264
|
-
const {
|
|
264
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
265
265
|
const { onUpdateValue, 'onUpdate:value': _onUpdateValue } = props;
|
|
266
266
|
if (onUpdateValue)
|
|
267
267
|
(0, _utils_1.call)(onUpdateValue, value);
|
|
268
268
|
if (_onUpdateValue)
|
|
269
269
|
(0, _utils_1.call)(_onUpdateValue, value);
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
triggerFormChange();
|
|
271
|
+
triggerFormInput();
|
|
272
272
|
uncontrolledValueRef.value = value;
|
|
273
273
|
}
|
|
274
274
|
function handleInputUpdateValue(value) {
|
|
@@ -279,7 +279,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
279
279
|
const { value } = mergedValueRef;
|
|
280
280
|
// no value & only hue changes will complete with no value
|
|
281
281
|
if (value) {
|
|
282
|
-
const {
|
|
282
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
283
283
|
const { onComplete } = props;
|
|
284
284
|
if (onComplete) {
|
|
285
285
|
;
|
|
@@ -291,8 +291,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
291
291
|
undoStack.splice(valueIndex + 1, undoStack.length, value);
|
|
292
292
|
valueIndexRef.value = valueIndex + 1;
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
triggerFormChange();
|
|
295
|
+
triggerFormInput();
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
function undo() {
|
package/lib/components.d.ts
CHANGED
package/lib/components.js
CHANGED
|
@@ -60,6 +60,7 @@ __exportStar(require("./icon-wrapper"), exports);
|
|
|
60
60
|
__exportStar(require("./image"), exports);
|
|
61
61
|
__exportStar(require("./input"), exports);
|
|
62
62
|
__exportStar(require("./input-number"), exports);
|
|
63
|
+
__exportStar(require("./input-otp"), exports);
|
|
63
64
|
__exportStar(require("./layout"), exports);
|
|
64
65
|
__exportStar(require("./legacy-grid"), exports);
|
|
65
66
|
__exportStar(require("./legacy-transfer"), exports);
|
|
@@ -37,6 +37,7 @@ import type { IconWrapperTheme } from '../../icon-wrapper/styles';
|
|
|
37
37
|
import type { ImageTheme } from '../../image/styles';
|
|
38
38
|
import type { InputTheme } from '../../input/styles';
|
|
39
39
|
import type { InputNumberTheme } from '../../input-number/styles';
|
|
40
|
+
import type { InputOtpTheme } from '../../input-otp/styles';
|
|
40
41
|
import type { LayoutTheme } from '../../layout/styles';
|
|
41
42
|
import type { LegacyTransferTheme } from '../../legacy-transfer/styles';
|
|
42
43
|
import type { ListTheme } from '../../list/styles';
|
|
@@ -190,6 +191,7 @@ export interface GlobalThemeWithoutCommon {
|
|
|
190
191
|
InternalSelectMenu?: InternalSelectMenuTheme;
|
|
191
192
|
InternalSelection?: InternalSelectionTheme;
|
|
192
193
|
AccountOption?: AccountOptionTheme;
|
|
194
|
+
InputOtp?: InputOtpTheme;
|
|
193
195
|
}
|
|
194
196
|
export interface GlobalComponentConfig {
|
|
195
197
|
Pagination?: {
|
|
@@ -24,6 +24,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
24
|
readonly default: () => never[];
|
|
25
25
|
};
|
|
26
26
|
readonly loading: BooleanConstructor;
|
|
27
|
+
readonly loadingSkeleton: BooleanConstructor;
|
|
27
28
|
readonly bordered: {
|
|
28
29
|
readonly type: import("vue").PropType<boolean | undefined>;
|
|
29
30
|
readonly default: undefined;
|
|
@@ -2871,6 +2872,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2871
2872
|
page: (page: number) => void;
|
|
2872
2873
|
sort: (columnKey: import("./interface").ColumnKey, order: import("./interface").SortOrder) => void;
|
|
2873
2874
|
scrollTo: import("../../scrollbar/src/Scrollbar").ScrollTo;
|
|
2875
|
+
getData: () => {
|
|
2876
|
+
data: import("./interface").InternalRowData[];
|
|
2877
|
+
totalRows: import("./interface").InternalRowData | null;
|
|
2878
|
+
};
|
|
2879
|
+
getTotalRowData: () => import("./interface").InternalRowData | null;
|
|
2874
2880
|
clearFilter: () => void;
|
|
2875
2881
|
mainTableInstRef: import("vue").Ref<{
|
|
2876
2882
|
getHeaderElement: () => HTMLElement | null;
|
|
@@ -4295,6 +4301,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4295
4301
|
readonly default: () => never[];
|
|
4296
4302
|
};
|
|
4297
4303
|
readonly loading: BooleanConstructor;
|
|
4304
|
+
readonly loadingSkeleton: BooleanConstructor;
|
|
4298
4305
|
readonly bordered: {
|
|
4299
4306
|
readonly type: import("vue").PropType<boolean | undefined>;
|
|
4300
4307
|
readonly default: undefined;
|
|
@@ -7145,6 +7152,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7145
7152
|
readonly virtualScroll: boolean;
|
|
7146
7153
|
readonly tableLayout: "auto" | "fixed";
|
|
7147
7154
|
readonly columns: import("./interface").TableColumns<any>;
|
|
7155
|
+
readonly loadingSkeleton: boolean;
|
|
7148
7156
|
readonly remote: boolean;
|
|
7149
7157
|
readonly paginateSinglePage: boolean;
|
|
7150
7158
|
readonly bottomBordered: boolean | undefined;
|
|
@@ -18,7 +18,6 @@ const use_resizable_1 = require("./use-resizable");
|
|
|
18
18
|
const interface_1 = require("./interface");
|
|
19
19
|
const use_group_header_1 = require("./use-group-header");
|
|
20
20
|
const use_expand_1 = require("./use-expand");
|
|
21
|
-
const use_mask_1 = require("./use-mask");
|
|
22
21
|
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
23
22
|
exports.default = (0, vue_1.defineComponent)({
|
|
24
23
|
name: 'DataTable',
|
|
@@ -98,7 +97,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
98
97
|
return;
|
|
99
98
|
if (!('totalRow' in col) || !col.totalRow)
|
|
100
99
|
return;
|
|
101
|
-
const { key, totalRow, render
|
|
100
|
+
const { key, totalRow, render } = col;
|
|
102
101
|
if (!totalRow)
|
|
103
102
|
return;
|
|
104
103
|
if (totalRow.type === 'default') {
|
|
@@ -111,18 +110,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
111
110
|
return Number(renderedValue) || 0;
|
|
112
111
|
});
|
|
113
112
|
const sum = values.reduce((sum, val) => sum + val, 0);
|
|
114
|
-
|
|
115
|
-
? (0, use_mask_1.processMaskedValue)(String(sum), mask)
|
|
116
|
-
: sum;
|
|
117
|
-
summaryRow[key] = { value: finalValue };
|
|
113
|
+
summaryRow[key] = { value: sum };
|
|
118
114
|
}
|
|
119
115
|
else {
|
|
120
116
|
const values = pageData.map((row) => Number(row[key]) || 0);
|
|
121
117
|
const sum = values.reduce((sum, val) => sum + val, 0);
|
|
122
|
-
|
|
123
|
-
? (0, use_mask_1.processMaskedValue)(String(sum), mask)
|
|
124
|
-
: sum;
|
|
125
|
-
summaryRow[key] = { value: finalValue };
|
|
118
|
+
summaryRow[key] = { value: sum };
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
121
|
else {
|
|
@@ -258,6 +251,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
258
251
|
mergedSortStateRef,
|
|
259
252
|
mergedFilterStateRef,
|
|
260
253
|
loadingRef: (0, vue_1.toRef)(props, 'loading'),
|
|
254
|
+
loadingSkeletonRef: (0, vue_1.toRef)(props, 'loadingSkeleton'),
|
|
261
255
|
rowClassNameRef: (0, vue_1.toRef)(props, 'rowClassName'),
|
|
262
256
|
mergedCheckedRowKeySetRef,
|
|
263
257
|
mergedExpandedRowKeysRef,
|
|
@@ -324,6 +318,23 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
324
318
|
scrollTo: (arg0, arg1) => {
|
|
325
319
|
var _a;
|
|
326
320
|
(_a = mainTableInstRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg0, arg1);
|
|
321
|
+
},
|
|
322
|
+
getData: () => {
|
|
323
|
+
const originalData = props.data || [];
|
|
324
|
+
const totalRowData = autoSummaryRef.value && rawPaginatedDataRef.value
|
|
325
|
+
? autoSummaryRef.value(rawPaginatedDataRef.value)
|
|
326
|
+
: null;
|
|
327
|
+
return {
|
|
328
|
+
data: originalData,
|
|
329
|
+
totalRows: totalRowData
|
|
330
|
+
};
|
|
331
|
+
},
|
|
332
|
+
getTotalRowData: () => {
|
|
333
|
+
if (autoSummaryRef.value && rawPaginatedDataRef.value) {
|
|
334
|
+
const summaryResult = autoSummaryRef.value(rawPaginatedDataRef.value);
|
|
335
|
+
return summaryResult;
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
327
338
|
}
|
|
328
339
|
};
|
|
329
340
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
@@ -1376,6 +1376,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1376
1376
|
scrollX: import("vue").Ref<string | number | undefined>;
|
|
1377
1377
|
cols: import("vue").Ref<ColItem[]>;
|
|
1378
1378
|
loading: import("vue").Ref<boolean>;
|
|
1379
|
+
loadingSkeleton: import("vue").Ref<boolean>;
|
|
1379
1380
|
bodyShowHeaderOnly: import("vue").ComputedRef<boolean>;
|
|
1380
1381
|
shouldDisplaySomeTablePart: import("vue").ComputedRef<boolean>;
|
|
1381
1382
|
empty: import("vue").ComputedRef<boolean>;
|
|
@@ -99,7 +99,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
99
99
|
bodyStyle: Object
|
|
100
100
|
},
|
|
101
101
|
setup(props) {
|
|
102
|
-
const { slots: dataTableSlots, bodyWidthRef, mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, leftActiveFixedChildrenColKeysRef, rightActiveFixedColKeyRef, rightActiveFixedChildrenColKeysRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, mergedTableLayoutRef, childTriggerColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, loadingRef, onLoadRef, loadingKeySetRef, expandableRef, stickyExpandedRowsRef, renderExpandIconRef, summaryPlacementRef, treeMateRef, scrollbarPropsRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck, renderCell
|
|
102
|
+
const { slots: dataTableSlots, bodyWidthRef, mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, leftActiveFixedChildrenColKeysRef, rightActiveFixedColKeyRef, rightActiveFixedChildrenColKeysRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, mergedTableLayoutRef, childTriggerColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, loadingRef, loadingSkeletonRef, onLoadRef, loadingKeySetRef, expandableRef, stickyExpandedRowsRef, renderExpandIconRef, summaryPlacementRef, treeMateRef, scrollbarPropsRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck, renderCell
|
|
103
103
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
104
104
|
} = (0, vue_1.inject)(interface_1.dataTableInjectionKey);
|
|
105
105
|
const scrollbarInstRef = (0, vue_1.ref)(null);
|
|
@@ -309,7 +309,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
309
309
|
componentId,
|
|
310
310
|
scrollbarInstRef,
|
|
311
311
|
virtualListRef,
|
|
312
|
-
emptyElRef, summary: summaryRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: mergedThemeRef, scrollX: scrollXRef, cols: colsRef, loading: loadingRef, bodyShowHeaderOnly: bodyShowHeaderOnlyRef, shouldDisplaySomeTablePart: shouldDisplaySomeTablePartRef, empty: emptyRef, paginatedDataAndInfo: (0, vue_1.computed)(() => {
|
|
312
|
+
emptyElRef, summary: summaryRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: mergedThemeRef, scrollX: scrollXRef, cols: colsRef, loading: loadingRef, loadingSkeleton: loadingSkeletonRef, bodyShowHeaderOnly: bodyShowHeaderOnlyRef, shouldDisplaySomeTablePart: shouldDisplaySomeTablePartRef, empty: emptyRef, paginatedDataAndInfo: (0, vue_1.computed)(() => {
|
|
313
313
|
const { value: striped } = stripedRef;
|
|
314
314
|
let hasChildren = false;
|
|
315
315
|
const data = paginatedDataRef.value.map(striped
|
|
@@ -565,6 +565,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
565
565
|
`${mergedClsPrefix}-data-table-td--last-row`,
|
|
566
566
|
'editable' in column &&
|
|
567
567
|
column.editable &&
|
|
568
|
+
!isSummary &&
|
|
568
569
|
`${mergedClsPrefix}-data-table-td--editable`
|
|
569
570
|
] }),
|
|
570
571
|
column.fixed && ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-data-table-td__shadow-holder` })),
|
|
@@ -596,12 +597,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
596
597
|
} },
|
|
597
598
|
(0, vue_1.h)("colgroup", null, cols.map((col) => ((0, vue_1.h)("col", { key: col.key, style: col.style })))),
|
|
598
599
|
this.showHeader ? (0, vue_1.h)(Header_1.default, { discrete: false }) : null,
|
|
599
|
-
this.
|
|
600
|
+
this.loadingSkeleton ? ((0, vue_1.h)(BodySkeleton_1.default, null)) : !this.empty ? ((0, vue_1.h)("tbody", { "data-u-id": componentId, class: `${mergedClsPrefix}-data-table-tbody` }, displayedData.map((rowInfo, displayedRowIndex) => {
|
|
600
601
|
return renderRow(rowInfo, displayedRowIndex, false);
|
|
601
602
|
}))) : null));
|
|
602
603
|
}
|
|
603
604
|
else {
|
|
604
|
-
if (this.loading) {
|
|
605
|
+
if (this.loading || this.loadingSkeleton) {
|
|
605
606
|
return ((0, vue_1.h)("table", { class: `${mergedClsPrefix}-data-table-table`, onMouseleave: handleMouseleaveTable, style: {
|
|
606
607
|
tableLayout: this.mergedTableLayout
|
|
607
608
|
} },
|
|
@@ -620,7 +621,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
620
621
|
}
|
|
621
622
|
}
|
|
622
623
|
}));
|
|
623
|
-
if (this.empty) {
|
|
624
|
+
if (this.empty && !this.loadingSkeleton) {
|
|
624
625
|
const createEmptyNode = () => ((0, vue_1.h)("div", { class: [
|
|
625
626
|
`${mergedClsPrefix}-data-table-empty`,
|
|
626
627
|
this.loading && `${mergedClsPrefix}-data-table-empty--hide`
|
|
@@ -4,6 +4,7 @@ const vue_1 = require("vue");
|
|
|
4
4
|
const lodash_es_1 = require("lodash-es");
|
|
5
5
|
const ellipsis_1 = require("../../../ellipsis");
|
|
6
6
|
const use_mask_1 = require("../use-mask");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
7
8
|
exports.default = (0, vue_1.defineComponent)({
|
|
8
9
|
name: 'DataTableCell',
|
|
9
10
|
emits: ['edit'],
|
|
@@ -35,7 +36,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
35
36
|
var _a;
|
|
36
37
|
const { isSummary, column, row, renderCell } = this;
|
|
37
38
|
let cell;
|
|
38
|
-
|
|
39
|
+
let { mask } = column;
|
|
40
|
+
const { render, key, ellipsis, editable, numeric } = column;
|
|
41
|
+
if (numeric && !mask)
|
|
42
|
+
mask = utils_1.defaultNumericMask;
|
|
39
43
|
if (render && !isSummary) {
|
|
40
44
|
let cellValue = render(row, this.index);
|
|
41
45
|
if (mask && cellValue !== null && cellValue !== undefined) {
|
|
@@ -47,37 +51,95 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
47
51
|
}
|
|
48
52
|
else if (editable && !isSummary) {
|
|
49
53
|
const { placeholder } = column;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
+
const rawValue = String(row[key] || '');
|
|
55
|
+
const displayValue = mask ? (0, use_mask_1.processMaskedValue)(rawValue, mask) : rawValue;
|
|
56
|
+
const isEditingRef = { current: false };
|
|
54
57
|
const inputProps = {
|
|
55
58
|
class: `${this.clsPrefix}-data-table-editable-input`,
|
|
56
|
-
value:
|
|
59
|
+
value: displayValue,
|
|
57
60
|
placeholder: placeholder || '',
|
|
61
|
+
onFocus: (e) => {
|
|
62
|
+
const input = e.target;
|
|
63
|
+
isEditingRef.current = true;
|
|
64
|
+
input.value = rawValue;
|
|
65
|
+
},
|
|
66
|
+
onKeyDown: (e) => {
|
|
67
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
68
|
+
const input = e.target;
|
|
69
|
+
input.value = rawValue;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
58
72
|
onInput: (e) => {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
const input = e.target;
|
|
74
|
+
const value = input.value;
|
|
75
|
+
if (mask && typeof mask === 'function' && !isEditingRef.current) {
|
|
76
|
+
isEditingRef.current = true;
|
|
77
|
+
}
|
|
78
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
79
|
+
const rawValue = value.replace(/\$/g, '').replace(/[^\d.,]/g, '');
|
|
80
|
+
input.value = rawValue;
|
|
81
|
+
let processedValue = rawValue;
|
|
82
|
+
if (numeric && rawValue !== '') {
|
|
83
|
+
const cleanValue = rawValue
|
|
84
|
+
.replace(/[^\d.,]/g, '')
|
|
85
|
+
.replace(',', '.');
|
|
86
|
+
const numValue = Number(cleanValue);
|
|
87
|
+
if (!isNaN(numValue)) {
|
|
88
|
+
processedValue = numValue;
|
|
68
89
|
}
|
|
69
|
-
}
|
|
90
|
+
}
|
|
70
91
|
this.$emit('edit', processedValue, row, key);
|
|
92
|
+
void Promise.resolve().then(() => {
|
|
93
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
94
|
+
input.value = rawValue;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let processedValue = value;
|
|
100
|
+
if (numeric && value !== '') {
|
|
101
|
+
const cleanValue = value.replace(/[^\d.,]/g, '').replace(',', '.');
|
|
102
|
+
const numValue = Number(cleanValue);
|
|
103
|
+
if (!isNaN(numValue)) {
|
|
104
|
+
processedValue = numValue;
|
|
105
|
+
}
|
|
71
106
|
}
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
this.$emit('edit', processedValue, row, key);
|
|
108
|
+
},
|
|
109
|
+
onKeyUp: (e) => {
|
|
110
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
111
|
+
const input = e.target;
|
|
112
|
+
input.value = rawValue;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
onChange: (e) => {
|
|
116
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
117
|
+
const input = e.target;
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
120
|
+
input.value = rawValue;
|
|
121
|
+
}
|
|
122
|
+
}, 0);
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
125
|
+
input.value = rawValue;
|
|
126
|
+
}
|
|
127
|
+
}, 10);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
onBlur: (e) => {
|
|
131
|
+
isEditingRef.current = false;
|
|
132
|
+
if (mask) {
|
|
133
|
+
const input = e.target;
|
|
134
|
+
let currentValue = input.value;
|
|
135
|
+
if (numeric && currentValue !== '') {
|
|
136
|
+
currentValue = currentValue.replace(',', '.');
|
|
137
|
+
}
|
|
138
|
+
const maskedValue = (0, use_mask_1.processMaskedValue)(currentValue, mask);
|
|
139
|
+
input.value = maskedValue;
|
|
74
140
|
}
|
|
75
141
|
}
|
|
76
142
|
};
|
|
77
|
-
if (mask) {
|
|
78
|
-
inputProps['data-mask'] =
|
|
79
|
-
typeof mask === 'string' ? mask : JSON.stringify(mask);
|
|
80
|
-
}
|
|
81
143
|
cell = (0, vue_1.h)('input', inputProps);
|
|
82
144
|
}
|
|
83
145
|
else {
|
|
@@ -34,6 +34,7 @@ export declare const dataTableProps: {
|
|
|
34
34
|
readonly default: () => never[];
|
|
35
35
|
};
|
|
36
36
|
readonly loading: BooleanConstructor;
|
|
37
|
+
readonly loadingSkeleton: BooleanConstructor;
|
|
37
38
|
readonly bordered: {
|
|
38
39
|
readonly type: PropType<boolean | undefined>;
|
|
39
40
|
readonly default: undefined;
|
|
@@ -2912,6 +2913,10 @@ export interface CommonColumnInfo<T = InternalRowData> {
|
|
|
2912
2913
|
cellProps?: (rowData: T, rowIndex: number) => HTMLAttributes;
|
|
2913
2914
|
visible?: boolean;
|
|
2914
2915
|
}
|
|
2916
|
+
export interface TableColumnMaskObject {
|
|
2917
|
+
postProcess: (value: string) => string;
|
|
2918
|
+
}
|
|
2919
|
+
export type TableColumnMask = string | ((value: string) => string) | TableColumnMaskObject;
|
|
2915
2920
|
export type TableColumnTitle = string | ((column: TableBaseColumn) => VNodeChild);
|
|
2916
2921
|
export type TableExpandColumnTitle = string | ((column: TableExpandColumn) => VNodeChild);
|
|
2917
2922
|
export type TableColumnGroupTitle = string | ((column: TableColumnGroup) => VNodeChild);
|
|
@@ -2931,18 +2936,14 @@ export type TableBaseColumn<T = InternalRowData> = {
|
|
|
2931
2936
|
type?: never;
|
|
2932
2937
|
key: ColumnKey;
|
|
2933
2938
|
editable?: boolean;
|
|
2934
|
-
mask?:
|
|
2935
|
-
|
|
2936
|
-
};
|
|
2939
|
+
mask?: TableColumnMask;
|
|
2940
|
+
numeric?: boolean;
|
|
2937
2941
|
placeholder?: string;
|
|
2938
2942
|
totalRow?: {
|
|
2939
2943
|
type: 'sum' | 'default' | 'diff' | 'multiply' | 'divide' | 'percentage' | 'function';
|
|
2940
2944
|
value?: string;
|
|
2941
2945
|
fields?: string[];
|
|
2942
2946
|
function?: (values: number[]) => number;
|
|
2943
|
-
mask?: string | ((value: string) => string) | {
|
|
2944
|
-
postProcess: (value: string) => string;
|
|
2945
|
-
};
|
|
2946
2947
|
};
|
|
2947
2948
|
tree?: boolean;
|
|
2948
2949
|
sorter?: boolean | Sorter<T> | 'default';
|
|
@@ -3035,6 +3036,7 @@ export interface DataTableInjection {
|
|
|
3035
3036
|
mergedSortStateRef: Ref<SortState[]>;
|
|
3036
3037
|
mergedFilterStateRef: Ref<FilterState>;
|
|
3037
3038
|
loadingRef: Ref<boolean>;
|
|
3039
|
+
loadingSkeletonRef: Ref<boolean>;
|
|
3038
3040
|
rowClassNameRef: Ref<string | CreateRowClassName | undefined>;
|
|
3039
3041
|
mergedCheckedRowKeySetRef: Ref<Set<RowKey>>;
|
|
3040
3042
|
mergedInderminateRowKeySetRef: Ref<Set<RowKey>>;
|
|
@@ -3136,6 +3138,11 @@ export interface DataTableInst {
|
|
|
3136
3138
|
page: (page: number) => void;
|
|
3137
3139
|
sort: (columnKey: ColumnKey, order: SortOrder) => void;
|
|
3138
3140
|
scrollTo: ScrollTo;
|
|
3141
|
+
getData: () => {
|
|
3142
|
+
data: InternalRowData[];
|
|
3143
|
+
totalRows: InternalRowData | null;
|
|
3144
|
+
};
|
|
3145
|
+
getTotalRowData: () => InternalRowData | null;
|
|
3139
3146
|
/** @deprecated it but just leave it here, it does no harm */
|
|
3140
3147
|
clearFilter: () => void;
|
|
3141
3148
|
}
|
|
@@ -17,7 +17,7 @@ exports.dataTableProps = Object.assign(Object.assign({}, _mixins_1.useTheme.prop
|
|
|
17
17
|
}, rowClassName: [String, Function], rowProps: Function, rowKey: Function, summary: [Function], data: {
|
|
18
18
|
type: Array,
|
|
19
19
|
default: () => []
|
|
20
|
-
}, loading: Boolean, bordered: {
|
|
20
|
+
}, loading: Boolean, loadingSkeleton: Boolean, bordered: {
|
|
21
21
|
type: Boolean,
|
|
22
22
|
default: undefined
|
|
23
23
|
}, bottomBordered: {
|
|
@@ -301,19 +301,21 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('data-table', `
|
|
|
301
301
|
`), (0, cssr_1.cM)('editable', `
|
|
302
302
|
cursor: pointer;
|
|
303
303
|
position: relative;
|
|
304
|
-
|
|
304
|
+
padding: 0;
|
|
305
305
|
.u-data-table-editable-input {
|
|
306
306
|
appearance: none;
|
|
307
307
|
text-align: right;
|
|
308
308
|
border: none;
|
|
309
309
|
background: none;
|
|
310
310
|
outline: none;
|
|
311
|
-
|
|
311
|
+
box-sizing: border-box;
|
|
312
|
+
padding: var(--u-td-padding);
|
|
312
313
|
margin: 0;
|
|
313
314
|
font: inherit;
|
|
314
315
|
color: inherit;
|
|
315
316
|
box-shadow: none;
|
|
316
|
-
|
|
317
|
+
height: 100%;
|
|
318
|
+
width: 100%;
|
|
317
319
|
}
|
|
318
320
|
`), fixedColumnStyle]), (0, cssr_1.cB)('data-table-empty', `
|
|
319
321
|
box-sizing: border-box;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
+
import { TableColumnMask } from './interface';
|
|
1
2
|
export declare function applyMask(value: string, mask: string): string;
|
|
2
|
-
export declare function processMaskedValue(value: string | number, mask:
|
|
3
|
-
|
|
4
|
-
}): string;
|
|
5
|
-
export declare function processInputWithMask(value: string, mask: string | ((value: string) => string) | {
|
|
6
|
-
postProcess: (value: string) => string;
|
|
7
|
-
}): {
|
|
3
|
+
export declare function processMaskedValue(value: string | number, mask: TableColumnMask): string;
|
|
4
|
+
export declare function processInputWithMask(value: string, mask: TableColumnMask): {
|
|
8
5
|
processedValue: string | number;
|
|
9
6
|
displayValue: string;
|
|
10
7
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { CSSProperties } from 'vue';
|
|
2
|
-
import type { SortOrder, TableBaseColumn, InternalRowData, SortOrderFlag, SortState, CreateRowClassName, TableSelectionColumn, TableColumn, TableExpandColumn } from './interface';
|
|
2
|
+
import type { SortOrder, TableBaseColumn, InternalRowData, SortOrderFlag, SortState, CreateRowClassName, TableSelectionColumn, TableColumn, TableExpandColumn, TableColumnMaskObject } from './interface';
|
|
3
3
|
export declare const SELECTION_COL_WIDTH = 40;
|
|
4
4
|
export declare const EXPAND_COL_WIDTH = 40;
|
|
5
5
|
export declare const REGEX: {
|
|
6
6
|
ONLY_DIGITS: RegExp;
|
|
7
7
|
ONLY_NUMERIC_AND_DOT: RegExp;
|
|
8
8
|
};
|
|
9
|
+
export declare const defaultNumericMask: TableColumnMaskObject;
|
|
9
10
|
export declare function getNumberColWidth(col: TableColumn): number | undefined;
|
|
10
11
|
export declare function getStringColWidth(col: TableColumn): string | undefined;
|
|
11
12
|
export declare function getColKey(col: TableColumn): string | number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REGEX = exports.EXPAND_COL_WIDTH = exports.SELECTION_COL_WIDTH = void 0;
|
|
3
|
+
exports.defaultNumericMask = exports.REGEX = exports.EXPAND_COL_WIDTH = exports.SELECTION_COL_WIDTH = void 0;
|
|
4
4
|
exports.getNumberColWidth = getNumberColWidth;
|
|
5
5
|
exports.getStringColWidth = getStringColWidth;
|
|
6
6
|
exports.getColKey = getColKey;
|
|
@@ -23,6 +23,19 @@ exports.REGEX = {
|
|
|
23
23
|
ONLY_DIGITS: /\D/g,
|
|
24
24
|
ONLY_NUMERIC_AND_DOT: /[^\d.]/g
|
|
25
25
|
};
|
|
26
|
+
exports.defaultNumericMask = {
|
|
27
|
+
postProcess: (value) => {
|
|
28
|
+
if (!value)
|
|
29
|
+
return '';
|
|
30
|
+
const isNegative = value.trim().startsWith('-');
|
|
31
|
+
const cleaned = value.replace(/[^\d.]/g, '');
|
|
32
|
+
const [intPartRaw, decimalPartRaw = ''] = cleaned.split('.', 2);
|
|
33
|
+
const intPart = intPartRaw.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
34
|
+
const decimalPart = decimalPartRaw.slice(0, 2);
|
|
35
|
+
const result = cleaned.includes('.') ? `${intPart}.${decimalPart}` : intPart;
|
|
36
|
+
return isNegative ? `-${result}` : result;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
26
39
|
function getNumberColWidth(col) {
|
|
27
40
|
if (col.type === 'selection') {
|
|
28
41
|
return col.width === undefined ? exports.SELECTION_COL_WIDTH : (0, seemly_1.depx)(col.width);
|