@qin-ui/element-plus-pro 1.3.2 → 1.3.4

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 (48) hide show
  1. package/AI-CONTEXT.md +4 -4
  2. package/README.md +3 -2
  3. package/api.json +3 -3
  4. package/es/components/component-provider/constants/index.d.ts.map +1 -1
  5. package/es/components/component-provider/types/index.d.ts +2 -1
  6. package/es/components/component-provider/types/index.d.ts.map +1 -1
  7. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  8. package/es/components/form/components/BaseFormItem/index.vue.d.ts +1 -1
  9. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  10. package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
  11. package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -1
  12. package/es/components/form/hooks/useForm.d.ts +3 -2
  13. package/es/components/form/hooks/useForm.d.ts.map +1 -1
  14. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  15. package/es/components/form/types/index.d.ts +2 -2
  16. package/es/components/form/types/index.d.ts.map +1 -1
  17. package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
  18. package/es/components/table/components/ProTable.vue.d.ts +30 -4
  19. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  20. package/es/components/table/components/SizeControl.vue.d.ts +2 -2
  21. package/es/components/table/index.d.ts +4 -28
  22. package/es/components/table/index.d.ts.map +1 -1
  23. package/es/components/table/useTable.d.ts +1 -1
  24. package/es/element-plus-pro.css +12 -12
  25. package/es/index.js +84 -67
  26. package/es/index.js.map +1 -1
  27. package/es/shared/core/index.d.ts +1 -2
  28. package/es/shared/core/index.d.ts.map +1 -1
  29. package/es/shared/ui/index.d.ts +2 -2
  30. package/es/shared/ui/index.d.ts.map +1 -1
  31. package/package.json +3 -3
  32. package/src/components/component-provider/constants/index.ts +12 -0
  33. package/src/components/component-provider/types/index.ts +7 -1
  34. package/src/components/form/components/BaseField/index.vue +14 -2
  35. package/src/components/form/components/BaseField/utils/index.ts +1 -1
  36. package/src/components/form/components/BaseFormItem/index.vue +4 -0
  37. package/src/components/form/components/ProForm/index.vue +7 -2
  38. package/src/components/form/components/SlotComponent/index.vue +4 -3
  39. package/src/components/form/hooks/useForm.ts +3 -2
  40. package/src/components/form/hooks/useGroupFieldAttrs.ts +2 -1
  41. package/src/components/form/types/index.ts +2 -8
  42. package/src/components/table/components/ColumnControl.vue +36 -35
  43. package/src/components/table/components/ProTable.vue +50 -2
  44. package/src/components/table/components/SearchForm.vue +1 -1
  45. package/src/components/table/index.ts +10 -30
  46. package/src/components/table/useTable.ts +1 -1
  47. package/src/shared/core/index.ts +1 -2
  48. package/src/shared/ui/index.ts +2 -0
package/es/index.js CHANGED
@@ -133,6 +133,18 @@ const INJECT_CONFIG = {
133
133
  injectionKey: Symbol(""),
134
134
  default: { style: { width: "100%" } }
135
135
  },
136
+ "date-picker.quarter": {
137
+ injectionKey: Symbol(""),
138
+ default: { style: { width: "100%" } }
139
+ },
140
+ "date-picker.quarters": {
141
+ injectionKey: Symbol(""),
142
+ default: { style: { width: "100%" } }
143
+ },
144
+ "date-picker.quarterrange": {
145
+ injectionKey: Symbol(""),
146
+ default: { style: { width: "100%" } }
147
+ },
136
148
  "date-picker.datetime": {
137
149
  injectionKey: Symbol(""),
138
150
  default: { style: { width: "100%" } }
@@ -212,6 +224,7 @@ const formItemPropKeys = Object.keys(formItemProps()).filter(
212
224
  const gridItemPropKeys = Object.keys(gridItemProps());
213
225
  const gridItemPropKeySet = new Set(gridItemPropKeys);
214
226
  const formItemPropKeySet = new Set(formItemPropKeys);
227
+ const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
215
228
  function useGroupFieldAttrs(validFields) {
216
229
  const config = INJECT_CONFIG["pro-form-item"];
217
230
  const injectFormItemProps = inject(config.injectionKey, config.default);
@@ -256,7 +269,7 @@ function useGroupFieldAttrs(validFields) {
256
269
  });
257
270
  Object.assign(componentProps, componentDataAttrs);
258
271
  Object.keys(slots).forEach((k) => {
259
- if (FORM_ITEM_SLOT_KEYS.includes(k)) {
272
+ if (formItemSlotKeySet.has(k)) {
260
273
  formItemSlots[k] = slots[k];
261
274
  } else {
262
275
  componentProps.slots[k] = slots[k];
@@ -324,6 +337,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
324
337
  raw.getFormItemComputedProps = () => formItemProps2;
325
338
  } else {
326
339
  formItemInstanceMap.delete(raw);
340
+ delete raw.getFormItemRef;
341
+ delete raw.getFormItemComputedProps;
327
342
  }
328
343
  };
329
344
  const setComponentRef = (field, el) => {
@@ -341,6 +356,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
341
356
  };
342
357
  } else {
343
358
  componentInstanceMap.delete(raw);
359
+ delete raw.getComponentRef;
360
+ delete raw.getComponentComputedProps;
344
361
  }
345
362
  };
346
363
  const groupedFields = useGroupFieldAttrs(validFields);
@@ -414,7 +431,7 @@ const _export_sfc = (sfc, props) => {
414
431
  }
415
432
  return target;
416
433
  };
417
- const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-e8f152ee"]]);
434
+ const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-42bb0876"]]);
418
435
  function useForm(...args) {
419
436
  return useForm$1(...args);
420
437
  }
@@ -570,6 +587,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
570
587
  newVal = setFormatter(val, oldVal);
571
588
  }
572
589
  (_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
590
+ const { onUpdateValue } = groupedAttrs.value;
591
+ if (typeof onUpdateValue === "function") {
592
+ onUpdateValue(val);
593
+ } else if (Array.isArray(onUpdateValue)) {
594
+ onUpdateValue.forEach((listener) => listener(val));
595
+ }
573
596
  }
574
597
  });
575
598
  const parentDisabled = useDisabledContext();
@@ -592,13 +615,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
592
615
  { disabled: effectiveDisabled },
593
616
  { modelProp: modelPropName }
594
617
  );
595
- const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, [modelPropName]: _modelVal, [`onUpdate:${modelPropName}`]: _onUpdateModelVal, ...bindAttrs } = mergedProps;
618
+ const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, [modelPropName]: _modelVal, [`onUpdate:${modelPropName}`]: onUpdateValue, ...bindAttrs } = mergedProps;
596
619
  return {
597
620
  attrs: bindAttrs,
598
621
  slots,
599
622
  componentContainer,
600
623
  modelProp: modelPropName,
601
- valueFormatter
624
+ valueFormatter,
625
+ onUpdateValue
602
626
  };
603
627
  });
604
628
  const formSlots = inject(InjectionFormSlotsKey, void 0);
@@ -906,7 +930,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
906
930
  };
907
931
  }
908
932
  });
909
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9c362a11"]]);
933
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a74f63bd"]]);
910
934
  const _sfc_main$8 = {};
911
935
  const _hoisted_1$4 = { class: "pro-table_search-form-container" };
912
936
  function _sfc_render$3(_ctx, _cache) {
@@ -1024,32 +1048,32 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1024
1048
  const { t } = useLocale();
1025
1049
  const checkAll = ref(false);
1026
1050
  const indeterminate = ref(false);
1027
- const getColumnKey = (column, index2) => {
1051
+ const getColumnKey = (column) => {
1028
1052
  const rawKey = column.key ?? column.prop;
1029
- if (rawKey === void 0 || rawKey === null) return `__col_${index2}`;
1053
+ if (rawKey === void 0 || rawKey === null || rawKey === "")
1054
+ return void 0;
1030
1055
  return normalizePathKey(rawKey);
1031
1056
  };
1032
1057
  const checkedColumnsOptions = computed(
1033
- () => props.columns.map((item, index2) => {
1058
+ () => props.columns.flatMap((item) => {
1034
1059
  var _a, _b, _c, _d, _e, _f;
1035
- const key = getColumnKey(item, index2);
1036
- const excluded = key === "__INDEX__" || item.type === "index" || ((_b = (_a = props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key));
1037
- const disabled = (_d = (_c = props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some(
1038
- (dk) => String(dk) === key
1039
- );
1060
+ const key = getColumnKey(item);
1061
+ if (key === void 0) return [];
1062
+ if (key === "__INDEX__" || item.type === "index" || ((_b = (_a = props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key)))
1063
+ return [];
1064
+ const disabled = ((_d = (_c = props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some((dk) => String(dk) === key)) ?? false;
1040
1065
  const rawTitle = item.label ?? item.title;
1041
1066
  const titleLabel = typeof rawTitle === "string" ? rawTitle : void 0;
1042
1067
  const propLabel = item.prop !== void 0 && item.prop !== null ? String(item.prop) : void 0;
1043
- const label = ((_f = (_e = props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? titleLabel ?? propLabel ?? key ?? t("table.columnFallback", { index: index2 + 1 });
1068
+ const label = ((_f = (_e = props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? titleLabel ?? propLabel ?? key;
1044
1069
  return {
1045
1070
  label,
1046
1071
  value: key,
1047
1072
  checked: !item.hidden || !!disabled,
1048
1073
  disabled: !!disabled,
1049
- column: item,
1050
- excluded
1074
+ column: item
1051
1075
  };
1052
- }).filter((item) => !item.excluded)
1076
+ })
1053
1077
  );
1054
1078
  const controllableOptions = computed(
1055
1079
  () => checkedColumnsOptions.value.filter((item) => !item.disabled)
@@ -1180,7 +1204,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1180
1204
  };
1181
1205
  }
1182
1206
  });
1183
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8c7ee12d"]]);
1207
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-a2cc0fcb"]]);
1184
1208
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1185
1209
  ...{ name: "TableColumnRenderer" },
1186
1210
  __name: "TableColumnRenderer",
@@ -1291,53 +1315,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1291
1315
  tableContainer: { type: [Object, Function, Boolean], default: void 0 },
1292
1316
  columns: { default: void 0 },
1293
1317
  data: { default: void 0 },
1294
- pagination: { type: [Boolean, Object], default: void 0 },
1295
- size: {},
1296
- width: {},
1297
- height: {},
1298
- maxHeight: {},
1299
- fit: { type: Boolean },
1300
- stripe: { type: Boolean },
1301
- border: { type: Boolean },
1302
- rowKey: {},
1303
- context: {},
1304
- showHeader: { type: Boolean },
1305
- showSummary: { type: Boolean },
1306
- sumText: {},
1307
- summaryMethod: {},
1308
- rowClassName: {},
1309
- rowStyle: {},
1310
- cellClassName: {},
1311
- cellStyle: {},
1312
- headerRowClassName: {},
1313
- headerRowStyle: {},
1314
- headerCellClassName: {},
1315
- headerCellStyle: {},
1316
- highlightCurrentRow: { type: Boolean },
1317
- currentRowKey: {},
1318
- emptyText: {},
1319
- expandRowKeys: {},
1320
- defaultExpandAll: { type: Boolean },
1321
- rowExpandable: {},
1322
- defaultSort: {},
1323
- tooltipEffect: {},
1324
- tooltipOptions: {},
1325
- spanMethod: {},
1326
- selectOnIndeterminate: { type: Boolean },
1327
- indent: {},
1328
- treeProps: {},
1329
- lazy: { type: Boolean },
1330
- load: {},
1331
- className: {},
1332
- style: { type: [Boolean, null, String, Object, Array] },
1333
- tableLayout: {},
1334
- scrollbarAlwaysOn: { type: Boolean },
1335
- flexible: { type: Boolean },
1336
- showOverflowTooltip: { type: [Boolean, Object] },
1337
- tooltipFormatter: {},
1338
- appendFilterPanelTo: {},
1339
- scrollbarTabindex: {},
1340
- nativeScrollbar: { type: Boolean }
1318
+ pagination: { type: [Boolean, Object], default: void 0 }
1341
1319
  }, {
1342
1320
  "size": {},
1343
1321
  "sizeModifiers": {},
@@ -1354,8 +1332,34 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1354
1332
  const injectPropsRaw = inject(config.injectionKey, config.default);
1355
1333
  const injectProps = computed(() => toValue(injectPropsRaw) || {});
1356
1334
  const attrs = useAttrs();
1335
+ const PRO_TABLE_EXCLUDED_ATTR_KEYS = /* @__PURE__ */ new Set([
1336
+ "class",
1337
+ "style",
1338
+ "onSearch",
1339
+ "onChange",
1340
+ "onUpdate:size",
1341
+ "onUpdate:loading",
1342
+ "data",
1343
+ "columns",
1344
+ "size",
1345
+ "pagination"
1346
+ ]);
1347
+ const PRO_TABLE_PROVIDER_KEYS = /* @__PURE__ */ new Set([
1348
+ "pagination",
1349
+ "searchFormConfig",
1350
+ "control",
1351
+ "immediateSearch",
1352
+ "addIndexColumn",
1353
+ "tableContainer"
1354
+ ]);
1357
1355
  const injectTableAttrs = computed(() => {
1358
- return pick(injectProps.value, tableProperties);
1356
+ const tableConfig = {};
1357
+ for (const [key, value] of Object.entries(injectProps.value)) {
1358
+ if (!PRO_TABLE_PROVIDER_KEYS.has(key)) {
1359
+ tableConfig[key] = value;
1360
+ }
1361
+ }
1362
+ return tableConfig;
1359
1363
  });
1360
1364
  const attrsTableProps = computed(() => {
1361
1365
  return pick(
@@ -1363,6 +1367,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1363
1367
  tableProperties
1364
1368
  );
1365
1369
  });
1370
+ const restTableAttrs = computed(() => {
1371
+ const rest = {};
1372
+ for (const [key, value] of Object.entries(attrs)) {
1373
+ if (!PRO_TABLE_EXCLUDED_ATTR_KEYS.has(key)) {
1374
+ rest[key] = value;
1375
+ }
1376
+ }
1377
+ return rest;
1378
+ });
1366
1379
  const size = useModel(__props, "size");
1367
1380
  const loading = useModel(__props, "loading");
1368
1381
  let searchSequence = 0;
@@ -1447,9 +1460,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1447
1460
  const computedTableProps = computed(() => {
1448
1461
  const merged = {
1449
1462
  ...injectTableAttrs.value,
1463
+ ...restTableAttrs.value,
1450
1464
  ...attrsTableProps.value
1451
1465
  };
1452
1466
  delete merged.data;
1467
+ delete merged.columns;
1468
+ delete merged.size;
1469
+ delete merged.pagination;
1453
1470
  return merged;
1454
1471
  });
1455
1472
  const computedPagination = computed(() => {
@@ -1613,7 +1630,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1613
1630
  };
1614
1631
  }
1615
1632
  });
1616
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d650e8f1"]]);
1633
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c108fd78"]]);
1617
1634
  function useTable(params = {}) {
1618
1635
  const { data, columns, ...rest } = params;
1619
1636
  const coreTable = useTable$1({