@ibiz-template/vue3-components 0.7.41-alpha.112 → 0.7.41-alpha.113

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.
Files changed (40) hide show
  1. package/dist/{index-XI8ySm9i.js → index-CkG9L_La.js} +3 -3
  2. package/dist/{index.es-Dsu1bPbQ.js → index.es-BU8Fy5we.js} +1 -1
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/{wang-editor-4OTQfjW9.js → wang-editor-9zdglekK.js} +1 -1
  6. package/dist/{xlsx-util--TUzshNx.js → xlsx-util-DrUAhpzt.js} +1 -1
  7. package/es/editor/check-box-list/checkbox-list-editor.controller.mjs +11 -1
  8. package/es/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.mjs +9 -4
  9. package/es/editor/date-range-select/date-range-select-picker/date-range-select.mjs +4 -4
  10. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.mjs +1 -1
  11. package/es/editor/dropdown-list/ibiz-tree-picker/ibiz-tree-picker.mjs +17 -1
  12. package/es/editor/dropdown-list/ibiz-virtualized-list/ibiz-virtualized-list.mjs +19 -4
  13. package/es/editor/list-box/ibiz-list-box/ibiz-list-box.mjs +24 -7
  14. package/es/editor/list-box/list-box-editor.controller.mjs +11 -0
  15. package/es/editor/list-box/list-box-picker-editor.controller.mjs +11 -0
  16. package/es/editor/radio-button-list/ibiz-radio/ibiz-radio.mjs +7 -0
  17. package/es/editor/radio-button-list/radio-button-list.controller.mjs +11 -1
  18. package/lib/editor/check-box-list/checkbox-list-editor.controller.cjs +11 -1
  19. package/lib/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.cjs +9 -4
  20. package/lib/editor/date-range-select/date-range-select-picker/date-range-select.cjs +4 -4
  21. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.cjs +1 -1
  22. package/lib/editor/dropdown-list/ibiz-tree-picker/ibiz-tree-picker.cjs +17 -1
  23. package/lib/editor/dropdown-list/ibiz-virtualized-list/ibiz-virtualized-list.cjs +19 -4
  24. package/lib/editor/list-box/ibiz-list-box/ibiz-list-box.cjs +24 -7
  25. package/lib/editor/list-box/list-box-editor.controller.cjs +11 -0
  26. package/lib/editor/list-box/list-box-picker-editor.controller.cjs +11 -0
  27. package/lib/editor/radio-button-list/ibiz-radio/ibiz-radio.cjs +7 -0
  28. package/lib/editor/radio-button-list/radio-button-list.controller.cjs +11 -1
  29. package/package.json +4 -4
  30. package/src/editor/check-box-list/checkbox-list-editor.controller.ts +11 -0
  31. package/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.tsx +28 -6
  32. package/src/editor/date-range-select/date-range-select-picker/date-range-select.tsx +8 -5
  33. package/src/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.tsx +3 -1
  34. package/src/editor/dropdown-list/ibiz-tree-picker/ibiz-tree-picker.tsx +28 -1
  35. package/src/editor/dropdown-list/ibiz-virtualized-list/ibiz-virtualized-list.tsx +31 -4
  36. package/src/editor/list-box/ibiz-list-box/ibiz-list-box.tsx +45 -9
  37. package/src/editor/list-box/list-box-editor.controller.ts +11 -0
  38. package/src/editor/list-box/list-box-picker-editor.controller.ts +11 -0
  39. package/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx +13 -0
  40. package/src/editor/radio-button-list/radio-button-list.controller.ts +11 -0
@@ -24,9 +24,14 @@ class CheckBoxListEditorController extends CodeListEditorController {
24
24
  * @type {(number | undefined)}
25
25
  */
26
26
  __publicField(this, "rowNumber");
27
+ /**
28
+ * @description 自动选中第一个
29
+ * @memberof CheckBoxListEditorController
30
+ */
31
+ __publicField(this, "autoSelectFirstOption", false);
27
32
  }
28
33
  async onInit() {
29
- var _a, _b;
34
+ var _a, _b, _c;
30
35
  super.onInit();
31
36
  if (this.model.appCodeListId) {
32
37
  const app = await ibiz.hub.getApp(this.context.srfappid);
@@ -38,6 +43,11 @@ class CheckBoxListEditorController extends CodeListEditorController {
38
43
  if ((_b = this.editorParams) == null ? void 0 : _b.rownumber) {
39
44
  this.rowNumber = Number(this.editorParams.rownumber);
40
45
  }
46
+ if ((_c = this.editorParams) == null ? void 0 : _c.autoselectfirstoption) {
47
+ this.autoSelectFirstOption = this.toBoolean(
48
+ this.editorParams.autoselectfirstoption
49
+ );
50
+ }
41
51
  }
42
52
  }
43
53
 
@@ -55,10 +55,19 @@ const IBizCheckboxList = /* @__PURE__ */ defineComponent({
55
55
  }
56
56
  return false;
57
57
  });
58
+ const valueSeparator = (codeList == null ? void 0 : codeList.valueSeparator) || ",";
58
59
  const items = ref([]);
60
+ const autoSelectFirstOption = () => {
61
+ const item = items.value[0];
62
+ if (!c.autoSelectFirstOption || props.value || !item)
63
+ return;
64
+ const selections = c.allItems ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
65
+ emit("change", c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator), void 0, true);
66
+ };
59
67
  watch(() => props.data, (newVal) => {
60
68
  c.loadCodeList(newVal).then((_codeList) => {
61
69
  items.value = c.handleCodeListAllItems(_codeList);
70
+ autoSelectFirstOption();
62
71
  });
63
72
  }, {
64
73
  immediate: true,
@@ -80,10 +89,6 @@ const IBizCheckboxList = /* @__PURE__ */ defineComponent({
80
89
  items.value = c.handleCodeListAllItems(data);
81
90
  };
82
91
  useCodeListListen(c.model.appCodeListId, c.context.srfappid, fn);
83
- let valueSeparator = ",";
84
- if (codeList && codeList.valueSeparator) {
85
- valueSeparator = codeList.valueSeparator;
86
- }
87
92
  const {
88
93
  useInFocusAndBlur,
89
94
  useInValueChange
@@ -132,8 +132,8 @@ const IBizDateRangeSelect = /* @__PURE__ */ defineComponent({
132
132
  "onUpdate:modelValue": ($event) => unitValue.value = $event,
133
133
  "onChange": unitChange,
134
134
  "class": ns.em("date-unit", "editor-select"),
135
- "popper-class": [ns.b("popper"), semanticClass("editor.popup")],
136
- "popper-style": semanticStyle("editor.popup")
135
+ "popper-class": [ns.b("date-unit-popper"), semanticClass("editor.dateUnit.popup")],
136
+ "popper-style": semanticStyle("editor.dateUnit.popup")
137
137
  }, _isSlot(_slot = units.map((item) => {
138
138
  return createVNode(resolveComponent("el-option"), {
139
139
  "class": [ns.em("date-unit", "item"), semanticClass("editor.dateUnit.popup.item", {
@@ -272,8 +272,8 @@ const IBizDateRangeSelect = /* @__PURE__ */ defineComponent({
272
272
  "visible": popVisible.value.ALL || popVisible.value.DYNAMIC || popVisible.value.STATIC,
273
273
  "trigger": "click",
274
274
  "width": "240px",
275
- "popper-class": [ns.b("popper"), ns.b("date-range-select"), semanticClass("editor.popup")],
276
- "popper-style": semanticStyle("editor.popup")
275
+ "popper-class": [ns.b("date-type-popper"), ns.b("date-range-select"), semanticClass("editor.dateType.popup")],
276
+ "popper-style": semanticStyle("editor.dateType.popup")
277
277
  }, {
278
278
  reference: () => {
279
279
  return createVNode("div", {
@@ -149,7 +149,7 @@ const IBizDropdown = /* @__PURE__ */ defineComponent({
149
149
  if (!c.autoSelectFirstOption || props.value || !item)
150
150
  return;
151
151
  if (c.multiple) {
152
- const value = c.allItems && !hasChildren.value ? getSelectionValue(item.value).map((v) => "".concat(v)) : [item.value];
152
+ const value = c.allItems && !hasChildren.value ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
153
153
  emit("change", c.model.valueType === "SIMPLES" ? value : value.join(valueSeparator), void 0, true);
154
154
  } else if (editorItems && editorItems.length > 0) {
155
155
  emit("change", item.value, editorItems[0].id, true);
@@ -1,4 +1,5 @@
1
1
  import { isVNode, defineComponent, createVNode, resolveComponent, withDirectives, resolveDirective, ref, watch, onMounted } from 'vue';
2
+ import { recursiveIterate } from '@ibiz-template/core';
2
3
  import { useNamespace, useSemanticNode, useCodeListListen, getEditorEmits, getDropdownProps } from '@ibiz-template/vue3-util';
3
4
  import { isArray, isString } from 'lodash-es';
4
5
  import './ibiz-tree-picker.css';
@@ -108,6 +109,20 @@ const IBizTreePicker = /* @__PURE__ */ defineComponent({
108
109
  });
109
110
  return list;
110
111
  };
112
+ const autoSelectFirstOption = () => {
113
+ const item = items.value[0];
114
+ if (!c.autoSelectFirstOption || props.value || !item)
115
+ return;
116
+ const selections = [];
117
+ recursiveIterate({
118
+ children: [item]
119
+ }, (_item) => {
120
+ selections.push(_item.value);
121
+ }, {
122
+ childrenFields: ["children"]
123
+ });
124
+ emit("change", c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator), void 0, true);
125
+ };
111
126
  const afterLoadCodeList = (codeList) => {
112
127
  items.value = [];
113
128
  codeListItems.value = [];
@@ -123,6 +138,7 @@ const IBizTreePicker = /* @__PURE__ */ defineComponent({
123
138
  break;
124
139
  }
125
140
  }
141
+ autoSelectFirstOption();
126
142
  };
127
143
  const loadCodeList = async () => {
128
144
  if (c.model.appCodeListId) {
@@ -149,7 +165,7 @@ const IBizTreePicker = /* @__PURE__ */ defineComponent({
149
165
  } else if (isString(newVal)) {
150
166
  val = newVal.split(valueSeparator);
151
167
  }
152
- defaultCheckedKeys.value = val.filter((_key) => codeListItems.value.find((item) => item.value === _key && item.isLeaf));
168
+ defaultCheckedKeys.value = val.filter((_key) => codeListItems.value.find((item) => item.value === _key && !item.children));
153
169
  }
154
170
  }, {
155
171
  immediate: true
@@ -94,6 +94,10 @@ const IBizVirtualizedList = /* @__PURE__ */ defineComponent({
94
94
  const isLoading = ref(false);
95
95
  let editorState = "";
96
96
  const codeItemValueNumber = ref(false);
97
+ const {
98
+ getSelection,
99
+ getSelectionValue
100
+ } = useCodeListSelection(c.allItemsValue);
97
101
  const handleTreeNodes = (nodes) => {
98
102
  if (nodes.length === 0) {
99
103
  return [];
@@ -121,6 +125,20 @@ const IBizVirtualizedList = /* @__PURE__ */ defineComponent({
121
125
  });
122
126
  return list;
123
127
  };
128
+ const autoSelectFirstOption = () => {
129
+ const item = items.value[0];
130
+ if (!c.autoSelectFirstOption || props.value || !item)
131
+ return;
132
+ if (c.multiple) {
133
+ const value = c.allItems && !hasChildren.value ? getSelectionValue(item.value).map((v) => "".concat(v)) : [item.value];
134
+ emit("change", c.model.valueType === "SIMPLES" ? value : value.join(","), void 0, true);
135
+ } else if (editorItems && editorItems.length > 0) {
136
+ emit("change", item.value, editorItems[0].id, true);
137
+ emit("change", item.text, void 0, true);
138
+ } else {
139
+ emit("change", item.value, void 0, true);
140
+ }
141
+ };
124
142
  const afterLoadCodeList = (codeList) => {
125
143
  items.value = [];
126
144
  codeListItems.value = [];
@@ -143,6 +161,7 @@ const IBizVirtualizedList = /* @__PURE__ */ defineComponent({
143
161
  break;
144
162
  }
145
163
  }
164
+ autoSelectFirstOption();
146
165
  };
147
166
  const loadCodeList = async () => {
148
167
  if (c.model.appCodeListId) {
@@ -194,10 +213,6 @@ const IBizVirtualizedList = /* @__PURE__ */ defineComponent({
194
213
  const list = hasChildren.value ? codeListItems.value : items.value;
195
214
  return list.find((item) => item.value === value);
196
215
  };
197
- const {
198
- getSelection,
199
- getSelectionValue
200
- } = useCodeListSelection(c.allItemsValue);
201
216
  const curValue = computed({
202
217
  get() {
203
218
  var _a, _b, _c;
@@ -64,16 +64,31 @@ const IBizListBox = /* @__PURE__ */ defineComponent({
64
64
  });
65
65
  const codeList = c.codeList;
66
66
  const editorType = editorModel.editorType;
67
+ const valueSeparator = (codeList == null ? void 0 : codeList.valueSeparator) || ",";
67
68
  const items = ref([]);
69
+ const autoSelectFirstOption = () => {
70
+ const item = items.value[0];
71
+ if (!c.autoSelectFirstOption || props.value || !item)
72
+ return;
73
+ let value;
74
+ if (multiple) {
75
+ const selections = c.allItems ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
76
+ value = c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator);
77
+ } else {
78
+ value = item.value;
79
+ }
80
+ emit("change", value, void 0, true);
81
+ };
68
82
  const loadListBoxItems = async () => {
69
83
  if (Object.is("LISTBOX", editorType)) {
70
84
  const controller = c;
71
85
  controller.loadCodeList(props.data).then((_codeList) => {
72
86
  if (multiple) {
73
87
  items.value = controller.handleCodeListAllItems(_codeList);
74
- return;
88
+ } else {
89
+ items.value = _codeList;
75
90
  }
76
- items.value = _codeList;
91
+ autoSelectFirstOption();
77
92
  });
78
93
  } else if (Object.is("LISTBOXPICKUP", editorType)) {
79
94
  const controller = c;
@@ -84,11 +99,17 @@ const IBizListBox = /* @__PURE__ */ defineComponent({
84
99
  value: item[controller.keyName],
85
100
  text: item[controller.textName]
86
101
  }));
102
+ autoSelectFirstOption();
87
103
  }
88
104
  }
89
105
  }
90
106
  };
91
- loadListBoxItems();
107
+ watch(() => props.data, () => {
108
+ loadListBoxItems();
109
+ }, {
110
+ immediate: true,
111
+ deep: true
112
+ });
92
113
  const fn = (data) => {
93
114
  if (data) {
94
115
  if (Object.is("LISTBOX", editorType) && multiple) {
@@ -106,10 +127,6 @@ const IBizListBox = /* @__PURE__ */ defineComponent({
106
127
  return "STR";
107
128
  });
108
129
  const calcOrMode = useCalcOrMode(currentMode.value, c.model.valueType);
109
- let valueSeparator = ",";
110
- if (codeList && codeList.valueSeparator) {
111
- valueSeparator = codeList.valueSeparator;
112
- }
113
130
  const {
114
131
  getSelection,
115
132
  getSelectionValue
@@ -17,13 +17,24 @@ class ListBoxEditorController extends CodeListEditorController {
17
17
  * @Date: 2023-05-24 10:55:50
18
18
  */
19
19
  __publicField(this, "codeList");
20
+ /**
21
+ * @description 自动选中第一个
22
+ * @memberof ListBoxEditorController
23
+ */
24
+ __publicField(this, "autoSelectFirstOption", false);
20
25
  }
21
26
  async onInit() {
27
+ var _a;
22
28
  super.onInit();
23
29
  if (this.model.appCodeListId) {
24
30
  const app = await ibiz.hub.getApp(this.context.srfappid);
25
31
  this.codeList = app.codeList.getCodeList(this.model.appCodeListId);
26
32
  }
33
+ if ((_a = this.editorParams) == null ? void 0 : _a.autoselectfirstoption) {
34
+ this.autoSelectFirstOption = this.toBoolean(
35
+ this.editorParams.autoselectfirstoption
36
+ );
37
+ }
27
38
  }
28
39
  }
29
40
 
@@ -40,9 +40,20 @@ class ListBoxPickerEditorController extends EditorController {
40
40
  * @type {IAcItemProvider}
41
41
  */
42
42
  __publicField(this, "acItemProvider");
43
+ /**
44
+ * @description 自动选中第一个
45
+ * @memberof ListBoxPickerEditorController
46
+ */
47
+ __publicField(this, "autoSelectFirstOption", false);
43
48
  }
44
49
  async onInit() {
50
+ var _a;
45
51
  super.onInit();
52
+ if ((_a = this.editorParams) == null ? void 0 : _a.autoselectfirstoption) {
53
+ this.autoSelectFirstOption = this.toBoolean(
54
+ this.editorParams.autoselectfirstoption
55
+ );
56
+ }
46
57
  if (this.model.editorType === "LISTBOXPICKUP") {
47
58
  if (this.model.appDEDataSetId) {
48
59
  this.interfaceName = this.model.appDEDataSetId;
@@ -71,9 +71,16 @@ const IBizRadio = /* @__PURE__ */ defineComponent({
71
71
  useInValueChange();
72
72
  };
73
73
  const items = ref([]);
74
+ const autoSelectFirstOption = () => {
75
+ const item = items.value[0];
76
+ if (!c.autoSelectFirstOption || props.value || !item)
77
+ return;
78
+ emit("change", item.value, void 0, true);
79
+ };
74
80
  watch(() => props.data, (newVal) => {
75
81
  c.loadCodeList(newVal).then((_codeList) => {
76
82
  items.value = _codeList;
83
+ autoSelectFirstOption();
77
84
  });
78
85
  }, {
79
86
  immediate: true,
@@ -17,9 +17,14 @@ class RadioButtonListEditorController extends CodeListEditorController {
17
17
  * @type {(number | undefined)}
18
18
  */
19
19
  __publicField(this, "rowNumber");
20
+ /**
21
+ * @description 自动选中第一个
22
+ * @memberof RadioButtonListEditorController
23
+ */
24
+ __publicField(this, "autoSelectFirstOption", false);
20
25
  }
21
26
  async onInit() {
22
- var _a, _b;
27
+ var _a, _b, _c;
23
28
  super.onInit();
24
29
  if ((_a = this.editorParams) == null ? void 0 : _a.rowNumber) {
25
30
  this.rowNumber = Number(this.editorParams.rowNumber);
@@ -27,6 +32,11 @@ class RadioButtonListEditorController extends CodeListEditorController {
27
32
  if ((_b = this.editorParams) == null ? void 0 : _b.rownumber) {
28
33
  this.rowNumber = Number(this.editorParams.rownumber);
29
34
  }
35
+ if ((_c = this.editorParams) == null ? void 0 : _c.autoselectfirstoption) {
36
+ this.autoSelectFirstOption = this.toBoolean(
37
+ this.editorParams.autoselectfirstoption
38
+ );
39
+ }
30
40
  }
31
41
  }
32
42
 
@@ -26,9 +26,14 @@ class CheckBoxListEditorController extends runtime.CodeListEditorController {
26
26
  * @type {(number | undefined)}
27
27
  */
28
28
  __publicField(this, "rowNumber");
29
+ /**
30
+ * @description 自动选中第一个
31
+ * @memberof CheckBoxListEditorController
32
+ */
33
+ __publicField(this, "autoSelectFirstOption", false);
29
34
  }
30
35
  async onInit() {
31
- var _a, _b;
36
+ var _a, _b, _c;
32
37
  super.onInit();
33
38
  if (this.model.appCodeListId) {
34
39
  const app = await ibiz.hub.getApp(this.context.srfappid);
@@ -40,6 +45,11 @@ class CheckBoxListEditorController extends runtime.CodeListEditorController {
40
45
  if ((_b = this.editorParams) == null ? void 0 : _b.rownumber) {
41
46
  this.rowNumber = Number(this.editorParams.rownumber);
42
47
  }
48
+ if ((_c = this.editorParams) == null ? void 0 : _c.autoselectfirstoption) {
49
+ this.autoSelectFirstOption = this.toBoolean(
50
+ this.editorParams.autoselectfirstoption
51
+ );
52
+ }
43
53
  }
44
54
  }
45
55
 
@@ -57,10 +57,19 @@ const IBizCheckboxList = /* @__PURE__ */ vue.defineComponent({
57
57
  }
58
58
  return false;
59
59
  });
60
+ const valueSeparator = (codeList == null ? void 0 : codeList.valueSeparator) || ",";
60
61
  const items = vue.ref([]);
62
+ const autoSelectFirstOption = () => {
63
+ const item = items.value[0];
64
+ if (!c.autoSelectFirstOption || props.value || !item)
65
+ return;
66
+ const selections = c.allItems ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
67
+ emit("change", c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator), void 0, true);
68
+ };
61
69
  vue.watch(() => props.data, (newVal) => {
62
70
  c.loadCodeList(newVal).then((_codeList) => {
63
71
  items.value = c.handleCodeListAllItems(_codeList);
72
+ autoSelectFirstOption();
64
73
  });
65
74
  }, {
66
75
  immediate: true,
@@ -82,10 +91,6 @@ const IBizCheckboxList = /* @__PURE__ */ vue.defineComponent({
82
91
  items.value = c.handleCodeListAllItems(data);
83
92
  };
84
93
  vue3Util.useCodeListListen(c.model.appCodeListId, c.context.srfappid, fn);
85
- let valueSeparator = ",";
86
- if (codeList && codeList.valueSeparator) {
87
- valueSeparator = codeList.valueSeparator;
88
- }
89
94
  const {
90
95
  useInFocusAndBlur,
91
96
  useInValueChange
@@ -134,8 +134,8 @@ const IBizDateRangeSelect = /* @__PURE__ */ vue.defineComponent({
134
134
  "onUpdate:modelValue": ($event) => unitValue.value = $event,
135
135
  "onChange": unitChange,
136
136
  "class": ns.em("date-unit", "editor-select"),
137
- "popper-class": [ns.b("popper"), semanticClass("editor.popup")],
138
- "popper-style": semanticStyle("editor.popup")
137
+ "popper-class": [ns.b("date-unit-popper"), semanticClass("editor.dateUnit.popup")],
138
+ "popper-style": semanticStyle("editor.dateUnit.popup")
139
139
  }, _isSlot(_slot = units.map((item) => {
140
140
  return vue.createVNode(vue.resolveComponent("el-option"), {
141
141
  "class": [ns.em("date-unit", "item"), semanticClass("editor.dateUnit.popup.item", {
@@ -274,8 +274,8 @@ const IBizDateRangeSelect = /* @__PURE__ */ vue.defineComponent({
274
274
  "visible": popVisible.value.ALL || popVisible.value.DYNAMIC || popVisible.value.STATIC,
275
275
  "trigger": "click",
276
276
  "width": "240px",
277
- "popper-class": [ns.b("popper"), ns.b("date-range-select"), semanticClass("editor.popup")],
278
- "popper-style": semanticStyle("editor.popup")
277
+ "popper-class": [ns.b("date-type-popper"), ns.b("date-range-select"), semanticClass("editor.dateType.popup")],
278
+ "popper-style": semanticStyle("editor.dateType.popup")
279
279
  }, {
280
280
  reference: () => {
281
281
  return vue.createVNode("div", {
@@ -151,7 +151,7 @@ const IBizDropdown = /* @__PURE__ */ vue.defineComponent({
151
151
  if (!c.autoSelectFirstOption || props.value || !item)
152
152
  return;
153
153
  if (c.multiple) {
154
- const value = c.allItems && !hasChildren.value ? getSelectionValue(item.value).map((v) => "".concat(v)) : [item.value];
154
+ const value = c.allItems && !hasChildren.value ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
155
155
  emit("change", c.model.valueType === "SIMPLES" ? value : value.join(valueSeparator), void 0, true);
156
156
  } else if (editorItems && editorItems.length > 0) {
157
157
  emit("change", item.value, editorItems[0].id, true);
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var vue = require('vue');
4
+ var core = require('@ibiz-template/core');
4
5
  var vue3Util = require('@ibiz-template/vue3-util');
5
6
  var lodashEs = require('lodash-es');
6
7
  require('./ibiz-tree-picker.css');
@@ -110,6 +111,20 @@ const IBizTreePicker = /* @__PURE__ */ vue.defineComponent({
110
111
  });
111
112
  return list;
112
113
  };
114
+ const autoSelectFirstOption = () => {
115
+ const item = items.value[0];
116
+ if (!c.autoSelectFirstOption || props.value || !item)
117
+ return;
118
+ const selections = [];
119
+ core.recursiveIterate({
120
+ children: [item]
121
+ }, (_item) => {
122
+ selections.push(_item.value);
123
+ }, {
124
+ childrenFields: ["children"]
125
+ });
126
+ emit("change", c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator), void 0, true);
127
+ };
113
128
  const afterLoadCodeList = (codeList) => {
114
129
  items.value = [];
115
130
  codeListItems.value = [];
@@ -125,6 +140,7 @@ const IBizTreePicker = /* @__PURE__ */ vue.defineComponent({
125
140
  break;
126
141
  }
127
142
  }
143
+ autoSelectFirstOption();
128
144
  };
129
145
  const loadCodeList = async () => {
130
146
  if (c.model.appCodeListId) {
@@ -151,7 +167,7 @@ const IBizTreePicker = /* @__PURE__ */ vue.defineComponent({
151
167
  } else if (lodashEs.isString(newVal)) {
152
168
  val = newVal.split(valueSeparator);
153
169
  }
154
- defaultCheckedKeys.value = val.filter((_key) => codeListItems.value.find((item) => item.value === _key && item.isLeaf));
170
+ defaultCheckedKeys.value = val.filter((_key) => codeListItems.value.find((item) => item.value === _key && !item.children));
155
171
  }
156
172
  }, {
157
173
  immediate: true
@@ -96,6 +96,10 @@ const IBizVirtualizedList = /* @__PURE__ */ vue.defineComponent({
96
96
  const isLoading = vue.ref(false);
97
97
  let editorState = "";
98
98
  const codeItemValueNumber = vue.ref(false);
99
+ const {
100
+ getSelection,
101
+ getSelectionValue
102
+ } = runtime.useCodeListSelection(c.allItemsValue);
99
103
  const handleTreeNodes = (nodes) => {
100
104
  if (nodes.length === 0) {
101
105
  return [];
@@ -123,6 +127,20 @@ const IBizVirtualizedList = /* @__PURE__ */ vue.defineComponent({
123
127
  });
124
128
  return list;
125
129
  };
130
+ const autoSelectFirstOption = () => {
131
+ const item = items.value[0];
132
+ if (!c.autoSelectFirstOption || props.value || !item)
133
+ return;
134
+ if (c.multiple) {
135
+ const value = c.allItems && !hasChildren.value ? getSelectionValue(item.value).map((v) => "".concat(v)) : [item.value];
136
+ emit("change", c.model.valueType === "SIMPLES" ? value : value.join(","), void 0, true);
137
+ } else if (editorItems && editorItems.length > 0) {
138
+ emit("change", item.value, editorItems[0].id, true);
139
+ emit("change", item.text, void 0, true);
140
+ } else {
141
+ emit("change", item.value, void 0, true);
142
+ }
143
+ };
126
144
  const afterLoadCodeList = (codeList) => {
127
145
  items.value = [];
128
146
  codeListItems.value = [];
@@ -145,6 +163,7 @@ const IBizVirtualizedList = /* @__PURE__ */ vue.defineComponent({
145
163
  break;
146
164
  }
147
165
  }
166
+ autoSelectFirstOption();
148
167
  };
149
168
  const loadCodeList = async () => {
150
169
  if (c.model.appCodeListId) {
@@ -196,10 +215,6 @@ const IBizVirtualizedList = /* @__PURE__ */ vue.defineComponent({
196
215
  const list = hasChildren.value ? codeListItems.value : items.value;
197
216
  return list.find((item) => item.value === value);
198
217
  };
199
- const {
200
- getSelection,
201
- getSelectionValue
202
- } = runtime.useCodeListSelection(c.allItemsValue);
203
218
  const curValue = vue.computed({
204
219
  get() {
205
220
  var _a, _b, _c;
@@ -66,16 +66,31 @@ const IBizListBox = /* @__PURE__ */ vue.defineComponent({
66
66
  });
67
67
  const codeList = c.codeList;
68
68
  const editorType = editorModel.editorType;
69
+ const valueSeparator = (codeList == null ? void 0 : codeList.valueSeparator) || ",";
69
70
  const items = vue.ref([]);
71
+ const autoSelectFirstOption = () => {
72
+ const item = items.value[0];
73
+ if (!c.autoSelectFirstOption || props.value || !item)
74
+ return;
75
+ let value;
76
+ if (multiple) {
77
+ const selections = c.allItems ? items.value.filter((_item) => _item.value !== c.allItemsValue).map((_item) => _item.value) : [item.value];
78
+ value = c.model.valueType === "SIMPLES" ? selections : selections.join(valueSeparator);
79
+ } else {
80
+ value = item.value;
81
+ }
82
+ emit("change", value, void 0, true);
83
+ };
70
84
  const loadListBoxItems = async () => {
71
85
  if (Object.is("LISTBOX", editorType)) {
72
86
  const controller = c;
73
87
  controller.loadCodeList(props.data).then((_codeList) => {
74
88
  if (multiple) {
75
89
  items.value = controller.handleCodeListAllItems(_codeList);
76
- return;
90
+ } else {
91
+ items.value = _codeList;
77
92
  }
78
- items.value = _codeList;
93
+ autoSelectFirstOption();
79
94
  });
80
95
  } else if (Object.is("LISTBOXPICKUP", editorType)) {
81
96
  const controller = c;
@@ -86,11 +101,17 @@ const IBizListBox = /* @__PURE__ */ vue.defineComponent({
86
101
  value: item[controller.keyName],
87
102
  text: item[controller.textName]
88
103
  }));
104
+ autoSelectFirstOption();
89
105
  }
90
106
  }
91
107
  }
92
108
  };
93
- loadListBoxItems();
109
+ vue.watch(() => props.data, () => {
110
+ loadListBoxItems();
111
+ }, {
112
+ immediate: true,
113
+ deep: true
114
+ });
94
115
  const fn = (data) => {
95
116
  if (data) {
96
117
  if (Object.is("LISTBOX", editorType) && multiple) {
@@ -108,10 +129,6 @@ const IBizListBox = /* @__PURE__ */ vue.defineComponent({
108
129
  return "STR";
109
130
  });
110
131
  const calcOrMode = runtime.useCalcOrMode(currentMode.value, c.model.valueType);
111
- let valueSeparator = ",";
112
- if (codeList && codeList.valueSeparator) {
113
- valueSeparator = codeList.valueSeparator;
114
- }
115
132
  const {
116
133
  getSelection,
117
134
  getSelectionValue
@@ -19,13 +19,24 @@ class ListBoxEditorController extends runtime.CodeListEditorController {
19
19
  * @Date: 2023-05-24 10:55:50
20
20
  */
21
21
  __publicField(this, "codeList");
22
+ /**
23
+ * @description 自动选中第一个
24
+ * @memberof ListBoxEditorController
25
+ */
26
+ __publicField(this, "autoSelectFirstOption", false);
22
27
  }
23
28
  async onInit() {
29
+ var _a;
24
30
  super.onInit();
25
31
  if (this.model.appCodeListId) {
26
32
  const app = await ibiz.hub.getApp(this.context.srfappid);
27
33
  this.codeList = app.codeList.getCodeList(this.model.appCodeListId);
28
34
  }
35
+ if ((_a = this.editorParams) == null ? void 0 : _a.autoselectfirstoption) {
36
+ this.autoSelectFirstOption = this.toBoolean(
37
+ this.editorParams.autoselectfirstoption
38
+ );
39
+ }
29
40
  }
30
41
  }
31
42
 
@@ -42,9 +42,20 @@ class ListBoxPickerEditorController extends runtime.EditorController {
42
42
  * @type {IAcItemProvider}
43
43
  */
44
44
  __publicField(this, "acItemProvider");
45
+ /**
46
+ * @description 自动选中第一个
47
+ * @memberof ListBoxPickerEditorController
48
+ */
49
+ __publicField(this, "autoSelectFirstOption", false);
45
50
  }
46
51
  async onInit() {
52
+ var _a;
47
53
  super.onInit();
54
+ if ((_a = this.editorParams) == null ? void 0 : _a.autoselectfirstoption) {
55
+ this.autoSelectFirstOption = this.toBoolean(
56
+ this.editorParams.autoselectfirstoption
57
+ );
58
+ }
48
59
  if (this.model.editorType === "LISTBOXPICKUP") {
49
60
  if (this.model.appDEDataSetId) {
50
61
  this.interfaceName = this.model.appDEDataSetId;
@@ -73,9 +73,16 @@ const IBizRadio = /* @__PURE__ */ vue.defineComponent({
73
73
  useInValueChange();
74
74
  };
75
75
  const items = vue.ref([]);
76
+ const autoSelectFirstOption = () => {
77
+ const item = items.value[0];
78
+ if (!c.autoSelectFirstOption || props.value || !item)
79
+ return;
80
+ emit("change", item.value, void 0, true);
81
+ };
76
82
  vue.watch(() => props.data, (newVal) => {
77
83
  c.loadCodeList(newVal).then((_codeList) => {
78
84
  items.value = _codeList;
85
+ autoSelectFirstOption();
79
86
  });
80
87
  }, {
81
88
  immediate: true,