@blueking/bkui-form 0.0.38 → 0.0.40
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/bkui-form-es-min.js +3 -3
- package/dist/bkui-form-es.js +86 -11
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +3 -3
- package/dist/bkui-form-umd.js +86 -11
- package/dist/bkui-form-umd.js.map +1 -1
- package/dist/bkui-form.css +8 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/types/bkui-form.d.ts +1 -1
- package/dist/util/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/bkui-form-umd.js
CHANGED
|
@@ -802,6 +802,20 @@
|
|
|
802
802
|
complete.splice.apply(complete, [restIndex, 1].concat(_toConsumableArray(rest)));
|
|
803
803
|
return complete;
|
|
804
804
|
}
|
|
805
|
+
var getCookie = function getCookie(name) {
|
|
806
|
+
var cookies = document.cookie.split(';');
|
|
807
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
808
|
+
var cookie = cookies[i];
|
|
809
|
+
var _cookie$split = cookie.split('='),
|
|
810
|
+
_cookie$split2 = _slicedToArray(_cookie$split, 2),
|
|
811
|
+
key = _cookie$split2[0],
|
|
812
|
+
value = _cookie$split2[1];
|
|
813
|
+
if (key.trim() === name) {
|
|
814
|
+
return value;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return null;
|
|
818
|
+
};
|
|
805
819
|
|
|
806
820
|
/**
|
|
807
821
|
* Registry注册Form组件全局相关内容
|
|
@@ -1930,7 +1944,7 @@
|
|
|
1930
1944
|
return;
|
|
1931
1945
|
}
|
|
1932
1946
|
var _node = new WidgetNode({
|
|
1933
|
-
id: path,
|
|
1947
|
+
id: instance.path,
|
|
1934
1948
|
type: type,
|
|
1935
1949
|
index: index,
|
|
1936
1950
|
parent: parentNode,
|
|
@@ -10207,7 +10221,22 @@
|
|
|
10207
10221
|
val = item.label;
|
|
10208
10222
|
}
|
|
10209
10223
|
}
|
|
10210
|
-
|
|
10224
|
+
var value = val === '' ? '--' : val;
|
|
10225
|
+
if (Object.prototype.call(value) === '[Object Object]') {
|
|
10226
|
+
value = JSON.stringify(value);
|
|
10227
|
+
} else if (Array.isArray(value)) {
|
|
10228
|
+
var isTrue = value.some(function (item) {
|
|
10229
|
+
return item && _typeof(item) === 'object';
|
|
10230
|
+
});
|
|
10231
|
+
if (isTrue) {
|
|
10232
|
+
value = JSON.stringify(value);
|
|
10233
|
+
} else {
|
|
10234
|
+
value = value.join(',');
|
|
10235
|
+
}
|
|
10236
|
+
} else {
|
|
10237
|
+
value = String(value);
|
|
10238
|
+
}
|
|
10239
|
+
return value;
|
|
10211
10240
|
}
|
|
10212
10241
|
},
|
|
10213
10242
|
render: function render(h) {
|
|
@@ -10376,6 +10405,25 @@
|
|
|
10376
10405
|
}
|
|
10377
10406
|
});
|
|
10378
10407
|
|
|
10408
|
+
var messages = {
|
|
10409
|
+
'zh-CN': {
|
|
10410
|
+
add: '添加'
|
|
10411
|
+
},
|
|
10412
|
+
'en-US': {
|
|
10413
|
+
add: 'Add'
|
|
10414
|
+
}
|
|
10415
|
+
};
|
|
10416
|
+
function locale(item) {
|
|
10417
|
+
var _messages$curLang;
|
|
10418
|
+
var curLang = getCookie('blueking_language') || 'zh-CN';
|
|
10419
|
+
if (['en-US', 'enUS', 'enus', 'en-us', 'en'].includes(curLang)) {
|
|
10420
|
+
curLang = 'en-US';
|
|
10421
|
+
} else {
|
|
10422
|
+
curLang = 'zh-CN';
|
|
10423
|
+
}
|
|
10424
|
+
return ((_messages$curLang = messages[curLang]) === null || _messages$curLang === void 0 ? void 0 : _messages$curLang[item]) || '';
|
|
10425
|
+
}
|
|
10426
|
+
|
|
10379
10427
|
var _excluded$2 = ["name"];
|
|
10380
10428
|
// 默认数组控件
|
|
10381
10429
|
var ArrayWidget = Vue__default["default"].extend({
|
|
@@ -10466,7 +10514,7 @@
|
|
|
10466
10514
|
}
|
|
10467
10515
|
}, [h('i', {
|
|
10468
10516
|
class: ['bk-icon icon-plus-circle-shape mr5']
|
|
10469
|
-
}), '
|
|
10517
|
+
}), locale('add')])])]));
|
|
10470
10518
|
}
|
|
10471
10519
|
});
|
|
10472
10520
|
|
|
@@ -10877,6 +10925,22 @@
|
|
|
10877
10925
|
var TableWidget = Vue__default["default"].extend({
|
|
10878
10926
|
name: 'TableWidget',
|
|
10879
10927
|
props: props,
|
|
10928
|
+
mounted: function mounted() {
|
|
10929
|
+
var _this = this;
|
|
10930
|
+
this.$nextTick(function () {
|
|
10931
|
+
var fieldMap = _this.schema.items.properties;
|
|
10932
|
+
_this.value.forEach(function (item, index) {
|
|
10933
|
+
Object.keys(fieldMap).forEach(function (key) {
|
|
10934
|
+
var config = fieldMap[key];
|
|
10935
|
+
if (config['ui:rules']) {
|
|
10936
|
+
var instance = _this.$refs[key + index];
|
|
10937
|
+
// 注册widget TreeNode
|
|
10938
|
+
widgetTree.addWidgetNode("".concat(_this.path, ".").concat(key), instance, 'node');
|
|
10939
|
+
}
|
|
10940
|
+
});
|
|
10941
|
+
});
|
|
10942
|
+
});
|
|
10943
|
+
},
|
|
10880
10944
|
methods: {
|
|
10881
10945
|
// 单元格表单编辑
|
|
10882
10946
|
handleCellValChange: function handleCellValChange(_ref) {
|
|
@@ -10889,12 +10953,14 @@
|
|
|
10889
10953
|
// 新增
|
|
10890
10954
|
handleAddRow: function handleAddRow(index) {
|
|
10891
10955
|
var _this$$props$schema$i;
|
|
10956
|
+
if (this.schema['ui:props'].disabled) return;
|
|
10892
10957
|
var newValue = this.value.slice(0);
|
|
10893
10958
|
newValue.splice.apply(newValue, [index + 1, 0].concat(_toConsumableArray(getRowDefaultData((_this$$props$schema$i = this.$props.schema.items) === null || _this$$props$schema$i === void 0 ? void 0 : _this$$props$schema$i.properties))));
|
|
10894
10959
|
this.$emit('input', newValue);
|
|
10895
10960
|
},
|
|
10896
10961
|
// 删除
|
|
10897
10962
|
handleDelRow: function handleDelRow(index) {
|
|
10963
|
+
if (this.schema['ui:props'].disabled) return;
|
|
10898
10964
|
var newValue = this.value.slice(0);
|
|
10899
10965
|
newValue.splice(index, 1);
|
|
10900
10966
|
this.$emit('input', newValue);
|
|
@@ -10902,7 +10968,7 @@
|
|
|
10902
10968
|
},
|
|
10903
10969
|
render: function render(h) {
|
|
10904
10970
|
var _schema$items,
|
|
10905
|
-
|
|
10971
|
+
_this2 = this;
|
|
10906
10972
|
var self = this;
|
|
10907
10973
|
var _this$$props = this.$props,
|
|
10908
10974
|
schema = _this$$props.schema,
|
|
@@ -10911,7 +10977,8 @@
|
|
|
10911
10977
|
path = _this$$props.path,
|
|
10912
10978
|
context = _this$$props.context,
|
|
10913
10979
|
rootData = _this$$props.rootData,
|
|
10914
|
-
value = _this$$props.value
|
|
10980
|
+
value = _this$$props.value,
|
|
10981
|
+
disabled = _this$$props.disabled;
|
|
10915
10982
|
var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
|
|
10916
10983
|
var uiOptions = Schema.getUiOptions(schema);
|
|
10917
10984
|
var getTableColumn = function getTableColumn() {
|
|
@@ -10928,7 +10995,7 @@
|
|
|
10928
10995
|
style: {
|
|
10929
10996
|
'text-decoration-line': 'underline',
|
|
10930
10997
|
'text-decoration-style': 'dashed',
|
|
10931
|
-
|
|
10998
|
+
cursor: 'pointer'
|
|
10932
10999
|
},
|
|
10933
11000
|
directives: [{
|
|
10934
11001
|
name: 'bk-tooltips',
|
|
@@ -10939,16 +11006,20 @@
|
|
|
10939
11006
|
}
|
|
10940
11007
|
return h(registry.getBaseWidget('table-column'), {
|
|
10941
11008
|
props: _objectSpread2({
|
|
10942
|
-
label: colField.title
|
|
11009
|
+
label: colField.title,
|
|
11010
|
+
minWidth: colField.minWidth,
|
|
11011
|
+
width: colField.width
|
|
10943
11012
|
}, colProps),
|
|
10944
11013
|
scopedSlots: {
|
|
10945
11014
|
default: function _default(props) {
|
|
10946
11015
|
return h(SchemaField, {
|
|
11016
|
+
ref: key + props.$index,
|
|
10947
11017
|
props: {
|
|
10948
11018
|
context: context,
|
|
10949
11019
|
rootData: rootData,
|
|
10950
11020
|
readonly: readonly,
|
|
10951
11021
|
readonlyMode: readonlyMode,
|
|
11022
|
+
disabled: disabled,
|
|
10952
11023
|
schema: mergeDeep(colField, {
|
|
10953
11024
|
'ui:props': {
|
|
10954
11025
|
// 默认不展示标题
|
|
@@ -10970,16 +11041,20 @@
|
|
|
10970
11041
|
}
|
|
10971
11042
|
});
|
|
10972
11043
|
});
|
|
10973
|
-
if (!
|
|
11044
|
+
if (!_this2.readonly && uiOptions.modifyRows !== false) {
|
|
10974
11045
|
VNodeList.push(h(registry.getBaseWidget('table-column'), {
|
|
10975
11046
|
props: {
|
|
10976
11047
|
label: '操作',
|
|
10977
|
-
width: 100
|
|
11048
|
+
width: 100,
|
|
11049
|
+
fixed: 'right'
|
|
10978
11050
|
},
|
|
10979
11051
|
scopedSlots: {
|
|
10980
11052
|
default: function _default(props) {
|
|
10981
11053
|
return h('div', {
|
|
10982
|
-
class:
|
|
11054
|
+
class: {
|
|
11055
|
+
'table-widget-actions': true,
|
|
11056
|
+
'is-disabled': schema['ui:props'].disabled
|
|
11057
|
+
}
|
|
10983
11058
|
}, [h('i', {
|
|
10984
11059
|
class: 'bk-icon icon-plus-circle action-btn',
|
|
10985
11060
|
on: {
|
|
@@ -11017,7 +11092,7 @@
|
|
|
11017
11092
|
},
|
|
11018
11093
|
scopedSlots: {
|
|
11019
11094
|
empty: function empty() {
|
|
11020
|
-
return
|
|
11095
|
+
return _this2.readonly || uiOptions.modifyRows === false ? null : h('div', {
|
|
11021
11096
|
style: {
|
|
11022
11097
|
color: '#3a84ff',
|
|
11023
11098
|
cursor: 'pointer'
|