cnhis-design-vue 3.0.7 → 3.1.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.1.0](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.9...v3.1.0) (2022-05-31)
6
+
7
+
8
+ ### Features
9
+
10
+ * 打印格式选择 ([56180bf](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/56180bfde66108455c7ed15870c257c46a88c834))
11
+ * 下拉加映射配置 ([0ea094b](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/0ea094be74e155b2cf37b52df149694118ecf876))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * 解决冲突 ([0ee5bc1](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/0ee5bc10e02148e208eb4da481590d2da9be536c))
17
+
18
+ ### [3.0.9](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.8...v3.0.9) (2022-05-30)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * 不传scrollConfig报错; ([8897413](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/88974131e5eed48f39ebe2955830062b6976f8ec))
24
+
25
+ ### [3.0.8](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.7...v3.0.8) (2022-05-27)
26
+
27
+
28
+ ### Features
29
+
30
+ * 表格按键配置、滚动事件派发、编辑formType事件index、选择行支持默认选中 ([1401d21](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/1401d21dada02da4a6aa82de33f23f206ef97662))
31
+ * 选人组件 ([a21d86e](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/a21d86e638afdd580cc5d0a90094b520a59f1b44))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * 表格MAX_CHECK_SIZE字段代码格式化导致传参失败 ([a22a3b4](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/a22a3b45c2c87be7f575a572549cfcdc407a7a52))
37
+ * 异步加载allow-checking-not-loaded报错 ([d086dc2](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/d086dc2e77cbe4c53e7a796b0cf29a4dad7b4d52))
38
+
5
39
  ### [3.0.7](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.6...v3.0.7) (2022-05-25)
6
40
 
7
41
 
@@ -54,7 +54,7 @@ const bigTableState = {
54
54
 
55
55
  const bigTableProps = {
56
56
  data: { type: Array, default: () => [] },
57
- MAX_CHECK_SIZE: { type: Number, default: 0 },
57
+ maxCheckSize: { type: Number, default: 0 },
58
58
  showFooter: Boolean,
59
59
  sumData: { type: Object, default: () => ({}) },
60
60
  avgData: { type: Object, default: () => ({}) },
@@ -210,7 +210,8 @@ const bigTableEmits = [
210
210
  "selectionChangeLocal",
211
211
  "switchBtnOnChange",
212
212
  "asyncTableChange",
213
- "formChange"
213
+ "formChange",
214
+ "scroll"
214
215
  ];
215
216
 
216
217
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -13345,6 +13346,7 @@ var script$5 = defineComponent({
13345
13346
  index: props.index
13346
13347
  });
13347
13348
  };
13349
+ console.log(attrs);
13348
13350
  return () => [createVNode(NSelect, mergeProps(attrs, {
13349
13351
  "options": state.options,
13350
13352
  "consistentMenuWidth": false,
@@ -13389,13 +13391,47 @@ var script$4 = defineComponent({
13389
13391
  index: props.index
13390
13392
  });
13391
13393
  };
13394
+ const { isStartDate = false, isEndDate = false, connectField } = props.col;
13395
+ const setDateDisabled = (cur, date) => {
13396
+ if (isStartDate && connectField) {
13397
+ return cur > date;
13398
+ }
13399
+ if (isEndDate && connectField) {
13400
+ return cur < date;
13401
+ }
13402
+ return false;
13403
+ };
13404
+ const isDateDisabled = (ts) => {
13405
+ return setDateDisabled(ts, new Date(props.row[connectField]).getTime());
13406
+ };
13407
+ const isTimeDisabled = (ts) => {
13408
+ const date = new Date(props.row[connectField] || ts);
13409
+ const h = date.getHours();
13410
+ const m = date.getMinutes();
13411
+ const s = date.getSeconds();
13412
+ return {
13413
+ isHourDisabled: (hour) => {
13414
+ return setDateDisabled(hour, h);
13415
+ },
13416
+ isMinuteDisabled: (minute) => {
13417
+ return setDateDisabled(minute, m);
13418
+ },
13419
+ isSecondDisabled: (second) => {
13420
+ return setDateDisabled(second, s);
13421
+ }
13422
+ };
13423
+ };
13392
13424
  const config = {
13393
13425
  type: props.col.type || "datetime",
13394
13426
  clearable: props.col.clearable || true,
13395
13427
  disabled: props.col.disabled || false,
13396
13428
  valueFormat: props.col.valueFormat || "yyyy-MM-dd HH:mm:ss",
13397
- to: false
13429
+ to: false,
13430
+ isDateDisabled: props.col.isDateDisabled || isDateDisabled
13398
13431
  };
13432
+ if (config.type.includes("time")) {
13433
+ config.isTimeDisabled = props.col.isTimeDisabled || isTimeDisabled;
13434
+ }
13399
13435
  return () => createVNode(NDatePicker, mergeProps(attrs, config, {
13400
13436
  "onUpdateFormattedValue": onConfirm
13401
13437
  }), null);
@@ -13465,15 +13501,35 @@ const useEdit = (props, state, emit, xGrid) => {
13465
13501
  await xGrid.value.insertAt(record, getInsertRecords.at(-1));
13466
13502
  xGrid.value.clearActived();
13467
13503
  };
13468
- const onFormChange = ({ value, row, column }) => {
13469
- row[column.columnName] = value;
13470
- emit("formChange", { value, row, column });
13504
+ const getLabel = (opts, value) => {
13505
+ return opts.find((opt) => opt.value === value)?.label || "";
13506
+ };
13507
+ const onFormChange = ({ value, row, column, index }) => {
13508
+ let oldValue = row[column.columnName];
13509
+ if ((column?.formType === "input" || column?.formType === "number") && props.columnConfig?.formValidate) {
13510
+ row[column.columnName] = props.columnConfig?.formValidate({ row, column, current: value, old: row[column.columnName] });
13511
+ }
13512
+ else if (column?.formatMap) {
13513
+ oldValue = {
13514
+ label: row[column.formatMap.label],
13515
+ value: row[column.formatMap.value]
13516
+ };
13517
+ row[column.formatMap.label] = getLabel(row[column.columnName + "_options"] || [], value);
13518
+ row[column.formatMap.value] = value;
13519
+ }
13520
+ else {
13521
+ row[column.columnName] = value;
13522
+ }
13523
+ emit("formChange", { value, row, column, index, oldValue });
13471
13524
  };
13472
13525
  const getDefaultValue = (params, item) => {
13473
13526
  const value = params.row[item.columnName];
13474
13527
  if (item.formType === "select") {
13528
+ if (item.formatMap) {
13529
+ return params.row[item.formatMap.label];
13530
+ }
13475
13531
  if (item.options) {
13476
- return item.options.find((v) => v.value === value)?.label || "";
13532
+ return item.options.find((v) => v.value == value)?.label || "";
13477
13533
  }
13478
13534
  if (item.queryOptions) {
13479
13535
  return params.row[`${item.columnName}_options`]?.find((v) => v.value === value)?.label || "";
@@ -39521,7 +39577,7 @@ var script = /* @__PURE__ */ defineComponent({
39521
39577
  });
39522
39578
  const visibleCancelCheckAllBtn = computed(() => {
39523
39579
  let isCurrentPageAllCheck = state.currentPageSelectedLength === state.curAbleCheckedLen;
39524
- let isMaxChecked = currentCheckedKeys.value.length === props.MAX_CHECK_SIZE;
39580
+ let isMaxChecked = currentCheckedKeys.value.length === props.maxCheckSize;
39525
39581
  let isCheckedTotal = currentCheckedKeys.value.length === props.pageVO.total;
39526
39582
  return isMaxChecked || !isCurrentPageAllCheck || isCheckedTotal;
39527
39583
  });
@@ -39847,6 +39903,7 @@ var script = /* @__PURE__ */ defineComponent({
39847
39903
  const formatterEdit = (params, col) => {
39848
39904
  let { row, column, $rowIndex, rowIndex } = params;
39849
39905
  let formType = column.formType || col.formType || "";
39906
+ let formatMap = column.formatMap || col.formatMap || null;
39850
39907
  if (!formType)
39851
39908
  return null;
39852
39909
  if (formType === "custom") {
@@ -39865,6 +39922,9 @@ var script = /* @__PURE__ */ defineComponent({
39865
39922
  if (formType === "date") {
39866
39923
  propsData.defaultFormattedValue = row[col.columnName];
39867
39924
  }
39925
+ else if (formatMap) {
39926
+ propsData.defaultValue = row[formatMap.value];
39927
+ }
39868
39928
  else {
39869
39929
  propsData.defaultValue = row[col.columnName];
39870
39930
  }
@@ -40302,8 +40362,8 @@ var script = /* @__PURE__ */ defineComponent({
40302
40362
  emit("refreshTable");
40303
40363
  };
40304
40364
  const handleCheckAll = () => {
40305
- if (props.pageVO.total > props.MAX_CHECK_SIZE) {
40306
- let text = `\u5F53\u524D\u5217\u8868\u5171${props.pageVO.total}\u6761\u6570\u636E\uFF0C\u4E3A\u4E86\u786E\u4FDD\u7CFB\u7EDF\u5B89\u5168\uFF0C\u53EA\u80FD\u5355\u6B21\u64CD\u4F5C${props.MAX_CHECK_SIZE}\u6761\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u9AD8\u7EA7\u7B5B\u9009\u8FC7\u6EE4\u518D\u6B21\u5C1D\u8BD5`;
40365
+ if (props.pageVO.total > props.maxCheckSize) {
40366
+ let text = `\u5F53\u524D\u5217\u8868\u5171${props.pageVO.total}\u6761\u6570\u636E\uFF0C\u4E3A\u4E86\u786E\u4FDD\u7CFB\u7EDF\u5B89\u5168\uFF0C\u53EA\u80FD\u5355\u6B21\u64CD\u4F5C${props.maxCheckSize}\u6761\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u9AD8\u7EA7\u7B5B\u9009\u8FC7\u6EE4\u518D\u6B21\u5C1D\u8BD5`;
40307
40367
  window.$message.warning(text);
40308
40368
  }
40309
40369
  emit("selectionChangeAll");
@@ -40391,7 +40451,7 @@ var script = /* @__PURE__ */ defineComponent({
40391
40451
  };
40392
40452
  const setChecklist = (list) => {
40393
40453
  return list.map((i) => {
40394
- i["checked"] = false;
40454
+ i["checked"] = i.checked || false;
40395
40455
  if (state.isTree == 2) {
40396
40456
  const treeNodeKey = state.levelLazyLoadSetting.childCountKey;
40397
40457
  const { isTreeOrList = "" } = props.tableParams;
@@ -40681,8 +40741,8 @@ var script = /* @__PURE__ */ defineComponent({
40681
40741
  const addCheckedRows = (rows) => {
40682
40742
  removeCheckedDisabledRows(state);
40683
40743
  let checkedRows = state.checkedRows;
40684
- if (currentCheckedKeys.value.length + rows.length > props.MAX_CHECK_SIZE) {
40685
- window.$message.warning(`\u4E3A\u4E86\u4FDD\u8BC1\u7CFB\u7EDF\u5B89\u5168\uFF0C\u5355\u6B21\u64CD\u4F5C\u6570\u636E\u91CF\u9650\u989D\u4E3A${props.MAX_CHECK_SIZE}\u6761\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u9AD8\u7EA7\u7B5B\u9009\u8FC7\u6EE4\u540E\u518D\u6B21\u5C1D\u8BD5`);
40744
+ if (currentCheckedKeys.value.length + rows.length > props.maxCheckSize) {
40745
+ window.$message.warning(`\u4E3A\u4E86\u4FDD\u8BC1\u7CFB\u7EDF\u5B89\u5168\uFF0C\u5355\u6B21\u64CD\u4F5C\u6570\u636E\u91CF\u9650\u989D\u4E3A${props.maxCheckSize}\u6761\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u9AD8\u7EA7\u7B5B\u9009\u8FC7\u6EE4\u540E\u518D\u6B21\u5C1D\u8BD5`);
40686
40746
  return false;
40687
40747
  }
40688
40748
  let newCheckedRows = rows.filter((row) => {
@@ -40751,10 +40811,21 @@ var script = /* @__PURE__ */ defineComponent({
40751
40811
  emit("setNestTableClickSetting", props.isNestTable);
40752
40812
  emit("showDrawer", theads);
40753
40813
  };
40814
+ let scrollEvent = (params) => {
40815
+ emit("scroll", params);
40816
+ };
40817
+ const initScroll = () => {
40818
+ const { throttle = false, throttleTime = 800, throttleOptions = {} } = props.columnConfig?.scrollConfig || {};
40819
+ if (throttle) {
40820
+ scrollEvent = xeUtils.throttle(scrollEvent, throttleTime, throttleOptions);
40821
+ }
40822
+ };
40823
+ initScroll();
40754
40824
  const handlerScroll = (params) => {
40755
40825
  if (params.isX) {
40756
40826
  hideFilterWrap(state, props);
40757
40827
  }
40828
+ scrollEvent(params);
40758
40829
  };
40759
40830
  const handleCellMouseenter = ({ column, $event }) => {
40760
40831
  if (column.showOverflow === "title") {
@@ -41478,7 +41549,7 @@ var script = /* @__PURE__ */ defineComponent({
41478
41549
  key: 0,
41479
41550
  class: "check-wrap-btn",
41480
41551
  onClick: handleCheckAll
41481
- }, [_ctx.pageVO.total > _ctx.MAX_CHECK_SIZE ? (openBlock(), createElementBlock("span", _hoisted_5, [createCommentVNode(" {{ `\u6700\u5927\u52FE\u9009\u201C${tableName}\u201D ${MAX_CHECK_SIZE}\u6761\u6570\u636E` }} "), createTextVNode(toDisplayString(`\u52FE\u9009\u5168\u90E8\u9875 ${_ctx.MAX_CHECK_SIZE}\u6761\u6570\u636E`), 1)])) : (openBlock(), createElementBlock("span", _hoisted_6, [createCommentVNode(' {{ $t("1.9.598", { name: tableName, total }) }} '), createTextVNode(toDisplayString(`\u52FE\u9009\u5168\u90E8\u9875 ${_ctx.pageVO.total}\u6761\u6570\u636E`), 1)]))])) : (openBlock(), createElementBlock("p", {
41552
+ }, [_ctx.pageVO.total > _ctx.maxCheckSize ? (openBlock(), createElementBlock("span", _hoisted_5, [createCommentVNode(" {{ `\u6700\u5927\u52FE\u9009\u201C${tableName}\u201D ${maxCheckSize}\u6761\u6570\u636E` }} "), createTextVNode(toDisplayString(`\u52FE\u9009\u5168\u90E8\u9875 ${_ctx.maxCheckSize}\u6761\u6570\u636E`), 1)])) : (openBlock(), createElementBlock("span", _hoisted_6, [createCommentVNode(' {{ $t("1.9.598", { name: tableName, total }) }} '), createTextVNode(toDisplayString(`\u52FE\u9009\u5168\u90E8\u9875 ${_ctx.pageVO.total}\u6761\u6570\u636E`), 1)]))])) : (openBlock(), createElementBlock("p", {
41482
41553
  key: 1,
41483
41554
  class: "check-wrap-btn",
41484
41555
  onClick: handleCancelAllCheck
@@ -41540,6 +41611,7 @@ var script = /* @__PURE__ */ defineComponent({
41540
41611
  iconOpen: "iconfont icon-a-xitongtubiaozhediejian",
41541
41612
  iconClose: "iconfont icon-a-xitongtubiaotianjia"
41542
41613
  },
41614
+ "keyboard-config": _ctx.columnConfig.keyboardConfig || {},
41543
41615
  onCellDblclick: rowdblclick,
41544
41616
  onCellClick: handlerClickRow,
41545
41617
  onCheckboxChange: selectionChange,
@@ -41590,7 +41662,7 @@ var script = /* @__PURE__ */ defineComponent({
41590
41662
  }
41591
41663
  })]),
41592
41664
  _: 3
41593
- }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41665
+ }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41594
41666
  class: "refresh",
41595
41667
  onClick: hanldeClickRefresh
41596
41668
  }, [createVNode(unref(NIcon), {