@ibiz-template/vue3-components 0.7.41-alpha.140 → 0.7.41-alpha.142

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 (38) hide show
  1. package/dist/index-DrjG63wY.js +339 -0
  2. package/dist/{index.es-CvL4i5Jr.js → index.es-CfZdec4G.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-CwP3vIhD.js → wang-editor-CUGqp4Uw.js} +1 -1
  6. package/dist/{xlsx-util-BTk7f0UX.js → xlsx-util-C9Q58lgT.js} +1 -1
  7. package/es/common/html-doc-preview/html-doc-preview.css +1 -0
  8. package/es/common/html-doc-preview/html-doc-preview.mjs +76 -0
  9. package/es/common/index.mjs +2 -0
  10. package/es/common/rawitem/rawitem.mjs +13 -0
  11. package/es/control/form/form-detail/form-rawitem/form-rawitem.mjs +9 -3
  12. package/es/editor/ai-chat/embed-ai-chat/embed-ai-chat.mjs +2 -1
  13. package/es/editor/raw/ibiz-raw/ibiz-raw.mjs +3 -0
  14. package/es/panel-component/index.mjs +2 -1
  15. package/es/util/ai-chat-util/ai-chat-util.mjs +24 -0
  16. package/es/view-engine/mpickup-view-engine.mjs +20 -16
  17. package/lib/common/html-doc-preview/html-doc-preview.cjs +78 -0
  18. package/lib/common/html-doc-preview/html-doc-preview.css +1 -0
  19. package/lib/common/index.cjs +2 -0
  20. package/lib/common/rawitem/rawitem.cjs +13 -0
  21. package/lib/control/form/form-detail/form-rawitem/form-rawitem.cjs +8 -2
  22. package/lib/editor/ai-chat/embed-ai-chat/embed-ai-chat.cjs +2 -1
  23. package/lib/editor/raw/ibiz-raw/ibiz-raw.cjs +3 -0
  24. package/lib/panel-component/index.cjs +1 -0
  25. package/lib/util/ai-chat-util/ai-chat-util.cjs +24 -0
  26. package/lib/view-engine/mpickup-view-engine.cjs +19 -15
  27. package/package.json +5 -5
  28. package/src/common/html-doc-preview/html-doc-preview.scss +9 -0
  29. package/src/common/html-doc-preview/html-doc-preview.tsx +78 -0
  30. package/src/common/index.ts +2 -0
  31. package/src/common/rawitem/rawitem.tsx +12 -0
  32. package/src/control/form/form-detail/form-rawitem/form-rawitem.tsx +7 -0
  33. package/src/editor/ai-chat/embed-ai-chat/embed-ai-chat.tsx +1 -0
  34. package/src/editor/raw/ibiz-raw/ibiz-raw.tsx +5 -0
  35. package/src/panel-component/index.ts +2 -0
  36. package/src/util/ai-chat-util/ai-chat-util.ts +32 -0
  37. package/src/view-engine/mpickup-view-engine.ts +22 -16
  38. package/dist/index-FaVj1BJA.js +0 -339
@@ -0,0 +1,9 @@
1
+ @include b(html-doc-preview) {
2
+ width: 100%;
3
+
4
+ @include e(iframe) {
5
+ display: block;
6
+ width: 100%;
7
+ border: none;
8
+ }
9
+ }
@@ -0,0 +1,78 @@
1
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
+ import { computed, defineComponent, PropType, ref, watch } from 'vue';
3
+ import { useNamespace } from '@ibiz-template/vue3-util';
4
+ import { IControlController, IViewController } from '@ibiz-template/runtime';
5
+ import './html-doc-preview.scss';
6
+
7
+ export const IBizHtmlDocPreview = defineComponent({
8
+ name: 'IBizHtmlDocPreview',
9
+ props: {
10
+ // html值,完整HTML文档内容
11
+ value: String,
12
+ enableScript: {
13
+ type: Boolean,
14
+ default: true,
15
+ },
16
+ ctrl: { type: Object as PropType<IControlController>, required: false },
17
+ view: { type: Object as PropType<IViewController>, required: false },
18
+ },
19
+ setup(props) {
20
+ const ns = useNamespace('html-doc-preview');
21
+
22
+ // iframe高度,undefined时使用默认高度
23
+ const iframeHeight = ref<number>();
24
+
25
+ // 默认禁止脚本执行仅渲染样式与结构;开启脚本后为同源+脚本
26
+ const sandbox = computed(() => {
27
+ if (props.enableScript) {
28
+ return 'allow-same-origin allow-scripts';
29
+ }
30
+ return 'allow-same-origin';
31
+ });
32
+
33
+ // 读取iframe内容实际高度撑开外层
34
+ const calcHeight = (e: Event) => {
35
+ const iframe = e.target as HTMLIFrameElement;
36
+ const doc = iframe.contentDocument;
37
+ const contentWindow = iframe.contentWindow;
38
+ if (contentWindow) {
39
+ (contentWindow as IData).ctrl = props.ctrl;
40
+ (contentWindow as IData).view = props.view;
41
+ }
42
+ if (doc && doc.body) {
43
+ let h = doc.body.scrollHeight;
44
+ if (h > doc.documentElement.scrollHeight) {
45
+ h = doc.body.scrollHeight;
46
+ }
47
+ iframeHeight.value = h;
48
+ }
49
+ };
50
+
51
+ watch(
52
+ () => props.value,
53
+ newVal => {
54
+ // srcDoc变化会触发iframe重新加载,加载完成后calcHeight重算高度
55
+ if (!newVal) {
56
+ iframeHeight.value = undefined;
57
+ }
58
+ },
59
+ );
60
+
61
+ return { ns, iframeHeight, sandbox, calcHeight };
62
+ },
63
+ render() {
64
+ return (
65
+ <div class={[this.ns.b()]}>
66
+ <iframe
67
+ class={this.ns.e('iframe')}
68
+ srcdoc={this.value}
69
+ sandbox={this.sandbox}
70
+ style={
71
+ this.iframeHeight ? { height: `${this.iframeHeight}px` } : undefined
72
+ }
73
+ onLoad={this.calcHeight}
74
+ />
75
+ </div>
76
+ );
77
+ },
78
+ });
@@ -13,6 +13,7 @@ import { IBizActionToolbar } from './action-toolbar/action-toolbar';
13
13
  import { IBizCol } from './col/col';
14
14
  import { IBizRow } from './row/row';
15
15
  import { IBizRawItem } from './rawitem/rawitem';
16
+ import { IBizHtmlDocPreview } from './html-doc-preview/html-doc-preview';
16
17
  import { IBizNoData } from './no-data/no-data';
17
18
  import { IBizSplit } from './split/split';
18
19
  import { IBizSplitTrigger } from './split-trigger/split-trigger';
@@ -74,6 +75,7 @@ export const IBizCommonComponents = {
74
75
  v.component(IBizViewShell.name, IBizViewShell);
75
76
  v.component(IBizControlShell.name, IBizControlShell);
76
77
  v.component(IBizRawItem.name, IBizRawItem);
78
+ v.component(IBizHtmlDocPreview.name, IBizHtmlDocPreview);
77
79
  v.component(IBizCodeList.name, IBizCodeList);
78
80
  v.component(IBizNoData.name, IBizNoData);
79
81
  v.component(IBizSplit.name, IBizSplit);
@@ -74,6 +74,7 @@ export const IBizRawItem = defineComponent({
74
74
  },
75
75
  chunkView: { type: String, required: false },
76
76
  chunkEntity: { type: String, required: false },
77
+ enableHtmlDoc: { type: Boolean, required: false },
77
78
  ctrl: { type: Object as PropType<IControlController>, required: false },
78
79
  view: { type: Object as PropType<IViewController>, required: false },
79
80
  data: { type: Object as PropType<IData>, required: false },
@@ -409,6 +410,17 @@ export const IBizRawItem = defineComponent({
409
410
  );
410
411
  }
411
412
  if (this.rawItemType === 'HTML') {
413
+ if (this.enableHtmlDoc) {
414
+ return (
415
+ <iBizHtmlDocPreview
416
+ class={[this.ns.e('paragraph'), this.semantic.html.class]}
417
+ style={this.semantic.html.style}
418
+ value={this.rawItemText}
419
+ view={this.view}
420
+ ctrl={this.ctrl}
421
+ ></iBizHtmlDocPreview>
422
+ );
423
+ }
412
424
  return (
413
425
  <div
414
426
  class={[this.ns.e('paragraph'), this.semantic.html.class]}
@@ -15,6 +15,10 @@ export const FormRawItem = defineComponent({
15
15
  type: FormRawItemController,
16
16
  required: true,
17
17
  },
18
+ attrs: {
19
+ type: Object as PropType<IData>,
20
+ required: false,
21
+ },
18
22
  },
19
23
  setup(props) {
20
24
  const ns = useNamespace('form-raw-item');
@@ -249,7 +253,10 @@ export const FormRawItem = defineComponent({
249
253
  style={this.semanticStyle(`rawitem`, { rawitem: this.controller })}
250
254
  rawItem={this.modelData}
251
255
  content={this.content}
256
+ ctrl={this.controller.form}
257
+ view={this.controller.form.view}
252
258
  onClick={(event: MouseEvent) => this.controller.onClick(event)}
259
+ {...this.attrs}
253
260
  ></iBizRawItem>
254
261
  );
255
262
  },
@@ -120,6 +120,7 @@ export const IBizEmbedAIChat = defineComponent({
120
120
  resourceOptions,
121
121
  containerOptions: {
122
122
  container: aiChatElementRef.value,
123
+ compWrapperId: editorParams.compwrapperid || 'DEFAULT',
123
124
  },
124
125
  topicOptions: {
125
126
  appid: ibiz.env.appId,
@@ -17,6 +17,7 @@ import './ibiz-raw.scss';
17
17
  * @editorparams {name:template,parameterType:string,description:配置的handlerBars模板内容,用于将组件输入参数中的value值解析并转换为HTML内容,实现动态内容的渲染}
18
18
  * @editorparams {"name":"chunkview","parameterType":"string", "description":"切片视图,用于定义打开目标切片视图"}
19
19
  * @editorparams {"name":"chunkentity","parameterType":"string", "description":"切片实体,用于打开切片视图数据主键key"}
20
+ * @editorparams {"name":"enablehtmldoc","parameterType":"boolean", "description":"是否启用html文档绘制模式,即使用iframe的srcdoc绘制html内容"}
20
21
  * @ignoreprops autoFocus | overflowMode
21
22
  * @ignoreemits change | blur | focus | enter | infoTextChange
22
23
  */
@@ -38,6 +39,8 @@ export const IBizRaw = defineComponent({
38
39
 
39
40
  const chunkView = c.editorParams.chunkview;
40
41
  const chunkEntity = c.editorParams.chunkentity;
42
+ // 启用html文档模式,使用iframe渲染
43
+ const enableHtmlDoc = c.toBoolean(c.editorParams.enablehtmldoc);
41
44
 
42
45
  // 类型
43
46
  let type = 'TEXT';
@@ -117,6 +120,7 @@ export const IBizRaw = defineComponent({
117
120
  template,
118
121
  chunkView,
119
122
  chunkEntity,
123
+ enableHtmlDoc,
120
124
  enableOverFlow,
121
125
  semanticClass,
122
126
  semanticStyle,
@@ -143,6 +147,7 @@ export const IBizRaw = defineComponent({
143
147
  content={this.content}
144
148
  chunkView={this.chunkView}
145
149
  chunkEntity={this.chunkEntity}
150
+ enableHtmlDoc={this.enableHtmlDoc}
146
151
  context={this.controller.context}
147
152
  ctrl={this.controller.ctrl}
148
153
  view={this.controller.view}
@@ -17,6 +17,7 @@ import {
17
17
  IBizPanelContainerTabs,
18
18
  IBizPanelCtrlViewPageCaption,
19
19
  IBizAuthWxmpQrcode,
20
+ IBizPanelSimpleList,
20
21
  } from '@ibiz-template/vue3-util';
21
22
  import IBizAuthUserinfo from './auth-userinfo';
22
23
  import IBizNavPosIndex from './nav-pos-index';
@@ -140,6 +141,7 @@ export const IBizPanelComponents = {
140
141
  v.use(IBizPanelContainerImage);
141
142
  v.use(IBizSearchFormButtons);
142
143
  v.use(IBizPanelItemRender);
144
+ v.use(IBizPanelSimpleList);
143
145
  v.use(IBizViewMessage);
144
146
  v.use(IBizPanelStaticCarousel);
145
147
  v.use(IBizTeleportPlaceholder);
@@ -110,6 +110,12 @@ export class AIChatUtil implements IApiAIChatUtil {
110
110
  ibiz.log.error(error);
111
111
  }
112
112
  }
113
+ // 组件外层容器id,用于隔离不同位置的组件界面状态
114
+ if (editorParams.compwrapperid) {
115
+ containerOptions.compWrapperId = editorParams.compwrapperid;
116
+ } else {
117
+ containerOptions.compWrapperId = 'DEFAULT';
118
+ }
113
119
 
114
120
  // 会话参数
115
121
  const topicOptions: IData = {};
@@ -301,6 +307,16 @@ export class AIChatUtil implements IApiAIChatUtil {
301
307
  chatOptions.placeholder = ibiz.config.common.aiInputPlaceholder;
302
308
  }
303
309
 
310
+ // AI会话消息分页数量
311
+ if (editorParams.srfaichatmessagepagesize) {
312
+ chatOptions.chatMessagePageSize = Number(
313
+ editorParams.srfaichatmessagepagesize,
314
+ );
315
+ } else {
316
+ chatOptions.chatMessagePageSize =
317
+ ibiz.config.common.aiChatMessagePageSize;
318
+ }
319
+
304
320
  // 智能体选项(由内部获取,优化打开速度)
305
321
  chatOptions.fetchAgentList = (args: IParams = {}) => {
306
322
  const { query, agentid } = args;
@@ -883,6 +899,13 @@ export class AIChatUtil implements IApiAIChatUtil {
883
899
  ibiz.log.error(error);
884
900
  }
885
901
  }
902
+ // 组件外层容器id,用于隔离不同位置的组件界面状态
903
+ if (params.hasOwnProperty('compwrapperid')) {
904
+ containerOptions.compWrapperId = params.compwrapperid;
905
+ delete params.compwrapperid;
906
+ } else {
907
+ containerOptions.compWrapperId = 'DEFAULT';
908
+ }
886
909
 
887
910
  // 会话参数
888
911
  const topicOptions: IData = {};
@@ -1104,6 +1127,15 @@ export class AIChatUtil implements IApiAIChatUtil {
1104
1127
  chatOptions.placeholder = ibiz.config.common.aiInputPlaceholder;
1105
1128
  }
1106
1129
 
1130
+ // AI会话消息分页数量
1131
+ if (params.hasOwnProperty('srfaichatmessagepagesize')) {
1132
+ chatOptions.chatMessagePageSize = Number(params.srfaichatmessagepagesize);
1133
+ delete params.srfaichatmessagepagesize;
1134
+ } else {
1135
+ chatOptions.chatMessagePageSize =
1136
+ ibiz.config.common.aiChatMessagePageSize;
1137
+ }
1138
+
1107
1139
  // 智能体选项(由内部获取,优化打开速度)
1108
1140
  chatOptions.fetchAgentList = (args: IParams = {}) => {
1109
1141
  const { query, agentid } = args;
@@ -1,4 +1,3 @@
1
- import { RuntimeModelError } from '@ibiz-template/core';
2
1
  import {
3
2
  ViewController,
4
3
  SysUIActionTag,
@@ -6,7 +5,9 @@ import {
6
5
  IMPickupViewState,
7
6
  IMPickupViewEvent,
8
7
  IApiMPickupViewCall,
8
+ getControlsByView,
9
9
  } from '@ibiz-template/runtime';
10
+ import { PanelSimpleListController } from '@ibiz-template/vue3-util';
10
11
  import { IAppDEPickupView } from '@ibiz/model-core';
11
12
  import { PickupViewEngine } from './pickup-view.engine';
12
13
 
@@ -41,8 +42,12 @@ export class MPickupViewEngine extends PickupViewEngine {
41
42
  * @readonly
42
43
  * @memberof MPickupViewEngine
43
44
  */
44
- get simpleList(): IListController {
45
- return this.view.getController('simplelist') as IListController;
45
+ get simpleList(): IListController | PanelSimpleListController {
46
+ const list = this.view.getController('simplelist') as IListController;
47
+ if (list) {
48
+ return list;
49
+ }
50
+ return this.view.layoutPanel?.panelItems.simplelist;
46
51
  }
47
52
 
48
53
  /**
@@ -55,24 +60,25 @@ export class MPickupViewEngine extends PickupViewEngine {
55
60
  */
56
61
  async onCreated(): Promise<void> {
57
62
  await super.onCreated();
58
- if (!this.view.providers.simplelist) {
59
- throw new RuntimeModelError(
60
- this.view.model,
61
- ibiz.i18n.t('viewEngine.missingConfigErr'),
62
- );
63
- }
64
63
 
65
- const { childNames } = this.view;
66
- childNames.push('simplelist');
67
- if (!this.view.slotProps.simplelist) {
68
- this.view.slotProps.simplelist = {};
64
+ // 存在simplelist部件,设置列表部件参数
65
+ const controls = getControlsByView(this.view.model);
66
+ const simpleListControl = controls.find(
67
+ control => control.name === 'simplelist',
68
+ );
69
+ if (simpleListControl) {
70
+ const { childNames } = this.view;
71
+ childNames.push('simplelist');
72
+ if (!this.view.slotProps.simplelist) {
73
+ this.view.slotProps.simplelist = {};
74
+ }
75
+ this.view.slotProps.simplelist.mdctrlActiveMode = 2;
76
+ this.view.slotProps.simplelist.isSimple = true;
77
+ this.view.slotProps.simplelist.singleSelect = false;
69
78
  }
70
79
  if (!this.view.slotProps.pickupviewpanel) {
71
80
  this.view.slotProps.pickupviewpanel = {};
72
81
  }
73
- this.view.slotProps.simplelist.mdctrlActiveMode = 2;
74
- this.view.slotProps.simplelist.isSimple = true;
75
- this.view.slotProps.simplelist.singleSelect = false;
76
82
  this.view.slotProps.pickupviewpanel.singleSelect = false;
77
83
  if (this.view.params.checkstrictly) {
78
84
  this.checkStrictly =