form-driver 0.4.18 → 0.4.20
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/README.md +17 -2
- package/dist/m3.css +1 -1
- package/dist/m3.js +1 -1
- package/es/m3.css +1 -1
- package/es/m3.js +353 -120
- package/lib/m3.css +1 -1
- package/lib/m3.js +352 -118
- package/package.json +2 -2
- package/src/framework/Init.tsx +6 -0
- package/src/framework/Schema.ts +16 -2
- package/src/index.ts +0 -1
- package/src/types/MDateRangeType.ts +65 -24
- package/src/types/MDateTimeType.ts +73 -29
- package/src/ui/editor/basic/ACascadePicker.tsx +23 -15
- package/src/ui/editor/basic/ADatetimePicker.tsx +103 -39
- package/src/ui/editor/basic/AGB2260.tsx +25 -14
- package/src/ui/editor/basic/ARangePicker.tsx +86 -22
- package/src/ui/readable/RichViewer.less +1 -1
- package/src/ui/widget/SelectBox.tsx +35 -15
- package/types/framework/Init.d.ts +1 -0
- package/types/framework/Schema.d.ts +11 -0
- package/types/index.d.ts +0 -1
- package/types/types/MDateTimeType.d.ts +2 -2
- package/types/ui/editor/basic/ADatetimePicker.d.ts +2 -1
- package/types/ui/editor/basic/AGB2260.d.ts +1 -0
- package/types/ui/editor/basic/ARangePicker.d.ts +5 -3
- package/types/ui/widget/SelectBox.d.ts +10 -3
package/lib/m3.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('antd/dist/antd.css');
|
|
6
|
-
require('antd-mobile/dist/antd-mobile.css');
|
|
7
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
8
7
|
var antd = require('antd');
|
|
9
8
|
var React = require('react');
|
|
@@ -13,7 +12,7 @@ var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
|
13
12
|
var _construct = require('@babel/runtime/helpers/construct');
|
|
14
13
|
var moment = require('moment');
|
|
15
14
|
var antdMobile = require('antd-mobile');
|
|
16
|
-
var zhCN = require('antd/
|
|
15
|
+
var zhCN = require('antd/es/locale/zh_CN');
|
|
17
16
|
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
18
17
|
var icons = require('@ant-design/icons');
|
|
19
18
|
var TextArea = require('antd/lib/input/TextArea');
|
|
@@ -22,8 +21,10 @@ var adapter = require('@atlaskit/pragmatic-drag-and-drop/element/adapter');
|
|
|
22
21
|
var clsx = require('clsx');
|
|
23
22
|
var Button = require('antd/lib/button');
|
|
24
23
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
24
|
+
var zhCN$1 = require('antd/lib/date-picker/locale/zh_CN');
|
|
25
25
|
var ReactDOM = require('react-dom');
|
|
26
26
|
var debounce = require('lodash/debounce');
|
|
27
|
+
require('moment/locale/zh-cn');
|
|
27
28
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
28
29
|
var OSS = require('ali-oss');
|
|
29
30
|
|
|
@@ -42,6 +43,7 @@ var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
|
42
43
|
var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
|
|
43
44
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
44
45
|
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
46
|
+
var zhCN__default$1 = /*#__PURE__*/_interopDefaultLegacy(zhCN$1);
|
|
45
47
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
46
48
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
47
49
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
@@ -15127,7 +15129,7 @@ var MGB2260Type = ___default["default"].assign({}, EmtpyType, {
|
|
|
15127
15129
|
var MDateTimeType = ___default["default"].assign({}, EmtpyType, {
|
|
15128
15130
|
validators: [validateRequired$1, validateDateMinMax],
|
|
15129
15131
|
antConf: function antConf(schema) {
|
|
15130
|
-
var _dataFormat, _dataFormat2, _dataFormat3, _dataFormat4;
|
|
15132
|
+
var _dataFormat, _dataFormat2, _dataFormat3, _dataFormat4, _dataFormat5, _dataFormat6, _dataFormat7, _dataFormat8;
|
|
15131
15133
|
|
|
15132
15134
|
var dataFormat = schema.dataFormat;
|
|
15133
15135
|
var readableFormat;
|
|
@@ -15137,28 +15139,59 @@ var MDateTimeType = ___default["default"].assign({}, EmtpyType, {
|
|
|
15137
15139
|
switch (schema.type) {
|
|
15138
15140
|
case "year":
|
|
15139
15141
|
mode = "year";
|
|
15140
|
-
dataFormat = (_dataFormat = dataFormat) != null ? _dataFormat :
|
|
15141
|
-
readableFormat =
|
|
15142
|
+
dataFormat = (_dataFormat = dataFormat) != null ? _dataFormat : "YYYY";
|
|
15143
|
+
readableFormat = "YYYY";
|
|
15142
15144
|
break;
|
|
15143
15145
|
|
|
15144
15146
|
case "yearMonth":
|
|
15145
15147
|
mode = "month";
|
|
15146
|
-
dataFormat = (_dataFormat2 = dataFormat) != null ? _dataFormat2 :
|
|
15147
|
-
readableFormat =
|
|
15148
|
+
dataFormat = (_dataFormat2 = dataFormat) != null ? _dataFormat2 : "YYYYMM";
|
|
15149
|
+
readableFormat = "YYYY-MM";
|
|
15148
15150
|
break;
|
|
15149
15151
|
|
|
15150
15152
|
case "yearMonthDay":
|
|
15151
15153
|
mode = "date";
|
|
15152
|
-
dataFormat = (_dataFormat3 = dataFormat) != null ? _dataFormat3 :
|
|
15153
|
-
readableFormat =
|
|
15154
|
+
dataFormat = (_dataFormat3 = dataFormat) != null ? _dataFormat3 : "YYYYMMDD";
|
|
15155
|
+
readableFormat = "YYYY-MM-DD";
|
|
15154
15156
|
break;
|
|
15155
15157
|
|
|
15156
15158
|
case "datetime":
|
|
15157
15159
|
mode = undefined;
|
|
15158
|
-
dataFormat = (_dataFormat4 = dataFormat) != null ? _dataFormat4 :
|
|
15159
|
-
readableFormat =
|
|
15160
|
+
dataFormat = (_dataFormat4 = dataFormat) != null ? _dataFormat4 : "x";
|
|
15161
|
+
readableFormat = "YYYY-MM-DD HH:mm";
|
|
15160
15162
|
showTime = true;
|
|
15161
15163
|
break;
|
|
15164
|
+
|
|
15165
|
+
case "date":
|
|
15166
|
+
switch (schema.datePrecision) {
|
|
15167
|
+
case "year":
|
|
15168
|
+
mode = "year";
|
|
15169
|
+
dataFormat = (_dataFormat5 = dataFormat) != null ? _dataFormat5 : "YYYY";
|
|
15170
|
+
readableFormat = "YYYY";
|
|
15171
|
+
break;
|
|
15172
|
+
|
|
15173
|
+
case "month":
|
|
15174
|
+
mode = "month";
|
|
15175
|
+
dataFormat = (_dataFormat6 = dataFormat) != null ? _dataFormat6 : "YYYYMM";
|
|
15176
|
+
readableFormat = "YYYY-MM";
|
|
15177
|
+
break;
|
|
15178
|
+
|
|
15179
|
+
case "minute":
|
|
15180
|
+
mode = undefined;
|
|
15181
|
+
dataFormat = (_dataFormat7 = dataFormat) != null ? _dataFormat7 : "x";
|
|
15182
|
+
readableFormat = "YYYY-MM-DD HH:mm";
|
|
15183
|
+
showTime = true;
|
|
15184
|
+
break;
|
|
15185
|
+
|
|
15186
|
+
default:
|
|
15187
|
+
// "day" 或未指定
|
|
15188
|
+
mode = "date";
|
|
15189
|
+
dataFormat = (_dataFormat8 = dataFormat) != null ? _dataFormat8 : "YYYYMMDD";
|
|
15190
|
+
readableFormat = "YYYY-MM-DD";
|
|
15191
|
+
break;
|
|
15192
|
+
}
|
|
15193
|
+
|
|
15194
|
+
break;
|
|
15162
15195
|
// case "yearAndQuarter":
|
|
15163
15196
|
// case "yearAndWeek":
|
|
15164
15197
|
// return MUtil.error(`移动端不支持${this.props.schema.type}`, this.props.schema);
|
|
@@ -15841,6 +15874,24 @@ var MObjectType = {
|
|
|
15841
15874
|
}
|
|
15842
15875
|
};
|
|
15843
15876
|
|
|
15877
|
+
/** 根据 precision 获取可读格式 */
|
|
15878
|
+
|
|
15879
|
+
function getReadableFormat(precision, showTime) {
|
|
15880
|
+
switch (precision) {
|
|
15881
|
+
case "year":
|
|
15882
|
+
return "YYYY年";
|
|
15883
|
+
|
|
15884
|
+
case "month":
|
|
15885
|
+
return "YYYY年MM月";
|
|
15886
|
+
|
|
15887
|
+
case "minute":
|
|
15888
|
+
return "YYYY年MM月DD日 HH:mm";
|
|
15889
|
+
|
|
15890
|
+
default:
|
|
15891
|
+
return showTime ? "YYYY年MM月DD日 HH:mm:ss" : "YYYY年MM月DD日";
|
|
15892
|
+
}
|
|
15893
|
+
}
|
|
15894
|
+
|
|
15844
15895
|
function timeExpr(assembly, v, tillNow, readableFormat) {
|
|
15845
15896
|
if (tillNow) {
|
|
15846
15897
|
return "至今";
|
|
@@ -15873,21 +15924,19 @@ var MDateRangeType = ___default["default"].assign({}, EmtpyType, {
|
|
|
15873
15924
|
return assembly.theme.READABLE_INVALID;
|
|
15874
15925
|
}
|
|
15875
15926
|
|
|
15876
|
-
|
|
15927
|
+
var fmt = getReadableFormat(s.dateRangePrecision, (_s$dateRange = s.dateRange) == null ? void 0 : _s$dateRange.showTime);
|
|
15928
|
+
return timeRangeExpr(assembly, vs[0], vs[1], vs[2], fmt);
|
|
15877
15929
|
},
|
|
15878
15930
|
|
|
15879
15931
|
/**
|
|
15880
15932
|
* 同toReadable,但数据无效时返回nil
|
|
15881
|
-
* @param assembly
|
|
15882
|
-
* @param s
|
|
15883
|
-
* @param vs
|
|
15884
|
-
* @returns
|
|
15885
15933
|
*/
|
|
15886
15934
|
toReadableN: function toReadableN(assembly, s, vs) {
|
|
15887
15935
|
if (!___default["default"].isNil(vs) && ___default["default"].isArray(vs)) {
|
|
15888
15936
|
var _s$dateRange2;
|
|
15889
15937
|
|
|
15890
|
-
|
|
15938
|
+
var fmt = getReadableFormat(s.dateRangePrecision, (_s$dateRange2 = s.dateRange) == null ? void 0 : _s$dateRange2.showTime);
|
|
15939
|
+
return timeRangeExpr(assembly, vs[0], vs[1], vs[2], fmt);
|
|
15891
15940
|
}
|
|
15892
15941
|
|
|
15893
15942
|
return undefined;
|
|
@@ -16413,6 +16462,23 @@ var ArrayViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16413
16462
|
function ownKeys$v(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16414
16463
|
|
|
16415
16464
|
function _objectSpread$v(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$v(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$v(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16465
|
+
|
|
16466
|
+
function toPrecision(mode) {
|
|
16467
|
+
switch (mode) {
|
|
16468
|
+
case "year":
|
|
16469
|
+
return "year";
|
|
16470
|
+
|
|
16471
|
+
case "month":
|
|
16472
|
+
return "month";
|
|
16473
|
+
|
|
16474
|
+
case "date":
|
|
16475
|
+
return "day";
|
|
16476
|
+
|
|
16477
|
+
default:
|
|
16478
|
+
return "minute";
|
|
16479
|
+
// datetime 场景
|
|
16480
|
+
}
|
|
16481
|
+
}
|
|
16416
16482
|
/**
|
|
16417
16483
|
* 日期选择框
|
|
16418
16484
|
* 配置示例:
|
|
@@ -16424,17 +16490,22 @@ function _objectSpread$v(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
16424
16490
|
* 类型是dateTime时,dataFormat默认是x,例如1608897466955
|
|
16425
16491
|
*/
|
|
16426
16492
|
|
|
16493
|
+
|
|
16427
16494
|
var ADatetimePicker = /*#__PURE__*/function (_BaseViewer) {
|
|
16428
16495
|
_inheritsLoose__default["default"](ADatetimePicker, _BaseViewer);
|
|
16429
16496
|
|
|
16430
|
-
function ADatetimePicker() {
|
|
16431
|
-
|
|
16497
|
+
function ADatetimePicker(props) {
|
|
16498
|
+
var _this;
|
|
16499
|
+
|
|
16500
|
+
_this = _BaseViewer.call(this, props) || this;
|
|
16501
|
+
_this.state.pickerVisible = false;
|
|
16502
|
+
return _this;
|
|
16432
16503
|
}
|
|
16433
16504
|
|
|
16434
16505
|
var _proto = ADatetimePicker.prototype;
|
|
16435
16506
|
|
|
16436
16507
|
_proto.element = function element() {
|
|
16437
|
-
var
|
|
16508
|
+
var _this2 = this,
|
|
16438
16509
|
_this$props$schema$pr;
|
|
16439
16510
|
|
|
16440
16511
|
var antConf = MDateTimeType.antConf(this.props.schema);
|
|
@@ -16451,9 +16522,9 @@ var ADatetimePicker = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16451
16522
|
if (vv) {
|
|
16452
16523
|
var vvAsM = ___default["default"].isDate(vv) ? moment__default["default"](vv) : vv;
|
|
16453
16524
|
|
|
16454
|
-
_BaseViewer.prototype.changeValue.call(
|
|
16525
|
+
_BaseViewer.prototype.changeValue.call(_this2, vvAsM.format(antConf.dataFormat));
|
|
16455
16526
|
} else {
|
|
16456
|
-
_BaseViewer.prototype.changeValue.call(
|
|
16527
|
+
_BaseViewer.prototype.changeValue.call(_this2, undefined);
|
|
16457
16528
|
}
|
|
16458
16529
|
};
|
|
16459
16530
|
|
|
@@ -16461,36 +16532,60 @@ var ADatetimePicker = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16461
16532
|
|
|
16462
16533
|
if (MUtil.phoneLike()) {
|
|
16463
16534
|
// 手机
|
|
16464
|
-
return jsxRuntime.
|
|
16465
|
-
|
|
16466
|
-
value: dataAsDate,
|
|
16467
|
-
minDate: this.props.schema.min ? moment__default["default"](this.props.schema.min, antConf.dataFormat).toDate() : undefined,
|
|
16468
|
-
maxDate: this.props.schema.max ? moment__default["default"](this.props.schema.max, antConf.dataFormat).toDate() : undefined,
|
|
16469
|
-
mode: antConf.mode,
|
|
16470
|
-
onChange: onChange
|
|
16471
|
-
}, p), {}, {
|
|
16472
|
-
children: jsxRuntime.jsx("div", {
|
|
16535
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
16536
|
+
children: [jsxRuntime.jsx("div", {
|
|
16473
16537
|
className: "backfill",
|
|
16538
|
+
onClick: function onClick() {
|
|
16539
|
+
if (!_this2.props.disable) _this2.setState({
|
|
16540
|
+
pickerVisible: true
|
|
16541
|
+
});
|
|
16542
|
+
},
|
|
16474
16543
|
children: dataAsDate ? moment__default["default"](dataAsDate).format(antConf.readableFormat) : "请点击选择"
|
|
16475
|
-
})
|
|
16476
|
-
|
|
16544
|
+
}), jsxRuntime.jsx(antdMobile.DatePicker, _objectSpread$v({
|
|
16545
|
+
visible: this.state.pickerVisible,
|
|
16546
|
+
value: dataAsDate,
|
|
16547
|
+
min: this.props.schema.min ? moment__default["default"](this.props.schema.min, antConf.dataFormat).toDate() : undefined,
|
|
16548
|
+
max: this.props.schema.max ? moment__default["default"](this.props.schema.max, antConf.dataFormat).toDate() : undefined,
|
|
16549
|
+
precision: toPrecision(antConf.mode),
|
|
16550
|
+
onConfirm: function onConfirm(val) {
|
|
16551
|
+
onChange(val);
|
|
16552
|
+
|
|
16553
|
+
_this2.setState({
|
|
16554
|
+
pickerVisible: false
|
|
16555
|
+
});
|
|
16556
|
+
},
|
|
16557
|
+
onClose: function onClose() {
|
|
16558
|
+
_this2.setState({
|
|
16559
|
+
pickerVisible: false
|
|
16560
|
+
});
|
|
16561
|
+
}
|
|
16562
|
+
}, p))]
|
|
16563
|
+
});
|
|
16477
16564
|
} else {
|
|
16565
|
+
var _antConf$mode;
|
|
16566
|
+
|
|
16478
16567
|
// 大屏
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
disabledDate: function disabledDate(m) {
|
|
16483
|
-
var d = _this.props.schema.min && moment__default["default"](_this.props.schema.min, antConf.dataFormat).isAfter(m) || _this.props.schema.max && moment__default["default"](_this.props.schema.max, antConf.dataFormat).isBefore(m);
|
|
16484
|
-
return !!d;
|
|
16485
|
-
},
|
|
16486
|
-
format: antConf.readableFormat,
|
|
16487
|
-
style: this.props.style,
|
|
16568
|
+
// key 中加入 mode 信息,确保精度切换时组件重新挂载
|
|
16569
|
+
var pickerKey = this.props.path + "_" + ((_antConf$mode = antConf.mode) != null ? _antConf$mode : "datetime");
|
|
16570
|
+
return jsxRuntime.jsx(antd.ConfigProvider, {
|
|
16488
16571
|
locale: zhCN__default["default"],
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16572
|
+
children: jsxRuntime.jsx(antd.DatePicker, _objectSpread$v({
|
|
16573
|
+
disabled: this.props.disable,
|
|
16574
|
+
bordered: this.props.hideBorder ? false : true,
|
|
16575
|
+
disabledDate: function disabledDate(m) {
|
|
16576
|
+
var d = _this2.props.schema.min && moment__default["default"](_this2.props.schema.min, antConf.dataFormat).isAfter(m) || _this2.props.schema.max && moment__default["default"](_this2.props.schema.max, antConf.dataFormat).isBefore(m);
|
|
16577
|
+
return !!d;
|
|
16578
|
+
},
|
|
16579
|
+
format: antConf.readableFormat,
|
|
16580
|
+
style: {
|
|
16581
|
+
width: "300px"
|
|
16582
|
+
},
|
|
16583
|
+
defaultValue: dataAsMoment,
|
|
16584
|
+
showTime: antConf.showTime,
|
|
16585
|
+
picker: antConf.mode,
|
|
16586
|
+
onChange: onChange
|
|
16587
|
+
}, p), pickerKey)
|
|
16588
|
+
});
|
|
16494
16589
|
}
|
|
16495
16590
|
};
|
|
16496
16591
|
|
|
@@ -16509,8 +16604,12 @@ function _objectSpread$u(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
16509
16604
|
var AGB2260 = /*#__PURE__*/function (_BaseViewer) {
|
|
16510
16605
|
_inheritsLoose__default["default"](AGB2260, _BaseViewer);
|
|
16511
16606
|
|
|
16512
|
-
function AGB2260() {
|
|
16513
|
-
|
|
16607
|
+
function AGB2260(props) {
|
|
16608
|
+
var _this;
|
|
16609
|
+
|
|
16610
|
+
_this = _BaseViewer.call(this, props) || this;
|
|
16611
|
+
_this.state.pickerVisible = false;
|
|
16612
|
+
return _this;
|
|
16514
16613
|
}
|
|
16515
16614
|
|
|
16516
16615
|
var _proto = AGB2260.prototype;
|
|
@@ -16518,7 +16617,7 @@ var AGB2260 = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16518
16617
|
_proto.element = function element() {
|
|
16519
16618
|
var _MGB2260Type$lookup,
|
|
16520
16619
|
_this$props$schema$pr,
|
|
16521
|
-
|
|
16620
|
+
_this2 = this;
|
|
16522
16621
|
|
|
16523
16622
|
var v = _BaseViewer.prototype.getValue.call(this);
|
|
16524
16623
|
|
|
@@ -16533,26 +16632,34 @@ var AGB2260 = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16533
16632
|
var _looked$label;
|
|
16534
16633
|
|
|
16535
16634
|
// 手机
|
|
16536
|
-
return jsxRuntime.
|
|
16537
|
-
|
|
16538
|
-
disabled: this.props.disable,
|
|
16539
|
-
className: "AGB2260",
|
|
16540
|
-
data: MGB2260Type.gb2260,
|
|
16541
|
-
value: looked.code,
|
|
16542
|
-
title: this.props.schema.label,
|
|
16543
|
-
onDismiss: function onDismiss() {
|
|
16544
|
-
return console.log('dismiss');
|
|
16545
|
-
},
|
|
16546
|
-
onOk: function onOk(e) {
|
|
16547
|
-
return _BaseViewer.prototype.changeValue.call(_this, ___default["default"].last(e));
|
|
16548
|
-
}
|
|
16549
|
-
}, p), {}, {
|
|
16550
|
-
children: jsxRuntime.jsx("div", {
|
|
16635
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
16636
|
+
children: [jsxRuntime.jsx("div", {
|
|
16551
16637
|
className: "backfill",
|
|
16552
16638
|
style: this.props.style,
|
|
16639
|
+
onClick: function onClick() {
|
|
16640
|
+
if (!_this2.props.disable) _this2.setState({
|
|
16641
|
+
pickerVisible: true
|
|
16642
|
+
});
|
|
16643
|
+
},
|
|
16553
16644
|
children: looked == null ? void 0 : (_looked$label = looked.label) == null ? void 0 : _looked$label.join("/")
|
|
16554
|
-
})
|
|
16555
|
-
|
|
16645
|
+
}), jsxRuntime.jsx(antdMobile.Picker, _objectSpread$u({
|
|
16646
|
+
columns: MGB2260Type.gb2260,
|
|
16647
|
+
value: looked.code,
|
|
16648
|
+
visible: this.state.pickerVisible,
|
|
16649
|
+
onConfirm: function onConfirm(e) {
|
|
16650
|
+
_BaseViewer.prototype.changeValue.call(_this2, ___default["default"].last(e));
|
|
16651
|
+
|
|
16652
|
+
_this2.setState({
|
|
16653
|
+
pickerVisible: false
|
|
16654
|
+
});
|
|
16655
|
+
},
|
|
16656
|
+
onClose: function onClose() {
|
|
16657
|
+
_this2.setState({
|
|
16658
|
+
pickerVisible: false
|
|
16659
|
+
});
|
|
16660
|
+
}
|
|
16661
|
+
}, p))]
|
|
16662
|
+
});
|
|
16556
16663
|
} else {
|
|
16557
16664
|
// PC
|
|
16558
16665
|
return jsxRuntime.jsx(antd.Cascader, _objectSpread$u({
|
|
@@ -16564,7 +16671,7 @@ var AGB2260 = /*#__PURE__*/function (_BaseViewer) {
|
|
|
16564
16671
|
style: this.props.style,
|
|
16565
16672
|
defaultValue: looked.code,
|
|
16566
16673
|
onChange: function onChange(vv) {
|
|
16567
|
-
_BaseViewer.prototype.changeValue.call(
|
|
16674
|
+
_BaseViewer.prototype.changeValue.call(_this2, ___default["default"].last(vv));
|
|
16568
16675
|
}
|
|
16569
16676
|
}, p), this.props.path);
|
|
16570
16677
|
}
|
|
@@ -17393,39 +17500,58 @@ var UnderlineInputBox = /*#__PURE__*/function (_React$Component) {
|
|
|
17393
17500
|
var SelectBox = /*#__PURE__*/function (_React$Component) {
|
|
17394
17501
|
_inheritsLoose__default["default"](SelectBox, _React$Component);
|
|
17395
17502
|
|
|
17396
|
-
function SelectBox() {
|
|
17397
|
-
|
|
17503
|
+
function SelectBox(props) {
|
|
17504
|
+
var _this;
|
|
17505
|
+
|
|
17506
|
+
_this = _React$Component.call(this, props) || this;
|
|
17507
|
+
_this.state = {
|
|
17508
|
+
pickerVisible: false
|
|
17509
|
+
};
|
|
17510
|
+
return _this;
|
|
17398
17511
|
}
|
|
17399
17512
|
|
|
17400
17513
|
var _proto = SelectBox.prototype;
|
|
17401
17514
|
|
|
17402
17515
|
_proto.render = function render() {
|
|
17403
|
-
var
|
|
17516
|
+
var _this2 = this;
|
|
17404
17517
|
|
|
17405
17518
|
if (MUtil.phoneLike()) {
|
|
17406
17519
|
var _looked$label;
|
|
17407
17520
|
|
|
17408
17521
|
var looked = this.props.options.find(function (o) {
|
|
17409
|
-
return o.value ===
|
|
17522
|
+
return o.value === _this2.props.data;
|
|
17410
17523
|
});
|
|
17411
17524
|
var backfillClass = looked ? "backfill" : "backfill_empty";
|
|
17412
|
-
return jsxRuntime.
|
|
17413
|
-
|
|
17414
|
-
cols: 1,
|
|
17415
|
-
data: this.props.options,
|
|
17416
|
-
value: [this.props.data],
|
|
17417
|
-
onOk: function onOk(e) {
|
|
17418
|
-
return _this.props.onChange(___default["default"].last(e));
|
|
17419
|
-
},
|
|
17420
|
-
onDismiss: function onDismiss() {
|
|
17421
|
-
if (_this.props.onBlur) {
|
|
17422
|
-
_this.props.onBlur();
|
|
17423
|
-
}
|
|
17424
|
-
},
|
|
17425
|
-
children: jsxRuntime.jsx("div", {
|
|
17525
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
17526
|
+
children: [jsxRuntime.jsx("div", {
|
|
17426
17527
|
className: backfillClass,
|
|
17528
|
+
onClick: function onClick() {
|
|
17529
|
+
return _this2.setState({
|
|
17530
|
+
pickerVisible: true
|
|
17531
|
+
});
|
|
17532
|
+
},
|
|
17427
17533
|
children: (_looked$label = looked == null ? void 0 : looked.label) != null ? _looked$label : "点击选择"
|
|
17428
|
-
})
|
|
17534
|
+
}), jsxRuntime.jsx(antdMobile.Picker, {
|
|
17535
|
+
columns: [this.props.options],
|
|
17536
|
+
value: [this.props.data],
|
|
17537
|
+
visible: this.state.pickerVisible,
|
|
17538
|
+
onConfirm: function onConfirm(e) {
|
|
17539
|
+
_this2.props.onChange(___default["default"].last(e));
|
|
17540
|
+
|
|
17541
|
+
_this2.setState({
|
|
17542
|
+
pickerVisible: false
|
|
17543
|
+
});
|
|
17544
|
+
},
|
|
17545
|
+
onClose: function onClose() {
|
|
17546
|
+
_this2.setState({
|
|
17547
|
+
pickerVisible: false
|
|
17548
|
+
});
|
|
17549
|
+
|
|
17550
|
+
if (_this2.props.onBlur) {
|
|
17551
|
+
_this2.props.onBlur();
|
|
17552
|
+
}
|
|
17553
|
+
}
|
|
17554
|
+
})]
|
|
17429
17555
|
});
|
|
17430
17556
|
} else {
|
|
17431
17557
|
return jsxRuntime.jsx(antd.Select, {
|
|
@@ -22659,10 +22785,13 @@ var ARangePicker = /*#__PURE__*/function (_Viewer) {
|
|
|
22659
22785
|
|
|
22660
22786
|
_this = _Viewer.call(this, p) || this;
|
|
22661
22787
|
_this._pickerRef = /*#__PURE__*/React__default["default"].createRef();
|
|
22788
|
+
_this._startConfirmed = false; // 标记开始日期是否已确认,用于区分 onClose 是取消还是确认后的自动触发
|
|
22789
|
+
|
|
22662
22790
|
_this.state = {
|
|
22663
22791
|
ctrlVersion: 1,
|
|
22664
22792
|
noValidate: false,
|
|
22665
|
-
mobileDlg: false
|
|
22793
|
+
mobileDlg: false,
|
|
22794
|
+
mobileStep: 'start'
|
|
22666
22795
|
};
|
|
22667
22796
|
return _this;
|
|
22668
22797
|
}
|
|
@@ -22725,57 +22854,115 @@ var ARangePicker = /*#__PURE__*/function (_Viewer) {
|
|
|
22725
22854
|
_this$getValue,
|
|
22726
22855
|
_this2 = this;
|
|
22727
22856
|
|
|
22728
|
-
|
|
22857
|
+
(_this$props$schema$pr = this.props.schema.props) != null ? _this$props$schema$pr : {};
|
|
22729
22858
|
|
|
22730
22859
|
var rangePickerData = this._data2rangePicker((_this$getValue = this.getValue()) != null ? _this$getValue : []);
|
|
22731
22860
|
|
|
22732
22861
|
if (MUtil.phoneLike()) {
|
|
22733
|
-
var _this$props$schema$da3;
|
|
22862
|
+
var _this$props$schema$da3, _this$props$schema$da4;
|
|
22863
|
+
|
|
22864
|
+
var show = MDateRangeType.toReadableN(assembly, this.props.schema, _Viewer.prototype.getValue.call(this)); // 根据 precision 配置确定移动端 DatePicker 精度(使用扁平化属性 dateRangePrecision)
|
|
22734
22865
|
|
|
22735
|
-
var
|
|
22866
|
+
var mobilePrecision = this.props.schema.dateRangePrecision || 'day';
|
|
22736
22867
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
22737
22868
|
children: [jsxRuntime.jsxs("div", {
|
|
22738
22869
|
className: "backfill",
|
|
22739
22870
|
onClick: function onClick() {
|
|
22740
22871
|
return _this2.setState({
|
|
22741
|
-
mobileDlg: true
|
|
22872
|
+
mobileDlg: true,
|
|
22873
|
+
mobileStep: 'start'
|
|
22742
22874
|
});
|
|
22743
22875
|
},
|
|
22744
22876
|
children: [" ", show != null ? show : '请点击选择', " "]
|
|
22745
|
-
}), jsxRuntime.jsx(antdMobile.
|
|
22746
|
-
visible: this.state.mobileDlg,
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22877
|
+
}), jsxRuntime.jsx(antdMobile.DatePicker, {
|
|
22878
|
+
visible: this.state.mobileDlg && this.state.mobileStep === 'start',
|
|
22879
|
+
precision: mobilePrecision,
|
|
22880
|
+
title: "\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
22881
|
+
min: this.props.schema.min ? new Date(this.props.schema.min) : undefined,
|
|
22882
|
+
max: this.props.schema.max ? new Date(this.props.schema.max) : undefined,
|
|
22883
|
+
onConfirm: function onConfirm(val) {
|
|
22884
|
+
_this2._startConfirmed = true;
|
|
22885
|
+
|
|
22886
|
+
_this2.setState({
|
|
22887
|
+
mobileStartDate: val,
|
|
22888
|
+
mobileStep: 'end'
|
|
22753
22889
|
});
|
|
22754
22890
|
},
|
|
22755
|
-
|
|
22756
|
-
|
|
22891
|
+
onClose: function onClose() {
|
|
22892
|
+
// antd-mobile v5 确认时会同时触发 onConfirm 和 onClose
|
|
22893
|
+
// 用实例变量同步判断:确认后的 onClose 应忽略,仅用户主动取消时才关闭
|
|
22894
|
+
if (_this2._startConfirmed) {
|
|
22895
|
+
_this2._startConfirmed = false;
|
|
22896
|
+
return;
|
|
22897
|
+
}
|
|
22757
22898
|
|
|
22758
22899
|
_this2.setState({
|
|
22759
22900
|
mobileDlg: false
|
|
22760
22901
|
});
|
|
22761
22902
|
}
|
|
22762
|
-
},
|
|
22903
|
+
}, "start_" + mobilePrecision), jsxRuntime.jsx(antdMobile.DatePicker, {
|
|
22904
|
+
visible: this.state.mobileDlg && this.state.mobileStep === 'end',
|
|
22905
|
+
precision: mobilePrecision,
|
|
22906
|
+
title: "\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
22907
|
+
tillNow: !((_this$props$schema$da3 = this.props.schema.dateRange) != null && _this$props$schema$da3.hideTillNow) && !((_this$props$schema$da4 = this.props.schema.dateRange) != null && _this$props$schema$da4.showTime),
|
|
22908
|
+
min: this.state.mobileStartDate || (this.props.schema.min ? new Date(this.props.schema.min) : undefined),
|
|
22909
|
+
max: this.props.schema.max ? new Date(this.props.schema.max) : undefined,
|
|
22910
|
+
onConfirm: function onConfirm(val) {
|
|
22911
|
+
var startDate = _this2.state.mobileStartDate;
|
|
22912
|
+
|
|
22913
|
+
if (startDate) {
|
|
22914
|
+
var isTillNow = !!val.tillNow;
|
|
22915
|
+
|
|
22916
|
+
if (isTillNow) {
|
|
22917
|
+
// 用户选择了"至今"
|
|
22918
|
+
_Viewer.prototype.changeValueEx.call(_this2, _this2._rangePicker2Data([moment__default["default"](startDate), moment__default["default"]()], true), true, true);
|
|
22919
|
+
} else {
|
|
22920
|
+
// 防御:结束日期不能早于开始日期
|
|
22921
|
+
var finalEnd = val < startDate ? startDate : val;
|
|
22922
|
+
|
|
22923
|
+
_Viewer.prototype.changeValueEx.call(_this2, _this2._rangePicker2Data([moment__default["default"](startDate), moment__default["default"](finalEnd)], false), true, true);
|
|
22924
|
+
}
|
|
22925
|
+
}
|
|
22926
|
+
|
|
22927
|
+
_this2.setState({
|
|
22928
|
+
mobileDlg: false
|
|
22929
|
+
});
|
|
22930
|
+
},
|
|
22931
|
+
onClose: function onClose() {
|
|
22932
|
+
// 回退到第一步,让用户可以重新选择开始日期
|
|
22933
|
+
_this2.setState({
|
|
22934
|
+
mobileStep: 'start'
|
|
22935
|
+
});
|
|
22936
|
+
}
|
|
22937
|
+
}, "end_" + mobilePrecision)]
|
|
22763
22938
|
});
|
|
22764
22939
|
} else {
|
|
22765
|
-
var _this$props$schema$
|
|
22940
|
+
var _this$props$schema$da5, _this$props$schema$da6, _this$props$schema$da7;
|
|
22941
|
+
|
|
22942
|
+
// 根据 precision 配置确定 PC 端 picker 模式和 showTime(使用扁平化属性 dateRangePrecision)
|
|
22943
|
+
var precision = this.props.schema.dateRangePrecision;
|
|
22944
|
+
var pcShowTime = precision === 'minute' || ((_this$props$schema$da5 = this.props.schema.dateRange) == null ? void 0 : _this$props$schema$da5.showTime);
|
|
22945
|
+
var hideFooter = ((_this$props$schema$da6 = this.props.schema.dateRange) == null ? void 0 : _this$props$schema$da6.hideTillNow) || pcShowTime; // 动态构建额外属性,避免 showTime 和 picker 同时传入导致类型冲突
|
|
22946
|
+
|
|
22947
|
+
var extraProps = {};
|
|
22766
22948
|
|
|
22767
|
-
|
|
22768
|
-
|
|
22949
|
+
if (precision === 'year') {
|
|
22950
|
+
extraProps.picker = 'year';
|
|
22951
|
+
} else if (precision === 'month') {
|
|
22952
|
+
extraProps.picker = 'month';
|
|
22953
|
+
} else if (pcShowTime) {
|
|
22954
|
+
extraProps.showTime = true;
|
|
22955
|
+
} // 构造元素
|
|
22956
|
+
|
|
22957
|
+
|
|
22958
|
+
return jsxRuntime.jsx(antd.DatePicker.RangePicker, _objectSpread$8({
|
|
22769
22959
|
ref: this._pickerRef,
|
|
22770
|
-
|
|
22771
|
-
|
|
22772
|
-
? undefined : function (mode) {
|
|
22773
|
-
return jsxRuntime.jsx("div", _objectSpread$8(_objectSpread$8({
|
|
22960
|
+
renderExtraFooter: hideFooter ? undefined : function (mode) {
|
|
22961
|
+
return jsxRuntime.jsx("div", {
|
|
22774
22962
|
style: {
|
|
22775
22963
|
textAlign: "right"
|
|
22776
|
-
}
|
|
22777
|
-
|
|
22778
|
-
children: jsxRuntime.jsx(antdMobile.Button, {
|
|
22964
|
+
},
|
|
22965
|
+
children: jsxRuntime.jsx(antd.Button, {
|
|
22779
22966
|
size: "small",
|
|
22780
22967
|
style: {
|
|
22781
22968
|
width: "100px",
|
|
@@ -22787,13 +22974,13 @@ var ARangePicker = /*#__PURE__*/function (_Viewer) {
|
|
|
22787
22974
|
},
|
|
22788
22975
|
children: "\u81F3\u4ECA"
|
|
22789
22976
|
})
|
|
22790
|
-
})
|
|
22977
|
+
});
|
|
22791
22978
|
},
|
|
22792
22979
|
bordered: this.props.hideBorder ? false : true,
|
|
22793
22980
|
style: {
|
|
22794
|
-
|
|
22981
|
+
width: "300px"
|
|
22795
22982
|
},
|
|
22796
|
-
locale: zhCN__default["default"],
|
|
22983
|
+
locale: zhCN__default$1["default"],
|
|
22797
22984
|
defaultValue: rangePickerData,
|
|
22798
22985
|
onCalendarChange: function onCalendarChange(d) {
|
|
22799
22986
|
_this2._onCalendarChangeValue = d;
|
|
@@ -22801,7 +22988,7 @@ var ARangePicker = /*#__PURE__*/function (_Viewer) {
|
|
|
22801
22988
|
onChange: function onChange(vv) {
|
|
22802
22989
|
_Viewer.prototype.changeValueEx.call(_this2, _this2._rangePicker2Data(vv, false), true, true);
|
|
22803
22990
|
}
|
|
22804
|
-
}, this.state.ctrlVersion);
|
|
22991
|
+
}, extraProps), this.state.ctrlVersion + "_" + ((_this$props$schema$da7 = this.props.schema.dateRangePrecision) != null ? _this$props$schema$da7 : 'day'));
|
|
22805
22992
|
}
|
|
22806
22993
|
};
|
|
22807
22994
|
|
|
@@ -23866,7 +24053,50 @@ var ACascadePicker = /*#__PURE__*/function (_BaseViewer) {
|
|
|
23866
24053
|
var p = (_this$props$schema$pr = this.props.schema.props) != null ? _this$props$schema$pr : {};
|
|
23867
24054
|
|
|
23868
24055
|
if (MUtil.phoneLike()) {
|
|
23869
|
-
|
|
24056
|
+
var _this$state;
|
|
24057
|
+
|
|
24058
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24059
|
+
children: [jsxRuntime.jsx("div", {
|
|
24060
|
+
className: "backfill",
|
|
24061
|
+
onClick: function onClick() {
|
|
24062
|
+
return _this.setState({
|
|
24063
|
+
cascadeVisible: true
|
|
24064
|
+
});
|
|
24065
|
+
},
|
|
24066
|
+
children: show.length > 0 ? show.map(function (item) {
|
|
24067
|
+
return item.label || item.value || item;
|
|
24068
|
+
}).join('-') : '请点击选择'
|
|
24069
|
+
}), jsxRuntime.jsx(antdMobile.CascadePicker, _objectSpread$4({
|
|
24070
|
+
options: candidate,
|
|
24071
|
+
value: show.map(function (item) {
|
|
24072
|
+
return item.value || item;
|
|
24073
|
+
}),
|
|
24074
|
+
visible: (_this$state = this.state) == null ? void 0 : _this$state.cascadeVisible,
|
|
24075
|
+
onConfirm: function onConfirm(v) {
|
|
24076
|
+
var vLabel = [];
|
|
24077
|
+
v.forEach(function (item) {
|
|
24078
|
+
candidate.forEach(function (dataItem) {
|
|
24079
|
+
var findItem = findById(dataItem, item, "label", "value", "children");
|
|
24080
|
+
|
|
24081
|
+
if (findItem !== -1) {
|
|
24082
|
+
vLabel.push(findItem);
|
|
24083
|
+
}
|
|
24084
|
+
});
|
|
24085
|
+
});
|
|
24086
|
+
|
|
24087
|
+
_BaseViewer.prototype.changeValue.call(_this, vLabel);
|
|
24088
|
+
|
|
24089
|
+
_this.setState({
|
|
24090
|
+
cascadeVisible: false
|
|
24091
|
+
});
|
|
24092
|
+
},
|
|
24093
|
+
onClose: function onClose() {
|
|
24094
|
+
_this.setState({
|
|
24095
|
+
cascadeVisible: false
|
|
24096
|
+
});
|
|
24097
|
+
}
|
|
24098
|
+
}, p))]
|
|
24099
|
+
});
|
|
23870
24100
|
} else {
|
|
23871
24101
|
return jsxRuntime.jsx(antd.Cascader, _objectSpread$4({
|
|
23872
24102
|
options: candidate,
|
|
@@ -24514,9 +24744,11 @@ function ensureM3() {
|
|
|
24514
24744
|
}
|
|
24515
24745
|
|
|
24516
24746
|
init = true;
|
|
24747
|
+
moment__default["default"].locale('zh-cn');
|
|
24517
24748
|
assembly.types = ___default["default"].merge(assembly.types, {
|
|
24518
24749
|
enum: MEnumType,
|
|
24519
24750
|
gb2260: MGB2260Type,
|
|
24751
|
+
date: MDateTimeType,
|
|
24520
24752
|
datetime: MDateTimeType,
|
|
24521
24753
|
year: MDateTimeType,
|
|
24522
24754
|
yearMonth: MDateTimeType,
|
|
@@ -24582,6 +24814,7 @@ function ensureM3() {
|
|
|
24582
24814
|
editor: {
|
|
24583
24815
|
enum: "ASelector",
|
|
24584
24816
|
gb2260: "AGB2260",
|
|
24817
|
+
date: "ADatetimePicker",
|
|
24585
24818
|
datetime: "ADatetimePicker",
|
|
24586
24819
|
year: "ADatetimePicker",
|
|
24587
24820
|
yearMonth: "ADatetimePicker",
|
|
@@ -24610,6 +24843,7 @@ function ensureM3() {
|
|
|
24610
24843
|
readable: {
|
|
24611
24844
|
enum: "DivViewer",
|
|
24612
24845
|
gb2260: "DivViewer",
|
|
24846
|
+
date: "DivViewer",
|
|
24613
24847
|
datetime: "DivViewer",
|
|
24614
24848
|
year: "DivViewer",
|
|
24615
24849
|
yearMonth: "DivViewer",
|