bkui-vue 0.0.2-beta.112 → 0.0.2-beta.114
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/index.cjs.js +30 -30
- package/dist/index.esm.js +5102 -5082
- package/dist/index.umd.js +30 -30
- package/lib/select/index.js +10 -0
- package/lib/table/index.js +70 -27
- package/lib/table/plugins/settings.d.ts +0 -7
- package/lib/table/use-attributes.d.ts +4 -1
- package/package.json +1 -1
package/lib/select/index.js
CHANGED
@@ -1640,9 +1640,19 @@ function select_objectSpread(target) { for (var i = 1; i < arguments.length; i++
|
|
1640
1640
|
setTimeout(function () {
|
1641
1641
|
focusInput();
|
1642
1642
|
initActiveOptionValue();
|
1643
|
+
scrollActiveOptionIntoView();
|
1643
1644
|
}, 10); // 等待Popover content出来,options加载完成
|
1644
1645
|
}
|
1645
1646
|
});
|
1647
|
+
// 滚动到当前选中的options中
|
1648
|
+
var scrollActiveOptionIntoView = function scrollActiveOptionIntoView() {
|
1649
|
+
var _contentRef$value, _contentRef$value$que, _optionsDom$;
|
1650
|
+
var optionsDom = (_contentRef$value = contentRef.value) === null || _contentRef$value === void 0 || (_contentRef$value$que = _contentRef$value.querySelectorAll) === null || _contentRef$value$que === void 0 ? void 0 : _contentRef$value$que.call(_contentRef$value, '.is-selected');
|
1651
|
+
(_optionsDom$ = optionsDom[0]) === null || _optionsDom$ === void 0 ? void 0 : _optionsDom$.scrollIntoView({
|
1652
|
+
block: 'center',
|
1653
|
+
behavior: 'smooth'
|
1654
|
+
});
|
1655
|
+
};
|
1646
1656
|
// 初始化当前悬浮的option项
|
1647
1657
|
var initActiveOptionValue = function initActiveOptionValue() {
|
1648
1658
|
var firstSelected = selected.value[0];
|
package/lib/table/index.js
CHANGED
@@ -3005,9 +3005,13 @@ var getElementTextWidth = function getElementTextWidth(element, text) {
|
|
3005
3005
|
return getTextWidth(text || (element === null || element === void 0 ? void 0 : element.innerHTML), getCanvasFont(element));
|
3006
3006
|
};
|
3007
3007
|
var isColumnHidden = function isColumnHidden(settingFields, column, checked) {
|
3008
|
+
var getFieldValue = function getFieldValue(field) {
|
3009
|
+
var _field$field;
|
3010
|
+
return (_field$field = field.field) !== null && _field$field !== void 0 ? _field$field : field.id;
|
3011
|
+
};
|
3008
3012
|
var isSettingField = function isSettingField(col) {
|
3009
3013
|
return settingFields.some(function (field) {
|
3010
|
-
return field
|
3014
|
+
return getFieldValue(field) === resolvePropVal(col, ['field', 'type'], [col]);
|
3011
3015
|
});
|
3012
3016
|
};
|
3013
3017
|
return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ['field', 'type'], [column]));
|
@@ -3168,18 +3172,28 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3168
3172
|
|
3169
3173
|
|
3170
3174
|
/* harmony default export */ const use_attributes = (function (props) {
|
3171
|
-
var
|
3172
|
-
|
3173
|
-
|
3175
|
+
var getDefaultSettings = function getDefaultSettings() {
|
3176
|
+
var _ref, _SETTING_SIZE$size;
|
3177
|
+
var _props$settings = props.settings,
|
3178
|
+
size = _props$settings.size,
|
3179
|
+
_props$settings$field = _props$settings.fields,
|
3180
|
+
fields = _props$settings$field === void 0 ? [] : _props$settings$field,
|
3181
|
+
_props$settings$check = _props$settings.checked,
|
3182
|
+
checked = _props$settings$check === void 0 ? [] : _props$settings$check;
|
3183
|
+
var height = (_ref = (_SETTING_SIZE$size = SETTING_SIZE[size]) !== null && _SETTING_SIZE$size !== void 0 ? _SETTING_SIZE$size : props.rowHeight) !== null && _ref !== void 0 ? _ref : SETTING_SIZE.small;
|
3184
|
+
return {
|
3185
|
+
size: size,
|
3186
|
+
height: height,
|
3187
|
+
fields: fields,
|
3188
|
+
checked: checked
|
3189
|
+
};
|
3190
|
+
};
|
3174
3191
|
var formatData = (0,external_vue_namespaceObject.reactive)({
|
3175
3192
|
data: _toConsumableArray(props.data),
|
3176
3193
|
dataSchema: new WeakMap(),
|
3177
3194
|
columns: _toConsumableArray(props.columns),
|
3178
3195
|
columnSchema: new WeakMap(),
|
3179
|
-
settings:
|
3180
|
-
size: size,
|
3181
|
-
height: height
|
3182
|
-
},
|
3196
|
+
settings: getDefaultSettings(),
|
3183
3197
|
layout: {
|
3184
3198
|
hasScrollY: false,
|
3185
3199
|
bottom: 0,
|
@@ -3194,6 +3208,27 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3194
3208
|
multiFilter = _usePagination.multiFilter,
|
3195
3209
|
sort = _usePagination.sort,
|
3196
3210
|
resetStartEndIndex = _usePagination.resetStartEndIndex;
|
3211
|
+
var updateSettings = function updateSettings(settings, rowHeight) {
|
3212
|
+
if (settings) {
|
3213
|
+
var _ref2, _ref3;
|
3214
|
+
var size = settings.size,
|
3215
|
+
_settings$fields = settings.fields,
|
3216
|
+
fields = _settings$fields === void 0 ? [] : _settings$fields,
|
3217
|
+
_settings$checked = settings.checked,
|
3218
|
+
checked = _settings$checked === void 0 ? [] : _settings$checked;
|
3219
|
+
var height = (_ref2 = (_ref3 = rowHeight !== null && rowHeight !== void 0 ? rowHeight : SETTING_SIZE[size]) !== null && _ref3 !== void 0 ? _ref3 : props.rowHeight) !== null && _ref2 !== void 0 ? _ref2 : SETTING_SIZE.small;
|
3220
|
+
Object.assign(formatData.settings, {
|
3221
|
+
size: size,
|
3222
|
+
height: height,
|
3223
|
+
fields: fields,
|
3224
|
+
checked: checked
|
3225
|
+
});
|
3226
|
+
return;
|
3227
|
+
}
|
3228
|
+
if (rowHeight) {
|
3229
|
+
formatData.settings.height = rowHeight;
|
3230
|
+
}
|
3231
|
+
};
|
3197
3232
|
var resolveMinWidth = function resolveMinWidth(col) {
|
3198
3233
|
if (/^\d+/.test("".concat(col.minWidth))) {
|
3199
3234
|
return col.minWidth;
|
@@ -3207,8 +3242,6 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3207
3242
|
}
|
3208
3243
|
return minWidth;
|
3209
3244
|
};
|
3210
|
-
var checked = ((_props$settings = props.settings) === null || _props$settings === void 0 ? void 0 : _props$settings.checked) || [];
|
3211
|
-
var settingFields = ((_props$settings2 = props.settings) === null || _props$settings2 === void 0 ? void 0 : _props$settings2.fields) || [];
|
3212
3245
|
/**
|
3213
3246
|
* Format columns
|
3214
3247
|
* @param columns
|
@@ -3221,14 +3254,14 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3221
3254
|
var needColSpan = neepColspanOrRowspan(['colspan']);
|
3222
3255
|
(columns || []).forEach(function (col, index) {
|
3223
3256
|
var _Object$assign;
|
3224
|
-
var
|
3257
|
+
var _ref4 = needColSpan ? getColumnSpanConfig(col, index, skipColNum) : {
|
3225
3258
|
skipCol: false,
|
3226
3259
|
skipColumnNum: 0,
|
3227
3260
|
skipColLen: 0
|
3228
3261
|
},
|
3229
|
-
skipCol =
|
3230
|
-
skipColumnNum =
|
3231
|
-
skipColLen =
|
3262
|
+
skipCol = _ref4.skipCol,
|
3263
|
+
skipColumnNum = _ref4.skipColumnNum,
|
3264
|
+
skipColLen = _ref4.skipColLen;
|
3232
3265
|
skipColNum = skipColumnNum;
|
3233
3266
|
if (!formatData.columnSchema.has(col)) {
|
3234
3267
|
var _formatData$columnSch;
|
@@ -3237,7 +3270,7 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3237
3270
|
fn = _resolveColumnSortPro.fn,
|
3238
3271
|
scope = _resolveColumnSortPro.scope,
|
3239
3272
|
active = _resolveColumnSortPro.active;
|
3240
|
-
formatData.columnSchema.set(col, (_formatData$columnSch = {}, defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.CALC_WIDTH, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.RESIZE_WIDTH, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_MIN_WIDTH, resolveMinWidth(col)), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.LISTENERS, new Map()), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.WIDTH, col.width), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.IS_HIDDEN, isColumnHidden(
|
3273
|
+
formatData.columnSchema.set(col, (_formatData$columnSch = {}, defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.CALC_WIDTH, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.RESIZE_WIDTH, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_MIN_WIDTH, resolveMinWidth(col)), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.LISTENERS, new Map()), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.WIDTH, col.width), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.IS_HIDDEN, isColumnHidden(formatData.settings.fields, col, formatData.settings.checked)), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_SORT_TYPE, type), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_SORT_FN, fn), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_FILTER_FN, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_FILTER_SCOPE, undefined), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_SORT_SCOPE, scope), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_SORT_ACTIVE, active), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_IS_DRAG, false), defineProperty_defineProperty(_formatData$columnSch, COLUMN_ATTRIBUTE.COL_SPAN, {
|
3241
3274
|
skipCol: skipCol,
|
3242
3275
|
skipColumnNum: skipColumnNum,
|
3243
3276
|
skipColLen: skipColLen
|
@@ -3381,10 +3414,10 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3381
3414
|
* @returns
|
3382
3415
|
*/
|
3383
3416
|
var getColumnOrderWidth = function getColumnOrderWidth(col) {
|
3384
|
-
var _formatData$columnSch4,
|
3417
|
+
var _formatData$columnSch4, _ref5, _target$orders$;
|
3385
3418
|
var orders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ORDER_LIST;
|
3386
3419
|
var target = (_formatData$columnSch4 = formatData.columnSchema.get(col)) !== null && _formatData$columnSch4 !== void 0 ? _formatData$columnSch4 : {};
|
3387
|
-
return (
|
3420
|
+
return (_ref5 = (_target$orders$ = target[orders[0]]) !== null && _target$orders$ !== void 0 ? _target$orders$ : target[orders[1]]) !== null && _ref5 !== void 0 ? _ref5 : target[orders[2]];
|
3388
3421
|
};
|
3389
3422
|
/**
|
3390
3423
|
* 指定列是否展示状态
|
@@ -3587,8 +3620,8 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3587
3620
|
var resolveColumnWidth = function resolveColumnWidth(root) {
|
3588
3621
|
var autoWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : COL_MIN_WIDTH;
|
3589
3622
|
var offsetWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
3590
|
-
var
|
3591
|
-
width =
|
3623
|
+
var _ref6 = root.getBoundingClientRect() || {},
|
3624
|
+
width = _ref6.width;
|
3592
3625
|
var availableWidth = width - offsetWidth;
|
3593
3626
|
// 可用来平均的宽度
|
3594
3627
|
var avgWidth = availableWidth;
|
@@ -3715,6 +3748,7 @@ function use_attributes_objectSpread(target) { for (var i = 1; i < arguments.len
|
|
3715
3748
|
sortData: sortData,
|
3716
3749
|
isCheckedAll: isCheckedAll,
|
3717
3750
|
hasCheckedRow: hasCheckedRow,
|
3751
|
+
updateSettings: updateSettings,
|
3718
3752
|
pageData: pageData,
|
3719
3753
|
localPagination: localPagination,
|
3720
3754
|
formatData: formatData
|
@@ -4962,8 +4996,7 @@ function settings_isSlot(s) {
|
|
4962
4996
|
name: 'Settings',
|
4963
4997
|
props: {
|
4964
4998
|
settings: ITableSettings,
|
4965
|
-
columns: external_shared_namespaceObject.PropTypes.arrayOf(IColumnType).def([])
|
4966
|
-
rowHeight: RowHeightFunctionNumberType.def(LINE_HEIGHT)
|
4999
|
+
columns: external_shared_namespaceObject.PropTypes.arrayOf(IColumnType).def([])
|
4967
5000
|
},
|
4968
5001
|
emits: ['change'],
|
4969
5002
|
setup: function setup(props, _ref) {
|
@@ -4988,7 +5021,7 @@ function settings_isSlot(s) {
|
|
4988
5021
|
}),
|
4989
5022
|
checked: [],
|
4990
5023
|
limit: 0,
|
4991
|
-
size:
|
5024
|
+
size: 'small',
|
4992
5025
|
sizeList: defaultSizeList,
|
4993
5026
|
showLineHeight: true
|
4994
5027
|
};
|
@@ -4996,7 +5029,7 @@ function settings_isSlot(s) {
|
|
4996
5029
|
return props.settings;
|
4997
5030
|
});
|
4998
5031
|
var activeSize = (0,external_vue_namespaceObject.ref)(localSettings.value.size || 'small');
|
4999
|
-
var activeHeight = (0,external_vue_namespaceObject.ref)(
|
5032
|
+
var activeHeight = (0,external_vue_namespaceObject.ref)(SETTING_SIZE.small);
|
5000
5033
|
var checkedFields = (0,external_vue_namespaceObject.ref)(localSettings.value.checked || []);
|
5001
5034
|
var className = resolveClassName('table-settings');
|
5002
5035
|
var theme = "light ".concat(className);
|
@@ -5313,10 +5346,9 @@ function use_render_isSlot(s) {
|
|
5313
5346
|
size = arg.size,
|
5314
5347
|
height = arg.height,
|
5315
5348
|
fields = arg.fields;
|
5316
|
-
tableResp.
|
5317
|
-
tableResp.
|
5349
|
+
tableResp.updateSettings(arg);
|
5350
|
+
tableResp.setColumnAttributeBySettings(props.settings, checked);
|
5318
5351
|
if (checked.length) {
|
5319
|
-
tableResp.setColumnAttributeBySettings(props.settings, checked);
|
5320
5352
|
(0,external_vue_namespaceObject.nextTick)(function () {
|
5321
5353
|
resetTableHeight(root.value);
|
5322
5354
|
});
|
@@ -5332,7 +5364,6 @@ function use_render_isSlot(s) {
|
|
5332
5364
|
"class": "table-head-settings",
|
5333
5365
|
"settings": props.settings,
|
5334
5366
|
"columns": columns.value,
|
5335
|
-
"rowHeight": props.rowHeight,
|
5336
5367
|
"onChange": handleSettingsChanged
|
5337
5368
|
}, {
|
5338
5369
|
"default": function _default() {
|
@@ -6148,6 +6179,18 @@ function table_objectSpread(target) { for (var i = 1; i < arguments.length; i++)
|
|
6148
6179
|
resetTableHeight(root.value);
|
6149
6180
|
});
|
6150
6181
|
});
|
6182
|
+
(0,external_vue_namespaceObject.watch)(function () {
|
6183
|
+
return [props.settings];
|
6184
|
+
}, function () {
|
6185
|
+
tableSchema.updateSettings(props.settings);
|
6186
|
+
}, {
|
6187
|
+
deep: true
|
6188
|
+
});
|
6189
|
+
(0,external_vue_namespaceObject.watch)(function () {
|
6190
|
+
return [props.rowHeight];
|
6191
|
+
}, function () {
|
6192
|
+
tableSchema.updateSettings(undefined, props.rowHeight);
|
6193
|
+
});
|
6151
6194
|
var handleScrollChanged = function handleScrollChanged(args) {
|
6152
6195
|
var _tableSchema$formatDa;
|
6153
6196
|
var preBottom = (_tableSchema$formatDa = tableSchema.formatData.layout.bottom) !== null && _tableSchema$formatDa !== void 0 ? _tableSchema$formatDa : 0;
|
@@ -3,21 +3,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
3
3
|
columns: import("vue-types").VueTypeDef<import("../props").Column[]> & {
|
4
4
|
default: () => import("../props").Column[];
|
5
5
|
};
|
6
|
-
rowHeight: import("vue-types").VueTypeDef<import("../props").RowHeightFunctionNumber> & {
|
7
|
-
default: import("../props").RowHeightFunctionNumber;
|
8
|
-
};
|
9
6
|
}, () => "" | JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
10
7
|
settings: import("vue-types").VueTypeDef<import("../props").ISettingPropType>;
|
11
8
|
columns: import("vue-types").VueTypeDef<import("../props").Column[]> & {
|
12
9
|
default: () => import("../props").Column[];
|
13
10
|
};
|
14
|
-
rowHeight: import("vue-types").VueTypeDef<import("../props").RowHeightFunctionNumber> & {
|
15
|
-
default: import("../props").RowHeightFunctionNumber;
|
16
|
-
};
|
17
11
|
}>> & {
|
18
12
|
onChange?: (...args: any[]) => any;
|
19
13
|
}, {
|
20
14
|
columns: import("../props").Column[];
|
21
|
-
rowHeight: import("../props").RowHeightFunctionNumber;
|
22
15
|
}, {}>;
|
23
16
|
export default _default;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { IEmptyObject } from './const';
|
2
|
-
import { Column, Settings, SortScope, TablePropTypes } from './props';
|
2
|
+
import { Column, Field, Settings, SortScope, TablePropTypes } from './props';
|
3
3
|
export type ITableFormatData = {
|
4
4
|
data: any[];
|
5
5
|
dataSchema: WeakMap<object, any>;
|
@@ -8,6 +8,8 @@ export type ITableFormatData = {
|
|
8
8
|
settings: {
|
9
9
|
size: string;
|
10
10
|
height: number;
|
11
|
+
fields: Field[];
|
12
|
+
checked: string[];
|
11
13
|
};
|
12
14
|
layout: {
|
13
15
|
bottom: number;
|
@@ -47,6 +49,7 @@ export type ITableResponse = {
|
|
47
49
|
hasCheckedRow: () => boolean;
|
48
50
|
setRowSelectionAll: (val: boolean) => void;
|
49
51
|
setRowIndeterminate: () => void;
|
52
|
+
updateSettings: (settings?: Settings, rowHeight?: number) => void;
|
50
53
|
pageData: any[];
|
51
54
|
localPagination: any;
|
52
55
|
formatData: ITableFormatData;
|