dsh-lark-bot 0.15.6 → 0.15.7

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.
package/dist/cli.js CHANGED
@@ -3950,7 +3950,19 @@ function renderApprovalCard(input) {
3950
3950
  body: {
3951
3951
  elements: [
3952
3952
  { tag: "markdown", content: markdown2 },
3953
- { tag: "action", actions }
3953
+ ...actions.length > 0 ? [
3954
+ {
3955
+ tag: "column_set",
3956
+ flex_mode: "none",
3957
+ horizontal_spacing: "default",
3958
+ columns: actions.map((button2) => ({
3959
+ tag: "column",
3960
+ width: "auto",
3961
+ vertical_align: "center",
3962
+ elements: [button2]
3963
+ }))
3964
+ }
3965
+ ] : []
3954
3966
  ]
3955
3967
  }
3956
3968
  };
@@ -3993,15 +4005,18 @@ function renderQuestionCard(input) {
3993
4005
  body: {
3994
4006
  elements: [
3995
4007
  { tag: "markdown", content: `\u2753 ${input.question}` },
3996
- formElement(input),
3997
4008
  {
3998
- tag: "action",
3999
- actions: [
4009
+ tag: "form",
4010
+ name: `form-${input.id}`,
4011
+ elements: [
4012
+ formElement(input),
4000
4013
  {
4001
4014
  tag: "button",
4002
4015
  text: { tag: "plain_text", content: "\u63D0\u4EA4" },
4003
4016
  type: "primary",
4004
- value: { cmd: "question-submit", id: input.id }
4017
+ value: { cmd: "question-submit", id: input.id },
4018
+ form_action_type: "submit",
4019
+ name: `btn-submit-${input.id}`
4005
4020
  }
4006
4021
  ]
4007
4022
  }
@@ -5249,8 +5264,18 @@ function button(text, value, type = "default") {
5249
5264
  value
5250
5265
  };
5251
5266
  }
5252
- function actionRow(actions) {
5253
- return { tag: "action", actions };
5267
+ function buttonRow(buttons) {
5268
+ return {
5269
+ tag: "column_set",
5270
+ flex_mode: "none",
5271
+ horizontal_spacing: "default",
5272
+ columns: buttons.map((button2) => ({
5273
+ tag: "column",
5274
+ width: "auto",
5275
+ vertical_align: "center",
5276
+ elements: [button2]
5277
+ }))
5278
+ };
5254
5279
  }
5255
5280
  function wizardValue(flow, step, extra) {
5256
5281
  return { cmd: "wizard", flow, step, ...extra };
@@ -5281,22 +5306,22 @@ function renderConfigHubCard(input) {
5281
5306
  `dsh \u9ED8\u8BA4\u6A21\u578B\uFF1A${defaultLine}`
5282
5307
  ].join("\n")
5283
5308
  },
5284
- actionRow([
5309
+ buttonRow([
5285
5310
  button("\u2795 \u6DFB\u52A0 Provider", { cmd: "cfg", action: "provider-add" }, "primary"),
5286
5311
  button("\u270F\uFE0F \u4FEE\u6539 Provider", { cmd: "cfg", action: "provider-update" }),
5287
5312
  button("\u{1F5D1} \u5220\u9664 Provider", { cmd: "cfg", action: "provider-remove" }, "danger")
5288
5313
  ]),
5289
- actionRow([
5314
+ buttonRow([
5290
5315
  button("\u{1F9E0} \u6DFB\u52A0\u6A21\u578B", { cmd: "cfg", action: "model-add" }),
5291
5316
  button("\u274C \u5220\u9664\u6A21\u578B", { cmd: "cfg", action: "model-remove" }, "danger"),
5292
5317
  button("\u{1F3AF} \u5207\u6362\u6A21\u578B", { cmd: "cfg", action: "model-use" })
5293
5318
  ]),
5294
- actionRow([
5319
+ buttonRow([
5295
5320
  button("\u{1F3E0} \u8BBE\u7F6E\u9ED8\u8BA4\u6A21\u578B", { cmd: "cfg", action: "model-default" }),
5296
5321
  button("\u{1F511} \u8BBE\u7F6E\u51ED\u636E", { cmd: "cfg", action: "key-set" }),
5297
5322
  button("\u{1F513} \u5220\u9664\u51ED\u636E", { cmd: "cfg", action: "key-remove" }, "danger")
5298
5323
  ]),
5299
- actionRow([
5324
+ buttonRow([
5300
5325
  button("\u{1F504} \u5237\u65B0", { cmd: "cfg", action: "refresh" }),
5301
5326
  button("\u2716\uFE0F \u5173\u95ED", { cmd: "cfg", action: "dismiss" })
5302
5327
  ])
@@ -5309,13 +5334,14 @@ function renderWizardOptionsCard(input) {
5309
5334
  const rows = [];
5310
5335
  for (let index = 0; index < input.options.length; index += 3) {
5311
5336
  rows.push(
5312
- actionRow(
5337
+ buttonRow(
5313
5338
  input.options.slice(index, index + 3).map(
5314
5339
  (option, offset) => button(option.label, wizardValue(input.flow, input.step, { choose: index + offset }))
5315
5340
  )
5316
5341
  )
5317
5342
  );
5318
5343
  }
5344
+ rows.push(buttonRow([cancel]));
5319
5345
  return {
5320
5346
  schema: "2.0",
5321
5347
  config: {
@@ -5328,8 +5354,7 @@ function renderWizardOptionsCard(input) {
5328
5354
  content: [input.question, input.hint ? `
5329
5355
  ${input.hint}` : ""].join("")
5330
5356
  },
5331
- ...rows,
5332
- actionRow([cancel])
5357
+ ...rows
5333
5358
  ]
5334
5359
  }
5335
5360
  };
@@ -5348,14 +5373,23 @@ function renderWizardTextStepCard(input) {
5348
5373
  ${input.hint}` : ""].join("")
5349
5374
  },
5350
5375
  {
5351
- tag: "input",
5352
- name: "answer",
5353
- placeholder: { tag: "plain_text", content: input.placeholder ?? "\u8BF7\u8F93\u5165\u2026" }
5376
+ tag: "form",
5377
+ name: `form-${input.flow}-${input.step}`,
5378
+ elements: [
5379
+ {
5380
+ tag: "input",
5381
+ name: "answer",
5382
+ ...input.required === true ? { required: true } : {},
5383
+ placeholder: { tag: "plain_text", content: input.placeholder ?? "\u8BF7\u8F93\u5165\u2026" }
5384
+ },
5385
+ {
5386
+ ...button("\u63D0\u4EA4", wizardValue(input.flow, input.step, { submit: true }), "primary"),
5387
+ form_action_type: "submit",
5388
+ name: `btn-submit-${input.flow}-${input.step}`
5389
+ }
5390
+ ]
5354
5391
  },
5355
- actionRow([
5356
- button("\u63D0\u4EA4", wizardValue(input.flow, input.step, { submit: true }), "primary"),
5357
- button("\u53D6\u6D88", wizardValue(input.flow, input.step, { cancel: true }))
5358
- ])
5392
+ button("\u53D6\u6D88", wizardValue(input.flow, input.step, { cancel: true }))
5359
5393
  ]
5360
5394
  }
5361
5395
  };
@@ -5374,7 +5408,7 @@ function renderWizardConfirmStepCard(input) {
5374
5408
 
5375
5409
  ${input.summary}`
5376
5410
  },
5377
- actionRow([
5411
+ buttonRow([
5378
5412
  button(input.confirmLabel ?? "\u2705 \u786E\u8BA4", wizardValue(input.flow, input.step, { confirm: true }), "primary"),
5379
5413
  button("\u53D6\u6D88", wizardValue(input.flow, input.step, { cancel: true }))
5380
5414
  ])
@@ -5991,6 +6025,7 @@ ${labels}
5991
6025
  flow: flow.id,
5992
6026
  step: state.step,
5993
6027
  question: step.question,
6028
+ ...step.optional === true ? {} : { required: true },
5994
6029
  ...step.placeholder === void 0 ? {} : { placeholder: step.placeholder },
5995
6030
  ...step.hint === void 0 ? {} : { hint: step.hint }
5996
6031
  })