@ibiz-template/vue3-components 0.7.41-alpha.46 → 0.7.41-alpha.48

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 (39) hide show
  1. package/dist/ibiz-markdown-editor-DlU-04L2.js +1 -0
  2. package/dist/index-CyLmf9lT.js +11 -0
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/{wang-editor-CRTv7Ujm.js → wang-editor-DE0C30tE.js} +1 -1
  6. package/dist/{xlsx-util-CqW4WJ9G.js → xlsx-util-DBJB7XtH.js} +1 -1
  7. package/es/control/drbar/drbar.controller.mjs +6 -1
  8. package/es/control/drbar/drbar.mjs +5 -5
  9. package/es/control/drtab/drtab-control.util.mjs +1 -1
  10. package/es/control/drtab/drtab.controller.mjs +6 -1
  11. package/es/control/drtab/drtab.mjs +5 -5
  12. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.mjs +14 -3
  13. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.mjs +2 -2
  14. package/es/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.mjs +6 -0
  15. package/es/editor/code/monaco-editor/monaco-editor.mjs +2 -2
  16. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +10 -6
  17. package/es/util/ai-chat-util/ai-chat-util.mjs +36 -2
  18. package/es/util/app-popover/app-popover-component.css +1 -1
  19. package/es/util/app-popover/app-popover-component.mjs +1 -0
  20. package/es/view-engine/edit-view.engine.mjs +6 -1
  21. package/es/view-engine/opt-view.engine.mjs +6 -1
  22. package/lib/control/drbar/drbar.cjs +4 -4
  23. package/lib/control/drbar/drbar.controller.cjs +6 -1
  24. package/lib/control/drtab/drtab-control.util.cjs +1 -1
  25. package/lib/control/drtab/drtab.cjs +4 -4
  26. package/lib/control/drtab/drtab.controller.cjs +6 -1
  27. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.cjs +2 -2
  28. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.controller.cjs +14 -3
  29. package/lib/control/form/form-detail/form-item/composite-form-item-ex/composite-form-item-ex.state.cjs +6 -0
  30. package/lib/editor/code/monaco-editor/monaco-editor.cjs +2 -2
  31. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +10 -6
  32. package/lib/util/ai-chat-util/ai-chat-util.cjs +36 -2
  33. package/lib/util/app-popover/app-popover-component.cjs +1 -0
  34. package/lib/util/app-popover/app-popover-component.css +1 -1
  35. package/lib/view-engine/edit-view.engine.cjs +6 -1
  36. package/lib/view-engine/opt-view.engine.cjs +6 -1
  37. package/package.json +5 -5
  38. package/dist/ibiz-markdown-editor-C7wR017-.js +0 -1
  39. package/dist/index-DTj1Yy9-.js +0 -11
@@ -1,4 +1,5 @@
1
1
  import { ControlController, Srfuf, calcItemVisibleByCounter, calcItemVisible, calcNavParams, hasSubRoute, CounterService } from '@ibiz-template/runtime';
2
+ import { isNil } from 'ramda';
2
3
 
3
4
  "use strict";
4
5
  var __defProp = Object.defineProperty;
@@ -253,7 +254,11 @@ class DRBarController extends ControlController {
253
254
  const data = event.data[0];
254
255
  this.view.state.srfactiveviewdata = data;
255
256
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
256
- this.view.context.srfreadonly = data.srfreadonly;
257
+ if (data.srfreadonly) {
258
+ this.view.context.srfreadonly = true;
259
+ } else if (isNil(this.view.context.srfreadonly)) {
260
+ this.view.context.srfreadonly = false;
261
+ }
257
262
  }
258
263
  await this.calcDrBarItemsState();
259
264
  this.handleFormChange();
@@ -1,4 +1,4 @@
1
- import { defineComponent, createVNode, resolveComponent, reactive, onUnmounted, watch } from 'vue';
1
+ import { defineComponent, createVNode, resolveComponent, ref, onUnmounted, watch } from 'vue';
2
2
  import { useControlController, useNamespace, getNestedRoutePath, route2routePath } from '@ibiz-template/vue3-util';
3
3
  import { useRouter, useRoute } from 'vue-router';
4
4
  import { DRBarController } from './drbar.controller.mjs';
@@ -63,9 +63,9 @@ const DRBarControl = /* @__PURE__ */ defineComponent({
63
63
  const c = useControlController((...args) => new DRBarController(...args));
64
64
  const ns = useNamespace("control-".concat(c.model.controlType.toLowerCase()));
65
65
  const router = useRouter();
66
- const counterData = reactive({});
66
+ const counterData = ref({});
67
67
  const fn = (counter) => {
68
- Object.assign(counterData, counter);
68
+ counterData.value = counter;
69
69
  };
70
70
  c.evt.on("onCreated", () => {
71
71
  if (c.counter) {
@@ -157,9 +157,9 @@ const DRBarControl = /* @__PURE__ */ defineComponent({
157
157
  default: () => [createVNode(resolveComponent("iBizIcon"), {
158
158
  "class": ns.e("icon"),
159
159
  "icon": item.sysImage
160
- }, null), createVNode("span", null, [item.caption]), item.counterId && counterData[item.counterId] != null && createVNode(resolveComponent("iBizBadge"), {
160
+ }, null), createVNode("span", null, [item.caption]), item.counterId && counterData.value[item.counterId] != null && createVNode(resolveComponent("iBizBadge"), {
161
161
  "class": ns.e("counter"),
162
- "value": counterData[item.counterId],
162
+ "value": counterData.value[item.counterId],
163
163
  "counterMode": item.counterMode
164
164
  }, null)]
165
165
  });
@@ -39,7 +39,7 @@ function useAppDRTab(c, controlRef, counterData) {
39
39
  drTabPages.forEach((tab, index) => {
40
40
  if (!tab.hidden) {
41
41
  const caption = tab.caption || "";
42
- const counterNum = tab.counterId ? counterData[tab.counterId] : void 0;
42
+ const counterNum = tab.counterId ? counterData.value[tab.counterId] : void 0;
43
43
  const fontSize = "var(--".concat(defaultNamespace, "-font-size-regular)");
44
44
  if (counterNum != null && !(!counterNum && counterNum !== 0) && !(tab.counterMode === 1 && counterNum <= 0)) {
45
45
  const counterStyle = {
@@ -1,6 +1,7 @@
1
1
  import { createUUID } from 'qx-util';
2
2
  import { ControlController, calcItemVisibleByCounter, calcItemVisible, Srfuf, hasSubRoute, calcNavParams, CounterService } from '@ibiz-template/runtime';
3
3
  import { getNestedRoutePath } from '@ibiz-template/vue3-util';
4
+ import { isNil } from 'ramda';
4
5
 
5
6
  "use strict";
6
7
  var __defProp = Object.defineProperty;
@@ -270,7 +271,11 @@ class DRTabController extends ControlController {
270
271
  const data = event.data[0];
271
272
  this.view.state.srfactiveviewdata = data;
272
273
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
273
- this.view.context.srfreadonly = data.srfreadonly;
274
+ if (data.srfreadonly) {
275
+ this.view.context.srfreadonly = true;
276
+ } else if (isNil(this.view.context.srfreadonly)) {
277
+ this.view.context.srfreadonly = false;
278
+ }
274
279
  }
275
280
  await this.calcDrTabPagesState();
276
281
  this.handleFormChange();
@@ -1,4 +1,4 @@
1
- import { defineComponent, createVNode, resolveComponent, createTextVNode, ref, reactive, computed, onUnmounted, watch } from 'vue';
1
+ import { defineComponent, createVNode, resolveComponent, createTextVNode, ref, computed, onUnmounted, watch } from 'vue';
2
2
  import { useControlController, useNamespace, getNestedRoutePath, route2routePath } from '@ibiz-template/vue3-util';
3
3
  import { useRouter, useRoute } from 'vue-router';
4
4
  import { hasSubRoute } from '@ibiz-template/runtime';
@@ -55,13 +55,13 @@ const DRTabControl = /* @__PURE__ */ defineComponent({
55
55
  const ns = useNamespace("control-".concat(c.model.controlType.toLowerCase()));
56
56
  const router = useRouter();
57
57
  const controlRef = ref();
58
- const counterData = reactive({});
58
+ const counterData = ref({});
59
59
  const {
60
60
  visibleItems,
61
61
  moreItems
62
62
  } = useAppDRTab(c, controlRef, counterData);
63
63
  const fn = (counter) => {
64
- Object.assign(counterData, counter);
64
+ counterData.value = counter;
65
65
  };
66
66
  const tabPosition = ((_a = c.view.model.tabLayout) == null ? void 0 : _a.toLowerCase()) || "top";
67
67
  c.evt.on("onCreated", () => {
@@ -148,7 +148,7 @@ const DRTabControl = /* @__PURE__ */ defineComponent({
148
148
  }, null), createVNode("div", {
149
149
  "class": "caption"
150
150
  }, [(_b = activeTab.value) == null ? void 0 : _b.caption, ((_c = activeTab.value) == null ? void 0 : _c.counterId) && createVNode(resolveComponent("iBizBadge"), {
151
- "value": counterData[activeTab.value.counterId],
151
+ "value": counterData.value[activeTab.value.counterId],
152
152
  "counterMode": activeTab.value.counterMode
153
153
  }, null)]), createVNode("ion-icon", {
154
154
  "name": "chevron-down-outline"
@@ -169,7 +169,7 @@ const DRTabControl = /* @__PURE__ */ defineComponent({
169
169
  }, null), createVNode("span", {
170
170
  "class": "caption"
171
171
  }, [tab.caption]), tab.counterId && createVNode(resolveComponent("iBizBadge"), {
172
- "value": counterData[tab.counterId],
172
+ "value": counterData.value[tab.counterId],
173
173
  "counterMode": tab.counterMode
174
174
  }, null), tab.tag === c.state.activeName && createVNode("ion-icon", {
175
175
  "name": "checkmark-outline"
@@ -32,7 +32,7 @@ class CompositeFormItemExController extends FormItemController {
32
32
  __publicField(this, "codeListId", "");
33
33
  /**
34
34
  * @description 切换菜单选项
35
- * @type {{ id: string; name: string; icon?: ISysImage, editor?: IData }[]}
35
+ * @type {{ id: string; name: string; icon?: ISysImage, editor?: IData, valueItem?: string }[]}
36
36
  * @memberof CompositeFormItemExController
37
37
  */
38
38
  __publicField(this, "switchOptions", []);
@@ -47,6 +47,16 @@ class CompositeFormItemExController extends FormItemController {
47
47
  var _a;
48
48
  return new CompositeFormItemExState((_a = this.parent) == null ? void 0 : _a.state);
49
49
  }
50
+ get name() {
51
+ return this.state.editorValueItem || this.model.id;
52
+ }
53
+ get value() {
54
+ var _a;
55
+ const option = this.switchOptions.find(
56
+ (item) => item.id === this.state.editorId
57
+ );
58
+ return (_a = this.data) == null ? void 0 : _a[(option == null ? void 0 : option.valueItem) || this.model.id];
59
+ }
50
60
  async onInit() {
51
61
  var _a, _b, _c, _d;
52
62
  await super.onInit();
@@ -71,7 +81,8 @@ class CompositeFormItemExController extends FormItemController {
71
81
  id: item.value,
72
82
  name: item.text,
73
83
  icon: item.sysImage,
74
- editor: item.data
84
+ editor: item.data,
85
+ valueItem: item.userData
75
86
  };
76
87
  });
77
88
  this.defaultType = ((_b = this.switchOptions[0]) == null ? void 0 : _b.id) || "";
@@ -102,6 +113,7 @@ class CompositeFormItemExController extends FormItemController {
102
113
  if (!option) {
103
114
  return;
104
115
  }
116
+ this.state.editorValueItem = option.valueItem || "";
105
117
  const editorModel = {
106
118
  ...this.createEditorModel(),
107
119
  ...option.editor
@@ -147,7 +159,6 @@ class CompositeFormItemExController extends FormItemController {
147
159
  if (!id || id === this.state.editorId) {
148
160
  return;
149
161
  }
150
- this.setDataValue("", this.name);
151
162
  if (this.valueItem && this.valueItem.id) {
152
163
  this.setDataValue(id, this.valueItem.id);
153
164
  }
@@ -23,8 +23,8 @@ const CompositeFormItemEx = /* @__PURE__ */ defineComponent({
23
23
  const ns = useNamespace("form-item");
24
24
  const ns2 = useNamespace("composite-form-item-ex");
25
25
  const c = props.controller;
26
- const onValueChange = (val, name, ignore = false) => {
27
- props.controller.setDataValue(val, name, ignore);
26
+ const onValueChange = (val, _name, ignore = false) => {
27
+ props.controller.setDataValue(val, c.name, ignore);
28
28
  };
29
29
  const loading = ref(true);
30
30
  const editorRef = ref();
@@ -16,6 +16,12 @@ class CompositeFormItemExState extends FormItemState {
16
16
  * @memberof CompositeFormItemExState
17
17
  */
18
18
  __publicField(this, "editorId", "");
19
+ /**
20
+ * @description 当前选中的编辑器值项
21
+ * @type {string}
22
+ * @memberof CompositeFormItemExState
23
+ */
24
+ __publicField(this, "editorValueItem", "");
19
25
  }
20
26
  }
21
27
 
@@ -266,7 +266,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
266
266
  // 不要滚动条的边框
267
267
  });
268
268
  editor.__instanceId = UUID;
269
- if (c.deACMode && ibiz.env.enableAI) {
269
+ if (c.chatCompletion && ibiz.env.enableAI) {
270
270
  codeLensProviderDisposable = loaderMonaco.languages.registerCodeLensProvider(props.language || props.controller.language, {
271
271
  provideCodeLenses: function(model, _token) {
272
272
  if (!validate(model))
@@ -449,7 +449,7 @@ const IBizCode = /* @__PURE__ */ defineComponent({
449
449
  }, null);
450
450
  };
451
451
  const renderTextEditorToolbar = () => {
452
- if (!textTBVisible.value)
452
+ if (!textTBVisible.value || !c.chatCompletion)
453
453
  return null;
454
454
  return createVNode("div", {
455
455
  "ref": "textTBRef",
@@ -15,7 +15,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
15
15
  emit,
16
16
  slots
17
17
  }) {
18
- var _a, _b, _c, _d, _e;
18
+ var _a, _b, _c, _d, _e, _f;
19
19
  const ns = useNamespace("markdown");
20
20
  const c = props.controller;
21
21
  const currentVal = ref("");
@@ -51,8 +51,12 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
51
51
  const lastDirectoryState = ref("pure");
52
52
  let isIgnoreChange = false;
53
53
  let chatInstance;
54
+ let disabledirectory = false;
55
+ if ((_e = c == null ? void 0 : c.editorParams) == null ? void 0 : _e.disabledirectory) {
56
+ disabledirectory = c.editorParams.disabledirectory === "true";
57
+ }
54
58
  let tocPos = "absolute";
55
- if ((_e = c == null ? void 0 : c.editorParams) == null ? void 0 : _e.tocpos) {
59
+ if ((_f = c == null ? void 0 : c.editorParams) == null ? void 0 : _f.tocpos) {
56
60
  tocPos = c.editorParams.tocpos === "fixed" ? "fixed" : "absolute";
57
61
  }
58
62
  const [AIMenu, AIChart] = initCustomMenu(c, {
@@ -274,7 +278,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
274
278
  defaultModel.value = "previewOnly";
275
279
  }
276
280
  nextTick(() => {
277
- var _a2;
281
+ var _a2, _b2, _c2;
278
282
  const bubble = ["bold", "italic", "underline", "strikethrough", "sub", "sup", "|", "size", "color"];
279
283
  const toolbar = ["bold", "italic", "underline", "strikethrough", "|", "color", "header", "|", "list", "image", {
280
284
  insert: ["link", "hr", "br", "code", "formula", "toc", "table", "line-table", "bar-table"]
@@ -328,7 +332,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
328
332
  // 定义顶部右侧工具栏,默认为空
329
333
  toolbarRight: [],
330
334
  // 目录
331
- toc: {
335
+ toc: !disabledirectory && {
332
336
  updateLocationHash: false,
333
337
  // 要不要更新URL的hash
334
338
  defaultModel: "pure",
@@ -361,7 +365,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
361
365
  editor.toggleToc("pure");
362
366
  const html = editor.engine.makeHtml(currentVal.value);
363
367
  editor.previewer.update(html);
364
- editor.toc.updateTocList();
368
+ (_b2 = (_a2 = editor.toc) == null ? void 0 : _a2.updateTocList) == null ? void 0 : _b2.call(_a2);
365
369
  editor.setTheme(theme.value);
366
370
  if (customTheme) {
367
371
  editor.setTheme(customTheme);
@@ -371,7 +375,7 @@ const IBizMarkDown = /* @__PURE__ */ defineComponent({
371
375
  span.title = ibiz.i18n.t("editor.common.fullscreen");
372
376
  span.onclick = onSwitchFullscreen;
373
377
  span.appendChild(createCherryIcon("fullscreen"));
374
- const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_a2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _a2.querySelector(".cherry-toolbar>.toolbar-right");
378
+ const parentElement = props.disabled ? editor.editor.options.editorDom.parentElement : (_c2 = editor.editor.options.editorDom.parentElement) == null ? void 0 : _c2.querySelector(".cherry-toolbar>.toolbar-right");
375
379
  parentElement == null ? void 0 : parentElement.appendChild(span);
376
380
  c == null ? void 0 : c.setMDEditor(editor);
377
381
  onMDEditorCreated(editor);
@@ -101,6 +101,7 @@ class AIChatUtil {
101
101
  chatOptions.sessionid = sessionid;
102
102
  let id = "";
103
103
  let abortController;
104
+ let asyncacitonid = "";
104
105
  const { chatInstance, view, ctrl } = args;
105
106
  chatOptions.history = async (ctx, param, other) => {
106
107
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -174,6 +175,7 @@ class AIChatUtil {
174
175
  await deService.aiChatSse(
175
176
  (msg) => {
176
177
  if (msg.actionstate === 20 && msg.actionresult) {
178
+ asyncacitonid = msg.asyncacitonid;
177
179
  aiChat.addMessage({
178
180
  messageid: id,
179
181
  state: msg.actionstate,
@@ -223,8 +225,23 @@ class AIChatUtil {
223
225
  return true;
224
226
  }
225
227
  };
226
- chatOptions.abortQuestion = async (aiChat) => {
228
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
227
229
  abortController == null ? void 0 : abortController.abort();
230
+ if (asyncacitonid) {
231
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
232
+ const abortRequestData = { asyncacitonid };
233
+ if (other.sessionid) {
234
+ Object.assign(abortRequestData, {
235
+ sessionid: other.sessionid
236
+ });
237
+ }
238
+ const result = await deService.aiChatCancel(
239
+ ctx,
240
+ param,
241
+ abortRequestData
242
+ );
243
+ asyncacitonid = "";
244
+ }
228
245
  await aiChat.stopMessage({
229
246
  messageid: id,
230
247
  state: 30,
@@ -442,6 +459,7 @@ class AIChatUtil {
442
459
  }
443
460
  let id = "";
444
461
  let abortController;
462
+ let asyncacitonid = "";
445
463
  const { chatInstance, view, ctrl } = args;
446
464
  chatOptions.history = async (ctx, param, other) => {
447
465
  const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
@@ -515,6 +533,7 @@ class AIChatUtil {
515
533
  await deService.aiChatSse(
516
534
  (msg) => {
517
535
  if (msg.actionstate === 20 && msg.actionresult) {
536
+ asyncacitonid = msg.asyncacitonid;
518
537
  aiChat.addMessage({
519
538
  messageid: id,
520
539
  state: msg.actionstate,
@@ -564,8 +583,23 @@ class AIChatUtil {
564
583
  return true;
565
584
  }
566
585
  };
567
- chatOptions.abortQuestion = async (aiChat) => {
586
+ chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
568
587
  abortController == null ? void 0 : abortController.abort();
588
+ if (asyncacitonid) {
589
+ const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
590
+ const abortRequestData = { asyncacitonid };
591
+ if (other.sessionid) {
592
+ Object.assign(abortRequestData, {
593
+ sessionid: other.sessionid
594
+ });
595
+ }
596
+ const result = await deService.aiChatCancel(
597
+ ctx,
598
+ param,
599
+ abortRequestData
600
+ );
601
+ asyncacitonid = "";
602
+ }
569
603
  await aiChat.stopMessage({
570
604
  messageid: id,
571
605
  state: 30,
@@ -1 +1 @@
1
- .ibiz-popover{position:absolute;top:0;left:0;z-index:1;display:none;width:-moz-max-content;width:max-content;background-color:var(--ibiz-color-bg-2);border:1px solid var(--ibiz-color-border);border-radius:var(--ibiz-border-radius-medium)}.ibiz-popover__arrow{position:absolute;z-index:-1;width:var(--ibiz-width-icon-extra-small);height:var(--ibiz-width-icon-extra-small);background:var(--ibiz-color-bg-2);transform:rotate(45deg)}.ibiz-popover.is-show{display:block}.ibiz-popover__overlay{position:fixed;inset:0;background-color:transparent}
1
+ .ibiz-popover{position:absolute;top:0;left:0;z-index:1;display:none;width:-moz-max-content;width:max-content;background-color:var(--ibiz-color-bg-2);border:1px solid var(--ibiz-color-border);border-radius:var(--ibiz-border-radius-medium)}.ibiz-popover__arrow{position:absolute;z-index:-1;width:var(--ibiz-width-icon-extra-small);height:var(--ibiz-width-icon-extra-small);background:var(--ibiz-color-bg-2);transform:rotate(45deg)}.ibiz-popover__arrow[data-placement^=top]{border-right:1px solid var(--ibiz-color-border);border-bottom:1px solid var(--ibiz-color-border)}.ibiz-popover__arrow[data-placement^=bottom]{border-top:1px solid var(--ibiz-color-border);border-left:1px solid var(--ibiz-color-border)}.ibiz-popover__arrow[data-placement^=left]{border-top:1px solid var(--ibiz-color-border);border-right:1px solid var(--ibiz-color-border)}.ibiz-popover__arrow[data-placement^=right]{border-bottom:1px solid var(--ibiz-color-border);border-left:1px solid var(--ibiz-color-border)}.ibiz-popover.is-show{display:block}.ibiz-popover__overlay{position:fixed;inset:0;background-color:transparent}
@@ -53,6 +53,7 @@ async function computePos(element, el, arrEl, opts) {
53
53
  bottom: "",
54
54
  [staticSide]: "-4px"
55
55
  });
56
+ arrEl.setAttribute("data-placement", placement);
56
57
  }
57
58
  }
58
59
  }
@@ -1,3 +1,4 @@
1
+ import { isNil } from 'ramda';
1
2
  import { RuntimeError } from '@ibiz-template/core';
2
3
  import { DEMainViewEngine, getControl, getControlsByView, calcDeCodeNameById, SysUIActionTag, ViewCallTag, ControlVO, getAppViewRef, OpenAppViewCommand, calcDynaSysParams, getDeDataMajorField, convertNavData } from '@ibiz-template/runtime';
3
4
 
@@ -121,7 +122,11 @@ class EditViewEngine extends DEMainViewEngine {
121
122
  const data = event.data[0];
122
123
  this.view.state.srfactiveviewdata = data;
123
124
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
124
- this.view.context.srfreadonly = data.srfreadonly;
125
+ if (data.srfreadonly) {
126
+ this.view.context.srfreadonly = true;
127
+ } else if (isNil(this.view.context.srfreadonly)) {
128
+ this.view.context.srfreadonly = false;
129
+ }
125
130
  }
126
131
  evt.emit("onDataChange", { ...event, actionType: "LOAD" });
127
132
  });
@@ -1,4 +1,5 @@
1
1
  import { ViewEngineBase, getControl, getControlsByView, SysUIActionTag, ViewCallTag } from '@ibiz-template/runtime';
2
+ import { isNil } from 'ramda';
2
3
 
3
4
  "use strict";
4
5
  class OptViewEngine extends ViewEngineBase {
@@ -77,7 +78,11 @@ class OptViewEngine extends ViewEngineBase {
77
78
  const data = event.data[0];
78
79
  this.view.state.srfactiveviewdata = data;
79
80
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
80
- this.view.context.srfreadonly = data.srfreadonly;
81
+ if (data.srfreadonly) {
82
+ this.view.context.srfreadonly = true;
83
+ } else if (isNil(this.view.context.srfreadonly)) {
84
+ this.view.context.srfreadonly = false;
85
+ }
81
86
  }
82
87
  formDataStateChange(event);
83
88
  });
@@ -65,9 +65,9 @@ const DRBarControl = /* @__PURE__ */ vue.defineComponent({
65
65
  const c = vue3Util.useControlController((...args) => new drbar_controller.DRBarController(...args));
66
66
  const ns = vue3Util.useNamespace("control-".concat(c.model.controlType.toLowerCase()));
67
67
  const router = vueRouter.useRouter();
68
- const counterData = vue.reactive({});
68
+ const counterData = vue.ref({});
69
69
  const fn = (counter) => {
70
- Object.assign(counterData, counter);
70
+ counterData.value = counter;
71
71
  };
72
72
  c.evt.on("onCreated", () => {
73
73
  if (c.counter) {
@@ -159,9 +159,9 @@ const DRBarControl = /* @__PURE__ */ vue.defineComponent({
159
159
  default: () => [vue.createVNode(vue.resolveComponent("iBizIcon"), {
160
160
  "class": ns.e("icon"),
161
161
  "icon": item.sysImage
162
- }, null), vue.createVNode("span", null, [item.caption]), item.counterId && counterData[item.counterId] != null && vue.createVNode(vue.resolveComponent("iBizBadge"), {
162
+ }, null), vue.createVNode("span", null, [item.caption]), item.counterId && counterData.value[item.counterId] != null && vue.createVNode(vue.resolveComponent("iBizBadge"), {
163
163
  "class": ns.e("counter"),
164
- "value": counterData[item.counterId],
164
+ "value": counterData.value[item.counterId],
165
165
  "counterMode": item.counterMode
166
166
  }, null)]
167
167
  });
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('@ibiz-template/runtime');
4
+ var ramda = require('ramda');
4
5
 
5
6
  "use strict";
6
7
  var __defProp = Object.defineProperty;
@@ -255,7 +256,11 @@ class DRBarController extends runtime.ControlController {
255
256
  const data = event.data[0];
256
257
  this.view.state.srfactiveviewdata = data;
257
258
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
258
- this.view.context.srfreadonly = data.srfreadonly;
259
+ if (data.srfreadonly) {
260
+ this.view.context.srfreadonly = true;
261
+ } else if (ramda.isNil(this.view.context.srfreadonly)) {
262
+ this.view.context.srfreadonly = false;
263
+ }
259
264
  }
260
265
  await this.calcDrBarItemsState();
261
266
  this.handleFormChange();
@@ -41,7 +41,7 @@ function useAppDRTab(c, controlRef, counterData) {
41
41
  drTabPages.forEach((tab, index) => {
42
42
  if (!tab.hidden) {
43
43
  const caption = tab.caption || "";
44
- const counterNum = tab.counterId ? counterData[tab.counterId] : void 0;
44
+ const counterNum = tab.counterId ? counterData.value[tab.counterId] : void 0;
45
45
  const fontSize = "var(--".concat(namespace.defaultNamespace, "-font-size-regular)");
46
46
  if (counterNum != null && !(!counterNum && counterNum !== 0) && !(tab.counterMode === 1 && counterNum <= 0)) {
47
47
  const counterStyle = {
@@ -57,13 +57,13 @@ const DRTabControl = /* @__PURE__ */ vue.defineComponent({
57
57
  const ns = vue3Util.useNamespace("control-".concat(c.model.controlType.toLowerCase()));
58
58
  const router = vueRouter.useRouter();
59
59
  const controlRef = vue.ref();
60
- const counterData = vue.reactive({});
60
+ const counterData = vue.ref({});
61
61
  const {
62
62
  visibleItems,
63
63
  moreItems
64
64
  } = drtabControl_util.useAppDRTab(c, controlRef, counterData);
65
65
  const fn = (counter) => {
66
- Object.assign(counterData, counter);
66
+ counterData.value = counter;
67
67
  };
68
68
  const tabPosition = ((_a = c.view.model.tabLayout) == null ? void 0 : _a.toLowerCase()) || "top";
69
69
  c.evt.on("onCreated", () => {
@@ -150,7 +150,7 @@ const DRTabControl = /* @__PURE__ */ vue.defineComponent({
150
150
  }, null), vue.createVNode("div", {
151
151
  "class": "caption"
152
152
  }, [(_b = activeTab.value) == null ? void 0 : _b.caption, ((_c = activeTab.value) == null ? void 0 : _c.counterId) && vue.createVNode(vue.resolveComponent("iBizBadge"), {
153
- "value": counterData[activeTab.value.counterId],
153
+ "value": counterData.value[activeTab.value.counterId],
154
154
  "counterMode": activeTab.value.counterMode
155
155
  }, null)]), vue.createVNode("ion-icon", {
156
156
  "name": "chevron-down-outline"
@@ -171,7 +171,7 @@ const DRTabControl = /* @__PURE__ */ vue.defineComponent({
171
171
  }, null), vue.createVNode("span", {
172
172
  "class": "caption"
173
173
  }, [tab.caption]), tab.counterId && vue.createVNode(vue.resolveComponent("iBizBadge"), {
174
- "value": counterData[tab.counterId],
174
+ "value": counterData.value[tab.counterId],
175
175
  "counterMode": tab.counterMode
176
176
  }, null), tab.tag === c.state.activeName && vue.createVNode("ion-icon", {
177
177
  "name": "checkmark-outline"
@@ -3,6 +3,7 @@
3
3
  var qxUtil = require('qx-util');
4
4
  var runtime = require('@ibiz-template/runtime');
5
5
  var vue3Util = require('@ibiz-template/vue3-util');
6
+ var ramda = require('ramda');
6
7
 
7
8
  "use strict";
8
9
  var __defProp = Object.defineProperty;
@@ -272,7 +273,11 @@ class DRTabController extends runtime.ControlController {
272
273
  const data = event.data[0];
273
274
  this.view.state.srfactiveviewdata = data;
274
275
  if (Object.prototype.hasOwnProperty.call(data, "srfreadonly")) {
275
- this.view.context.srfreadonly = data.srfreadonly;
276
+ if (data.srfreadonly) {
277
+ this.view.context.srfreadonly = true;
278
+ } else if (ramda.isNil(this.view.context.srfreadonly)) {
279
+ this.view.context.srfreadonly = false;
280
+ }
276
281
  }
277
282
  await this.calcDrTabPagesState();
278
283
  this.handleFormChange();
@@ -27,8 +27,8 @@ const CompositeFormItemEx = /* @__PURE__ */ vue.defineComponent({
27
27
  const ns = vue3Util.useNamespace("form-item");
28
28
  const ns2 = vue3Util.useNamespace("composite-form-item-ex");
29
29
  const c = props.controller;
30
- const onValueChange = (val, name, ignore = false) => {
31
- props.controller.setDataValue(val, name, ignore);
30
+ const onValueChange = (val, _name, ignore = false) => {
31
+ props.controller.setDataValue(val, c.name, ignore);
32
32
  };
33
33
  const loading = vue.ref(true);
34
34
  const editorRef = vue.ref();
@@ -34,7 +34,7 @@ class CompositeFormItemExController extends runtime.FormItemController {
34
34
  __publicField(this, "codeListId", "");
35
35
  /**
36
36
  * @description 切换菜单选项
37
- * @type {{ id: string; name: string; icon?: ISysImage, editor?: IData }[]}
37
+ * @type {{ id: string; name: string; icon?: ISysImage, editor?: IData, valueItem?: string }[]}
38
38
  * @memberof CompositeFormItemExController
39
39
  */
40
40
  __publicField(this, "switchOptions", []);
@@ -49,6 +49,16 @@ class CompositeFormItemExController extends runtime.FormItemController {
49
49
  var _a;
50
50
  return new compositeFormItemEx_state.CompositeFormItemExState((_a = this.parent) == null ? void 0 : _a.state);
51
51
  }
52
+ get name() {
53
+ return this.state.editorValueItem || this.model.id;
54
+ }
55
+ get value() {
56
+ var _a;
57
+ const option = this.switchOptions.find(
58
+ (item) => item.id === this.state.editorId
59
+ );
60
+ return (_a = this.data) == null ? void 0 : _a[(option == null ? void 0 : option.valueItem) || this.model.id];
61
+ }
52
62
  async onInit() {
53
63
  var _a, _b, _c, _d;
54
64
  await super.onInit();
@@ -73,7 +83,8 @@ class CompositeFormItemExController extends runtime.FormItemController {
73
83
  id: item.value,
74
84
  name: item.text,
75
85
  icon: item.sysImage,
76
- editor: item.data
86
+ editor: item.data,
87
+ valueItem: item.userData
77
88
  };
78
89
  });
79
90
  this.defaultType = ((_b = this.switchOptions[0]) == null ? void 0 : _b.id) || "";
@@ -104,6 +115,7 @@ class CompositeFormItemExController extends runtime.FormItemController {
104
115
  if (!option) {
105
116
  return;
106
117
  }
118
+ this.state.editorValueItem = option.valueItem || "";
107
119
  const editorModel = {
108
120
  ...this.createEditorModel(),
109
121
  ...option.editor
@@ -149,7 +161,6 @@ class CompositeFormItemExController extends runtime.FormItemController {
149
161
  if (!id || id === this.state.editorId) {
150
162
  return;
151
163
  }
152
- this.setDataValue("", this.name);
153
164
  if (this.valueItem && this.valueItem.id) {
154
165
  this.setDataValue(id, this.valueItem.id);
155
166
  }
@@ -18,6 +18,12 @@ class CompositeFormItemExState extends runtime.FormItemState {
18
18
  * @memberof CompositeFormItemExState
19
19
  */
20
20
  __publicField(this, "editorId", "");
21
+ /**
22
+ * @description 当前选中的编辑器值项
23
+ * @type {string}
24
+ * @memberof CompositeFormItemExState
25
+ */
26
+ __publicField(this, "editorValueItem", "");
21
27
  }
22
28
  }
23
29
 
@@ -268,7 +268,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
268
268
  // 不要滚动条的边框
269
269
  });
270
270
  editor.__instanceId = UUID;
271
- if (c.deACMode && ibiz.env.enableAI) {
271
+ if (c.chatCompletion && ibiz.env.enableAI) {
272
272
  codeLensProviderDisposable = loaderMonaco.languages.registerCodeLensProvider(props.language || props.controller.language, {
273
273
  provideCodeLenses: function(model, _token) {
274
274
  if (!validate(model))
@@ -451,7 +451,7 @@ const IBizCode = /* @__PURE__ */ vue.defineComponent({
451
451
  }, null);
452
452
  };
453
453
  const renderTextEditorToolbar = () => {
454
- if (!textTBVisible.value)
454
+ if (!textTBVisible.value || !c.chatCompletion)
455
455
  return null;
456
456
  return vue.createVNode("div", {
457
457
  "ref": "textTBRef",