@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.
@@ -1917,51 +1917,6 @@ var SchemaField = Vue.extend({
1917
1917
  }
1918
1918
  });
1919
1919
 
1920
- var _excluded$4 = ["name"];
1921
- var ObjectField = Vue.extend({
1922
- name: 'ObjectField',
1923
- functional: true,
1924
- props: props,
1925
- render: function render(h, ctx) {
1926
- var _ctx$props = ctx.props,
1927
- schema = _ctx$props.schema,
1928
- path = _ctx$props.path,
1929
- layout = _ctx$props.layout,
1930
- rootData = _ctx$props.rootData;
1931
- var properties = orderProperties(Object.keys(schema.properties), schema['ui:order']);
1932
- var vNodeList = properties.map(function (name) {
1933
- var curPath = Path.getCurPath(path, name);
1934
- var lastProp = curPath.split('.').pop();
1935
- var layoutConfig = Layout.findLayoutByProp(lastProp, layout.group || []) || {};
1936
- return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
1937
- key: curPath,
1938
- props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
1939
- schema: schema.properties[name],
1940
- required: Schema.isRequired(schema, name),
1941
- path: curPath,
1942
- layout: layoutConfig,
1943
- removeable: false // todo: 不往下传递可删除属性
1944
-
1945
- })
1946
- }));
1947
- });
1948
-
1949
- var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
1950
- name = _Schema$getGroupWrap.name,
1951
- vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$4); // todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
1952
-
1953
-
1954
- return h(name, mergeDeep({
1955
- props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
1956
- value: Path.getPathVal(rootData, path),
1957
- path: path
1958
- }),
1959
- style: _objectSpread2({}, ctx.data.style || {}),
1960
- on: _objectSpread2({}, ctx.data.on || {})
1961
- }, vnodeData), _toConsumableArray(vNodeList));
1962
- }
1963
- });
1964
-
1965
1920
  /* eslint-disable @typescript-eslint/no-unused-vars */
1966
1921
 
1967
1922
  var getContext = function getContext(instance) {
@@ -10413,7 +10368,7 @@ var FormEvent = /*#__PURE__*/function () {
10413
10368
  }();
10414
10369
  var events = new FormEvent();
10415
10370
 
10416
- var _excluded$3 = ["url", "params"],
10371
+ var _excluded$4 = ["url", "params"],
10417
10372
  _excluded2 = ["name"];
10418
10373
  var Widget = Vue.extend({
10419
10374
  name: 'Widget',
@@ -10521,7 +10476,7 @@ var Widget = Vue.extend({
10521
10476
  break;
10522
10477
  }
10523
10478
 
10524
- url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$3);
10479
+ url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
10525
10480
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
10526
10481
  _context.prev = 4;
10527
10482
  _this3.loading = true;
@@ -10658,6 +10613,58 @@ var Widget = Vue.extend({
10658
10613
  }
10659
10614
  });
10660
10615
 
10616
+ var _excluded$3 = ["name"];
10617
+ var ObjectField = Vue.extend({
10618
+ name: 'ObjectField',
10619
+ functional: true,
10620
+ props: props,
10621
+ render: function render(h, ctx) {
10622
+ var _ctx$props = ctx.props,
10623
+ schema = _ctx$props.schema,
10624
+ path = _ctx$props.path,
10625
+ layout = _ctx$props.layout,
10626
+ rootData = _ctx$props.rootData;
10627
+ var properties = orderProperties(Object.keys(schema.properties || {}), schema['ui:order']);
10628
+ var vNodeList = [];
10629
+
10630
+ if (properties.length) {
10631
+ vNodeList = properties.map(function (name) {
10632
+ var curPath = Path.getCurPath(path, name);
10633
+ var lastProp = curPath.split('.').pop();
10634
+ var layoutConfig = Layout.findLayoutByProp(lastProp, layout.group || []) || {};
10635
+ return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
10636
+ key: curPath,
10637
+ props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
10638
+ schema: schema.properties[name],
10639
+ required: Schema.isRequired(schema, name),
10640
+ path: curPath,
10641
+ layout: layoutConfig,
10642
+ removeable: false // todo: 不往下传递可删除属性
10643
+
10644
+ })
10645
+ }));
10646
+ });
10647
+ } else if (Schema.getUiComponent(schema)) {
10648
+ // 如果object属性没有配置 Properties,但是有ui:component属性,那个直接渲染对应的组件
10649
+ vNodeList = [h(Widget, _objectSpread2({}, ctx.data))];
10650
+ }
10651
+
10652
+ var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
10653
+ name = _Schema$getGroupWrap.name,
10654
+ vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$3); // todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
10655
+
10656
+
10657
+ return h(name, mergeDeep({
10658
+ props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
10659
+ value: Path.getPathVal(rootData, path),
10660
+ path: path
10661
+ }),
10662
+ style: _objectSpread2({}, ctx.data.style || {}),
10663
+ on: _objectSpread2({}, ctx.data.on || {})
10664
+ }, vnodeData), _toConsumableArray(vNodeList));
10665
+ }
10666
+ });
10667
+
10661
10668
  var StringField = Vue.extend({
10662
10669
  name: 'StringField',
10663
10670
  functional: true,
@@ -11754,7 +11761,7 @@ var InputWidget = Vue.extend({
11754
11761
  methods: {
11755
11762
  handleInput: function handleInput(v) {
11756
11763
  if (this.$attrs.type === 'number') {
11757
- this.$emit('input', isNaN(v) ? v : Number(v));
11764
+ this.$emit('input', isNaN(v) || v === '' ? v : Number(v));
11758
11765
  } else {
11759
11766
  this.$emit('input', v);
11760
11767
  }
@@ -11860,13 +11867,16 @@ function createForm() {
11860
11867
  props: props$1,
11861
11868
  data: function data() {
11862
11869
  return {
11863
- rootData: {}
11870
+ rootData: {},
11871
+ formKey: 'bk-ui-form'
11864
11872
  };
11865
11873
  },
11866
11874
  watch: {
11867
- schema: function schema() {
11875
+ schema: function schema(newSchema, oldSchema) {
11876
+ if (JSON.stringify(newSchema) === JSON.stringify(oldSchema)) return;
11868
11877
  this.validateSchema(this.schema);
11869
11878
  this.initFormData();
11879
+ this.formKey = "bk-ui-form-".concat(new Date().getTime());
11870
11880
  },
11871
11881
  context: {
11872
11882
  handler: function handler(ctx) {
@@ -11916,6 +11926,7 @@ function createForm() {
11916
11926
  var self = this;
11917
11927
  return h(registry.getBaseWidget('form'), {
11918
11928
  ref: 'bkui-form',
11929
+ key: this.formKey,
11919
11930
  props: {
11920
11931
  model: this.value,
11921
11932
  formType: this.formType,