cnhis-design-vue 3.1.34-beta.7 → 3.1.34-beta.9

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.
@@ -143,11 +143,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
143
143
  } = props.tableParams;
144
144
  let statusNumber = Number(state.isTree);
145
145
  if ([1, 3].includes(statusNumber)) {
146
- result = {
146
+ result = Object.assign({}, {
147
147
  children: "childrenList",
148
148
  accordion: state.openOnly > 0,
149
149
  reserve: true
150
- };
150
+ }, result);
151
151
  if (isTransform) {
152
152
  Reflect.deleteProperty(result, "children");
153
153
  Object.assign(result, {
@@ -157,14 +157,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
157
157
  });
158
158
  }
159
159
  } else if (statusNumber == 2) {
160
- result = {
160
+ result = Object.assign({}, {
161
161
  lazy: true,
162
162
  reserve: true,
163
163
  children: "childrenList",
164
164
  hasChild: "hasChildren",
165
165
  loadMethod: loadChildrenMethod,
166
166
  accordion: state.openOnly > 0
167
- };
167
+ }, result);
168
168
  }
169
169
  return result;
170
170
  });
@@ -47,6 +47,9 @@ var EditSelect = defineComponent({
47
47
  const setOptions = async () => {
48
48
  if (props.col.options) {
49
49
  state.options = JSON.parse(JSON.stringify(props.col.options));
50
+ if (!state.keyupValue && state.options.length) {
51
+ state.keyupValue = state.options[0].value;
52
+ }
50
53
  } else {
51
54
  `${props.col.columnName}_options`;
52
55
  const obj = {
@@ -90,6 +93,8 @@ var EditSelect = defineComponent({
90
93
  if (state.config.multiple || !["ArrowUp", "ArrowDown"].includes(key))
91
94
  return;
92
95
  let index = state.options.findIndex((item) => item.value === state.keyupValue);
96
+ if (!~index)
97
+ return;
93
98
  const length = state.options.length;
94
99
  if (key === "ArrowUp") {
95
100
  index = index === 0 ? length - 1 : index - 1;
@@ -102,8 +107,7 @@ var EditSelect = defineComponent({
102
107
  }
103
108
  function onBlur() {
104
109
  var _a, _b;
105
- if (!state.keyupValue)
106
- onUpdateValue((_b = (_a = state.options) == null ? void 0 : _a[0]) == null ? void 0 : _b.value);
110
+ onUpdateValue((_b = (_a = state.options) == null ? void 0 : _a[0]) == null ? void 0 : _b.value);
107
111
  }
108
112
  init();
109
113
  return () => createVNode(NSelect, mergeProps({
@@ -2,8 +2,8 @@ import { COMPONENT_NAMESPACE } from '../../shared/global/variable.js';
2
2
  import { safeComponentRegister } from '../../shared/utils/index.js';
3
3
  import script from './src/IhoTable.vue.js';
4
4
  import PluginPresets from './src/plugins/index.js';
5
- import 'vue';
6
5
  import 'lodash-es';
6
+ import 'vue';
7
7
  import './src/constants/index.js';
8
8
  import '../../shared/utils/tapable/SyncHook.js';
9
9
  import '../../shared/utils/tapable/SyncBailHook.js';
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, provide, ref, computed, watch, resolveComponent, openBlock, createElementBlock, unref, createBlock, resolveDynamicComponent, createVNode, mergeProps, createSlots, withCtx, Fragment, renderList, renderSlot } from 'vue';
2
2
  import { uuidGenerator } from '../../../shared/utils/index.js';
3
3
  import { useDebounceFn } from '@vueuse/core';
4
+ import { promiseTimeout } from '@vueuse/shared';
4
5
  import { VxeEventListenerNameList, InjectionIhoTableEmits, InjectionIhoTableUUID, InjectionIhoTableInstance, InjectionIhoTableConfig, InjectionIhoTableFieldList, InjectionIhoTableHandler } from './constants/index.js';
5
6
  import { createTableHooks, applyTableConfigHooks, applyTableFieldHooks, createTableEventHandlers, createDomInsertComponent, createDataTransfer } from './hooks/tapHooks/index.js';
6
7
  import 'lodash-es';
@@ -87,7 +88,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
88
  },
88
89
  { deep: true }
89
90
  );
90
- watch(() => props.tableData, updateTableDataRef);
91
+ watch([() => props.tableData, () => {
92
+ var _a2;
93
+ return (_a2 = props.tableData) == null ? void 0 : _a2.length;
94
+ }], async () => {
95
+ var _a2, _b2;
96
+ if (!((_a2 = configRef.value.treeConfig) == null ? void 0 : _a2.expandAll))
97
+ return;
98
+ await promiseTimeout(11);
99
+ (_b2 = $table.value) == null ? void 0 : _b2.setAllTreeExpand(true);
100
+ });
101
+ watch(() => [...props.tableData], updateTableDataRef);
91
102
  _updateConfigRef();
92
103
  _updateFieldListRef();
93
104
  _updateTableDataRef();
@@ -2,8 +2,8 @@ import { AnyObject, Nullable } from '../../../../../../es/shared/types';
2
2
  import { MaybeRef } from '@vueuse/core';
3
3
  import { Ref } from 'vue';
4
4
  import { VxeTableInstance } from 'vxe-table';
5
- import { IhoTableEventListener } from '../../../../../../es/components/iho-table/src/hooks/tapHooks/useEventHooks';
6
5
  import { IhoTableConfig, IhoTableEmits, IhoTableFieldItem, IhoTableHandler, TableHooks } from '../../../../../../es/components/iho-table/src/types';
6
+ import { IhoTableEventListener } from './useEventHooks';
7
7
  export declare const createTableHooks: () => Readonly<{
8
8
  configHooks: import("../../../../../../es/components/iho-table/src/types").AbstractConfigHooks;
9
9
  fieldHooks: import("../../../../../../es/components/iho-table/src/types").AbstractFieldHooks;
@@ -1,15 +1,15 @@
1
1
  import { arrayed } from '../../../../../shared/utils/index.js';
2
- import { unref, defineComponent } from 'vue';
3
2
  import { cloneDeep, isArray, isFunction } from 'lodash-es';
3
+ import { unref, defineComponent } from 'vue';
4
4
  import { VxeEventListenerNameList } from '../../constants/index.js';
5
+ import { getEventName } from '../../utils/index.js';
6
+ import { useConfigHooks } from './useConfigHooks.js';
5
7
  import { useDataHooks } from './useDataHooks.js';
6
8
  import { useDomInsertHooks } from './useDomInsertHooks.js';
7
9
  import { useEventHooks } from './useEventHooks.js';
8
10
  import { useExposeHooks } from './useExposeHooks.js';
9
- import { useSetupHooks } from './useSetupHooks.js';
10
- import { getEventName } from '../../utils/index.js';
11
- import { useConfigHooks } from './useConfigHooks.js';
12
11
  import { useFieldHooks } from './useFieldHooks.js';
12
+ import { useSetupHooks } from './useSetupHooks.js';
13
13
 
14
14
  const createTableHooks = (() => {
15
15
  let tapHooks = null;
@@ -16,20 +16,22 @@ function defaultConfigPlugin() {
16
16
  showSeq: true,
17
17
  columnConfig: { resizable: true },
18
18
  rowConfig: { height: 36, isHover: true, isCurrent: true, keyField: "theUniqueKey" },
19
- mouseConfig: { selected: true },
20
19
  showOverflow: "tooltip",
21
20
  editConfig: {
22
21
  trigger: "click",
23
22
  mode: "cell",
24
23
  autoClear: false,
25
24
  showIcon: false
26
- },
27
- keyboardConfig: { isArrow: true, isDel: true, isEnter: true, isTab: true, isEdit: true, isChecked: true }
25
+ }
28
26
  },
29
27
  config
30
28
  );
31
29
  if (config.isTree === IHO_TABLE_TREE_TYPE.TRANSFORM_TREE_TYPE) {
32
- result.treeConfig = Object.assign({}, { transform: true }, result.treeConfig);
30
+ result.treeConfig = Object.assign(
31
+ {},
32
+ { transform: true, expandAll: true, lazy: true, reserve: true },
33
+ result.treeConfig
34
+ );
33
35
  }
34
36
  if (IhoTableStatusHelper.isPositive(config.isBatchSelect) || config.selectType) {
35
37
  result.selectType = config.selectType || "checkbox";
@@ -6,6 +6,9 @@ declare const _default: import("vue").DefineComponent<{
6
6
  type: PropType<VxeColumnPropTypes.HeaderSlotParams>;
7
7
  required: true;
8
8
  };
9
+ sortable: {
10
+ type: BooleanConstructor;
11
+ };
9
12
  options: {
10
13
  type: PropType<AnyObject[]>;
11
14
  default: () => never[];
@@ -23,6 +26,9 @@ declare const _default: import("vue").DefineComponent<{
23
26
  type: PropType<VxeColumnPropTypes.HeaderSlotParams>;
24
27
  required: true;
25
28
  };
29
+ sortable: {
30
+ type: BooleanConstructor;
31
+ };
26
32
  options: {
27
33
  type: PropType<AnyObject[]>;
28
34
  default: () => never[];
@@ -62,6 +68,8 @@ declare const _default: import("vue").DefineComponent<{
62
68
  marginTop: string;
63
69
  };
64
70
  }>;
71
+ indeterminate: import("vue").ComputedRef<boolean>;
72
+ checkAll: import("vue").WritableComputedRef<boolean>;
65
73
  containerStyleWithHeight: import("vue").ComputedRef<CSSProperties>;
66
74
  confirmFilter: () => void;
67
75
  sortStatusList: {
@@ -134,6 +142,9 @@ declare const _default: import("vue").DefineComponent<{
134
142
  type: PropType<VxeColumnPropTypes.HeaderSlotParams>;
135
143
  required: true;
136
144
  };
145
+ sortable: {
146
+ type: BooleanConstructor;
147
+ };
137
148
  options: {
138
149
  type: PropType<AnyObject[]>;
139
150
  default: () => never[];
@@ -150,5 +161,6 @@ declare const _default: import("vue").DefineComponent<{
150
161
  "onUpdate:sortStatus"?: ((...args: any[]) => any) | undefined;
151
162
  }, {
152
163
  options: AnyObject[];
164
+ sortable: boolean;
153
165
  }>;
154
166
  export default _default;
@@ -1,16 +1,18 @@
1
- import { defineComponent, inject, ref, onDeactivated, watch, computed, openBlock, createElementBlock, createElementVNode, renderSlot, createVNode, unref, withCtx, createTextVNode, toDisplayString, normalizeClass, Fragment, renderList, normalizeStyle } from 'vue';
1
+ import { defineComponent, inject, ref, onDeactivated, watch, computed, openBlock, createElementBlock, createElementVNode, renderSlot, createVNode, unref, withCtx, createTextVNode, toDisplayString, normalizeClass, createCommentVNode, Fragment, renderList, createBlock, isRef, normalizeStyle } from 'vue';
2
2
  import { widthAppend } from '../../../../../shared/utils/index.js';
3
3
  import { FunnelSharp } from '@vicons/ionicons5';
4
4
  import { useVModel, useVirtualList } from '@vueuse/core';
5
- import { NEllipsis, NPopover, NIcon, NInput, NCheckboxGroup, NCheckbox, NButtonGroup, NButton } from 'naive-ui';
5
+ import { NEllipsis, NPopover, NIcon, NInput, NCheckbox, NCheckboxGroup, NButtonGroup, NButton } from 'naive-ui';
6
6
  import { InjectionIhoTableUUID } from '../../constants/index.js';
7
7
  import _export_sfc from '../../../../../_virtual/plugin-vue_export-helper.js';
8
8
 
9
9
  const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
10
10
  const _hoisted_2 = { style: { "max-width": "calc(100% - 22px)" } };
11
11
  const _hoisted_3 = { class: "iho-table__filterWrapper" };
12
- const _hoisted_4 = ["onClick"];
13
- const _hoisted_5 = { class: "iho-table__filterFooter" };
12
+ const _hoisted_4 = { key: 0 };
13
+ const _hoisted_5 = ["onClick"];
14
+ const _hoisted_6 = { class: "iho-table__filterListItem" };
15
+ const _hoisted_7 = { class: "iho-table__filterFooter" };
14
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
15
17
  __name: "filter",
16
18
  props: {
@@ -18,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
20
  type: Object,
19
21
  required: true
20
22
  },
23
+ sortable: { type: Boolean },
21
24
  options: { type: Array, default: () => [] },
22
25
  checked: { type: Array, required: true },
23
26
  sortStatus: { type: String }
@@ -55,6 +58,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
55
58
  overscan: 3
56
59
  }
57
60
  );
61
+ const indeterminate = computed(() => !!checkedCacheRef.value.length && checkedCacheRef.value.length !== props.options.length);
62
+ const checkAll = computed({
63
+ get() {
64
+ return checkedCacheRef.value.length === props.options.length;
65
+ },
66
+ set: (isCheck) => {
67
+ if (isCheck) {
68
+ checkedCacheRef.value = props.options.map((item) => item.value);
69
+ return;
70
+ }
71
+ checkedCacheRef.value = [];
72
+ }
73
+ });
58
74
  const containerStyleWithHeight = computed(() => {
59
75
  return {
60
76
  ...containerProps.style,
@@ -101,26 +117,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
101
117
  ]),
102
118
  default: withCtx(() => [
103
119
  createElementVNode("section", _hoisted_3, [
104
- (openBlock(), createElementBlock(Fragment, null, renderList(sortStatusList, (item) => {
105
- return createElementVNode("div", {
106
- key: item.status,
107
- class: normalizeClass(["iho-table__filterButton", { "iho-table__filterButton--active": unref(sortStatusRef) === item.status }]),
108
- onClick: ($event) => setSort(item.status)
109
- }, toDisplayString(item.text), 11, _hoisted_4);
110
- }), 64)),
111
- createVNode(unref(NInput), {
120
+ createCommentVNode(' \u5224\u65AD\u662F\u5426\u663E\u793A\u5347\u5E8F\u964D\u5E8F\u6A21\u5757\u7684\u7EC4\u4EF6 v-if="sortable"'),
121
+ __props.sortable ? (openBlock(), createElementBlock("div", _hoisted_4, [
122
+ (openBlock(), createElementBlock(Fragment, null, renderList(sortStatusList, (item) => {
123
+ return createElementVNode("div", {
124
+ key: item.status,
125
+ class: normalizeClass(["iho-table__filterButton", { "iho-table__filterButton--active": unref(sortStatusRef) === item.status }]),
126
+ onClick: ($event) => setSort(item.status)
127
+ }, toDisplayString(item.text), 11, _hoisted_5);
128
+ }), 64))
129
+ ])) : createCommentVNode("v-if", true),
130
+ __props.options.length > 5 ? (openBlock(), createBlock(unref(NInput), {
131
+ key: 1,
112
132
  value: searchFilterText.value,
113
133
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchFilterText.value = $event)
114
- }, null, 8, ["value"]),
134
+ }, null, 8, ["value"])) : createCommentVNode("v-if", true),
135
+ createElementVNode("div", _hoisted_6, [
136
+ createVNode(unref(NCheckbox), {
137
+ label: "\u5168\u9009",
138
+ checked: unref(checkAll),
139
+ "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => isRef(checkAll) ? checkAll.value = $event : null),
140
+ indeterminate: unref(indeterminate)
141
+ }, null, 8, ["checked", "indeterminate"])
142
+ ]),
115
143
  createVNode(unref(NCheckboxGroup), {
116
144
  value: checkedCacheRef.value,
117
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => checkedCacheRef.value = $event)
145
+ "onUpdate:value": _cache[3] || (_cache[3] = ($event) => checkedCacheRef.value = $event)
118
146
  }, {
119
147
  default: withCtx(() => [
120
148
  createElementVNode("section", {
121
149
  ref: unref(containerProps).ref,
122
150
  style: normalizeStyle(unref(containerStyleWithHeight)),
123
- onScroll: _cache[1] || (_cache[1] = (...args) => unref(containerProps).onScroll && unref(containerProps).onScroll(...args)),
151
+ onScroll: _cache[2] || (_cache[2] = (...args) => unref(containerProps).onScroll && unref(containerProps).onScroll(...args)),
124
152
  class: "iho-table__filterListWrapper"
125
153
  }, [
126
154
  createElementVNode("section", {
@@ -142,12 +170,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
142
170
  ]),
143
171
  _: 1
144
172
  }, 8, ["value"]),
145
- createElementVNode("footer", _hoisted_5, [
173
+ createElementVNode("footer", _hoisted_7, [
146
174
  createElementVNode("section", null, toDisplayString(`\u5DF2\u9009\u62E9${checkedCacheRef.value.length}\u9879`), 1),
147
175
  createVNode(unref(NButtonGroup), { size: "tiny" }, {
148
176
  default: withCtx(() => [
149
177
  createVNode(unref(NButton), {
150
- onClick: _cache[3] || (_cache[3] = ($event) => checkedCacheRef.value = [])
178
+ onClick: _cache[4] || (_cache[4] = ($event) => checkedCacheRef.value = [])
151
179
  }, {
152
180
  default: withCtx(() => [
153
181
  createTextVNode("\u6E05\u7A7A")
@@ -125,6 +125,7 @@ function filterPlugin() {
125
125
  const fieldSetting = jsonParse(lowCodeField.fieldSetting || "");
126
126
  if (!isFieldSetting(fieldSetting) || !showFilter(fieldSetting))
127
127
  return;
128
+ const sortable = fieldItem.sortable;
128
129
  fieldItem.sortable = false;
129
130
  let options = (_d = (_c = (_b = fieldSetting.mapping) == null ? void 0 : _b.mappingFiled) == null ? void 0 : _c.map((item) => item.value[0])) != null ? _d : [];
130
131
  if (isCompatibleColumn(lowCodeField)) {
@@ -167,6 +168,7 @@ function filterPlugin() {
167
168
  return createVNode(FilterComponent, {
168
169
  "payload": payload,
169
170
  "options": optionsRef.value,
171
+ "sortable": sortable,
170
172
  "checked": checkedRef.value,
171
173
  "onUpdate:checked": ($event) => checkedRef.value = $event,
172
174
  "sortStatus": sortStatusRef.value,
@@ -19,7 +19,8 @@ function lowCodeFieldAdaptorPlugin() {
19
19
  minWidth: _field.colWidth,
20
20
  sortable: IhoTableStatusHelper.isPositive(_field.isSort),
21
21
  slots: { ..._field.slots, default: _field.slotFn, header: _field.headerSlotFn },
22
- ...pick(_field, ["title", "treeNode", "resizable"])
22
+ title: _field.alias || _field.title,
23
+ ...pick(_field, ["treeNode", "resizable"])
23
24
  };
24
25
  settingObjAdaptor(result, _field, config);
25
26
  return result;
@@ -54,6 +54,7 @@ export declare type LowCodeTableFieldItem = {
54
54
  } & Partial<{
55
55
  id: number | string;
56
56
  title: string;
57
+ alias: string;
57
58
  colWidth: VxeTableDefines.ColumnInfo['width'];
58
59
  settingObj: IhoTableLowCodeField.SettingObj;
59
60
  treeNode: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.34-beta.7",
3
+ "version": "3.1.34-beta.9",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "3c82a0504dac43c4c53ab67a6cdda4038f03303f"
64
+ "gitHead": "26c99554848d060368051db9cc34ea769d67a9a6"
65
65
  }