zzz-pc-view 0.0.53 → 0.0.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
@@ -183,6 +183,13 @@ export declare class CurdApi<T extends object = object, P extends PaginationResp
183
183
  * @returns {Promise<any>} - 返回一个包含导出结果的Promise。
184
184
  */
185
185
  export(query?: T | Reactive<T>): httpRequest.HttpRequestPromise<void>;
186
+ /**
187
+ * 生成 API 请求的完整路径。
188
+ * 该方法会将基础路径和可选的子路径拼接起来,形成一个完整的 API 请求路径。
189
+ * @param {string} [subpath=''] - 可选的子路径,默认为空字符串。
190
+ * @returns {string} - 返回拼接后的完整 API 请求路径。
191
+ */
192
+ protected getApiPath(subpath?: string): string;
186
193
  /**
187
194
  * 获取数据对象的ID。
188
195
  * @param {T} data - 包含ID的数据对象。
package/src/index.es.js CHANGED
@@ -3542,7 +3542,7 @@ class CurdApi {
3542
3542
  // 发起GET请求,获取列表数据
3543
3543
  api({
3544
3544
  // 构建请求URL,包括基础路径和查询参数
3545
- url: `${this.basePath}/list${stringify(query)}`,
3545
+ url: `${this.getApiPath("/list")}${stringify(query)}`,
3546
3546
  // 设置请求方法为GET
3547
3547
  method: "GET"
3548
3548
  }),
@@ -3577,7 +3577,7 @@ class CurdApi {
3577
3577
  return bindThenAjaxSource(
3578
3578
  api({
3579
3579
  // 构造请求 URL,包含基础路径
3580
- url: `${this.basePath}/page`,
3580
+ url: this.getApiPath("/page"),
3581
3581
  // 设置请求方法为 POST
3582
3582
  method: "POST",
3583
3583
  // 合并分页参数和查询参数
@@ -3597,7 +3597,7 @@ class CurdApi {
3597
3597
  return bindThenAjaxSource(
3598
3598
  // 使用 api 函数创建一个API请求配置对象,设置请求的URL和方法
3599
3599
  api({
3600
- url: `${this.basePath}/${this.getId(data)}`,
3600
+ url: `${this.getApiPath()}/${this.getId(data)}`,
3601
3601
  method: "GET"
3602
3602
  }),
3603
3603
  // 在请求成功后,将返回的数据绑定到目标类,并返回绑定后的对象
@@ -3626,7 +3626,7 @@ class CurdApi {
3626
3626
  }
3627
3627
  return api({
3628
3628
  // 构造请求 URL,包含基础路径
3629
- url: `${this.basePath}`,
3629
+ url: this.getApiPath(),
3630
3630
  // 设置请求方法为根据 saveTypeId 获取的方法
3631
3631
  method: editTypeMap[saveTypeId].method,
3632
3632
  // 扩展请求参数
@@ -3641,7 +3641,7 @@ class CurdApi {
3641
3641
  delete(data) {
3642
3642
  return api({
3643
3643
  // 构造请求 URL,包含基础路径和数据的 ID
3644
- url: `${this.basePath}/${this.getId(data)}`,
3644
+ url: `${this.getApiPath()}/${this.getId(data)}`,
3645
3645
  // 设置请求方法为 DELETE
3646
3646
  method: "DELETE"
3647
3647
  });
@@ -3655,7 +3655,7 @@ class CurdApi {
3655
3655
  changeState(data, state) {
3656
3656
  return api({
3657
3657
  // 构造请求 URL,包含基础路径和状态路径
3658
- url: `${this.basePath}/state`,
3658
+ url: this.getApiPath("/state"),
3659
3659
  // 设置请求方法为 PUT
3660
3660
  method: "PUT",
3661
3661
  // 设置请求数据,包含数据的 ID 和新的状态值
@@ -3677,7 +3677,7 @@ class CurdApi {
3677
3677
  return bindThenAjaxSource(
3678
3678
  // 使用api方法发送一个POST请求到指定的URL,请求体为查询参数,响应类型为blob
3679
3679
  api({
3680
- url: `${this.basePath}/export`,
3680
+ url: this.getApiPath("/export"),
3681
3681
  method: "POST",
3682
3682
  data: query,
3683
3683
  responseType: "blob"
@@ -3689,6 +3689,15 @@ class CurdApi {
3689
3689
  }
3690
3690
  );
3691
3691
  }
3692
+ /**
3693
+ * 生成 API 请求的完整路径。
3694
+ * 该方法会将基础路径和可选的子路径拼接起来,形成一个完整的 API 请求路径。
3695
+ * @param {string} [subpath=''] - 可选的子路径,默认为空字符串。
3696
+ * @returns {string} - 返回拼接后的完整 API 请求路径。
3697
+ */
3698
+ getApiPath(subpath = "") {
3699
+ return `${this.basePath}${subpath}`;
3700
+ }
3692
3701
  /**
3693
3702
  * 获取数据对象的ID。
3694
3703
  * @param {T} data - 包含ID的数据对象。
@@ -11011,6 +11020,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11011
11020
  __name: "CurdFormOperatorView",
11012
11021
  props: {
11013
11022
  operatorComponents: {},
11023
+ size: {},
11014
11024
  viewHandler: {}
11015
11025
  },
11016
11026
  setup(__props) {
@@ -11028,6 +11038,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11028
11038
  disabled: _ctx.viewHandler.formDisabled || _ctx.viewHandler.formStepIndex === 0,
11029
11039
  type: "info",
11030
11040
  icon: "ArrowLeft",
11041
+ size: _ctx.size,
11031
11042
  plain: "",
11032
11043
  onClick: _cache[0] || (_cache[0] = ($event) => onStepBtnClick(-1))
11033
11044
  }, {
@@ -11035,10 +11046,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11035
11046
  createTextVNode("上一步")
11036
11047
  ])),
11037
11048
  _: 1
11038
- }, 8, ["disabled"]),
11049
+ }, 8, ["disabled", "size"]),
11039
11050
  createVNode(_component_el_button, {
11040
11051
  disabled: _ctx.viewHandler.formDisabled || _ctx.viewHandler.formStepIndex === _ctx.viewHandler.displayStepFormItemsGroup.length - 1,
11041
11052
  type: "info",
11053
+ size: _ctx.size,
11042
11054
  plain: "",
11043
11055
  onClick: _cache[1] || (_cache[1] = ($event) => onStepBtnClick(1))
11044
11056
  }, {
@@ -11052,7 +11064,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11052
11064
  })
11053
11065
  ]),
11054
11066
  _: 1
11055
- }, 8, ["disabled"])
11067
+ }, 8, ["disabled", "size"])
11056
11068
  ], 64)) : createCommentVNode("", true),
11057
11069
  Array.isArray(_ctx.operatorComponents) ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.operatorComponents, (operatorComponent, index2) => {
11058
11070
  return openBlock(), createBlock(resolveDynamicComponent(operatorComponent), {
@@ -11064,6 +11076,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11064
11076
  key: 2,
11065
11077
  disabled: _ctx.viewHandler.formDisabled || _ctx.viewHandler.formStepIndex !== _ctx.viewHandler.displayStepFormItemsGroup.length - 1,
11066
11078
  icon: "SaveSvg",
11079
+ size: _ctx.size,
11067
11080
  type: "primary",
11068
11081
  onClick: _ctx.viewHandler.onSaveBtnClick
11069
11082
  }, {
@@ -11071,11 +11084,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11071
11084
  createTextVNode("保存")
11072
11085
  ])),
11073
11086
  _: 1
11074
- }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
11087
+ }, 8, ["disabled", "size", "onClick"])) : createCommentVNode("", true),
11075
11088
  _ctx.viewHandler.editType.id === unref(ZDecorators).CurdKey.EditTypeEnum.CREATE ? (openBlock(), createBlock(_component_el_button, {
11076
11089
  key: 3,
11077
11090
  disabled: _ctx.viewHandler.formDisabled || _ctx.viewHandler.formStepIndex !== _ctx.viewHandler.displayStepFormItemsGroup.length - 1,
11078
11091
  icon: "SaveContinueSvg",
11092
+ size: _ctx.size,
11079
11093
  type: "success",
11080
11094
  plain: "",
11081
11095
  onClick: _ctx.viewHandler.onSaveContinueBtnClick
@@ -11084,7 +11098,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11084
11098
  createTextVNode("保存并继续")
11085
11099
  ])),
11086
11100
  _: 1
11087
- }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
11101
+ }, 8, ["disabled", "size", "onClick"])) : createCommentVNode("", true),
11088
11102
  createVNode(_component_el_button, {
11089
11103
  disabled: _ctx.viewHandler.saveEditorDataLoadStatus,
11090
11104
  icon: "Close",
@@ -11102,6 +11116,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11102
11116
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
11103
11117
  __name: "SelectView",
11104
11118
  props: {
11119
+ descKey: {},
11105
11120
  options: {},
11106
11121
  primaryKey: {},
11107
11122
  nameKey: {},
@@ -11123,9 +11138,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
11123
11138
  (openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item) => {
11124
11139
  return openBlock(), createBlock(_component_el_option, {
11125
11140
  key: item[_ctx.primaryKey],
11141
+ title: _ctx.descKey ? item[_ctx.descKey] ?? "" : "",
11126
11142
  label: item[_ctx.nameKey],
11127
11143
  value: item[_ctx.primaryKey]
11128
- }, null, 8, ["label", "value"]);
11144
+ }, null, 8, ["title", "label", "value"]);
11129
11145
  }), 128))
11130
11146
  ]),
11131
11147
  _: 1
@@ -11366,6 +11382,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
11366
11382
  footer: withCtx(() => [
11367
11383
  createVNode(_sfc_main$f, {
11368
11384
  "view-handler": _ctx.viewHandler,
11385
+ size: "large",
11369
11386
  class: "align-left"
11370
11387
  }, null, 8, ["view-handler"])
11371
11388
  ]),