@blueking/bkui-form 0.0.39 → 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.
@@ -1944,7 +1944,7 @@
1944
1944
  return;
1945
1945
  }
1946
1946
  var _node = new WidgetNode({
1947
- id: path,
1947
+ id: instance.path,
1948
1948
  type: type,
1949
1949
  index: index,
1950
1950
  parent: parentNode,
@@ -10221,7 +10221,22 @@
10221
10221
  val = item.label;
10222
10222
  }
10223
10223
  }
10224
- return val === '' ? '--' : String(val);
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;
10225
10240
  }
10226
10241
  },
10227
10242
  render: function render(h) {
@@ -10910,6 +10925,22 @@
10910
10925
  var TableWidget = Vue__default["default"].extend({
10911
10926
  name: 'TableWidget',
10912
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
+ },
10913
10944
  methods: {
10914
10945
  // 单元格表单编辑
10915
10946
  handleCellValChange: function handleCellValChange(_ref) {
@@ -10922,12 +10953,14 @@
10922
10953
  // 新增
10923
10954
  handleAddRow: function handleAddRow(index) {
10924
10955
  var _this$$props$schema$i;
10956
+ if (this.schema['ui:props'].disabled) return;
10925
10957
  var newValue = this.value.slice(0);
10926
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))));
10927
10959
  this.$emit('input', newValue);
10928
10960
  },
10929
10961
  // 删除
10930
10962
  handleDelRow: function handleDelRow(index) {
10963
+ if (this.schema['ui:props'].disabled) return;
10931
10964
  var newValue = this.value.slice(0);
10932
10965
  newValue.splice(index, 1);
10933
10966
  this.$emit('input', newValue);
@@ -10935,7 +10968,7 @@
10935
10968
  },
10936
10969
  render: function render(h) {
10937
10970
  var _schema$items,
10938
- _this = this;
10971
+ _this2 = this;
10939
10972
  var self = this;
10940
10973
  var _this$$props = this.$props,
10941
10974
  schema = _this$$props.schema,
@@ -10944,7 +10977,8 @@
10944
10977
  path = _this$$props.path,
10945
10978
  context = _this$$props.context,
10946
10979
  rootData = _this$$props.rootData,
10947
- value = _this$$props.value;
10980
+ value = _this$$props.value,
10981
+ disabled = _this$$props.disabled;
10948
10982
  var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
10949
10983
  var uiOptions = Schema.getUiOptions(schema);
10950
10984
  var getTableColumn = function getTableColumn() {
@@ -10972,16 +11006,20 @@
10972
11006
  }
10973
11007
  return h(registry.getBaseWidget('table-column'), {
10974
11008
  props: _objectSpread2({
10975
- label: colField.title
11009
+ label: colField.title,
11010
+ minWidth: colField.minWidth,
11011
+ width: colField.width
10976
11012
  }, colProps),
10977
11013
  scopedSlots: {
10978
11014
  default: function _default(props) {
10979
11015
  return h(SchemaField, {
11016
+ ref: key + props.$index,
10980
11017
  props: {
10981
11018
  context: context,
10982
11019
  rootData: rootData,
10983
11020
  readonly: readonly,
10984
11021
  readonlyMode: readonlyMode,
11022
+ disabled: disabled,
10985
11023
  schema: mergeDeep(colField, {
10986
11024
  'ui:props': {
10987
11025
  // 默认不展示标题
@@ -11003,16 +11041,20 @@
11003
11041
  }
11004
11042
  });
11005
11043
  });
11006
- if (!_this.readonly && uiOptions.modifyRows !== false) {
11044
+ if (!_this2.readonly && uiOptions.modifyRows !== false) {
11007
11045
  VNodeList.push(h(registry.getBaseWidget('table-column'), {
11008
11046
  props: {
11009
11047
  label: '操作',
11010
- width: 100
11048
+ width: 100,
11049
+ fixed: 'right'
11011
11050
  },
11012
11051
  scopedSlots: {
11013
11052
  default: function _default(props) {
11014
11053
  return h('div', {
11015
- class: 'table-widget-actions'
11054
+ class: {
11055
+ 'table-widget-actions': true,
11056
+ 'is-disabled': schema['ui:props'].disabled
11057
+ }
11016
11058
  }, [h('i', {
11017
11059
  class: 'bk-icon icon-plus-circle action-btn',
11018
11060
  on: {
@@ -11050,7 +11092,7 @@
11050
11092
  },
11051
11093
  scopedSlots: {
11052
11094
  empty: function empty() {
11053
- return _this.readonly || uiOptions.modifyRows === false ? null : h('div', {
11095
+ return _this2.readonly || uiOptions.modifyRows === false ? null : h('div', {
11054
11096
  style: {
11055
11097
  color: '#3a84ff',
11056
11098
  cursor: 'pointer'