cnhis-design-vue 3.0.6 → 3.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
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.0.7](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.6...v3.0.7) (2022-05-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * big-table 编辑增加date类型 ([fce033b](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/fce033b338b0ea2ccd4b4496e21a27e44ef8e68b))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 表格编辑初始化不应展示操作项 ([165217d](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/165217d96e076b67f449483cf957b4b211545af8))
16
+
5
17
  ### [3.0.6](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.5...v3.0.6) (2022-05-24)
6
18
 
7
19
 
@@ -1,6 +1,6 @@
1
- import { computed, watch, defineComponent, openBlock, createElementBlock, unref, createCommentVNode, createElementVNode, toDisplayString, ref, createVNode, withCtx, normalizeClass, renderSlot, createTextVNode, mergeProps, reactive, h, resolveComponent, inject, nextTick, createApp, Teleport, provide, onMounted, onUnmounted, getCurrentInstance, onBeforeUnmount, onActivated, onDeactivated, isVNode, useAttrs, normalizeStyle, withDirectives, vShow, Fragment, createBlock } from 'vue';
1
+ import { computed, watch, defineComponent, createVNode, mergeProps, reactive, openBlock, createElementBlock, unref, createCommentVNode, createElementVNode, toDisplayString, ref, withCtx, normalizeClass, renderSlot, createTextVNode, h, resolveComponent, inject, nextTick, createApp, Teleport, provide, onMounted, onUnmounted, getCurrentInstance, onBeforeUnmount, onActivated, onDeactivated, isVNode, useAttrs, normalizeStyle, withDirectives, vShow, Fragment, createBlock } from 'vue';
2
+ import { NInput, NInputNumber, NSelect, NDatePicker, NTooltip, useMessage, NIcon, NPopconfirm, NButton, NInputGroup, NCheckbox, NCheckboxGroup, NSpace, NProgress, NDropdown, NSwitch, NPopover } from 'naive-ui';
2
3
  import { SettingsSharp, CaretDown, CaretForward, CopyOutline, SyncOutline } from '@vicons/ionicons5';
3
- import { NTooltip, NInput, NInputNumber, NSelect, NDatePicker, useMessage, NIcon, NPopconfirm, NButton, NInputGroup, NCheckbox, NCheckboxGroup, NSpace, NProgress, NDropdown, NSwitch, NPopover } from 'naive-ui';
4
4
 
5
5
  const bigTableState = {
6
6
  curAbleCheckedLen: 0,
@@ -13254,6 +13254,162 @@ const useNestTable = (props, state, emit) => {
13254
13254
  };
13255
13255
  };
13256
13256
 
13257
+ var script$6 = defineComponent({
13258
+ name: "EditInput",
13259
+ inheritAttrs: false,
13260
+ components: {
13261
+ NInput,
13262
+ NInputNumber
13263
+ },
13264
+ props: {
13265
+ type: {
13266
+ type: String,
13267
+ default: "input"
13268
+ },
13269
+ col: {
13270
+ type: Object,
13271
+ default: () => ({})
13272
+ },
13273
+ row: {
13274
+ type: Object,
13275
+ default: () => ({})
13276
+ },
13277
+ index: {
13278
+ type: [Number, Object],
13279
+ default: 0
13280
+ }
13281
+ },
13282
+ emits: ["formChange"],
13283
+ setup(props, { attrs, slots, emit }) {
13284
+ const onUpdateValue = (value) => {
13285
+ emit("formChange", {
13286
+ value,
13287
+ row: props.row,
13288
+ column: props.col,
13289
+ index: props.index
13290
+ });
13291
+ };
13292
+ return () => props.type === "input" ? createVNode(NInput, mergeProps(attrs, {
13293
+ "onUpdateValue": onUpdateValue
13294
+ }), null) : createVNode(NInputNumber, mergeProps(attrs, {
13295
+ "onUpdateValue": onUpdateValue
13296
+ }), null);
13297
+ }
13298
+ });
13299
+
13300
+ script$6.__file = "packages/big-table/src/components/edit-form/edit-input.vue";
13301
+
13302
+ var script$5 = defineComponent({
13303
+ name: "EditSelect",
13304
+ inheritAttrs: false,
13305
+ components: {
13306
+ NSelect
13307
+ },
13308
+ props: {
13309
+ col: {
13310
+ type: Object,
13311
+ default: () => ({})
13312
+ },
13313
+ row: {
13314
+ type: Object,
13315
+ default: () => ({})
13316
+ },
13317
+ index: {
13318
+ type: [Number, Object],
13319
+ default: 0
13320
+ }
13321
+ },
13322
+ emits: ["setOptions", "formChange"],
13323
+ setup(props, { attrs, slots, emit }) {
13324
+ const state = reactive({
13325
+ options: []
13326
+ });
13327
+ const setOptions = async () => {
13328
+ if (props.col.options) {
13329
+ state.options = JSON.parse(JSON.stringify(props.col.options));
13330
+ }
13331
+ else {
13332
+ const optionsName = `${props.col.columnName}_options`;
13333
+ state.options = props.row[optionsName] || await props.col.queryOptions();
13334
+ if (!props.row[optionsName]) {
13335
+ emit("setOptions", state.options);
13336
+ }
13337
+ }
13338
+ };
13339
+ setOptions();
13340
+ const onUpdateValue = (value) => {
13341
+ emit("formChange", {
13342
+ value,
13343
+ row: props.row,
13344
+ column: props.col,
13345
+ index: props.index
13346
+ });
13347
+ };
13348
+ return () => [createVNode(NSelect, mergeProps(attrs, {
13349
+ "options": state.options,
13350
+ "consistentMenuWidth": false,
13351
+ "clearable": true,
13352
+ "filterable": true,
13353
+ "to": false,
13354
+ "placeholder": "\u8BF7\u9009\u62E9",
13355
+ "onUpdateValue": onUpdateValue
13356
+ }), null)];
13357
+ }
13358
+ });
13359
+
13360
+ script$5.__file = "packages/big-table/src/components/edit-form/edit-select.vue";
13361
+
13362
+ var script$4 = defineComponent({
13363
+ name: "EditDate",
13364
+ inheritAttrs: false,
13365
+ components: {
13366
+ NDatePicker
13367
+ },
13368
+ props: {
13369
+ col: {
13370
+ type: Object,
13371
+ default: () => ({})
13372
+ },
13373
+ row: {
13374
+ type: Object,
13375
+ default: () => ({})
13376
+ },
13377
+ index: {
13378
+ type: [Number, Object],
13379
+ default: 0
13380
+ }
13381
+ },
13382
+ emits: ["formChange"],
13383
+ setup(props, { attrs, slots, emit }) {
13384
+ const onConfirm = (value) => {
13385
+ emit("formChange", {
13386
+ value,
13387
+ row: props.row,
13388
+ column: props.col,
13389
+ index: props.index
13390
+ });
13391
+ };
13392
+ const config = {
13393
+ type: props.col.type || "datetime",
13394
+ clearable: props.col.clearable || true,
13395
+ disabled: props.col.disabled || false,
13396
+ valueFormat: props.col.valueFormat || "yyyy-MM-dd HH:mm:ss",
13397
+ to: false
13398
+ };
13399
+ return () => createVNode(NDatePicker, mergeProps(attrs, config, {
13400
+ "onUpdateFormattedValue": onConfirm
13401
+ }), null);
13402
+ }
13403
+ });
13404
+
13405
+ script$4.__file = "packages/big-table/src/components/edit-form/edit-date.vue";
13406
+
13407
+ const comps = {
13408
+ "input": script$6,
13409
+ "number": script$6,
13410
+ "select": script$5,
13411
+ "date": script$4
13412
+ };
13257
13413
  const useEdit = (props, state, emit, xGrid) => {
13258
13414
  const initEditTable = async () => {
13259
13415
  const { isEdit, fieldList = [] } = props.columnConfig;
@@ -13310,6 +13466,7 @@ const useEdit = (props, state, emit, xGrid) => {
13310
13466
  xGrid.value.clearActived();
13311
13467
  };
13312
13468
  const onFormChange = ({ value, row, column }) => {
13469
+ row[column.columnName] = value;
13313
13470
  emit("formChange", { value, row, column });
13314
13471
  };
13315
13472
  const getDefaultValue = (params, item) => {
@@ -13346,7 +13503,7 @@ var img$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAADKCAYAAABDnT56A
13346
13503
  const _hoisted_1$3 = { class: "no-data-tip NoData-page" };
13347
13504
  const _hoisted_2$2 = ["src"];
13348
13505
  const _hoisted_3$1 = { key: 1 };
13349
- var script$6 = /* @__PURE__ */ defineComponent({
13506
+ var script$3 = /* @__PURE__ */ defineComponent({
13350
13507
  props: {
13351
13508
  noDataTip: {
13352
13509
  type: String,
@@ -13407,14 +13564,14 @@ var script$6 = /* @__PURE__ */ defineComponent({
13407
13564
  }
13408
13565
  });
13409
13566
 
13410
- script$6.__scopeId = "data-v-4a4b0812";
13411
- script$6.__file = "packages/big-table/src/components/NoData.vue";
13567
+ script$3.__scopeId = "data-v-4a4b0812";
13568
+ script$3.__file = "packages/big-table/src/components/NoData.vue";
13412
13569
 
13413
13570
  const _hoisted_1$2 = { class: "text-over-tooltip-components" };
13414
13571
  const __default__$2 = {
13415
13572
  name: "TextOverTooltip"
13416
13573
  };
13417
- var script$5 = /* @__PURE__ */ defineComponent({
13574
+ var script$2 = /* @__PURE__ */ defineComponent({
13418
13575
  ...__default__$2,
13419
13576
  props: {
13420
13577
  content: { type: [String, Number], required: false },
@@ -13482,15 +13639,15 @@ var script$5 = /* @__PURE__ */ defineComponent({
13482
13639
  }
13483
13640
  });
13484
13641
 
13485
- script$5.__scopeId = "data-v-6633a934";
13486
- script$5.__file = "packages/big-table/src/components/TextOverTooltip.vue";
13642
+ script$2.__scopeId = "data-v-6633a934";
13643
+ script$2.__file = "packages/big-table/src/components/TextOverTooltip.vue";
13487
13644
 
13488
13645
  const _hoisted_1$1 = { key: 0 };
13489
13646
  const _hoisted_2$1 = ["xlink:href"];
13490
13647
  const __default__$1 = {
13491
13648
  name: "SvgIcon"
13492
13649
  };
13493
- var script$4 = /* @__PURE__ */ defineComponent({
13650
+ var script$1 = /* @__PURE__ */ defineComponent({
13494
13651
  ...__default__$1,
13495
13652
  props: {
13496
13653
  iconClass: { type: String, required: true, default: "" },
@@ -13520,159 +13677,8 @@ var script$4 = /* @__PURE__ */ defineComponent({
13520
13677
  }
13521
13678
  });
13522
13679
 
13523
- script$4.__scopeId = "data-v-d1ad5be8";
13524
- script$4.__file = "src/component/svg/index.vue";
13525
-
13526
- var script$3 = defineComponent({
13527
- name: "EditInput",
13528
- inheritAttrs: false,
13529
- components: {
13530
- NInput,
13531
- NInputNumber
13532
- },
13533
- props: {
13534
- type: {
13535
- type: String,
13536
- default: "input"
13537
- },
13538
- col: {
13539
- type: Object,
13540
- default: () => ({})
13541
- },
13542
- row: {
13543
- type: Object,
13544
- default: () => ({})
13545
- },
13546
- index: {
13547
- type: [Number, Object],
13548
- default: 0
13549
- }
13550
- },
13551
- emits: ["formChange"],
13552
- setup(props, { attrs, slots, emit }) {
13553
- const onUpdateValue = (value) => {
13554
- emit("formChange", {
13555
- value,
13556
- row: props.row,
13557
- column: props.col,
13558
- index: props.index
13559
- });
13560
- };
13561
- return () => props.type === "input" ? createVNode(NInput, mergeProps(attrs, {
13562
- "onUpdateValue": onUpdateValue
13563
- }), null) : createVNode(NInputNumber, mergeProps(attrs, {
13564
- "onUpdateValue": onUpdateValue
13565
- }), null);
13566
- }
13567
- });
13568
-
13569
- script$3.__file = "packages/big-table/src/components/edit-form/edit-input.vue";
13570
-
13571
- var script$2 = defineComponent({
13572
- name: "EditSelect",
13573
- inheritAttrs: false,
13574
- components: {
13575
- NSelect
13576
- },
13577
- props: {
13578
- col: {
13579
- type: Object,
13580
- default: () => ({})
13581
- },
13582
- row: {
13583
- type: Object,
13584
- default: () => ({})
13585
- },
13586
- index: {
13587
- type: [Number, Object],
13588
- default: 0
13589
- }
13590
- },
13591
- emits: ["setOptions", "formChange"],
13592
- setup(props, { attrs, slots, emit }) {
13593
- const state = reactive({
13594
- options: []
13595
- });
13596
- const setOptions = async () => {
13597
- if (props.col.options) {
13598
- state.options = JSON.parse(JSON.stringify(props.col.options));
13599
- }
13600
- else {
13601
- const optionsName = `${props.col.columnName}_options`;
13602
- state.options = props.row[optionsName] || await props.col.queryOptions();
13603
- if (!props.row[optionsName]) {
13604
- emit("setOptions", state.options);
13605
- }
13606
- }
13607
- };
13608
- setOptions();
13609
- const onUpdateValue = (value) => {
13610
- emit("formChange", {
13611
- value,
13612
- row: props.row,
13613
- column: props.col,
13614
- index: props.index
13615
- });
13616
- };
13617
- return () => [createVNode(NSelect, mergeProps(attrs, {
13618
- "options": state.options,
13619
- "consistentMenuWidth": false,
13620
- "clearable": true,
13621
- "filterable": true,
13622
- "to": false,
13623
- "placeholder": "\u8BF7\u9009\u62E9",
13624
- "onUpdateValue": onUpdateValue
13625
- }), null)];
13626
- }
13627
- });
13628
-
13629
- script$2.__file = "packages/big-table/src/components/edit-form/edit-select.vue";
13630
-
13631
- var script$1 = defineComponent({
13632
- name: "EditDate",
13633
- inheritAttrs: false,
13634
- components: {
13635
- NDatePicker
13636
- },
13637
- props: {
13638
- col: {
13639
- type: Object,
13640
- default: () => ({})
13641
- },
13642
- row: {
13643
- type: Object,
13644
- default: () => ({})
13645
- },
13646
- index: {
13647
- type: [Number, Object],
13648
- default: 0
13649
- }
13650
- },
13651
- emits: ["formChange"],
13652
- setup(props, { attrs, slots, emit }) {
13653
- const onConfirm = (value, formattedValue) => {
13654
- console.log("\u65F6\u95F4\u9009\u62E9->", value);
13655
- emit("formChange", {
13656
- value,
13657
- row: props.row,
13658
- column: props.col,
13659
- index: props.index
13660
- });
13661
- };
13662
- const config = {
13663
- type: props.col.type || "datetime",
13664
- clearable: props.col.clearable || true,
13665
- disabled: props.col.disabled || false,
13666
- valueFormat: props.col.valueFormat || "yyyy-MM-dd HH:mm:ss",
13667
- to: false
13668
- };
13669
- return () => createVNode(NDatePicker, mergeProps(attrs, config, {
13670
- "onConfirm": onConfirm
13671
- }), null);
13672
- }
13673
- });
13674
-
13675
- script$1.__file = "packages/big-table/src/components/edit-form/edit-date.vue";
13680
+ script$1.__scopeId = "data-v-d1ad5be8";
13681
+ script$1.__file = "src/component/svg/index.vue";
13676
13682
 
13677
13683
  var iconPrefix = 'vxe-icon--';
13678
13684
  var GlobalConfig = {
@@ -39841,37 +39847,31 @@ var script = /* @__PURE__ */ defineComponent({
39841
39847
  const formatterEdit = (params, col) => {
39842
39848
  let { row, column, $rowIndex, rowIndex } = params;
39843
39849
  let formType = column.formType || col.formType || "";
39850
+ if (!formType)
39851
+ return null;
39844
39852
  if (formType === "custom") {
39845
39853
  return col.slotFn(params);
39846
39854
  }
39855
+ const Comp = comps[formType] || "";
39856
+ if (!Comp)
39857
+ return null;
39847
39858
  const propsData = {
39848
39859
  col,
39849
39860
  row,
39850
- index: $rowIndex
39861
+ index: $rowIndex,
39862
+ type: formType,
39863
+ onFormChange
39851
39864
  };
39852
- if (formType === "input" || formType === "number") {
39853
- return createVNode(script$3, mergeProps(propsData, {
39854
- "type": formType,
39855
- "value": row[col.columnName],
39856
- "onUpdate:value": ($event) => row[col.columnName] = $event,
39857
- "onFormChange": onFormChange
39858
- }), null);
39865
+ if (formType === "date") {
39866
+ propsData.defaultFormattedValue = row[col.columnName];
39859
39867
  }
39860
- if (formType === "select") {
39861
- return createVNode(script$2, mergeProps(propsData, {
39862
- "value": row[col.columnName],
39863
- "onUpdate:value": ($event) => row[col.columnName] = $event,
39864
- "onSetOptions": (options) => row[`${col.columnName}_options`] = options,
39865
- "onFormChange": onFormChange
39866
- }), null);
39868
+ else {
39869
+ propsData.defaultValue = row[col.columnName];
39867
39870
  }
39868
- if (formType === "date") {
39869
- return createVNode(script$1, mergeProps(propsData, {
39870
- "formattedValue": row[col.columnName],
39871
- "onUpdate:formattedValue": ($event) => row[col.columnName] = $event,
39872
- "onFormChange": onFormChange
39873
- }), null);
39871
+ if (formType === "select") {
39872
+ propsData.onSetOptions = (options) => row[`${col.columnName}_options`] = options;
39874
39873
  }
39874
+ return createVNode(Comp, propsData, null);
39875
39875
  };
39876
39876
  const getEditBtn = (row, col, index) => {
39877
39877
  return col.tileBtnList?.map((btn) => {
@@ -39967,7 +39967,7 @@ var script = /* @__PURE__ */ defineComponent({
39967
39967
  return getOrCode(row, own, attrType);
39968
39968
  }
39969
39969
  if (column.property === "operatorColumn") {
39970
- if (props.columnConfig.isEdit) {
39970
+ if (props.columnConfig.isEdit && !row.initRow) {
39971
39971
  return getEditBtn(row, col, $rowIndex);
39972
39972
  }
39973
39973
  if (state.showButtonTop != 0 || props.isBatchEditing)
@@ -40252,13 +40252,13 @@ var script = /* @__PURE__ */ defineComponent({
40252
40252
  isAlias = !!tooltipTitle;
40253
40253
  }
40254
40254
  if (type === "format")
40255
- return createVNode(script$5, {
40255
+ return createVNode(script$2, {
40256
40256
  "tooltipTitle": tooltipTitle,
40257
40257
  "content": name,
40258
40258
  "isAlias": isAlias
40259
40259
  }, null);
40260
40260
  return () => {
40261
- return [createVNode(script$5, {
40261
+ return [createVNode(script$2, {
40262
40262
  "tooltipTitle": tooltipTitle,
40263
40263
  "content": name,
40264
40264
  "isAlias": isAlias
@@ -40812,7 +40812,7 @@ var script = /* @__PURE__ */ defineComponent({
40812
40812
  return createVNode(NPopconfirm, {
40813
40813
  "onPositiveClick": () => confirmScanMulti(params)
40814
40814
  }, {
40815
- trigger: () => createVNode(script$4, {
40815
+ trigger: () => createVNode(script$1, {
40816
40816
  "class": "scan-multi-delete",
40817
40817
  "iconClass": "shanchu"
40818
40818
  }, null),
@@ -41025,7 +41025,7 @@ var script = /* @__PURE__ */ defineComponent({
41025
41025
  }, [createVNode("img", {
41026
41026
  "class": "bigTable-qr-img",
41027
41027
  "src": src
41028
- }, null), createVNode("span", null, [createVNode(script$4, {
41028
+ }, null), createVNode("span", null, [createVNode(script$1, {
41029
41029
  "iconClass": "fangda"
41030
41030
  }, null)])])];
41031
41031
  };
@@ -41109,7 +41109,7 @@ var script = /* @__PURE__ */ defineComponent({
41109
41109
  }
41110
41110
  else {
41111
41111
  icon = createVNode(NTooltip, null, {
41112
- trigger: () => createVNode(script$4, {
41112
+ trigger: () => createVNode(script$1, {
41113
41113
  "iconClass": btn.icon,
41114
41114
  "style": {
41115
41115
  marginRight: mr
@@ -41120,7 +41120,7 @@ var script = /* @__PURE__ */ defineComponent({
41120
41120
  }
41121
41121
  }
41122
41122
  else if (btn.iconSetting) {
41123
- icon = createVNode(script$4, {
41123
+ icon = createVNode(script$1, {
41124
41124
  "iconClass": JSON.parse(btn.iconSetting).icon,
41125
41125
  "style": {
41126
41126
  marginRight: mr
@@ -41549,7 +41549,7 @@ var script = /* @__PURE__ */ defineComponent({
41549
41549
  onScroll: handlerScroll,
41550
41550
  onCellMouseenter: handleCellMouseenter
41551
41551
  }, {
41552
- empty: withCtx(() => [unref(state).isShowEmpty ? (openBlock(), createElementBlock("div", _hoisted_9, [createVNode(script$6, {
41552
+ empty: withCtx(() => [unref(state).isShowEmpty ? (openBlock(), createElementBlock("div", _hoisted_9, [createVNode(script$3, {
41553
41553
  "no-data-img": props.emptyItems.noDataImg,
41554
41554
  "no-data-tip": props.emptyItems.noDataTip,
41555
41555
  "show-img": !props.isNestTable