@uzum-tech/ui 1.5.2 → 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 +1030 -564
- 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/_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 +5 -0
- package/es/data-table/src/DataTable.js +20 -10
- package/es/data-table/src/TableParts/Body.js +3 -2
- package/es/data-table/src/TableParts/Cell.js +85 -23
- package/es/data-table/src/interface.d.ts +11 -6
- 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/ListItem.js +8 -4
- 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/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/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/_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 +5 -0
- package/lib/data-table/src/DataTable.js +20 -10
- package/lib/data-table/src/TableParts/Body.js +3 -2
- package/lib/data-table/src/TableParts/Cell.js +84 -22
- package/lib/data-table/src/interface.d.ts +11 -6
- 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/ListItem.js +8 -4
- 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/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/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 +119 -4
|
@@ -255,14 +255,14 @@ export default defineComponent({
|
|
|
255
255
|
else {
|
|
256
256
|
upcomingValue = null;
|
|
257
257
|
}
|
|
258
|
-
const {
|
|
258
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
259
259
|
const { onUpdateValue, 'onUpdate:value': _onUpdateValue } = props;
|
|
260
260
|
if (onUpdateValue)
|
|
261
261
|
call(onUpdateValue, value);
|
|
262
262
|
if (_onUpdateValue)
|
|
263
263
|
call(_onUpdateValue, value);
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
triggerFormChange();
|
|
265
|
+
triggerFormInput();
|
|
266
266
|
uncontrolledValueRef.value = value;
|
|
267
267
|
}
|
|
268
268
|
function handleInputUpdateValue(value) {
|
|
@@ -273,7 +273,7 @@ export default defineComponent({
|
|
|
273
273
|
const { value } = mergedValueRef;
|
|
274
274
|
// no value & only hue changes will complete with no value
|
|
275
275
|
if (value) {
|
|
276
|
-
const {
|
|
276
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
277
277
|
const { onComplete } = props;
|
|
278
278
|
if (onComplete) {
|
|
279
279
|
;
|
|
@@ -285,8 +285,8 @@ export default defineComponent({
|
|
|
285
285
|
undoStack.splice(valueIndex + 1, undoStack.length, value);
|
|
286
286
|
valueIndexRef.value = valueIndex + 1;
|
|
287
287
|
}
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
triggerFormChange();
|
|
289
|
+
triggerFormInput();
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
function undo() {
|
package/es/components.d.ts
CHANGED
package/es/components.js
CHANGED
|
@@ -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?: {
|
|
@@ -2872,6 +2872,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2872
2872
|
page: (page: number) => void;
|
|
2873
2873
|
sort: (columnKey: import("./interface").ColumnKey, order: import("./interface").SortOrder) => void;
|
|
2874
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;
|
|
2875
2880
|
clearFilter: () => void;
|
|
2876
2881
|
mainTableInstRef: import("vue").Ref<{
|
|
2877
2882
|
getHeaderElement: () => HTMLElement | null;
|
|
@@ -13,7 +13,6 @@ import { useResizable } from './use-resizable';
|
|
|
13
13
|
import { dataTableInjectionKey, dataTableProps } from './interface';
|
|
14
14
|
import { useGroupHeader } from './use-group-header';
|
|
15
15
|
import { useExpand } from './use-expand';
|
|
16
|
-
import { processMaskedValue } from './use-mask';
|
|
17
16
|
import style from './styles/index.cssr';
|
|
18
17
|
export default defineComponent({
|
|
19
18
|
name: 'DataTable',
|
|
@@ -93,7 +92,7 @@ export default defineComponent({
|
|
|
93
92
|
return;
|
|
94
93
|
if (!('totalRow' in col) || !col.totalRow)
|
|
95
94
|
return;
|
|
96
|
-
const { key, totalRow, render
|
|
95
|
+
const { key, totalRow, render } = col;
|
|
97
96
|
if (!totalRow)
|
|
98
97
|
return;
|
|
99
98
|
if (totalRow.type === 'default') {
|
|
@@ -106,18 +105,12 @@ export default defineComponent({
|
|
|
106
105
|
return Number(renderedValue) || 0;
|
|
107
106
|
});
|
|
108
107
|
const sum = values.reduce((sum, val) => sum + val, 0);
|
|
109
|
-
|
|
110
|
-
? processMaskedValue(String(sum), mask)
|
|
111
|
-
: sum;
|
|
112
|
-
summaryRow[key] = { value: finalValue };
|
|
108
|
+
summaryRow[key] = { value: sum };
|
|
113
109
|
}
|
|
114
110
|
else {
|
|
115
111
|
const values = pageData.map((row) => Number(row[key]) || 0);
|
|
116
112
|
const sum = values.reduce((sum, val) => sum + val, 0);
|
|
117
|
-
|
|
118
|
-
? processMaskedValue(String(sum), mask)
|
|
119
|
-
: sum;
|
|
120
|
-
summaryRow[key] = { value: finalValue };
|
|
113
|
+
summaryRow[key] = { value: sum };
|
|
121
114
|
}
|
|
122
115
|
}
|
|
123
116
|
else {
|
|
@@ -320,6 +313,23 @@ export default defineComponent({
|
|
|
320
313
|
scrollTo: (arg0, arg1) => {
|
|
321
314
|
var _a;
|
|
322
315
|
(_a = mainTableInstRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg0, arg1);
|
|
316
|
+
},
|
|
317
|
+
getData: () => {
|
|
318
|
+
const originalData = props.data || [];
|
|
319
|
+
const totalRowData = autoSummaryRef.value && rawPaginatedDataRef.value
|
|
320
|
+
? autoSummaryRef.value(rawPaginatedDataRef.value)
|
|
321
|
+
: null;
|
|
322
|
+
return {
|
|
323
|
+
data: originalData,
|
|
324
|
+
totalRows: totalRowData
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
getTotalRowData: () => {
|
|
328
|
+
if (autoSummaryRef.value && rawPaginatedDataRef.value) {
|
|
329
|
+
const summaryResult = autoSummaryRef.value(rawPaginatedDataRef.value);
|
|
330
|
+
return summaryResult;
|
|
331
|
+
}
|
|
332
|
+
return null;
|
|
323
333
|
}
|
|
324
334
|
};
|
|
325
335
|
const cssVarsRef = computed(() => {
|
|
@@ -560,6 +560,7 @@ export default defineComponent({
|
|
|
560
560
|
`${mergedClsPrefix}-data-table-td--last-row`,
|
|
561
561
|
'editable' in column &&
|
|
562
562
|
column.editable &&
|
|
563
|
+
!isSummary &&
|
|
563
564
|
`${mergedClsPrefix}-data-table-td--editable`
|
|
564
565
|
] }),
|
|
565
566
|
column.fixed && (h("div", { class: `${mergedClsPrefix}-data-table-td__shadow-holder` })),
|
|
@@ -596,7 +597,7 @@ export default defineComponent({
|
|
|
596
597
|
}))) : null));
|
|
597
598
|
}
|
|
598
599
|
else {
|
|
599
|
-
if (this.loading) {
|
|
600
|
+
if (this.loading || this.loadingSkeleton) {
|
|
600
601
|
return (h("table", { class: `${mergedClsPrefix}-data-table-table`, onMouseleave: handleMouseleaveTable, style: {
|
|
601
602
|
tableLayout: this.mergedTableLayout
|
|
602
603
|
} },
|
|
@@ -615,7 +616,7 @@ export default defineComponent({
|
|
|
615
616
|
}
|
|
616
617
|
}
|
|
617
618
|
}));
|
|
618
|
-
if (this.empty) {
|
|
619
|
+
if (this.empty && !this.loadingSkeleton) {
|
|
619
620
|
const createEmptyNode = () => (h("div", { class: [
|
|
620
621
|
`${mergedClsPrefix}-data-table-empty`,
|
|
621
622
|
this.loading && `${mergedClsPrefix}-data-table-empty--hide`
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { h, defineComponent } from 'vue';
|
|
2
2
|
import { get } from 'lodash-es';
|
|
3
3
|
import { UEllipsis } from '../../../ellipsis';
|
|
4
|
-
import { processMaskedValue
|
|
4
|
+
import { processMaskedValue } from '../use-mask';
|
|
5
|
+
import { defaultNumericMask } from '../utils';
|
|
5
6
|
export default defineComponent({
|
|
6
7
|
name: 'DataTableCell',
|
|
7
8
|
emits: ['edit'],
|
|
@@ -33,7 +34,10 @@ export default defineComponent({
|
|
|
33
34
|
var _a;
|
|
34
35
|
const { isSummary, column, row, renderCell } = this;
|
|
35
36
|
let cell;
|
|
36
|
-
|
|
37
|
+
let { mask } = column;
|
|
38
|
+
const { render, key, ellipsis, editable, numeric } = column;
|
|
39
|
+
if (numeric && !mask)
|
|
40
|
+
mask = defaultNumericMask;
|
|
37
41
|
if (render && !isSummary) {
|
|
38
42
|
let cellValue = render(row, this.index);
|
|
39
43
|
if (mask && cellValue !== null && cellValue !== undefined) {
|
|
@@ -45,37 +49,95 @@ export default defineComponent({
|
|
|
45
49
|
}
|
|
46
50
|
else if (editable && !isSummary) {
|
|
47
51
|
const { placeholder } = column;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
+
const rawValue = String(row[key] || '');
|
|
53
|
+
const displayValue = mask ? processMaskedValue(rawValue, mask) : rawValue;
|
|
54
|
+
const isEditingRef = { current: false };
|
|
52
55
|
const inputProps = {
|
|
53
56
|
class: `${this.clsPrefix}-data-table-editable-input`,
|
|
54
|
-
value:
|
|
57
|
+
value: displayValue,
|
|
55
58
|
placeholder: placeholder || '',
|
|
59
|
+
onFocus: (e) => {
|
|
60
|
+
const input = e.target;
|
|
61
|
+
isEditingRef.current = true;
|
|
62
|
+
input.value = rawValue;
|
|
63
|
+
},
|
|
64
|
+
onKeyDown: (e) => {
|
|
65
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
66
|
+
const input = e.target;
|
|
67
|
+
input.value = rawValue;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
56
70
|
onInput: (e) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
const input = e.target;
|
|
72
|
+
const value = input.value;
|
|
73
|
+
if (mask && typeof mask === 'function' && !isEditingRef.current) {
|
|
74
|
+
isEditingRef.current = true;
|
|
75
|
+
}
|
|
76
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
77
|
+
const rawValue = value.replace(/\$/g, '').replace(/[^\d.,]/g, '');
|
|
78
|
+
input.value = rawValue;
|
|
79
|
+
let processedValue = rawValue;
|
|
80
|
+
if (numeric && rawValue !== '') {
|
|
81
|
+
const cleanValue = rawValue
|
|
82
|
+
.replace(/[^\d.,]/g, '')
|
|
83
|
+
.replace(',', '.');
|
|
84
|
+
const numValue = Number(cleanValue);
|
|
85
|
+
if (!isNaN(numValue)) {
|
|
86
|
+
processedValue = numValue;
|
|
66
87
|
}
|
|
67
|
-
}
|
|
88
|
+
}
|
|
68
89
|
this.$emit('edit', processedValue, row, key);
|
|
90
|
+
void Promise.resolve().then(() => {
|
|
91
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
92
|
+
input.value = rawValue;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let processedValue = value;
|
|
98
|
+
if (numeric && value !== '') {
|
|
99
|
+
const cleanValue = value.replace(/[^\d.,]/g, '').replace(',', '.');
|
|
100
|
+
const numValue = Number(cleanValue);
|
|
101
|
+
if (!isNaN(numValue)) {
|
|
102
|
+
processedValue = numValue;
|
|
103
|
+
}
|
|
69
104
|
}
|
|
70
|
-
|
|
71
|
-
|
|
105
|
+
this.$emit('edit', processedValue, row, key);
|
|
106
|
+
},
|
|
107
|
+
onKeyUp: (e) => {
|
|
108
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
109
|
+
const input = e.target;
|
|
110
|
+
input.value = rawValue;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
onChange: (e) => {
|
|
114
|
+
if (mask && typeof mask === 'function' && isEditingRef.current) {
|
|
115
|
+
const input = e.target;
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
118
|
+
input.value = rawValue;
|
|
119
|
+
}
|
|
120
|
+
}, 0);
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
if (isEditingRef.current && input.value !== rawValue) {
|
|
123
|
+
input.value = rawValue;
|
|
124
|
+
}
|
|
125
|
+
}, 10);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
onBlur: (e) => {
|
|
129
|
+
isEditingRef.current = false;
|
|
130
|
+
if (mask) {
|
|
131
|
+
const input = e.target;
|
|
132
|
+
let currentValue = input.value;
|
|
133
|
+
if (numeric && currentValue !== '') {
|
|
134
|
+
currentValue = currentValue.replace(',', '.');
|
|
135
|
+
}
|
|
136
|
+
const maskedValue = processMaskedValue(currentValue, mask);
|
|
137
|
+
input.value = maskedValue;
|
|
72
138
|
}
|
|
73
139
|
}
|
|
74
140
|
};
|
|
75
|
-
if (mask) {
|
|
76
|
-
inputProps['data-mask'] =
|
|
77
|
-
typeof mask === 'string' ? mask : JSON.stringify(mask);
|
|
78
|
-
}
|
|
79
141
|
cell = h('input', inputProps);
|
|
80
142
|
}
|
|
81
143
|
else {
|
|
@@ -2913,6 +2913,10 @@ export interface CommonColumnInfo<T = InternalRowData> {
|
|
|
2913
2913
|
cellProps?: (rowData: T, rowIndex: number) => HTMLAttributes;
|
|
2914
2914
|
visible?: boolean;
|
|
2915
2915
|
}
|
|
2916
|
+
export interface TableColumnMaskObject {
|
|
2917
|
+
postProcess: (value: string) => string;
|
|
2918
|
+
}
|
|
2919
|
+
export type TableColumnMask = string | ((value: string) => string) | TableColumnMaskObject;
|
|
2916
2920
|
export type TableColumnTitle = string | ((column: TableBaseColumn) => VNodeChild);
|
|
2917
2921
|
export type TableExpandColumnTitle = string | ((column: TableExpandColumn) => VNodeChild);
|
|
2918
2922
|
export type TableColumnGroupTitle = string | ((column: TableColumnGroup) => VNodeChild);
|
|
@@ -2932,18 +2936,14 @@ export type TableBaseColumn<T = InternalRowData> = {
|
|
|
2932
2936
|
type?: never;
|
|
2933
2937
|
key: ColumnKey;
|
|
2934
2938
|
editable?: boolean;
|
|
2935
|
-
mask?:
|
|
2936
|
-
|
|
2937
|
-
};
|
|
2939
|
+
mask?: TableColumnMask;
|
|
2940
|
+
numeric?: boolean;
|
|
2938
2941
|
placeholder?: string;
|
|
2939
2942
|
totalRow?: {
|
|
2940
2943
|
type: 'sum' | 'default' | 'diff' | 'multiply' | 'divide' | 'percentage' | 'function';
|
|
2941
2944
|
value?: string;
|
|
2942
2945
|
fields?: string[];
|
|
2943
2946
|
function?: (values: number[]) => number;
|
|
2944
|
-
mask?: string | ((value: string) => string) | {
|
|
2945
|
-
postProcess: (value: string) => string;
|
|
2946
|
-
};
|
|
2947
2947
|
};
|
|
2948
2948
|
tree?: boolean;
|
|
2949
2949
|
sorter?: boolean | Sorter<T> | 'default';
|
|
@@ -3138,6 +3138,11 @@ export interface DataTableInst {
|
|
|
3138
3138
|
page: (page: number) => void;
|
|
3139
3139
|
sort: (columnKey: ColumnKey, order: SortOrder) => void;
|
|
3140
3140
|
scrollTo: ScrollTo;
|
|
3141
|
+
getData: () => {
|
|
3142
|
+
data: InternalRowData[];
|
|
3143
|
+
totalRows: InternalRowData | null;
|
|
3144
|
+
};
|
|
3145
|
+
getTotalRowData: () => InternalRowData | null;
|
|
3141
3146
|
/** @deprecated it but just leave it here, it does no harm */
|
|
3142
3147
|
clearFilter: () => void;
|
|
3143
3148
|
}
|
|
@@ -296,19 +296,21 @@ c('&:last-child', 'flex-grow: 1;')])])])])])])]), c('>', [cB('data-table-loading
|
|
|
296
296
|
`), cM('editable', `
|
|
297
297
|
cursor: pointer;
|
|
298
298
|
position: relative;
|
|
299
|
-
|
|
299
|
+
padding: 0;
|
|
300
300
|
.u-data-table-editable-input {
|
|
301
301
|
appearance: none;
|
|
302
302
|
text-align: right;
|
|
303
303
|
border: none;
|
|
304
304
|
background: none;
|
|
305
305
|
outline: none;
|
|
306
|
-
|
|
306
|
+
box-sizing: border-box;
|
|
307
|
+
padding: var(--u-td-padding);
|
|
307
308
|
margin: 0;
|
|
308
309
|
font: inherit;
|
|
309
310
|
color: inherit;
|
|
310
311
|
box-shadow: none;
|
|
311
|
-
|
|
312
|
+
height: 100%;
|
|
313
|
+
width: 100%;
|
|
312
314
|
}
|
|
313
315
|
`), fixedColumnStyle]), cB('data-table-empty', `
|
|
314
316
|
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;
|
|
@@ -6,6 +6,19 @@ export const REGEX = {
|
|
|
6
6
|
ONLY_DIGITS: /\D/g,
|
|
7
7
|
ONLY_NUMERIC_AND_DOT: /[^\d.]/g
|
|
8
8
|
};
|
|
9
|
+
export const defaultNumericMask = {
|
|
10
|
+
postProcess: (value) => {
|
|
11
|
+
if (!value)
|
|
12
|
+
return '';
|
|
13
|
+
const isNegative = value.trim().startsWith('-');
|
|
14
|
+
const cleaned = value.replace(/[^\d.]/g, '');
|
|
15
|
+
const [intPartRaw, decimalPartRaw = ''] = cleaned.split('.', 2);
|
|
16
|
+
const intPart = intPartRaw.replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
17
|
+
const decimalPart = decimalPartRaw.slice(0, 2);
|
|
18
|
+
const result = cleaned.includes('.') ? `${intPart}.${decimalPart}` : intPart;
|
|
19
|
+
return isNegative ? `-${result}` : result;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
9
22
|
export function getNumberColWidth(col) {
|
|
10
23
|
if (col.type === 'selection') {
|
|
11
24
|
return col.width === undefined ? SELECTION_COL_WIDTH : depx(col.width);
|
|
@@ -281,7 +281,7 @@ export default defineComponent({
|
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
283
|
const { 'onUpdate:value': _onUpdateValue, onUpdateValue, onChange } = props;
|
|
284
|
-
const {
|
|
284
|
+
const { triggerFormChange, triggerFormInput } = formItem;
|
|
285
285
|
const formattedValue = getFormattedValue(value);
|
|
286
286
|
if (options.doConfirm) {
|
|
287
287
|
doConfirm(value, formattedValue);
|
|
@@ -296,8 +296,8 @@ export default defineComponent({
|
|
|
296
296
|
call(onChange, value, formattedValue);
|
|
297
297
|
uncontrolledValueRef.value = value;
|
|
298
298
|
doUpdateFormattedValue(formattedValue, value);
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
triggerFormChange();
|
|
300
|
+
triggerFormInput();
|
|
301
301
|
}
|
|
302
302
|
function doClear() {
|
|
303
303
|
const { onClear } = props;
|
|
@@ -310,17 +310,17 @@ export default defineComponent({
|
|
|
310
310
|
}
|
|
311
311
|
function doFocus(e) {
|
|
312
312
|
const { onFocus } = props;
|
|
313
|
-
const {
|
|
313
|
+
const { triggerFormFocus } = formItem;
|
|
314
314
|
if (onFocus)
|
|
315
315
|
call(onFocus, e);
|
|
316
|
-
|
|
316
|
+
triggerFormFocus();
|
|
317
317
|
}
|
|
318
318
|
function doBlur(e) {
|
|
319
319
|
const { onBlur } = props;
|
|
320
|
-
const {
|
|
320
|
+
const { triggerFormBlur } = formItem;
|
|
321
321
|
if (onBlur)
|
|
322
322
|
call(onBlur, e);
|
|
323
|
-
|
|
323
|
+
triggerFormBlur();
|
|
324
324
|
}
|
|
325
325
|
function doUpdateShow(show) {
|
|
326
326
|
const { 'onUpdate:show': _onUpdateShow, onUpdateShow } = props;
|
|
@@ -283,6 +283,9 @@ export declare const UDialogProvider: import("vue").DefineComponent<{
|
|
|
283
283
|
scrollbarHeight: string;
|
|
284
284
|
scrollbarBorderRadius: string;
|
|
285
285
|
opacityDisabled: string;
|
|
286
|
+
brand150: string;
|
|
287
|
+
brand350: string;
|
|
288
|
+
brand550: string;
|
|
286
289
|
brandPrimary50: string;
|
|
287
290
|
brandPrimary100: string;
|
|
288
291
|
brandPrimary200: string;
|
|
@@ -639,6 +642,9 @@ export declare const UDialogProvider: import("vue").DefineComponent<{
|
|
|
639
642
|
scrollbarHeight: string;
|
|
640
643
|
scrollbarBorderRadius: string;
|
|
641
644
|
opacityDisabled: string;
|
|
645
|
+
brand150: string;
|
|
646
|
+
brand350: string;
|
|
647
|
+
brand550: string;
|
|
642
648
|
brandPrimary50: string;
|
|
643
649
|
brandPrimary100: string;
|
|
644
650
|
brandPrimary200: string;
|
|
@@ -61,7 +61,7 @@ export default defineComponent({
|
|
|
61
61
|
});
|
|
62
62
|
function doChange(value) {
|
|
63
63
|
const { onChange, 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
64
|
-
const {
|
|
64
|
+
const { triggerFormInput, triggerFormChange } = formItem;
|
|
65
65
|
if (onChange)
|
|
66
66
|
call(onChange, value);
|
|
67
67
|
if (onUpdateValue)
|
|
@@ -69,8 +69,8 @@ export default defineComponent({
|
|
|
69
69
|
if (_onUpdateValue)
|
|
70
70
|
call(_onUpdateValue, value);
|
|
71
71
|
uncontrolledValueRef.value = value;
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
triggerFormInput();
|
|
73
|
+
triggerFormChange();
|
|
74
74
|
}
|
|
75
75
|
function handleCloseClick(index) {
|
|
76
76
|
const tags = mergedValueRef.value.slice(0);
|
package/es/input/src/Input.js
CHANGED
|
@@ -244,7 +244,7 @@ export default defineComponent({
|
|
|
244
244
|
const vm = getCurrentInstance().proxy;
|
|
245
245
|
function doUpdateValue(value) {
|
|
246
246
|
const { onUpdateValue, 'onUpdate:value': _onUpdateValue, onInput } = props;
|
|
247
|
-
const {
|
|
247
|
+
const { triggerFormInput } = formItem;
|
|
248
248
|
if (onUpdateValue)
|
|
249
249
|
call(onUpdateValue, value);
|
|
250
250
|
if (_onUpdateValue)
|
|
@@ -252,30 +252,30 @@ export default defineComponent({
|
|
|
252
252
|
if (onInput)
|
|
253
253
|
call(onInput, value);
|
|
254
254
|
uncontrolledValueRef.value = value;
|
|
255
|
-
|
|
255
|
+
triggerFormInput();
|
|
256
256
|
emitDebouncedInput(value);
|
|
257
257
|
}
|
|
258
258
|
function doChange(value) {
|
|
259
259
|
const { onChange } = props;
|
|
260
|
-
const {
|
|
260
|
+
const { triggerFormChange } = formItem;
|
|
261
261
|
if (onChange)
|
|
262
262
|
call(onChange, value);
|
|
263
263
|
uncontrolledValueRef.value = value;
|
|
264
|
-
|
|
264
|
+
triggerFormChange();
|
|
265
265
|
}
|
|
266
266
|
function doBlur(e) {
|
|
267
267
|
const { onBlur } = props;
|
|
268
|
-
const {
|
|
268
|
+
const { triggerFormBlur } = formItem;
|
|
269
269
|
if (onBlur)
|
|
270
270
|
call(onBlur, e);
|
|
271
|
-
|
|
271
|
+
triggerFormBlur();
|
|
272
272
|
}
|
|
273
273
|
function doFocus(e) {
|
|
274
274
|
const { onFocus } = props;
|
|
275
|
-
const {
|
|
275
|
+
const { triggerFormFocus } = formItem;
|
|
276
276
|
if (onFocus)
|
|
277
277
|
call(onFocus, e);
|
|
278
|
-
|
|
278
|
+
triggerFormFocus();
|
|
279
279
|
}
|
|
280
280
|
function doClear(e) {
|
|
281
281
|
const { onClear } = props;
|
|
@@ -114,7 +114,7 @@ export default defineComponent({
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
const { 'onUpdate:value': _onUpdateValue, onUpdateValue, onChange } = props;
|
|
117
|
-
const {
|
|
117
|
+
const { triggerFormInput, triggerFormChange } = formItem;
|
|
118
118
|
if (onChange)
|
|
119
119
|
call(onChange, value);
|
|
120
120
|
if (onUpdateValue)
|
|
@@ -122,8 +122,8 @@ export default defineComponent({
|
|
|
122
122
|
if (_onUpdateValue)
|
|
123
123
|
call(_onUpdateValue, value);
|
|
124
124
|
uncontrolledValueRef.value = value;
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
triggerFormInput();
|
|
126
|
+
triggerFormChange();
|
|
127
127
|
};
|
|
128
128
|
const deriveValueFromDisplayedValue = ({ offset, doUpdateIfValid, fixPrecision, isInputing }) => {
|
|
129
129
|
const { value: displayedValue } = displayedValueRef;
|
|
@@ -234,10 +234,10 @@ export default defineComponent({
|
|
|
234
234
|
});
|
|
235
235
|
function doFocus(e) {
|
|
236
236
|
const { onFocus } = props;
|
|
237
|
-
const {
|
|
237
|
+
const { triggerFormFocus } = formItem;
|
|
238
238
|
if (onFocus)
|
|
239
239
|
call(onFocus, e);
|
|
240
|
-
|
|
240
|
+
triggerFormFocus();
|
|
241
241
|
}
|
|
242
242
|
function doBlur(e) {
|
|
243
243
|
var _a, _b;
|
|
@@ -272,10 +272,10 @@ export default defineComponent({
|
|
|
272
272
|
deriveDisplayedValueFromValue();
|
|
273
273
|
}
|
|
274
274
|
const { onBlur } = props;
|
|
275
|
-
const {
|
|
275
|
+
const { triggerFormBlur } = formItem;
|
|
276
276
|
if (onBlur)
|
|
277
277
|
call(onBlur, e);
|
|
278
|
-
|
|
278
|
+
triggerFormBlur();
|
|
279
279
|
// User may change value in blur callback, we make sure it will be
|
|
280
280
|
// displayed. Sometimes mergedValue won't be viewed as changed
|
|
281
281
|
void nextTick(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { inputOtpProps, default as UInputOtp } from './src/InputOtp';
|