@blueking/bkui-form 0.0.26 → 0.0.28

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.
@@ -1925,51 +1925,6 @@
1925
1925
  }
1926
1926
  });
1927
1927
 
1928
- var _excluded$4 = ["name"];
1929
- var ObjectField = Vue__default["default"].extend({
1930
- name: 'ObjectField',
1931
- functional: true,
1932
- props: props,
1933
- render: function render(h, ctx) {
1934
- var _ctx$props = ctx.props,
1935
- schema = _ctx$props.schema,
1936
- path = _ctx$props.path,
1937
- layout = _ctx$props.layout,
1938
- rootData = _ctx$props.rootData;
1939
- var properties = orderProperties(Object.keys(schema.properties), schema['ui:order']);
1940
- var vNodeList = properties.map(function (name) {
1941
- var curPath = Path.getCurPath(path, name);
1942
- var lastProp = curPath.split('.').pop();
1943
- var layoutConfig = Layout.findLayoutByProp(lastProp, layout.group || []) || {};
1944
- return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
1945
- key: curPath,
1946
- props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
1947
- schema: schema.properties[name],
1948
- required: Schema.isRequired(schema, name),
1949
- path: curPath,
1950
- layout: layoutConfig,
1951
- removeable: false // todo: 不往下传递可删除属性
1952
-
1953
- })
1954
- }));
1955
- });
1956
-
1957
- var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
1958
- name = _Schema$getGroupWrap.name,
1959
- vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$4); // todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
1960
-
1961
-
1962
- return h(name, mergeDeep({
1963
- props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
1964
- value: Path.getPathVal(rootData, path),
1965
- path: path
1966
- }),
1967
- style: _objectSpread2({}, ctx.data.style || {}),
1968
- on: _objectSpread2({}, ctx.data.on || {})
1969
- }, vnodeData), _toConsumableArray(vNodeList));
1970
- }
1971
- });
1972
-
1973
1928
  /* eslint-disable @typescript-eslint/no-unused-vars */
1974
1929
 
1975
1930
  var getContext = function getContext(instance) {
@@ -10421,7 +10376,7 @@
10421
10376
  }();
10422
10377
  var events = new FormEvent();
10423
10378
 
10424
- var _excluded$3 = ["url", "params"],
10379
+ var _excluded$4 = ["url", "params"],
10425
10380
  _excluded2 = ["name"];
10426
10381
  var Widget = Vue__default["default"].extend({
10427
10382
  name: 'Widget',
@@ -10529,7 +10484,7 @@
10529
10484
  break;
10530
10485
  }
10531
10486
 
10532
- url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$3);
10487
+ url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
10533
10488
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
10534
10489
  _context.prev = 4;
10535
10490
  _this3.loading = true;
@@ -10666,6 +10621,58 @@
10666
10621
  }
10667
10622
  });
10668
10623
 
10624
+ var _excluded$3 = ["name"];
10625
+ var ObjectField = Vue__default["default"].extend({
10626
+ name: 'ObjectField',
10627
+ functional: true,
10628
+ props: props,
10629
+ render: function render(h, ctx) {
10630
+ var _ctx$props = ctx.props,
10631
+ schema = _ctx$props.schema,
10632
+ path = _ctx$props.path,
10633
+ layout = _ctx$props.layout,
10634
+ rootData = _ctx$props.rootData;
10635
+ var properties = orderProperties(Object.keys(schema.properties || {}), schema['ui:order']);
10636
+ var vNodeList = [];
10637
+
10638
+ if (properties.length) {
10639
+ vNodeList = properties.map(function (name) {
10640
+ var curPath = Path.getCurPath(path, name);
10641
+ var lastProp = curPath.split('.').pop();
10642
+ var layoutConfig = Layout.findLayoutByProp(lastProp, layout.group || []) || {};
10643
+ return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
10644
+ key: curPath,
10645
+ props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
10646
+ schema: schema.properties[name],
10647
+ required: Schema.isRequired(schema, name),
10648
+ path: curPath,
10649
+ layout: layoutConfig,
10650
+ removeable: false // todo: 不往下传递可删除属性
10651
+
10652
+ })
10653
+ }));
10654
+ });
10655
+ } else if (Schema.getUiComponent(schema)) {
10656
+ // 如果object属性没有配置 Properties,但是有ui:component属性,那个直接渲染对应的组件
10657
+ vNodeList = [h(Widget, _objectSpread2({}, ctx.data))];
10658
+ }
10659
+
10660
+ var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
10661
+ name = _Schema$getGroupWrap.name,
10662
+ vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$3); // todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
10663
+
10664
+
10665
+ return h(name, mergeDeep({
10666
+ props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
10667
+ value: Path.getPathVal(rootData, path),
10668
+ path: path
10669
+ }),
10670
+ style: _objectSpread2({}, ctx.data.style || {}),
10671
+ on: _objectSpread2({}, ctx.data.on || {})
10672
+ }, vnodeData), _toConsumableArray(vNodeList));
10673
+ }
10674
+ });
10675
+
10669
10676
  var StringField = Vue__default["default"].extend({
10670
10677
  name: 'StringField',
10671
10678
  functional: true,
@@ -11762,7 +11769,7 @@
11762
11769
  methods: {
11763
11770
  handleInput: function handleInput(v) {
11764
11771
  if (this.$attrs.type === 'number') {
11765
- this.$emit('input', isNaN(v) ? v : Number(v));
11772
+ this.$emit('input', isNaN(v) || v === '' ? v : Number(v));
11766
11773
  } else {
11767
11774
  this.$emit('input', v);
11768
11775
  }
@@ -11868,13 +11875,16 @@
11868
11875
  props: props$1,
11869
11876
  data: function data() {
11870
11877
  return {
11871
- rootData: {}
11878
+ rootData: {},
11879
+ formKey: 'bk-ui-form'
11872
11880
  };
11873
11881
  },
11874
11882
  watch: {
11875
- schema: function schema() {
11883
+ schema: function schema(newSchema, oldSchema) {
11884
+ if (JSON.stringify(newSchema) === JSON.stringify(oldSchema)) return;
11876
11885
  this.validateSchema(this.schema);
11877
11886
  this.initFormData();
11887
+ this.formKey = "bk-ui-form-".concat(new Date().getTime());
11878
11888
  },
11879
11889
  context: {
11880
11890
  handler: function handler(ctx) {
@@ -11924,6 +11934,7 @@
11924
11934
  var self = this;
11925
11935
  return h(registry.getBaseWidget('form'), {
11926
11936
  ref: 'bkui-form',
11937
+ key: this.formKey,
11927
11938
  props: {
11928
11939
  model: this.value,
11929
11940
  formType: this.formType,