yc-pro-components 0.0.12 → 0.0.14
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/es/components/dialog/src/index.vue2.mjs +17 -4
- package/es/components/dialog-form/src/index.vue2.mjs +19 -5
- package/es/components/display-item/index.d.ts +42 -6
- package/es/components/display-item/src/index.vue.d.ts +42 -6
- package/es/components/drawer-form/src/index.vue2.mjs +15 -5
- package/es/components/form/src/form-content.vue.d.ts +42 -6
- package/es/components/form/src/index.vue2.mjs +15 -5
- package/es/components/form-item/index.d.ts +88 -16
- package/es/components/form-item/src/index.vue.d.ts +35 -4
- package/es/components/form-item/src/index.vue2.mjs +1 -0
- package/es/components/page/src/index.vue2.mjs +1 -1
- package/es/components/popover/src/index.vue2.mjs +15 -5
- package/es/components/render/index.d.ts +3 -3
- package/es/components/render/src/index.vue.d.ts +1 -1
- package/es/components/table/src/table-action-bar.vue2.mjs +1 -1
- package/es/components/table/src/table-column.vue.d.ts +42 -6
- package/es/components/yc-drawer/src/index.vue.mjs +1 -1
- package/es/components/yc-drawer/src/index.vue2.mjs +3 -1
- package/es/components/yc-plus-tree/src/index.vue.mjs +1 -1
- package/es/components/yc-plus-tree/src/index.vue2.mjs +16 -4
- package/es/components/yc-status-dialog/src/index.vue.mjs +1 -1
- package/es/components/yc-status-dialog/src/index.vue2.mjs +14 -4
- package/es/constants/dict.d.ts +78 -0
- package/es/constants/dict.mjs +3 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.mjs +1 -0
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/useDictInjection.d.ts +38 -0
- package/es/hooks/useDictInjection.mjs +18 -0
- package/es/hooks/useGetOptions.mjs +118 -30
- package/es/index.css +4 -4
- package/es/index.d.ts +1 -1
- package/es/index.mjs +2 -0
- package/es/types/plus.d.ts +74 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/yc-components/index.d.ts +1 -1
- package/es/yc-components/version.d.ts +1 -1
- package/index.css +65 -53
- package/index.js +276 -95
- package/index.min.css +4 -4
- package/index.min.js +7 -7
- package/index.min.mjs +7 -7
- package/index.mjs +276 -97
- package/lib/components/dialog/src/index.vue2.js +17 -4
- package/lib/components/dialog-form/src/index.vue2.js +19 -5
- package/lib/components/display-item/index.d.ts +42 -6
- package/lib/components/display-item/src/index.vue.d.ts +42 -6
- package/lib/components/drawer-form/src/index.vue2.js +15 -5
- package/lib/components/form/src/form-content.vue.d.ts +42 -6
- package/lib/components/form/src/index.vue2.js +15 -5
- package/lib/components/form-item/index.d.ts +88 -16
- package/lib/components/form-item/src/index.vue.d.ts +35 -4
- package/lib/components/form-item/src/index.vue2.js +1 -0
- package/lib/components/page/src/index.vue2.js +1 -1
- package/lib/components/popover/src/index.vue2.js +14 -4
- package/lib/components/render/index.d.ts +3 -3
- package/lib/components/render/src/index.vue.d.ts +1 -1
- package/lib/components/table/src/table-action-bar.vue2.js +1 -1
- package/lib/components/table/src/table-column.vue.d.ts +42 -6
- package/lib/components/yc-drawer/src/index.vue.js +1 -1
- package/lib/components/yc-drawer/src/index.vue2.js +3 -1
- package/lib/components/yc-plus-tree/src/index.vue.js +1 -1
- package/lib/components/yc-plus-tree/src/index.vue2.js +16 -4
- package/lib/components/yc-status-dialog/src/index.vue.js +1 -1
- package/lib/components/yc-status-dialog/src/index.vue2.js +13 -3
- package/lib/constants/dict.d.ts +78 -0
- package/lib/constants/dict.js +5 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +2 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/useDictInjection.d.ts +38 -0
- package/lib/hooks/useDictInjection.js +20 -0
- package/lib/hooks/useGetOptions.js +117 -29
- package/lib/index.css +4 -4
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -0
- package/lib/types/plus.d.ts +74 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/yc-components/index.d.ts +1 -1
- package/lib/yc-components/version.d.ts +1 -1
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
- package/es/components/dialog-form/index.d.ts +0 -1142
- package/es/components/dialog-form/src/index.vue.d.ts +0 -481
- package/es/components/drawer-form/index.d.ts +0 -3455
- package/es/components/drawer-form/src/index.vue.d.ts +0 -1242
- package/es/components/form/index.d.ts +0 -1645
- package/es/components/form/src/index.vue.d.ts +0 -628
- package/es/components/page/index.d.ts +0 -15194
- package/es/components/page/src/index.vue.d.ts +0 -5234
- package/es/components/search/index.d.ts +0 -4430
- package/es/components/search/src/index.vue.d.ts +0 -1503
- package/es/components/yc-plus-page/src/index.vue.d.ts +0 -12672
- package/es/hooks/usePlusFormReset.d.ts +0 -9853
- package/lib/components/dialog-form/index.d.ts +0 -1142
- package/lib/components/dialog-form/src/index.vue.d.ts +0 -481
- package/lib/components/drawer-form/index.d.ts +0 -3455
- package/lib/components/drawer-form/src/index.vue.d.ts +0 -1242
- package/lib/components/form/index.d.ts +0 -1645
- package/lib/components/form/src/index.vue.d.ts +0 -628
- package/lib/components/page/index.d.ts +0 -15194
- package/lib/components/page/src/index.vue.d.ts +0 -5234
- package/lib/components/search/index.d.ts +0 -4430
- package/lib/components/search/src/index.vue.d.ts +0 -1503
- package/lib/components/yc-plus-page/src/index.vue.d.ts +0 -12672
- package/lib/hooks/usePlusFormReset.d.ts +0 -9853
|
@@ -227,7 +227,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
227
227
|
};
|
|
228
228
|
}> & {} & ComponentCustomProperties & {} & {
|
|
229
229
|
$slots: Partial<Record<string, (_: {
|
|
230
|
-
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap">> & {
|
|
230
|
+
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap" | "autoDict">> & {
|
|
231
231
|
readonly label: string | ComputedRef<string>;
|
|
232
232
|
readonly modelValue: string | number | boolean | string[] | [string, string] | number[] | Date | RecordType | boolean[] | Date[] | [Date, Date] | [number, number] | string[][] | number[][] | null;
|
|
233
233
|
readonly hasLabel: boolean | Ref<boolean> | ComputedRef<boolean>;
|
|
@@ -256,7 +256,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
256
256
|
};
|
|
257
257
|
rows: number;
|
|
258
258
|
autocomplete: string;
|
|
259
|
-
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "
|
|
259
|
+
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "datetimerange" | "daterange" | "monthrange" | "checkbox" | "radio" | "color" | "success" | "warning" | "info" | "primary" | "danger" | "reset" | "submit" | "hidden" | "range" | "date" | "year" | "years" | "month" | "dates" | "week" | "datetime" | "dashboard" | "datetime-local" | "email" | "file" | "password" | "tel" | "url";
|
|
260
260
|
loading: EpPropMergeType<BooleanConstructor, unknown, unknown> | EpPropMergeType<StringConstructor, "lazy" | "eager", unknown> | undefined;
|
|
261
261
|
step: string | number;
|
|
262
262
|
format: string | ProgressFn | undefined;
|
|
@@ -283,6 +283,12 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
283
283
|
label?: string | undefined;
|
|
284
284
|
value?: string | undefined;
|
|
285
285
|
} | undefined;
|
|
286
|
+
readonly autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
287
|
+
store?: any;
|
|
288
|
+
method?: string | undefined;
|
|
289
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
290
|
+
dictCode?: string | undefined;
|
|
291
|
+
} | undefined;
|
|
286
292
|
readonly clearable: boolean;
|
|
287
293
|
readonly index: number;
|
|
288
294
|
} & {
|
|
@@ -320,10 +326,16 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
320
326
|
label?: string | undefined;
|
|
321
327
|
value?: string | undefined;
|
|
322
328
|
} | undefined;
|
|
329
|
+
autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
330
|
+
store?: any;
|
|
331
|
+
method?: string | undefined;
|
|
332
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
333
|
+
dictCode?: string | undefined;
|
|
334
|
+
} | undefined;
|
|
323
335
|
clearable: boolean;
|
|
324
336
|
index: number;
|
|
325
337
|
}) => any>> & Partial<Record<string, (_: {
|
|
326
|
-
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap">> & {
|
|
338
|
+
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap" | "autoDict">> & {
|
|
327
339
|
readonly label: string | ComputedRef<string>;
|
|
328
340
|
readonly modelValue: string | number | boolean | string[] | [string, string] | number[] | Date | RecordType | boolean[] | Date[] | [Date, Date] | [number, number] | string[][] | number[][] | null;
|
|
329
341
|
readonly hasLabel: boolean | Ref<boolean> | ComputedRef<boolean>;
|
|
@@ -352,7 +364,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
352
364
|
};
|
|
353
365
|
rows: number;
|
|
354
366
|
autocomplete: string;
|
|
355
|
-
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "
|
|
367
|
+
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "datetimerange" | "daterange" | "monthrange" | "checkbox" | "radio" | "color" | "success" | "warning" | "info" | "primary" | "danger" | "reset" | "submit" | "hidden" | "range" | "date" | "year" | "years" | "month" | "dates" | "week" | "datetime" | "dashboard" | "datetime-local" | "email" | "file" | "password" | "tel" | "url";
|
|
356
368
|
loading: EpPropMergeType<BooleanConstructor, unknown, unknown> | EpPropMergeType<StringConstructor, "lazy" | "eager", unknown> | undefined;
|
|
357
369
|
step: string | number;
|
|
358
370
|
format: string | ProgressFn | undefined;
|
|
@@ -379,6 +391,12 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
379
391
|
label?: string | undefined;
|
|
380
392
|
value?: string | undefined;
|
|
381
393
|
} | undefined;
|
|
394
|
+
readonly autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
395
|
+
store?: any;
|
|
396
|
+
method?: string | undefined;
|
|
397
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
398
|
+
dictCode?: string | undefined;
|
|
399
|
+
} | undefined;
|
|
382
400
|
readonly clearable: boolean;
|
|
383
401
|
readonly index: number;
|
|
384
402
|
} & {
|
|
@@ -416,10 +434,16 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
416
434
|
label?: string | undefined;
|
|
417
435
|
value?: string | undefined;
|
|
418
436
|
} | undefined;
|
|
437
|
+
autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
438
|
+
store?: any;
|
|
439
|
+
method?: string | undefined;
|
|
440
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
441
|
+
dictCode?: string | undefined;
|
|
442
|
+
} | undefined;
|
|
419
443
|
clearable: boolean;
|
|
420
444
|
index: number;
|
|
421
445
|
}) => any>> & Partial<Record<string, (_: {
|
|
422
|
-
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap">> & {
|
|
446
|
+
column: Readonly<Omit< LooseRequired<PlusFormItemProps>, "index" | "label" | "tooltip" | "formItemProps" | "fieldProps" | "options" | "modelValue" | "fieldSlots" | "fieldChildrenSlot" | "hasLabel" | "clearable" | "valueType" | "renderField" | "renderLabel" | "renderErrorMessage" | "optionsMap" | "autoDict">> & {
|
|
423
447
|
readonly label: string | ComputedRef<string>;
|
|
424
448
|
readonly modelValue: string | number | boolean | string[] | [string, string] | number[] | Date | RecordType | boolean[] | Date[] | [Date, Date] | [number, number] | string[][] | number[][] | null;
|
|
425
449
|
readonly hasLabel: boolean | Ref<boolean> | ComputedRef<boolean>;
|
|
@@ -448,7 +472,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
448
472
|
};
|
|
449
473
|
rows: number;
|
|
450
474
|
autocomplete: string;
|
|
451
|
-
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "
|
|
475
|
+
type: "" | "number" | "default" | "search" | "button" | "textarea" | "time" | "circle" | "image" | "line" | "text" | "datetimerange" | "daterange" | "monthrange" | "checkbox" | "radio" | "color" | "success" | "warning" | "info" | "primary" | "danger" | "reset" | "submit" | "hidden" | "range" | "date" | "year" | "years" | "month" | "dates" | "week" | "datetime" | "dashboard" | "datetime-local" | "email" | "file" | "password" | "tel" | "url";
|
|
452
476
|
loading: EpPropMergeType<BooleanConstructor, unknown, unknown> | EpPropMergeType<StringConstructor, "lazy" | "eager", unknown> | undefined;
|
|
453
477
|
step: string | number;
|
|
454
478
|
format: string | ProgressFn | undefined;
|
|
@@ -475,6 +499,12 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
475
499
|
label?: string | undefined;
|
|
476
500
|
value?: string | undefined;
|
|
477
501
|
} | undefined;
|
|
502
|
+
readonly autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
503
|
+
store?: any;
|
|
504
|
+
method?: string | undefined;
|
|
505
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
506
|
+
dictCode?: string | undefined;
|
|
507
|
+
} | undefined;
|
|
478
508
|
readonly clearable: boolean;
|
|
479
509
|
readonly index: number;
|
|
480
510
|
} & {
|
|
@@ -512,6 +542,12 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
512
542
|
label?: string | undefined;
|
|
513
543
|
value?: string | undefined;
|
|
514
544
|
} | undefined;
|
|
545
|
+
autoDict: boolean | ((column: PlusColumn) => OptionsRow<undefined>[] | Promise< OptionsRow<undefined>[]>) | {
|
|
546
|
+
store?: any;
|
|
547
|
+
method?: string | undefined;
|
|
548
|
+
transform?: ((data: any) => OptionsRow<undefined>[]) | undefined;
|
|
549
|
+
dictCode?: string | undefined;
|
|
550
|
+
} | undefined;
|
|
515
551
|
clearable: boolean;
|
|
516
552
|
index: number;
|
|
517
553
|
}) => any>> & Partial<Record<string, (_: {
|
|
@@ -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-
|
|
4
|
+
var YcDrawerComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f8ad9f74"], ["__file", "index.vue"]]);
|
|
5
5
|
|
|
6
6
|
export { YcDrawerComponent as default };
|
|
@@ -3,7 +3,7 @@ import { isFunction } from 'lodash-es';
|
|
|
3
3
|
import { Close } from '@element-plus/icons-vue';
|
|
4
4
|
import { drawerStore, closeDrawer } from '../store.mjs';
|
|
5
5
|
|
|
6
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
|
6
|
+
const _withScopeId = (n) => (pushScopeId("data-v-f8ad9f74"), n = n(), popScopeId(), n);
|
|
7
7
|
const _hoisted_1 = { class: "custom-drawer-header" };
|
|
8
8
|
const _hoisted_2 = { class: "header-content" };
|
|
9
9
|
const _hoisted_3 = ["id"];
|
|
@@ -46,7 +46,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
46
46
|
bg: true,
|
|
47
47
|
popConfirm: options == null ? void 0 : options.popConfirm,
|
|
48
48
|
btnClick: ({ drawer: { options: options2, index } }) => {
|
|
49
|
+
var _a;
|
|
49
50
|
if (!options2 || index === void 0) return;
|
|
51
|
+
if ((_a = sureBtnMap.value[index]) == null ? void 0 : _a.loading) return;
|
|
50
52
|
if (options2 == null ? void 0 : options2.sureBtnLoading) {
|
|
51
53
|
sureBtnMap.value[index] = Object.assign({}, sureBtnMap.value[index] || {}, {
|
|
52
54
|
loading: true
|
|
@@ -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 YcPlusTreeComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
var YcPlusTreeComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0043eed3"], ["__file", "index.vue"]]);
|
|
5
5
|
|
|
6
6
|
export { YcPlusTreeComponent as default };
|
|
@@ -651,6 +651,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
651
651
|
});
|
|
652
652
|
return (_ctx, _cache) => {
|
|
653
653
|
const _component_el_input = resolveComponent("el-input");
|
|
654
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
654
655
|
const _component_el_divider = resolveComponent("el-divider");
|
|
655
656
|
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
656
657
|
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
@@ -771,10 +772,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
771
772
|
}, () => [
|
|
772
773
|
createElementVNode("span", _hoisted_4, [
|
|
773
774
|
createCommentVNode(" \u9ED8\u8BA4\u8282\u70B9\u6807\u7B7E\u6587\u672C "),
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
775
|
+
createVNode(_component_el_tooltip, {
|
|
776
|
+
content: node.label,
|
|
777
|
+
placement: "top",
|
|
778
|
+
disabled: !node.label || node.label.length <= 20,
|
|
779
|
+
"show-after": 500
|
|
780
|
+
}, {
|
|
781
|
+
default: withCtx(() => [
|
|
782
|
+
createElementVNode("span", {
|
|
783
|
+
class: "label-text",
|
|
784
|
+
innerHTML: highlightKeyword(node.label, props.searchMode === "local" ? filterText.value : "")
|
|
785
|
+
}, null, 8, _hoisted_5)
|
|
786
|
+
]),
|
|
787
|
+
_: 2
|
|
788
|
+
/* DYNAMIC */
|
|
789
|
+
}, 1032, ["content", "disabled"])
|
|
778
790
|
])
|
|
779
791
|
], true),
|
|
780
792
|
createCommentVNode(" \u8282\u70B9\u64CD\u4F5C\u533A\u57DF\uFF08\u72EC\u7ACB\u4E8E\u81EA\u5B9A\u4E49 slot\uFF09 "),
|
|
@@ -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 YcStatusDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
var YcStatusDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a1851fcd"], ["__file", "index.vue"]]);
|
|
5
5
|
|
|
6
6
|
export { YcStatusDialog as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, resolveDynamicComponent, normalizeStyle, toDisplayString, renderSlot, createTextVNode, createCommentVNode, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, resolveDynamicComponent, normalizeStyle, toDisplayString, renderSlot, createTextVNode, createCommentVNode, createVNode } from 'vue';
|
|
2
|
+
import { debounce } from 'lodash-es';
|
|
2
3
|
import { ElDialog, ElButton } from 'element-plus';
|
|
3
4
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
|
4
5
|
import { STATUS_CONFIG_MAP } from './type.mjs';
|
|
@@ -55,10 +56,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
55
56
|
if (props.confirmText) return props.confirmText;
|
|
56
57
|
return props.status === "delete" ? "\u5220\u9664" : "\u786E\u5B9A";
|
|
57
58
|
});
|
|
58
|
-
const
|
|
59
|
+
const isSubmitting = ref(false);
|
|
60
|
+
const doConfirm = () => {
|
|
61
|
+
isSubmitting.value = true;
|
|
59
62
|
emit("confirm");
|
|
60
63
|
dialogVisible.value = false;
|
|
61
64
|
};
|
|
65
|
+
const handleConfirm = debounce(doConfirm, 300, {
|
|
66
|
+
leading: true,
|
|
67
|
+
// 立即执行第一次
|
|
68
|
+
trailing: false
|
|
69
|
+
// 不执行最后一次
|
|
70
|
+
});
|
|
62
71
|
const handleCancel = () => {
|
|
63
72
|
emit("cancel");
|
|
64
73
|
dialogVisible.value = false;
|
|
@@ -117,7 +126,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
117
126
|
})) : createCommentVNode("v-if", true),
|
|
118
127
|
createVNode(unref(ElButton), {
|
|
119
128
|
type: currentStatusConfig.value.confirmButtonType,
|
|
120
|
-
|
|
129
|
+
loading: isSubmitting.value,
|
|
130
|
+
onClick: unref(handleConfirm)
|
|
121
131
|
}, {
|
|
122
132
|
default: withCtx(() => [
|
|
123
133
|
createTextVNode(
|
|
@@ -128,7 +138,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
128
138
|
]),
|
|
129
139
|
_: 1
|
|
130
140
|
/* STABLE */
|
|
131
|
-
}, 8, ["type"])
|
|
141
|
+
}, 8, ["type", "loading", "onClick"])
|
|
132
142
|
], true)
|
|
133
143
|
])
|
|
134
144
|
]),
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OptionsRow } from 'yc-pro-components/es/types';
|
|
2
|
+
import { InjectionKey } from 'vue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 字典 Store 标准接口
|
|
6
|
+
* @description 所有项目的字典 Store 必须实现此接口才能使用自动字典注入功能
|
|
7
|
+
* @version v0.2.0
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { DictStoreInterface } from 'yc-components'
|
|
11
|
+
*
|
|
12
|
+
* export const useDictStore = defineStore('dict', () => {
|
|
13
|
+
* const getDictData = (field: string): OptionsRow[] => {
|
|
14
|
+
* // 返回字典数据
|
|
15
|
+
* return dictData.value[field] || []
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* const hasDict = (field: string): boolean => {
|
|
19
|
+
* return !!dictData.value[field]
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const getDictLabel = (field: string, value: string | number): string => {
|
|
23
|
+
* const items = dictData.value[field] || []
|
|
24
|
+
* const item = items.find(item => item.value === value)
|
|
25
|
+
* return item?.label || String(value)
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* return { getDictData, hasDict, getDictLabel }
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface DictStoreInterface {
|
|
33
|
+
/**
|
|
34
|
+
* 根据字段名或字典 code 获取字典数据
|
|
35
|
+
* @param field 字段名(如 "status")或字典 code(如 "ORDER_STATUS")
|
|
36
|
+
* @returns 字典选项数组
|
|
37
|
+
* @description 此方法是核心方法,必须实现
|
|
38
|
+
*/
|
|
39
|
+
getDictData: (field: string) => OptionsRow[];
|
|
40
|
+
/**
|
|
41
|
+
* 检查字段是否有字典映射
|
|
42
|
+
* @param field 字段名或字典 code
|
|
43
|
+
* @returns 是否存在字典数据
|
|
44
|
+
* @description 可选方法,用于优化性能
|
|
45
|
+
*/
|
|
46
|
+
hasDict?: (field: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 获取字典标签
|
|
49
|
+
* @param field 字段名或字典 code
|
|
50
|
+
* @param value 字典值
|
|
51
|
+
* @returns 字典标签
|
|
52
|
+
* @description 可选方法,用于显示字典标签
|
|
53
|
+
*/
|
|
54
|
+
getDictLabel?: (field: string, value: string | number) => string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 字典 Store 注入 Key
|
|
58
|
+
* @description 用于 provide/inject 传递字典 Store 实例
|
|
59
|
+
* @version v0.2.0
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* // 提供字典 Store
|
|
63
|
+
* import { provide } from 'vue'
|
|
64
|
+
* import { DictStoreInjectionKey } from 'yc-components'
|
|
65
|
+
*
|
|
66
|
+
* const dictStore = useDictStore()
|
|
67
|
+
* provide(DictStoreInjectionKey, dictStore)
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* // 注入字典 Store
|
|
72
|
+
* import { inject } from 'vue'
|
|
73
|
+
* import { DictStoreInjectionKey } from 'yc-components'
|
|
74
|
+
*
|
|
75
|
+
* const dictStore = inject(DictStoreInjectionKey)
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const DictStoreInjectionKey: InjectionKey<DictStoreInterface>;
|
package/es/constants/index.d.ts
CHANGED
package/es/constants/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DefaultPageInfo, DefaultPageSizeList } from './page.mjs';
|
|
2
2
|
export { DatePickerValueIsArrayList, TableFormFieldRefInjectionKey, TableFormRefInjectionKey, TableFormRowInfoInjectionKey, ValueIsArrayList, ValueIsBooleanList, ValueIsNumberList } from './form.mjs';
|
|
3
3
|
export { selectValueTypeList } from './display-item.mjs';
|
|
4
|
+
export { DictStoreInjectionKey } from './dict.mjs';
|
package/es/hooks/index.d.ts
CHANGED
package/es/hooks/index.mjs
CHANGED
|
@@ -6,3 +6,4 @@ export { providePlusProConfig, useDialogFormConfig, useDrawerFormConfig, usePlus
|
|
|
6
6
|
export { useSortableDrag } from './useSortableDrag.mjs';
|
|
7
7
|
export { usePlusFormClearValidate, usePlusFormFullReset, usePlusFormReset } from './usePlusFormReset.mjs';
|
|
8
8
|
export { useSelectWithPagination } from './useSelectWithPagination.mjs';
|
|
9
|
+
export { useDictInjection } from './useDictInjection.mjs';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DictStoreInterface } from 'yc-pro-components/es/constants';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 提供字典 Store 给子组件
|
|
5
|
+
* @param dictStore 字典 Store 实例,必须实现 DictStoreInterface 接口
|
|
6
|
+
* @description 在父组件中调用此函数,将字典 Store 提供给所有子组件使用
|
|
7
|
+
* @version v0.2.0
|
|
8
|
+
* @example
|
|
9
|
+
* ```vue
|
|
10
|
+
* <!-- 在父组件中提供字典 Store -->
|
|
11
|
+
* <script setup lang="ts">
|
|
12
|
+
* import { useDictInjection } from 'yc-components'
|
|
13
|
+
* import { useFieldCatalogStore } from '@/store/modules/fieldCatalog'
|
|
14
|
+
*
|
|
15
|
+
* const fieldCatalogStore = useFieldCatalogStore()
|
|
16
|
+
*
|
|
17
|
+
* // 提供字典 Store 给所有子组件
|
|
18
|
+
* useDictInjection(fieldCatalogStore)
|
|
19
|
+
* </script>
|
|
20
|
+
*
|
|
21
|
+
* <template>
|
|
22
|
+
* <PlusPage :columns="columns" />
|
|
23
|
+
* </template>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* // 子组件中使用 autoDict
|
|
28
|
+
* const columns: PlusColumn[] = [
|
|
29
|
+
* {
|
|
30
|
+
* label: '状态',
|
|
31
|
+
* prop: 'status',
|
|
32
|
+
* valueType: 'select',
|
|
33
|
+
* autoDict: true // 自动从父组件注入的 dictStore 获取
|
|
34
|
+
* }
|
|
35
|
+
* ]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function useDictInjection(dictStore: DictStoreInterface): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { provide } from 'vue';
|
|
2
|
+
import { DictStoreInjectionKey } from '../constants/dict.mjs';
|
|
3
|
+
|
|
4
|
+
function useDictInjection(dictStore) {
|
|
5
|
+
if (!dictStore) {
|
|
6
|
+
console.warn("[yc-components] useDictInjection: dictStore is required");
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (typeof dictStore.getDictData !== "function") {
|
|
10
|
+
console.error(
|
|
11
|
+
"[yc-components] useDictInjection: dictStore must implement getDictData method. Please ensure your dictStore implements DictStoreInterface."
|
|
12
|
+
);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
provide(DictStoreInjectionKey, dictStore);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useDictInjection };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ref, isRef, isReactive, watch } from 'vue';
|
|
1
|
+
import { ref, inject, isRef, isReactive, watch } from 'vue';
|
|
2
|
+
import { DictStoreInjectionKey } from '../constants/dict.mjs';
|
|
2
3
|
import { isPlainObject, isArray, isFunction, isPromise, toRawType } from '../components/utils/is.mjs';
|
|
3
4
|
|
|
4
5
|
const throwError = (data) => {
|
|
@@ -27,27 +28,53 @@ const getOptionsByOptionsMap = (options, props) => {
|
|
|
27
28
|
const useGetOptions = (props) => {
|
|
28
29
|
const options = ref([]);
|
|
29
30
|
const optionsIsReady = ref(false);
|
|
30
|
-
|
|
31
|
+
const injectedDictStore = inject(DictStoreInjectionKey, null);
|
|
32
|
+
const hasValidOptions = props.options && (!isArray(props.options) || props.options.length > 0);
|
|
33
|
+
if (hasValidOptions) {
|
|
34
|
+
handleOptions();
|
|
35
|
+
} else if (props.autoDict) {
|
|
36
|
+
handleAutoDict();
|
|
37
|
+
} else {
|
|
31
38
|
options.value = [];
|
|
32
39
|
optionsIsReady.value = true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
}
|
|
41
|
+
function handleOptions() {
|
|
42
|
+
if (!props.options) {
|
|
43
|
+
options.value = [];
|
|
44
|
+
optionsIsReady.value = true;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (isRef(props.options) || isReactive(props.options) || isArray(props.options)) {
|
|
48
|
+
watch(
|
|
49
|
+
() => props.options,
|
|
50
|
+
(val) => {
|
|
51
|
+
const value = isRef(val) ? val.value : val;
|
|
52
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
53
|
+
optionsIsReady.value = true;
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
immediate: true,
|
|
57
|
+
deep: true
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
} else if (isFunction(props.options)) {
|
|
61
|
+
const getValue = props.options;
|
|
62
|
+
const result = getValue(props);
|
|
63
|
+
if (isPromise(result)) {
|
|
64
|
+
result.then((value) => {
|
|
65
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
66
|
+
optionsIsReady.value = true;
|
|
67
|
+
throwError(options.value);
|
|
68
|
+
}).catch((err) => {
|
|
69
|
+
throw err;
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
options.value = getOptionsByOptionsMap(result, props);
|
|
39
73
|
optionsIsReady.value = true;
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
immediate: true,
|
|
43
|
-
deep: true
|
|
44
74
|
}
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const result = getValue(props);
|
|
49
|
-
if (isPromise(result)) {
|
|
50
|
-
result.then((value) => {
|
|
75
|
+
} else if (isPromise(props.options)) {
|
|
76
|
+
const getValue = props.options;
|
|
77
|
+
getValue.then((value) => {
|
|
51
78
|
options.value = getOptionsByOptionsMap(value, props);
|
|
52
79
|
optionsIsReady.value = true;
|
|
53
80
|
throwError(options.value);
|
|
@@ -55,21 +82,82 @@ const useGetOptions = (props) => {
|
|
|
55
82
|
throw err;
|
|
56
83
|
});
|
|
57
84
|
} else {
|
|
58
|
-
options.value = getOptionsByOptionsMap(result, props);
|
|
59
85
|
optionsIsReady.value = true;
|
|
86
|
+
throwError(props.options);
|
|
60
87
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
}
|
|
89
|
+
function handleAutoDict() {
|
|
90
|
+
if (isFunction(props.autoDict)) {
|
|
91
|
+
const autoDictFn = props.autoDict;
|
|
92
|
+
watch(
|
|
93
|
+
() => {
|
|
94
|
+
return autoDictFn(props);
|
|
95
|
+
},
|
|
96
|
+
(result) => {
|
|
97
|
+
if (isPromise(result)) {
|
|
98
|
+
result.then((value) => {
|
|
99
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
100
|
+
optionsIsReady.value = true;
|
|
101
|
+
}).catch((err) => {
|
|
102
|
+
console.error("[yc-components] autoDict function error:", err);
|
|
103
|
+
options.value = [];
|
|
104
|
+
optionsIsReady.value = true;
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
options.value = getOptionsByOptionsMap(result, props);
|
|
108
|
+
optionsIsReady.value = true;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{ immediate: true }
|
|
112
|
+
);
|
|
113
|
+
} else if (typeof props.autoDict === "object" && props.autoDict !== null) {
|
|
114
|
+
const { store, method = "getDictData", transform, dictCode } = props.autoDict;
|
|
115
|
+
const dictStore = store || injectedDictStore;
|
|
116
|
+
const fieldOrCode = dictCode || props.prop;
|
|
117
|
+
if (dictStore && isFunction(dictStore[method])) {
|
|
118
|
+
watch(
|
|
119
|
+
() => dictStore[method](fieldOrCode),
|
|
120
|
+
(val) => {
|
|
121
|
+
try {
|
|
122
|
+
const data = transform && isFunction(transform) ? transform(val) : val;
|
|
123
|
+
options.value = getOptionsByOptionsMap(data, props);
|
|
124
|
+
optionsIsReady.value = true;
|
|
125
|
+
} catch (err) {
|
|
126
|
+
console.error("[yc-components] autoDict transform error:", err);
|
|
127
|
+
options.value = [];
|
|
128
|
+
optionsIsReady.value = true;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{ immediate: true }
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
console.warn(
|
|
135
|
+
`[yc-components] autoDict: DictStore or method "${method}" not found for field "${fieldOrCode}"`
|
|
136
|
+
);
|
|
137
|
+
options.value = [];
|
|
138
|
+
optionsIsReady.value = true;
|
|
139
|
+
}
|
|
140
|
+
} else if (props.autoDict === true) {
|
|
141
|
+
if (injectedDictStore && isFunction(injectedDictStore.getDictData)) {
|
|
142
|
+
watch(
|
|
143
|
+
() => injectedDictStore.getDictData(props.prop),
|
|
144
|
+
(val) => {
|
|
145
|
+
options.value = getOptionsByOptionsMap(val, props);
|
|
146
|
+
optionsIsReady.value = true;
|
|
147
|
+
},
|
|
148
|
+
{ immediate: true }
|
|
149
|
+
);
|
|
150
|
+
} else {
|
|
151
|
+
console.warn(
|
|
152
|
+
`[yc-components] autoDict: DictStore not provided via inject for field "${props.prop}". Please use useDictInjection() in parent component.`
|
|
153
|
+
);
|
|
154
|
+
options.value = [];
|
|
155
|
+
optionsIsReady.value = true;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
options.value = [];
|
|
65
159
|
optionsIsReady.value = true;
|
|
66
|
-
|
|
67
|
-
}).catch((err) => {
|
|
68
|
-
throw err;
|
|
69
|
-
});
|
|
70
|
-
} else {
|
|
71
|
-
optionsIsReady.value = true;
|
|
72
|
-
throwError(props.options);
|
|
160
|
+
}
|
|
73
161
|
}
|
|
74
162
|
return { customOptions: options, customOptionsIsReady: optionsIsReady };
|
|
75
163
|
};
|