yc-pro-components 0.0.74 → 0.0.76

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 (46) hide show
  1. package/es/components/form-item/src/index.vue2.mjs +2 -2
  2. package/es/components/table/src/table-title-bar.vue.mjs +1 -1
  3. package/es/components/table/src/table-title-bar.vue2.mjs +79 -40
  4. package/es/components/table/src/type.d.ts +17 -0
  5. package/es/components/yc-drawer/src/index.vue.mjs +1 -1
  6. package/es/components/yc-drawer/src/index.vue2.mjs +2 -3
  7. package/es/index.css +11 -9
  8. package/es/version.d.ts +1 -1
  9. package/es/version.mjs +1 -1
  10. package/es/yc-components/version.d.ts +1 -1
  11. package/index.js +86 -48
  12. package/index.min.css +3 -1
  13. package/index.min.js +11 -11
  14. package/index.min.mjs +11 -11
  15. package/index.mjs +87 -49
  16. package/lib/components/form-item/src/index.vue2.js +2 -2
  17. package/lib/components/table/src/table-title-bar.vue.js +1 -1
  18. package/lib/components/table/src/table-title-bar.vue2.js +78 -39
  19. package/lib/components/table/src/type.d.ts +17 -0
  20. package/lib/components/yc-drawer/src/index.vue.js +1 -1
  21. package/lib/components/yc-drawer/src/index.vue2.js +2 -3
  22. package/lib/index.css +12 -10
  23. package/lib/version.d.ts +1 -1
  24. package/lib/version.js +1 -1
  25. package/lib/yc-components/version.d.ts +1 -1
  26. package/locale/en.js +1 -1
  27. package/locale/en.min.js +1 -1
  28. package/locale/en.min.mjs +1 -1
  29. package/locale/en.mjs +1 -1
  30. package/locale/ja.js +1 -1
  31. package/locale/ja.min.js +1 -1
  32. package/locale/ja.min.mjs +1 -1
  33. package/locale/ja.mjs +1 -1
  34. package/locale/ko.js +1 -1
  35. package/locale/ko.min.js +1 -1
  36. package/locale/ko.min.mjs +1 -1
  37. package/locale/ko.mjs +1 -1
  38. package/locale/zh-cn.js +1 -1
  39. package/locale/zh-cn.min.js +1 -1
  40. package/locale/zh-cn.min.mjs +1 -1
  41. package/locale/zh-cn.mjs +1 -1
  42. package/locale/zh-tw.js +1 -1
  43. package/locale/zh-tw.min.js +1 -1
  44. package/locale/zh-tw.min.mjs +1 -1
  45. package/locale/zh-tw.mjs +1 -1
  46. package/package.json +1 -1
@@ -229,7 +229,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
229
229
  ref: formItemInstance,
230
230
  label: _ctx.hasLabel ? labelValue.value : "",
231
231
  prop: _ctx.prop,
232
- class: "plus-form-item"
232
+ class: ["plus-form-item", { "plus-form-item--no-label": !_ctx.hasLabel }]
233
233
  }, customFormItemProps.value, {
234
234
  "label-width": _ctx.hasLabel ? (_a = customFormItemProps.value) == null ? void 0 : _a.labelWidth : "0px"
235
235
  }), createSlots({
@@ -637,7 +637,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
637
637
  ]),
638
638
  key: "1"
639
639
  } : void 0
640
- ]), 1040, ["label", "prop", "label-width"])) : createCommentVNode("v-if", true);
640
+ ]), 1040, ["label", "prop", "class", "label-width"])) : createCommentVNode("v-if", true);
641
641
  };
642
642
  }
643
643
  });
@@ -1,6 +1,6 @@
1
1
  import _sfc_main from './table-title-bar.vue2.mjs';
2
2
  import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
3
 
4
- var PlusTableTitleBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "table-title-bar.vue"]]);
4
+ var PlusTableTitleBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d1506155"], ["__file", "table-title-bar.vue"]]);
5
5
 
6
6
  export { PlusTableTitleBar as default };
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, reactive, watch, onMounted, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createVNode, unref, withCtx, createCommentVNode, createBlock, Fragment, renderList, mergeProps, withModifiers } from 'vue';
1
+ import { defineComponent, ref, computed, reactive, watch, onMounted, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createVNode, unref, withCtx, createCommentVNode, createBlock, Fragment, renderList, withModifiers, mergeProps, pushScopeId, popScopeId } from 'vue';
2
2
  import { RefreshRight, Setting } from '@element-plus/icons-vue';
3
3
  import { PlusPopover } from '../../popover/index.mjs';
4
4
  import { versionIsLessThan299, versionIsLessThan260, getTableKey, getLabel } from '../../utils/index.mjs';
@@ -7,11 +7,12 @@ import Sortable from 'sortablejs';
7
7
  import { ElTooltip, ElIcon, ElButton, ElCheckbox, ElLink, ElCheckboxGroup } from 'element-plus';
8
8
  import { isPlainObject } from '../../utils/is.mjs';
9
9
 
10
+ const _withScopeId = (n) => (pushScopeId("data-v-d1506155"), n = n(), popScopeId(), n);
10
11
  const _hoisted_1 = { class: "plus-table-title-bar" };
11
12
  const _hoisted_2 = { class: "plus-table-title-bar__title" };
12
13
  const _hoisted_3 = { class: "plus-table-title-bar__toolbar" };
13
14
  const _hoisted_4 = { class: "plus-table-title-bar__toolbar__density" };
14
- const _hoisted_5 = /* @__PURE__ */ createElementVNode(
15
+ const _hoisted_5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode(
15
16
  "svg",
16
17
  {
17
18
  viewBox: "0 0 1024 1024",
@@ -25,14 +26,15 @@ const _hoisted_5 = /* @__PURE__ */ createElementVNode(
25
26
  ],
26
27
  -1
27
28
  /* HOISTED */
28
- );
29
+ ));
29
30
  const _hoisted_6 = { class: "plus-table-checkbox-checkAll" };
30
- const _hoisted_7 = {
31
+ const _hoisted_7 = { class: "plus-table-checkbox-actions" };
32
+ const _hoisted_8 = {
31
33
  key: 0,
32
34
  class: "plus-table-checkbox-handle"
33
35
  };
34
- const _hoisted_8 = { key: 1 };
35
36
  const _hoisted_9 = { key: 1 };
37
+ const _hoisted_10 = { key: 1 };
36
38
  var _sfc_main = /* @__PURE__ */ defineComponent({
37
39
  ...{
38
40
  name: "PlusTableToolbar"
@@ -72,6 +74,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
72
74
  var _a;
73
75
  return ((_a = columnSetting.value) == null ? void 0 : _a.overflowLabelLength) || 6;
74
76
  });
77
+ const confirmTextValue = computed(
78
+ () => {
79
+ var _a;
80
+ return ((_a = columnSetting.value) == null ? void 0 : _a.confirmText) || String(t("plus.table.confirmText"));
81
+ }
82
+ );
75
83
  const sortable = ref(null);
76
84
  const buttonNameDensity = [
77
85
  {
@@ -93,6 +101,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
93
101
  }
94
102
  return props.columns.filter((item) => unref(item.headerIsChecked) !== false).map((item) => getTableKey(item));
95
103
  };
104
+ const buildFilterColumns = () => {
105
+ return props.columns.map((item) => {
106
+ if (state.checkList.includes(getTableKey(item))) {
107
+ return { ...item, headerIsChecked: true };
108
+ }
109
+ return { ...item, headerIsChecked: false };
110
+ });
111
+ };
112
+ const buildConfirmPayload = () => {
113
+ const columns = buildFilterColumns();
114
+ const order = columns.map((item) => String(item.prop || "")).filter(Boolean);
115
+ const checked = columns.filter((item) => item.headerIsChecked !== false).map((item) => String(item.prop || "")).filter(Boolean);
116
+ return { columns, order, checked };
117
+ };
96
118
  const state = reactive({
97
119
  checkAll: true,
98
120
  isIndeterminate: false,
@@ -121,13 +143,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
121
143
  handleFilterTableConfirm("allCheck");
122
144
  };
123
145
  const handleFilterTableConfirm = (type) => {
124
- const filterColumns = props.columns.map((item) => {
125
- if (state.checkList.includes(getTableKey(item))) {
126
- return { ...item, headerIsChecked: true };
127
- }
128
- return { ...item, headerIsChecked: false };
129
- });
130
- emit("filterTableHeader", filterColumns, type);
146
+ emit("filterTableHeader", buildFilterColumns(), type);
147
+ };
148
+ const handleConfirmClick = async () => {
149
+ var _a, _b;
150
+ await ((_b = (_a = columnSetting.value) == null ? void 0 : _a.onConfirm) == null ? void 0 : _b.call(_a, buildConfirmPayload()));
131
151
  };
132
152
  const handleCheckGroupChange = (value) => {
133
153
  setCheckAllState(value);
@@ -192,10 +212,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
192
212
  1
193
213
  /* TEXT */
194
214
  )
195
- ])
215
+ ], true)
196
216
  ]),
197
217
  createElementVNode("div", _hoisted_3, [
198
- renderSlot(_ctx.$slots, "toolbar"),
218
+ renderSlot(_ctx.$slots, "toolbar", {}, void 0, true),
199
219
  ((_a = titleBarConfig.value) == null ? void 0 : _a.refresh) === true ? (openBlock(), createElementBlock("span", {
200
220
  key: 0,
201
221
  class: "plus-table-title-bar__toolbar__refresh",
@@ -219,7 +239,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
219
239
  _: 1
220
240
  /* STABLE */
221
241
  }, 8, ["size", "color"])
222
- ])
242
+ ], true)
223
243
  ]),
224
244
  _: 3
225
245
  /* FORWARDED */
@@ -252,7 +272,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
252
272
  _: 1
253
273
  /* STABLE */
254
274
  }, 8, ["size", "color"])
255
- ])
275
+ ], true)
256
276
  ]),
257
277
  _: 3
258
278
  /* FORWARDED */
@@ -317,14 +337,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
317
337
  _: 1
318
338
  /* STABLE */
319
339
  }, 8, ["size", "color"])
320
- ])
340
+ ], true)
321
341
  ]),
322
342
  _: 3
323
343
  /* FORWARDED */
324
344
  }, 8, ["content"])
325
345
  ]),
326
346
  default: withCtx(() => {
327
- var _a2, _b2, _c2;
347
+ var _a2, _b2, _c2, _d;
328
348
  return [
329
349
  createElementVNode("div", _hoisted_6, [
330
350
  createVNode(unref(ElCheckbox), {
@@ -343,24 +363,43 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
343
363
  _: 1
344
364
  /* STABLE */
345
365
  }, 8, ["modelValue", "indeterminate"]),
346
- ((_a2 = columnSetting.value) == null ? void 0 : _a2.reset) !== false ? (openBlock(), createBlock(unref(ElLink), mergeProps({
347
- key: 0,
348
- type: "primary",
349
- underline: unref(versionIsLessThan299) ? false : "never",
350
- href: "javaScript:;"
351
- }, unref(isPlainObject)((_b2 = columnSetting.value) == null ? void 0 : _b2.reset) ? (_c2 = columnSetting.value) == null ? void 0 : _c2.reset : {}, {
352
- onClick: withModifiers(resetCheckBoxList, ["stop", "prevent"])
353
- }), {
354
- default: withCtx(() => [
355
- createTextVNode(
356
- toDisplayString(unref(t)("plus.table.resetText")),
357
- 1
358
- /* TEXT */
359
- )
360
- ]),
361
- _: 1
362
- /* STABLE */
363
- }, 16, ["underline"])) : createCommentVNode("v-if", true)
366
+ createElementVNode("div", _hoisted_7, [
367
+ ((_a2 = columnSetting.value) == null ? void 0 : _a2.confirm) ? (openBlock(), createBlock(unref(ElLink), {
368
+ key: 0,
369
+ type: "primary",
370
+ underline: unref(versionIsLessThan299) ? false : "never",
371
+ href: "javaScript:;",
372
+ onClick: withModifiers(handleConfirmClick, ["stop", "prevent"])
373
+ }, {
374
+ default: withCtx(() => [
375
+ createTextVNode(
376
+ toDisplayString(confirmTextValue.value),
377
+ 1
378
+ /* TEXT */
379
+ )
380
+ ]),
381
+ _: 1
382
+ /* STABLE */
383
+ }, 8, ["underline"])) : createCommentVNode("v-if", true),
384
+ ((_b2 = columnSetting.value) == null ? void 0 : _b2.reset) !== false ? (openBlock(), createBlock(unref(ElLink), mergeProps({
385
+ key: 1,
386
+ type: "primary",
387
+ underline: unref(versionIsLessThan299) ? false : "never",
388
+ href: "javaScript:;"
389
+ }, unref(isPlainObject)((_c2 = columnSetting.value) == null ? void 0 : _c2.reset) ? (_d = columnSetting.value) == null ? void 0 : _d.reset : {}, {
390
+ onClick: withModifiers(resetCheckBoxList, ["stop", "prevent"])
391
+ }), {
392
+ default: withCtx(() => [
393
+ createTextVNode(
394
+ toDisplayString(unref(t)("plus.table.resetText")),
395
+ 1
396
+ /* TEXT */
397
+ )
398
+ ]),
399
+ _: 1
400
+ /* STABLE */
401
+ }, 16, ["underline"])) : createCommentVNode("v-if", true)
402
+ ])
364
403
  ]),
365
404
  createVNode(unref(ElCheckboxGroup), {
366
405
  modelValue: state.checkList,
@@ -385,10 +424,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
385
424
  key: item.prop,
386
425
  class: "plus-table-checkbox-item"
387
426
  }, [
388
- ((_a3 = columnSetting.value) == null ? void 0 : _a3.dragSort) !== false ? (openBlock(), createElementBlock("div", _hoisted_7, [
427
+ ((_a3 = columnSetting.value) == null ? void 0 : _a3.dragSort) !== false ? (openBlock(), createElementBlock("div", _hoisted_8, [
389
428
  renderSlot(_ctx.$slots, "drag-sort-icon", {}, () => [
390
429
  createTextVNode("\u2637")
391
- ])
430
+ ], true)
392
431
  ])) : createCommentVNode("v-if", true),
393
432
  createCommentVNode(" element-plus \u7248\u672C\u53F7\u5C0F\u4E8E2.6.0 "),
394
433
  unref(versionIsLessThan260) ? (openBlock(), createBlock(unref(ElCheckbox), {
@@ -414,7 +453,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
414
453
  /* DYNAMIC */
415
454
  }, 1032, ["content"])) : (openBlock(), createElementBlock(
416
455
  "span",
417
- _hoisted_8,
456
+ _hoisted_9,
418
457
  toDisplayString(item.label ? getLabelValue(item.label) : ""),
419
458
  1
420
459
  /* TEXT */
@@ -449,7 +488,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
449
488
  /* DYNAMIC */
450
489
  }, 1032, ["content"])) : (openBlock(), createElementBlock(
451
490
  "span",
452
- _hoisted_9,
491
+ _hoisted_10,
453
492
  toDisplayString(item.label ? getLabelValue(item.label) : ""),
454
493
  1
455
494
  /* TEXT */
@@ -322,6 +322,14 @@ export interface PlusTableState {
322
322
  * 列设置类型
323
323
  * @version v0.1.20 新增reset,默认:true
324
324
  */
325
+ /**
326
+ * 列设置确认回调 payload
327
+ */
328
+ export type ColumnSettingConfirmPayload = {
329
+ columns: PlusColumn[];
330
+ order: string[];
331
+ checked: string[];
332
+ };
325
333
  export type ColumnSetting = {
326
334
  dragSort?: boolean | Partial<SortableOptions>;
327
335
  /**
@@ -342,6 +350,15 @@ export type ColumnSetting = {
342
350
  * @default 6
343
351
  */
344
352
  overflowLabelLength?: number;
353
+ /**
354
+ * 是否显示「确认」按钮;默认 false 不展示
355
+ * 不影响勾选/拖拽/重置的即时生效行为,点击确认仅触发 onConfirm 回调(如发起保存请求)
356
+ */
357
+ confirm?: boolean;
358
+ /** 确认按钮文案 */
359
+ confirmText?: string;
360
+ /** 点击确认时回调,payload 为当前列设置快照 */
361
+ onConfirm?: (payload: ColumnSettingConfirmPayload) => void | Promise<void>;
345
362
  };
346
363
  /**
347
364
  * 标题栏
@@ -1,6 +1,6 @@
1
1
  import _sfc_main from './index.vue2.mjs';
2
2
  import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
3
 
4
- var YcDrawerComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-eb9ddafc"], ["__file", "index.vue"]]);
4
+ var YcDrawerComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-80cac14a"], ["__file", "index.vue"]]);
5
5
 
6
6
  export { YcDrawerComponent as default };
@@ -4,8 +4,7 @@ import { Close } from '@element-plus/icons-vue';
4
4
  import { drawerStore, claimDrawerInstance, releaseDrawerInstance, closeDrawer } from '../store.mjs';
5
5
  import { DictStoreInjectionKey } from '../../../constants/dict.mjs';
6
6
 
7
- const import_meta = {};
8
- const _withScopeId = (n) => (pushScopeId("data-v-eb9ddafc"), n = n(), popScopeId(), n);
7
+ const _withScopeId = (n) => (pushScopeId("data-v-80cac14a"), n = n(), popScopeId(), n);
9
8
  const _hoisted_1 = { class: "custom-drawer-header" };
10
9
  const _hoisted_2 = { class: "header-content" };
11
10
  const _hoisted_3 = ["id"];
@@ -24,7 +23,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
24
23
  __name: "index",
25
24
  setup(__props) {
26
25
  const shouldRender = claimDrawerInstance();
27
- if (!shouldRender && import_meta.env.DEV) {
26
+ if (!shouldRender && process.env.NODE_ENV !== "production") {
28
27
  console.warn(
29
28
  "[YcDrawer] Multiple <YcDrawer /> instances detected. Only the first instance renders drawers. Remove duplicate <YcDrawer /> from your component \u2014 it only needs to be placed once in the root App."
30
29
  );