n8n-nodes-feishu-message-bot 0.1.3 → 0.1.6

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.
@@ -23,8 +23,44 @@ const postElementTypeOptions = [
23
23
  ];
24
24
  const cardModeOptions = [
25
25
  { name: '简单模式(标题 + 正文 + 按钮)', value: 'simple' },
26
+ { name: '表单配置(卡片 2.0)', value: 'form' },
26
27
  { name: '高级模式(完整 JSON)', value: 'raw' },
27
28
  ];
29
+ const card2WidthModeOptions = [
30
+ { name: '默认 (600px)', value: 'default' },
31
+ { name: '紧凑 (400px)', value: 'compact' },
32
+ { name: '撑满宽度', value: 'fill' },
33
+ ];
34
+ const card2HeaderTemplateOptions = [
35
+ { name: 'Default', value: 'default' },
36
+ { name: 'Blue', value: 'blue' },
37
+ { name: 'Wathet', value: 'wathet' },
38
+ { name: 'Turquoise', value: 'turquoise' },
39
+ { name: 'Green', value: 'green' },
40
+ { name: 'Yellow', value: 'yellow' },
41
+ { name: 'Orange', value: 'orange' },
42
+ { name: 'Red', value: 'red' },
43
+ { name: 'Carmine', value: 'carmine' },
44
+ { name: 'Violet', value: 'violet' },
45
+ { name: 'Purple', value: 'purple' },
46
+ { name: 'Indigo', value: 'indigo' },
47
+ { name: 'Grey', value: 'grey' },
48
+ ];
49
+ const card2BodyElementTypeOptions = [
50
+ { name: '纯文本 (Plain_text)', value: 'plain_text' },
51
+ { name: '富文本 Markdown (Markdown)', value: 'markdown' },
52
+ { name: '按钮 (Button)', value: 'button' },
53
+ { name: '图片 (Img)', value: 'img' },
54
+ { name: '分割线 (Hr)', value: 'hr' },
55
+ { name: '分栏 (Column_set)', value: 'column_set' },
56
+ { name: '交互容器 (Interactive_container)', value: 'interactive_container' },
57
+ { name: '折叠面板 (Collapsible_panel)', value: 'collapsible_panel' },
58
+ { name: '表单容器 (Form)', value: 'form' },
59
+ ];
60
+ const showCardForm = {
61
+ messageType: ['interactive'],
62
+ cardMode: ['form'],
63
+ };
28
64
  function toArray(v) {
29
65
  if (!v)
30
66
  return [];
@@ -34,6 +70,194 @@ function toArray(v) {
34
70
  .sort((a, b) => Number(a) - Number(b))
35
71
  .map((k) => v[k]);
36
72
  }
73
+ function buildCard2SimpleElement(el) {
74
+ var _a, _b, _c, _d, _e, _f, _g;
75
+ const tag = ((_b = (_a = el.elementType) !== null && _a !== void 0 ? _a : el.col_elType) !== null && _b !== void 0 ? _b : el.c_elType);
76
+ const out = {};
77
+ if (el.element_id && String(el.element_id).trim())
78
+ out.element_id = String(el.element_id).trim();
79
+ if (tag === 'plain_text') {
80
+ out.tag = 'plain_text';
81
+ out.content = (_c = el.content) !== null && _c !== void 0 ? _c : '';
82
+ return out;
83
+ }
84
+ if (tag === 'markdown') {
85
+ out.tag = 'markdown';
86
+ out.content = (_d = el.content) !== null && _d !== void 0 ? _d : '';
87
+ return out;
88
+ }
89
+ if (tag === 'button') {
90
+ out.tag = 'button';
91
+ out.text = { tag: 'plain_text', content: (_e = el.button_text) !== null && _e !== void 0 ? _e : '' };
92
+ out.url = (_f = el.button_url) !== null && _f !== void 0 ? _f : '';
93
+ out.type = el.button_type || 'default';
94
+ return out;
95
+ }
96
+ if (tag === 'img') {
97
+ out.tag = 'img';
98
+ out.img_key = (_g = el.img_key) !== null && _g !== void 0 ? _g : '';
99
+ return out;
100
+ }
101
+ if (tag === 'hr') {
102
+ out.tag = 'hr';
103
+ return out;
104
+ }
105
+ return out;
106
+ }
107
+ const CARD2_CONTAINER_TAGS = ['column_set', 'interactive_container', 'collapsible_panel', 'form'];
108
+ function buildCard2Elements(raw) {
109
+ const arr = toArray(raw);
110
+ return arr
111
+ .filter((el) => el && (el.elementType || el.col_elType || el.c_elType))
112
+ .map((el) => {
113
+ const tag = el.elementType;
114
+ if (tag && CARD2_CONTAINER_TAGS.includes(tag))
115
+ return buildCard2Element(el);
116
+ return buildCard2SimpleElement(el);
117
+ });
118
+ }
119
+ function buildCard2FormElements(raw) {
120
+ const arr = toArray(raw);
121
+ return arr
122
+ .filter((el) => el && (el.elementType || el.col_elType || el.c_elType))
123
+ .map((el) => {
124
+ var _a;
125
+ const tag = ((_a = el.elementType) !== null && _a !== void 0 ? _a : el.c_elType);
126
+ if (tag && CARD2_CONTAINER_TAGS.includes(tag))
127
+ return buildCard2Element(el);
128
+ const out = buildCard2SimpleElement(el);
129
+ if (out.tag === 'button') {
130
+ if (el.form_action_type)
131
+ out.form_action_type = el.form_action_type;
132
+ if (el.form_button_name != null && String(el.form_button_name).trim())
133
+ out.name = String(el.form_button_name).trim();
134
+ }
135
+ return out;
136
+ });
137
+ }
138
+ function buildCard2Element(el) {
139
+ const tag = el.elementType;
140
+ const out = {};
141
+ if (el.element_id && String(el.element_id).trim())
142
+ out.element_id = String(el.element_id).trim();
143
+ if (tag === 'column_set') {
144
+ out.tag = 'column_set';
145
+ if (el.flex_mode)
146
+ out.flex_mode = el.flex_mode;
147
+ if (el.horizontal_spacing)
148
+ out.horizontal_spacing = el.horizontal_spacing;
149
+ if (el.horizontal_align)
150
+ out.horizontal_align = el.horizontal_align;
151
+ if (el.margin)
152
+ out.margin = el.margin;
153
+ if (el.background_style)
154
+ out.background_style = el.background_style;
155
+ const rawColumns = toArray(el.columns);
156
+ out.columns = rawColumns.map((col) => {
157
+ const column = { tag: 'column' };
158
+ if (col.column_width)
159
+ column.width = col.column_width;
160
+ if (col.column_weight != null)
161
+ column.weight = Number(col.column_weight) || 1;
162
+ if (col.vertical_align)
163
+ column.vertical_align = col.vertical_align;
164
+ if (col.vertical_spacing)
165
+ column.vertical_spacing = col.vertical_spacing;
166
+ if (col.direction)
167
+ column.direction = col.direction;
168
+ if (col.padding)
169
+ column.padding = col.padding;
170
+ if (col.margin)
171
+ column.margin = col.margin;
172
+ if (col.background_style)
173
+ column.background_style = col.background_style;
174
+ column.elements = buildCard2Elements(col.column_elements);
175
+ return column;
176
+ });
177
+ return out;
178
+ }
179
+ if (tag === 'interactive_container') {
180
+ out.tag = 'interactive_container';
181
+ if (el.container_width)
182
+ out.width = el.container_width;
183
+ if (el.direction)
184
+ out.direction = el.direction;
185
+ if (el.horizontal_spacing)
186
+ out.horizontal_spacing = el.horizontal_spacing;
187
+ if (el.horizontal_align)
188
+ out.horizontal_align = el.horizontal_align;
189
+ if (el.vertical_align)
190
+ out.vertical_align = el.vertical_align;
191
+ if (el.vertical_spacing)
192
+ out.vertical_spacing = el.vertical_spacing;
193
+ if (el.background_style)
194
+ out.background_style = el.background_style;
195
+ if (el.has_border != null)
196
+ out.has_border = Boolean(el.has_border);
197
+ if (el.border_color)
198
+ out.border_color = el.border_color;
199
+ if (el.padding)
200
+ out.padding = el.padding;
201
+ if (el.corner_radius)
202
+ out.corner_radius = el.corner_radius;
203
+ const behaviors = [];
204
+ if (el.action_type === 'open_url' && el.action_url) {
205
+ behaviors.push({
206
+ type: 'open_url',
207
+ default_url: el.action_url,
208
+ pc_url: el.action_pc_url || el.action_url,
209
+ ios_url: el.action_ios_url || el.action_url,
210
+ android_url: el.action_android_url || el.action_url,
211
+ });
212
+ }
213
+ if (el.action_type === 'callback' && el.callback_value != null) {
214
+ try {
215
+ const value = typeof el.callback_value === 'string' ? JSON.parse(el.callback_value) : el.callback_value;
216
+ behaviors.push({ type: 'callback', value });
217
+ }
218
+ catch {
219
+ behaviors.push({ type: 'callback', value: {} });
220
+ }
221
+ }
222
+ if (behaviors.length)
223
+ out.behaviors = behaviors;
224
+ out.elements = buildCard2Elements(el.container_elements);
225
+ return out;
226
+ }
227
+ if (tag === 'collapsible_panel') {
228
+ out.tag = 'collapsible_panel';
229
+ if (el.panel_expanded != null)
230
+ out.expanded = Boolean(el.panel_expanded);
231
+ if (el.panel_header_title != null && String(el.panel_header_title).trim()) {
232
+ const header = {
233
+ title: { tag: 'plain_text', content: String(el.panel_header_title).trim() },
234
+ };
235
+ if (el.panel_header_background_color)
236
+ header.background_color = el.panel_header_background_color;
237
+ out.header = header;
238
+ }
239
+ if (el.panel_background_color)
240
+ out.background_color = el.panel_background_color;
241
+ if (el.panel_border_color || el.panel_border_corner_radius) {
242
+ const border = {};
243
+ if (el.panel_border_color)
244
+ border.color = el.panel_border_color;
245
+ if (el.panel_border_corner_radius)
246
+ border.corner_radius = el.panel_border_corner_radius;
247
+ out.border = border;
248
+ }
249
+ out.elements = buildCard2Elements(el.container_elements);
250
+ return out;
251
+ }
252
+ if (tag === 'form') {
253
+ out.tag = 'form';
254
+ if (el.form_name)
255
+ out.name = String(el.form_name);
256
+ out.elements = buildCard2FormElements(el.container_elements);
257
+ return out;
258
+ }
259
+ return buildCard2SimpleElement(el);
260
+ }
37
261
  function buildPostContent(paragraphs) {
38
262
  if (!paragraphs || !Array.isArray(paragraphs))
39
263
  return [[]];
@@ -123,6 +347,63 @@ function buildRequestBody(messageType, params) {
123
347
  }
124
348
  return { msg_type: 'interactive', card };
125
349
  }
350
+ if (cardMode === 'form') {
351
+ const card = { schema: '2.0' };
352
+ const config = { update_multi: true };
353
+ if (params.card2_config_summary != null && String(params.card2_config_summary).trim() !== '') {
354
+ config.summary = { content: String(params.card2_config_summary).trim() };
355
+ }
356
+ if (params.card2_config_width_mode) {
357
+ config.width_mode = params.card2_config_width_mode;
358
+ }
359
+ if (params.card2_config_enable_forward !== undefined) {
360
+ config.enable_forward = Boolean(params.card2_config_enable_forward);
361
+ }
362
+ card.config = config;
363
+ const cardLink = {};
364
+ if (params.card2_card_link_url)
365
+ cardLink.url = String(params.card2_card_link_url);
366
+ if (params.card2_card_link_pc_url)
367
+ cardLink.pc_url = String(params.card2_card_link_pc_url);
368
+ if (params.card2_card_link_ios_url)
369
+ cardLink.ios_url = String(params.card2_card_link_ios_url);
370
+ if (params.card2_card_link_android_url)
371
+ cardLink.android_url = String(params.card2_card_link_android_url);
372
+ if (Object.keys(cardLink).length)
373
+ card.card_link = cardLink;
374
+ const headerTitle = params.card2_header_title || '';
375
+ if (headerTitle) {
376
+ const header = {
377
+ title: { tag: 'plain_text', content: headerTitle },
378
+ };
379
+ if (params.card2_header_subtitle) {
380
+ header.subtitle = {
381
+ tag: 'plain_text',
382
+ content: String(params.card2_header_subtitle),
383
+ };
384
+ }
385
+ if (params.card2_header_template && params.card2_header_template !== 'default') {
386
+ header.template = params.card2_header_template;
387
+ }
388
+ card.header = header;
389
+ }
390
+ const body = {
391
+ direction: params.card2_body_direction || 'vertical',
392
+ };
393
+ if (params.card2_body_padding)
394
+ body.padding = String(params.card2_body_padding);
395
+ const rawElements = params.card2_body_elements;
396
+ const elementsArr = toArray(Array.isArray(rawElements)
397
+ ? rawElements
398
+ : rawElements && typeof rawElements === 'object'
399
+ ? rawElements
400
+ : []);
401
+ body.elements = elementsArr.filter((el) => el === null || el === void 0 ? void 0 : el.elementType).map(buildCard2Element);
402
+ if (body.elements.length === 0)
403
+ body.elements = [{ tag: 'plain_text', content: ' ' }];
404
+ card.body = body;
405
+ return { msg_type: 'interactive', card };
406
+ }
126
407
  const headerTitle = params.cardHeaderTitle || '';
127
408
  const bodyMarkdown = params.cardBodyMarkdown || '';
128
409
  const buttonText = params.cardButtonText || '';
@@ -361,6 +642,424 @@ const properties = [
361
642
  show: { messageType: ['interactive'], cardMode: ['simple'] },
362
643
  },
363
644
  },
645
+ {
646
+ displayName: '摘要(聊天栏预览文案)',
647
+ name: 'card2_config_summary',
648
+ type: 'string',
649
+ default: '',
650
+ displayOptions: { show: showCardForm },
651
+ description: 'Config.summary.content,自定义聊天栏消息预览文案',
652
+ },
653
+ {
654
+ displayName: '卡片宽度',
655
+ name: 'card2_config_width_mode',
656
+ type: 'options',
657
+ options: card2WidthModeOptions,
658
+ default: 'default',
659
+ displayOptions: { show: showCardForm },
660
+ },
661
+ {
662
+ displayName: '允许转发',
663
+ name: 'card2_config_enable_forward',
664
+ type: 'boolean',
665
+ default: true,
666
+ displayOptions: { show: showCardForm },
667
+ },
668
+ {
669
+ displayName: '卡片整体跳转链接',
670
+ name: 'card2_card_link_url',
671
+ type: 'string',
672
+ default: '',
673
+ displayOptions: { show: showCardForm },
674
+ description: '点击卡片跳转的默认链接',
675
+ },
676
+ {
677
+ displayName: 'PC 端链接',
678
+ name: 'card2_card_link_pc_url',
679
+ type: 'string',
680
+ default: '',
681
+ displayOptions: { show: showCardForm },
682
+ },
683
+ {
684
+ displayName: 'iOS 端链接',
685
+ name: 'card2_card_link_ios_url',
686
+ type: 'string',
687
+ default: '',
688
+ displayOptions: { show: showCardForm },
689
+ },
690
+ {
691
+ displayName: 'Android 端链接',
692
+ name: 'card2_card_link_android_url',
693
+ type: 'string',
694
+ default: '',
695
+ displayOptions: { show: showCardForm },
696
+ },
697
+ {
698
+ displayName: '标题',
699
+ name: 'card2_header_title',
700
+ type: 'string',
701
+ default: '',
702
+ displayOptions: { show: showCardForm },
703
+ },
704
+ {
705
+ displayName: '副标题',
706
+ name: 'card2_header_subtitle',
707
+ type: 'string',
708
+ default: '',
709
+ displayOptions: { show: showCardForm },
710
+ },
711
+ {
712
+ displayName: '标题主题',
713
+ name: 'card2_header_template',
714
+ type: 'options',
715
+ options: card2HeaderTemplateOptions,
716
+ default: 'default',
717
+ displayOptions: { show: showCardForm },
718
+ },
719
+ {
720
+ displayName: '正文排列方向',
721
+ name: 'card2_body_direction',
722
+ type: 'options',
723
+ options: [
724
+ { name: '垂直', value: 'vertical' },
725
+ { name: '水平', value: 'horizontal' },
726
+ ],
727
+ default: 'vertical',
728
+ displayOptions: { show: showCardForm },
729
+ },
730
+ {
731
+ displayName: '正文内边距',
732
+ name: 'card2_body_padding',
733
+ type: 'string',
734
+ default: '',
735
+ placeholder: '12px 8px 12px 8px',
736
+ displayOptions: { show: showCardForm },
737
+ },
738
+ {
739
+ displayName: '正文元素',
740
+ name: 'card2_body_elements',
741
+ type: 'collection',
742
+ typeOptions: {
743
+ multipleValues: true,
744
+ multipleValueButtonText: '添加元素',
745
+ },
746
+ displayOptions: { show: showCardForm },
747
+ default: {},
748
+ options: [
749
+ {
750
+ displayName: '按钮链接',
751
+ name: 'button_url',
752
+ type: 'string',
753
+ default: '',
754
+ displayOptions: { show: { elementType: ['button'] } },
755
+ },
756
+ {
757
+ displayName: '按钮文字',
758
+ name: 'button_text',
759
+ type: 'string',
760
+ default: '',
761
+ displayOptions: { show: { elementType: ['button'] } },
762
+ },
763
+ {
764
+ displayName: '按钮样式',
765
+ name: 'button_type',
766
+ type: 'options',
767
+ options: [
768
+ { name: 'Default', value: 'default' },
769
+ { name: 'Primary', value: 'primary' },
770
+ { name: 'Danger', value: 'danger' },
771
+ ],
772
+ default: 'default',
773
+ displayOptions: { show: { elementType: ['button'] } },
774
+ },
775
+ {
776
+ displayName: '内容',
777
+ name: 'content',
778
+ type: 'string',
779
+ typeOptions: { rows: 2 },
780
+ default: '',
781
+ displayOptions: { show: { elementType: ['plain_text', 'markdown'] } },
782
+ },
783
+ {
784
+ displayName: '图片 Key',
785
+ name: 'img_key',
786
+ type: 'string',
787
+ default: '',
788
+ displayOptions: { show: { elementType: ['img'] } },
789
+ },
790
+ {
791
+ displayName: '元素 ID',
792
+ name: 'element_id',
793
+ type: 'string',
794
+ default: '',
795
+ description: 'Element_id,同一卡片内唯一,字母/数字/下划线,以字母开头,最多 20 字符',
796
+ },
797
+ {
798
+ displayName: '元素类型',
799
+ name: 'elementType',
800
+ type: 'options',
801
+ options: card2BodyElementTypeOptions,
802
+ default: 'plain_text',
803
+ },
804
+ {
805
+ displayName: '列配置',
806
+ name: 'columns',
807
+ type: 'collection',
808
+ typeOptions: { multipleValues: true, multipleValueButtonText: '添加列' },
809
+ default: {},
810
+ displayOptions: { show: { elementType: ['column_set'] } },
811
+ options: [
812
+ {
813
+ displayName: '列内元素',
814
+ name: 'column_elements',
815
+ type: 'collection',
816
+ typeOptions: { multipleValues: true, multipleValueButtonText: '添加元素' },
817
+ default: {},
818
+ options: [
819
+ { displayName: '内容', name: 'content', type: 'string', typeOptions: { rows: 2 }, default: '', displayOptions: { show: { col_elType: ['plain_text', 'markdown'] } } },
820
+ { displayName: '元素类型', name: 'col_elType', type: 'options', options: [{ name: 'Button', value: 'button' }, { name: 'Hr', value: 'hr' }, { name: 'Img', value: 'img' }, { name: 'Markdown', value: 'markdown' }, { name: 'Plain_text', value: 'plain_text' }], default: 'plain_text' },
821
+ { displayName: '按钮链接', name: 'button_url', type: 'string', default: '', displayOptions: { show: { col_elType: ['button'] } } },
822
+ { displayName: '按钮文字', name: 'button_text', type: 'string', default: '', displayOptions: { show: { col_elType: ['button'] } } },
823
+ { displayName: '按钮样式', name: 'button_type', type: 'options', options: [{ name: 'Default', value: 'default' }, { name: 'Primary', value: 'primary' }, { name: 'Danger', value: 'danger' }], default: 'default', displayOptions: { show: { col_elType: ['button'] } } },
824
+ { displayName: '图片 Key', name: 'img_key', type: 'string', default: '', displayOptions: { show: { col_elType: ['img'] } } },
825
+ ],
826
+ },
827
+ { displayName: '列宽', name: 'column_width', type: 'options', options: [{ name: 'Auto', value: 'auto' }, { name: 'Weighted', value: 'weighted' }], default: 'weighted' },
828
+ { displayName: '列权重', name: 'column_weight', type: 'number', typeOptions: { minValue: 1, maxValue: 5 }, default: 1 },
829
+ { displayName: '列垂直对齐', name: 'vertical_align', type: 'options', options: [{ name: 'Bottom', value: 'bottom' }, { name: 'Center', value: 'center' }, { name: 'Top', value: 'top' }], default: 'top' },
830
+ { displayName: '列垂直间距', name: 'vertical_spacing', type: 'options', options: [{ name: 'Extra_large (16px)', value: 'extra_large' }, { name: 'Large (12px)', value: 'large' }, { name: 'Medium (8px)', value: 'medium' }, { name: 'Small (4px)', value: 'small' }], default: 'medium' },
831
+ { displayName: '列排列方向', name: 'direction', type: 'options', options: [{ name: '水平', value: 'horizontal' }, { name: '垂直', value: 'vertical' }], default: 'vertical' },
832
+ { displayName: '列内边距', name: 'padding', type: 'string', default: '', placeholder: '8px' },
833
+ { displayName: '列外边距', name: 'margin', type: 'string', default: '', placeholder: '4px 0' },
834
+ { displayName: '列背景样式', name: 'background_style', type: 'options', options: [{ name: 'Default', value: 'default' }, { name: 'Grey', value: 'grey' }], default: 'default' },
835
+ ],
836
+ },
837
+ {
838
+ displayName: '分栏背景样式',
839
+ name: 'background_style',
840
+ type: 'options',
841
+ options: [{ name: 'Default', value: 'default' }, { name: 'Grey', value: 'grey' }],
842
+ default: 'default',
843
+ displayOptions: { show: { elementType: ['column_set'] } },
844
+ },
845
+ {
846
+ displayName: 'Flex 模式',
847
+ name: 'flex_mode',
848
+ type: 'options',
849
+ options: [
850
+ { name: 'Bisect', value: 'bisect' },
851
+ { name: 'Flow', value: 'flow' },
852
+ { name: 'None', value: 'none' },
853
+ { name: 'Stretch', value: 'stretch' },
854
+ { name: 'Trisect', value: 'trisect' },
855
+ ],
856
+ default: 'none',
857
+ displayOptions: { show: { elementType: ['column_set'] } },
858
+ },
859
+ {
860
+ displayName: '水平对齐',
861
+ name: 'horizontal_align',
862
+ type: 'options',
863
+ options: [{ name: 'Left', value: 'left' }, { name: 'Center', value: 'center' }, { name: 'Right', value: 'right' }],
864
+ default: 'left',
865
+ displayOptions: { show: { elementType: ['column_set', 'interactive_container'] } },
866
+ },
867
+ {
868
+ displayName: '水平间距',
869
+ name: 'horizontal_spacing',
870
+ type: 'options',
871
+ options: [
872
+ { name: 'Small (4px)', value: 'small' },
873
+ { name: 'Medium (8px)', value: 'medium' },
874
+ { name: 'Large (12px)', value: 'large' },
875
+ { name: 'Extra_large (16px)', value: 'extra_large' },
876
+ ],
877
+ default: 'medium',
878
+ displayOptions: { show: { elementType: ['column_set', 'interactive_container'] } },
879
+ },
880
+ {
881
+ displayName: '外边距',
882
+ name: 'margin',
883
+ type: 'string',
884
+ default: '',
885
+ placeholder: '4px 0px 4px 0px',
886
+ displayOptions: { show: { elementType: ['column_set'] } },
887
+ },
888
+ {
889
+ displayName: '容器内元素',
890
+ name: 'container_elements',
891
+ type: 'collection',
892
+ typeOptions: { multipleValues: true, multipleValueButtonText: '添加元素' },
893
+ default: {},
894
+ displayOptions: { show: { elementType: ['interactive_container', 'collapsible_panel', 'form'] } },
895
+ options: [
896
+ { displayName: '按钮链接', name: 'button_url', type: 'string', default: '', displayOptions: { show: { c_elType: ['button'] } } },
897
+ { displayName: '按钮文字', name: 'button_text', type: 'string', default: '', displayOptions: { show: { c_elType: ['button'] } } },
898
+ { displayName: '按钮样式', name: 'button_type', type: 'options', options: [{ name: 'Default', value: 'default' }, { name: 'Primary', value: 'primary' }, { name: 'Danger', value: 'danger' }], default: 'default', displayOptions: { show: { c_elType: ['button'] } } },
899
+ { displayName: '内容', name: 'content', type: 'string', typeOptions: { rows: 2 }, default: '', displayOptions: { show: { c_elType: ['plain_text', 'markdown'] } } },
900
+ { displayName: '元素类型', name: 'c_elType', type: 'options', options: [{ name: 'Button', value: 'button' }, { name: 'Hr', value: 'hr' }, { name: 'Img', value: 'img' }, { name: 'Markdown', value: 'markdown' }, { name: 'Plain_text', value: 'plain_text' }], default: 'plain_text' },
901
+ { displayName: '图片 Key', name: 'img_key', type: 'string', default: '', displayOptions: { show: { c_elType: ['img'] } } },
902
+ { displayName: '表单按钮名称', name: 'form_button_name', type: 'string', default: '', description: '表单内按钮唯一标识,提交时回传', displayOptions: { show: { elementType: ['form'], c_elType: ['button'] } } },
903
+ { displayName: '表单操作类型', name: 'form_action_type', type: 'options', options: [{ name: '提交 (Submit)', value: 'submit' }, { name: '重置 (Reset)', value: 'reset' }], default: 'submit', description: '表单内至少需一个提交按钮', displayOptions: { show: { elementType: ['form'], c_elType: ['button'] } } },
904
+ ],
905
+ },
906
+ {
907
+ displayName: '交互类型',
908
+ name: 'action_type',
909
+ type: 'options',
910
+ options: [
911
+ { name: '打开链接 (Open_url)', value: 'open_url' },
912
+ { name: '回传 (Callback)', value: 'callback' },
913
+ ],
914
+ default: 'open_url',
915
+ displayOptions: { show: { elementType: ['interactive_container'] } },
916
+ },
917
+ {
918
+ displayName: '跳转链接',
919
+ name: 'action_url',
920
+ type: 'string',
921
+ default: '',
922
+ displayOptions: { show: { elementType: ['interactive_container'], action_type: ['open_url'] } },
923
+ },
924
+ {
925
+ displayName: 'Callback 回传值 (JSON)',
926
+ name: 'callback_value',
927
+ type: 'string',
928
+ default: '{}',
929
+ placeholder: '{"key":"value"}',
930
+ displayOptions: { show: { elementType: ['interactive_container'], action_type: ['callback'] } },
931
+ },
932
+ {
933
+ displayName: '表单名称',
934
+ name: 'form_name',
935
+ type: 'string',
936
+ default: '',
937
+ description: 'Form 容器的唯一标识,同一卡片内唯一',
938
+ displayOptions: { show: { elementType: ['form'] } },
939
+ },
940
+ {
941
+ displayName: '面板标题',
942
+ name: 'panel_header_title',
943
+ type: 'string',
944
+ default: '',
945
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
946
+ },
947
+ {
948
+ displayName: '默认展开',
949
+ name: 'panel_expanded',
950
+ type: 'boolean',
951
+ default: false,
952
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
953
+ },
954
+ {
955
+ displayName: '面板背景色',
956
+ name: 'panel_background_color',
957
+ type: 'options',
958
+ options: [{ name: 'Default', value: 'default' }, { name: 'Grey', value: 'grey' }],
959
+ default: 'default',
960
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
961
+ },
962
+ {
963
+ displayName: '标题区背景色',
964
+ name: 'panel_header_background_color',
965
+ type: 'options',
966
+ options: [{ name: 'Default', value: 'default' }, { name: 'Grey', value: 'grey' }, { name: 'Yellow', value: 'yellow' }],
967
+ default: 'default',
968
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
969
+ },
970
+ {
971
+ displayName: '边框颜色',
972
+ name: 'panel_border_color',
973
+ type: 'options',
974
+ options: [{ name: 'Grey', value: 'grey' }],
975
+ default: 'grey',
976
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
977
+ },
978
+ {
979
+ displayName: '边框圆角',
980
+ name: 'panel_border_corner_radius',
981
+ type: 'string',
982
+ default: '5px',
983
+ placeholder: '5px',
984
+ displayOptions: { show: { elementType: ['collapsible_panel'] } },
985
+ },
986
+ {
987
+ displayName: '垂直对齐',
988
+ name: 'vertical_align',
989
+ type: 'options',
990
+ options: [{ name: 'Top', value: 'top' }, { name: 'Center', value: 'center' }, { name: 'Bottom', value: 'bottom' }],
991
+ default: 'top',
992
+ displayOptions: { show: { elementType: ['interactive_container'] } },
993
+ },
994
+ {
995
+ displayName: '垂直间距',
996
+ name: 'vertical_spacing',
997
+ type: 'options',
998
+ options: [
999
+ { name: 'Small (4px)', value: 'small' },
1000
+ { name: 'Medium (8px)', value: 'medium' },
1001
+ { name: 'Large (12px)', value: 'large' },
1002
+ { name: 'Extra_large (16px)', value: 'extra_large' },
1003
+ ],
1004
+ default: 'medium',
1005
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1006
+ },
1007
+ {
1008
+ displayName: '背景样式',
1009
+ name: 'background_style',
1010
+ type: 'options',
1011
+ options: [{ name: 'Default', value: 'default' }, { name: 'Grey', value: 'grey' }],
1012
+ default: 'default',
1013
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1014
+ },
1015
+ {
1016
+ displayName: '显示边框',
1017
+ name: 'has_border',
1018
+ type: 'boolean',
1019
+ default: true,
1020
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1021
+ },
1022
+ {
1023
+ displayName: '边框颜色',
1024
+ name: 'border_color',
1025
+ type: 'options',
1026
+ options: [{ name: 'Grey', value: 'grey' }],
1027
+ default: 'grey',
1028
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1029
+ },
1030
+ {
1031
+ displayName: '内边距',
1032
+ name: 'padding',
1033
+ type: 'string',
1034
+ default: '4px 12px 4px 12px',
1035
+ placeholder: '4px 12px 4px 12px',
1036
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1037
+ },
1038
+ {
1039
+ displayName: '圆角',
1040
+ name: 'corner_radius',
1041
+ type: 'string',
1042
+ default: '8px',
1043
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1044
+ },
1045
+ {
1046
+ displayName: '容器宽度',
1047
+ name: 'container_width',
1048
+ type: 'options',
1049
+ options: [{ name: 'Fill', value: 'fill' }, { name: 'Auto', value: 'auto' }],
1050
+ default: 'fill',
1051
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1052
+ },
1053
+ {
1054
+ displayName: '排列方向',
1055
+ name: 'direction',
1056
+ type: 'options',
1057
+ options: [{ name: '垂直', value: 'vertical' }, { name: '水平', value: 'horizontal' }],
1058
+ default: 'vertical',
1059
+ displayOptions: { show: { elementType: ['interactive_container'] } },
1060
+ },
1061
+ ],
1062
+ },
364
1063
  {
365
1064
  displayName: '卡片 JSON',
366
1065
  name: 'cardJson',
@@ -411,6 +1110,19 @@ class FeishuCustomBot {
411
1110
  cardButtonText: this.getNodeParameter('cardButtonText', i, ''),
412
1111
  cardButtonUrl: this.getNodeParameter('cardButtonUrl', i, ''),
413
1112
  cardJson: this.getNodeParameter('cardJson', i, ''),
1113
+ card2_config_summary: this.getNodeParameter('card2_config_summary', i, ''),
1114
+ card2_config_width_mode: this.getNodeParameter('card2_config_width_mode', i, 'default'),
1115
+ card2_config_enable_forward: this.getNodeParameter('card2_config_enable_forward', i, true),
1116
+ card2_card_link_url: this.getNodeParameter('card2_card_link_url', i, ''),
1117
+ card2_card_link_pc_url: this.getNodeParameter('card2_card_link_pc_url', i, ''),
1118
+ card2_card_link_ios_url: this.getNodeParameter('card2_card_link_ios_url', i, ''),
1119
+ card2_card_link_android_url: this.getNodeParameter('card2_card_link_android_url', i, ''),
1120
+ card2_header_title: this.getNodeParameter('card2_header_title', i, ''),
1121
+ card2_header_subtitle: this.getNodeParameter('card2_header_subtitle', i, ''),
1122
+ card2_header_template: this.getNodeParameter('card2_header_template', i, 'default'),
1123
+ card2_body_direction: this.getNodeParameter('card2_body_direction', i, 'vertical'),
1124
+ card2_body_padding: this.getNodeParameter('card2_body_padding', i, ''),
1125
+ card2_body_elements: this.getNodeParameter('card2_body_elements', i, []),
414
1126
  };
415
1127
  let body = buildRequestBody(messageType, params);
416
1128
  if (signSecret) {