form-driver 0.4.5 → 0.4.7

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/es/m3.js CHANGED
@@ -20477,7 +20477,6 @@ var AWeight = /*#__PURE__*/function (_Viewer) {
20477
20477
 
20478
20478
  var _this;
20479
20479
 
20480
- console.log("AWeight props", props);
20481
20480
  _this = _Viewer.call(this, props) || this;
20482
20481
  _this.allSliderValuesChanged = []; // 添加防抖定时器
20483
20482
 
@@ -20489,21 +20488,28 @@ var AWeight = /*#__PURE__*/function (_Viewer) {
20489
20488
  _this.allValues = [];
20490
20489
  var schema = props.schema;
20491
20490
  _this._enumFields = MUtil.option(_this.props.schema);
20492
- console.log("this._enumFields", _this._enumFields);
20493
20491
  _this.totalWeight = schema.weight;
20494
20492
  _this.allValues = (_this$_enumFields$map = (_this$_enumFields = _this._enumFields) == null ? void 0 : _this$_enumFields.map(function (i) {
20495
- var _values$find;
20493
+ var _values$find$value, _values$find;
20496
20494
 
20497
20495
  var values = _Viewer.prototype.getValue.call(_assertThisInitialized(_this));
20498
20496
 
20499
- return values == null ? void 0 : (_values$find = values.find(function (v) {
20497
+ return (_values$find$value = values == null ? void 0 : (_values$find = values.find(function (v) {
20500
20498
  return i.value === v.label;
20501
- })) == null ? void 0 : _values$find.value;
20499
+ })) == null ? void 0 : _values$find.value) != null ? _values$find$value : 0;
20502
20500
  })) != null ? _this$_enumFields$map : new Array(_this._enumFields.length).fill(0);
20503
20501
  _this.state = {
20504
20502
  allSliderValues: _this.allValues,
20505
20503
  ctrlVersion: 1
20506
- };
20504
+ }; // 初始化数据,避免出现 null 的情况
20505
+
20506
+ _Viewer.prototype.changeValue.call(_assertThisInitialized(_this), _this.allValues.map(function (n, index) {
20507
+ return {
20508
+ label: _this._enumFields[index].value,
20509
+ value: n
20510
+ };
20511
+ }));
20512
+
20507
20513
  return _this;
20508
20514
  }
20509
20515
 
@@ -21868,12 +21874,15 @@ var ACascadePicker = /*#__PURE__*/function (_BaseViewer) {
21868
21874
  }),
21869
21875
  changeOnSelect: true,
21870
21876
  placeholder: _BaseViewer.prototype.getPlaceholder.call(this),
21877
+ onClear: function onClear() {
21878
+ _BaseViewer.prototype.changeValue.call(_this, []);
21879
+ },
21871
21880
  onChange: function onChange(v) {
21872
21881
  var vLabel = [];
21873
21882
  v.map(function (item) {
21874
21883
  var findItem;
21875
21884
  candidate.map(function (dataItem) {
21876
- findItem = findById(dataItem, item, 'label', 'value', 'children');
21885
+ findItem = findById(dataItem, item, "label", "value", "children");
21877
21886
 
21878
21887
  if (findItem != -1) {
21879
21888
  vLabel.push(findItem);
package/lib/m3.js CHANGED
@@ -20501,7 +20501,6 @@ var AWeight = /*#__PURE__*/function (_Viewer) {
20501
20501
 
20502
20502
  var _this;
20503
20503
 
20504
- console.log("AWeight props", props);
20505
20504
  _this = _Viewer.call(this, props) || this;
20506
20505
  _this.allSliderValuesChanged = []; // 添加防抖定时器
20507
20506
 
@@ -20513,21 +20512,28 @@ var AWeight = /*#__PURE__*/function (_Viewer) {
20513
20512
  _this.allValues = [];
20514
20513
  var schema = props.schema;
20515
20514
  _this._enumFields = MUtil.option(_this.props.schema);
20516
- console.log("this._enumFields", _this._enumFields);
20517
20515
  _this.totalWeight = schema.weight;
20518
20516
  _this.allValues = (_this$_enumFields$map = (_this$_enumFields = _this._enumFields) == null ? void 0 : _this$_enumFields.map(function (i) {
20519
- var _values$find;
20517
+ var _values$find$value, _values$find;
20520
20518
 
20521
20519
  var values = _Viewer.prototype.getValue.call(_assertThisInitialized__default["default"](_this));
20522
20520
 
20523
- return values == null ? void 0 : (_values$find = values.find(function (v) {
20521
+ return (_values$find$value = values == null ? void 0 : (_values$find = values.find(function (v) {
20524
20522
  return i.value === v.label;
20525
- })) == null ? void 0 : _values$find.value;
20523
+ })) == null ? void 0 : _values$find.value) != null ? _values$find$value : 0;
20526
20524
  })) != null ? _this$_enumFields$map : new Array(_this._enumFields.length).fill(0);
20527
20525
  _this.state = {
20528
20526
  allSliderValues: _this.allValues,
20529
20527
  ctrlVersion: 1
20530
- };
20528
+ }; // 初始化数据,避免出现 null 的情况
20529
+
20530
+ _Viewer.prototype.changeValue.call(_assertThisInitialized__default["default"](_this), _this.allValues.map(function (n, index) {
20531
+ return {
20532
+ label: _this._enumFields[index].value,
20533
+ value: n
20534
+ };
20535
+ }));
20536
+
20531
20537
  return _this;
20532
20538
  }
20533
20539
 
@@ -21892,12 +21898,15 @@ var ACascadePicker = /*#__PURE__*/function (_BaseViewer) {
21892
21898
  }),
21893
21899
  changeOnSelect: true,
21894
21900
  placeholder: _BaseViewer.prototype.getPlaceholder.call(this),
21901
+ onClear: function onClear() {
21902
+ _BaseViewer.prototype.changeValue.call(_this, []);
21903
+ },
21895
21904
  onChange: function onChange(v) {
21896
21905
  var vLabel = [];
21897
21906
  v.map(function (item) {
21898
21907
  var findItem;
21899
21908
  candidate.map(function (dataItem) {
21900
- findItem = findById(dataItem, item, 'label', 'value', 'children');
21909
+ findItem = findById(dataItem, item, "label", "value", "children");
21901
21910
 
21902
21911
  if (findItem != -1) {
21903
21912
  vLabel.push(findItem);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-driver",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "An efficient framework for creating forms.",
5
5
  "license": "MIT",
6
6
  "authors": [
@@ -108,7 +108,15 @@ export class AWeight extends Viewer<AWeightState> {
108
108
  allSliderValues: this.allValues,
109
109
  ctrlVersion: 1,
110
110
  };
111
- console.log("this.state", this.state);
111
+ // 初始化数据,避免出现 null 的情况
112
+ super.changeValue(
113
+ this.allValues.map((n, index) => {
114
+ return {
115
+ label: this._enumFields[index].value,
116
+ value: n,
117
+ };
118
+ })
119
+ );
112
120
  }
113
121
 
114
122
  componentDidMount(): void {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { MFieldSchema } from '../../../framework/Schema';
2
+ import { MFieldSchema } from "../../../framework/Schema";
3
3
  import { BaseViewer } from "../../..";
4
4
  export declare function labelExpr(d: any, remote: MFieldSchema["remote"]): any;
5
5
  export declare function convert(node: {}, dataPath: any, valuePath: any, childPath: any): {};