tiddy 2.0.7 → 2.0.9
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/index.d.ts +26 -13
- package/dist/index.js +17 -20
- package/package.json +17 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as vue32 from "vue";
|
|
2
|
-
import { AllowedComponentProps, CSSProperties, Component, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Slot } from "vue";
|
|
2
|
+
import { AllowedComponentProps, CSSProperties, Component, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Ref as Ref$1, Slot } from "vue";
|
|
3
3
|
import * as element_plus0 from "element-plus";
|
|
4
4
|
import { DialogInstance, DialogProps, FormInstance, FormItemProp, FormItemProps, FormItemRule, FormProps, TableColumnInstance, TableInstance } from "element-plus";
|
|
5
5
|
|
|
@@ -39,7 +39,7 @@ declare const objectFieldPropsDef: {
|
|
|
39
39
|
type: PropType<OrFunction<string | number>>;
|
|
40
40
|
};
|
|
41
41
|
labelPosition: {
|
|
42
|
-
type: PropType<"
|
|
42
|
+
type: PropType<FormProps["labelPosition"]>;
|
|
43
43
|
};
|
|
44
44
|
fields: {
|
|
45
45
|
type: PropType<any[]>;
|
|
@@ -67,7 +67,7 @@ declare const widgetFieldPropsDef: {
|
|
|
67
67
|
type: PropType<OrFunction<string | number>>;
|
|
68
68
|
};
|
|
69
69
|
labelPosition: {
|
|
70
|
-
type: PropType<"
|
|
70
|
+
type: PropType<FormProps["labelPosition"]>;
|
|
71
71
|
};
|
|
72
72
|
type: {
|
|
73
73
|
type: PropType<"widget">;
|
|
@@ -145,7 +145,7 @@ declare const arrayFieldPropsDef: {
|
|
|
145
145
|
type: PropType<OrFunction<string | number>>;
|
|
146
146
|
};
|
|
147
147
|
labelPosition: {
|
|
148
|
-
type: PropType<"
|
|
148
|
+
type: PropType<FormProps["labelPosition"]>;
|
|
149
149
|
};
|
|
150
150
|
fields: {
|
|
151
151
|
type: PropType<any[]>;
|
|
@@ -197,7 +197,7 @@ declare const layoutFieldPropsDef: {
|
|
|
197
197
|
type: PropType<OrFunction<string | number>>;
|
|
198
198
|
};
|
|
199
199
|
labelPosition: {
|
|
200
|
-
type: PropType<"
|
|
200
|
+
type: PropType<FormProps["labelPosition"]>;
|
|
201
201
|
};
|
|
202
202
|
fields: {
|
|
203
203
|
type: PropType<any[]>;
|
|
@@ -327,9 +327,9 @@ declare const __VLS_base$2: vue32.DefineComponent<vue32.ExtractPropTypes<{
|
|
|
327
327
|
default: boolean;
|
|
328
328
|
};
|
|
329
329
|
}>> & Readonly<{}>, {
|
|
330
|
+
hideRequiredAsterisk: boolean;
|
|
330
331
|
messageLabel: any;
|
|
331
332
|
formatMessage: AnyFunction;
|
|
332
|
-
hideRequiredAsterisk: boolean;
|
|
333
333
|
}, {}, {}, {}, string, vue32.ComponentProvideOptions, true, {}, any>;
|
|
334
334
|
declare const __VLS_export$4: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|
|
335
335
|
declare const _default$3: typeof __VLS_export$4;
|
|
@@ -352,16 +352,20 @@ type TdFormItemInstance = InstanceType<typeof _default$3>;
|
|
|
352
352
|
type TableColumnProp = {
|
|
353
353
|
slots: {
|
|
354
354
|
type: PropType<OrArray<SlotDef>>;
|
|
355
|
-
default:
|
|
355
|
+
default: null;
|
|
356
356
|
};
|
|
357
357
|
columns: {
|
|
358
|
-
type: PropType<
|
|
358
|
+
type: PropType<TdTableColumnProps[]>;
|
|
359
359
|
default: () => never[];
|
|
360
360
|
};
|
|
361
361
|
transform: {
|
|
362
362
|
type: PropType<AnyFunction[]>;
|
|
363
363
|
default: () => never[];
|
|
364
364
|
};
|
|
365
|
+
hide: {
|
|
366
|
+
type: PropType<boolean | Ref$1<boolean>>;
|
|
367
|
+
default: false;
|
|
368
|
+
};
|
|
365
369
|
};
|
|
366
370
|
type TdTableColumnProps = ExtractPublicPropTypes<TableColumnProp> & TableColumnInstance["$props"];
|
|
367
371
|
declare const tableColumnPropsDef: TableColumnProp;
|
|
@@ -405,32 +409,41 @@ type __VLS_WithSlots$1<T, S> = T & {
|
|
|
405
409
|
declare const __VLS_export$1: vue32.DefineComponent<vue32.ExtractPropTypes<{
|
|
406
410
|
slots: {
|
|
407
411
|
type: vue32.PropType<OrArray<SlotDef>>;
|
|
408
|
-
default:
|
|
412
|
+
default: null;
|
|
409
413
|
};
|
|
410
414
|
columns: {
|
|
411
|
-
type: vue32.PropType<
|
|
415
|
+
type: vue32.PropType<TdTableColumnProps[]>;
|
|
412
416
|
default: () => never[];
|
|
413
417
|
};
|
|
414
418
|
transform: {
|
|
415
419
|
type: vue32.PropType<AnyFunction[]>;
|
|
416
420
|
default: () => never[];
|
|
417
421
|
};
|
|
422
|
+
hide: {
|
|
423
|
+
type: vue32.PropType<boolean | vue32.Ref<boolean>>;
|
|
424
|
+
default: false;
|
|
425
|
+
};
|
|
418
426
|
}>, {}, {}, {}, {}, vue32.ComponentOptionsMixin, vue32.ComponentOptionsMixin, {}, string, vue32.PublicProps, Readonly<vue32.ExtractPropTypes<{
|
|
419
427
|
slots: {
|
|
420
428
|
type: vue32.PropType<OrArray<SlotDef>>;
|
|
421
|
-
default:
|
|
429
|
+
default: null;
|
|
422
430
|
};
|
|
423
431
|
columns: {
|
|
424
|
-
type: vue32.PropType<
|
|
432
|
+
type: vue32.PropType<TdTableColumnProps[]>;
|
|
425
433
|
default: () => never[];
|
|
426
434
|
};
|
|
427
435
|
transform: {
|
|
428
436
|
type: vue32.PropType<AnyFunction[]>;
|
|
429
437
|
default: () => never[];
|
|
430
438
|
};
|
|
439
|
+
hide: {
|
|
440
|
+
type: vue32.PropType<boolean | vue32.Ref<boolean>>;
|
|
441
|
+
default: false;
|
|
442
|
+
};
|
|
431
443
|
}>> & Readonly<{}>, {
|
|
444
|
+
hide: boolean | vue32.Ref<boolean, boolean>;
|
|
432
445
|
slots: OrArray<SlotDef>;
|
|
433
|
-
columns:
|
|
446
|
+
columns: TdTableColumnProps[];
|
|
434
447
|
transform: AnyFunction[];
|
|
435
448
|
}, {}, {}, {}, string, vue32.ComponentProvideOptions, true, {}, any>;
|
|
436
449
|
declare const _default$5: typeof __VLS_export$1;
|
package/dist/index.js
CHANGED
|
@@ -413,15 +413,15 @@ var widget_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
413
413
|
const props = __props;
|
|
414
414
|
const attrs = useAttrs();
|
|
415
415
|
const formCtx = inject(formCtxKey);
|
|
416
|
-
const
|
|
416
|
+
const modelModifiers = computed(() => Object.fromEntries(props.modifiers.map((m) => [m, true])));
|
|
417
|
+
console.log(modelModifiers.value);
|
|
417
418
|
const widgetModel = computed({
|
|
418
419
|
get() {
|
|
419
|
-
if (props.modifiers.includes("lazy")) return tempValue.value;
|
|
420
420
|
return props.formatter(getDeepValue(formCtx.model, attrs["full-prop"]));
|
|
421
421
|
},
|
|
422
422
|
set(v) {
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
const parsed = props.parser(v);
|
|
424
|
+
setDeepValue(formCtx.model, attrs["full-prop"], parsed);
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
427
|
if (!isNullOrUndef(props.default)) widgetModel.value = props.default;
|
|
@@ -435,16 +435,6 @@ var widget_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
435
435
|
...pick(props, ["rules", /^label/])
|
|
436
436
|
};
|
|
437
437
|
});
|
|
438
|
-
function onModelChange(...args) {
|
|
439
|
-
if (props.modifiers.includes("lazy")) updateModelValue(tempValue.value);
|
|
440
|
-
props.on.blur?.(...args);
|
|
441
|
-
}
|
|
442
|
-
function updateModelValue(v) {
|
|
443
|
-
const parsed = props.parser(v);
|
|
444
|
-
if (props.modifiers.includes("trim")) setDeepValue(formCtx.model, attrs["full-prop"], parsed.trim());
|
|
445
|
-
else if (props.modifiers.includes("number")) setDeepValue(formCtx.model, attrs["full-prop"], Number(parsed));
|
|
446
|
-
else setDeepValue(formCtx.model, attrs["full-prop"], parsed);
|
|
447
|
-
}
|
|
448
438
|
const Widget = resolveWidget(props.component);
|
|
449
439
|
const widgetAttrs = computed(() => {
|
|
450
440
|
return {
|
|
@@ -471,8 +461,8 @@ var widget_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
471
461
|
!!unref(Widget) ? (openBlock(), createBlock(unref(Widget), mergeProps({ key: 0 }, widgetAttrs.value, toHandlers(_ctx.on), {
|
|
472
462
|
modelValue: widgetModel.value,
|
|
473
463
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => widgetModel.value = $event),
|
|
474
|
-
|
|
475
|
-
|
|
464
|
+
modelModifiers: modelModifiers.value,
|
|
465
|
+
class: "widget-component"
|
|
476
466
|
}), createSlots({ _: 2 }, [renderList(unref(widgetSlots), (sc) => {
|
|
477
467
|
return {
|
|
478
468
|
name: sc.name,
|
|
@@ -481,7 +471,7 @@ var widget_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
481
471
|
"ctx-key": unref(formCtxKey)
|
|
482
472
|
}), null, 16, ["scope", "ctx-key"])])
|
|
483
473
|
};
|
|
484
|
-
})]), 1040, ["modelValue"])) : createCommentVNode("v-if", true),
|
|
474
|
+
})]), 1040, ["modelValue", "modelModifiers"])) : createCommentVNode("v-if", true),
|
|
485
475
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(afterSlots), (ssc) => {
|
|
486
476
|
return openBlock(), createBlock(deep_slot_default, mergeProps({ key: ssc.name }, { ref_for: true }, ssc, {
|
|
487
477
|
scope: { value: widgetModel.value },
|
|
@@ -792,7 +782,7 @@ const tableColumnPropsDef = {
|
|
|
792
782
|
Object,
|
|
793
783
|
String
|
|
794
784
|
],
|
|
795
|
-
default:
|
|
785
|
+
default: null
|
|
796
786
|
},
|
|
797
787
|
columns: {
|
|
798
788
|
type: Array,
|
|
@@ -801,6 +791,10 @@ const tableColumnPropsDef = {
|
|
|
801
791
|
transform: {
|
|
802
792
|
type: Array,
|
|
803
793
|
default: () => []
|
|
794
|
+
},
|
|
795
|
+
hide: {
|
|
796
|
+
type: [Boolean, Object],
|
|
797
|
+
default: false
|
|
804
798
|
}
|
|
805
799
|
};
|
|
806
800
|
const tablePropsDef = { columns: {
|
|
@@ -818,6 +812,7 @@ var table_col_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
818
812
|
setup(__props) {
|
|
819
813
|
const props = __props;
|
|
820
814
|
const attrs = useAttrs();
|
|
815
|
+
const visibleColumns = computed(() => props.columns.filter((col) => !unref(col.hide)));
|
|
821
816
|
function filtered(scope) {
|
|
822
817
|
const { row, column } = scope;
|
|
823
818
|
return props.transform.reduce((res, filter) => filter(res, row, column), getDeepValue(row, column.property));
|
|
@@ -826,7 +821,7 @@ var table_col_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
826
821
|
return (_ctx, _cache) => {
|
|
827
822
|
const _component_TdTableCol = resolveComponent("TdTableCol");
|
|
828
823
|
return openBlock(), createBlock(unref(ElTableColumn), normalizeProps(guardReactiveProps(_ctx.$attrs)), createSlots({
|
|
829
|
-
default: withCtx(() => [
|
|
824
|
+
default: withCtx(() => [visibleColumns.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(visibleColumns.value, (col) => {
|
|
830
825
|
return openBlock(), createBlock(_component_TdTableCol, mergeProps({ key: col.label }, { ref_for: true }, col), null, 16);
|
|
831
826
|
}), 128)) : createCommentVNode("v-if", true)]),
|
|
832
827
|
_: 2
|
|
@@ -859,6 +854,8 @@ var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
859
854
|
__name: "table",
|
|
860
855
|
props: tablePropsDef,
|
|
861
856
|
setup(__props, { expose: __expose }) {
|
|
857
|
+
const props = __props;
|
|
858
|
+
const visibleColumns = computed(() => props.columns.filter((col) => !unref(col.hide)));
|
|
862
859
|
const slots = useSlots();
|
|
863
860
|
const tableRef = ref(null);
|
|
864
861
|
const slotNames = computed(() => Object.keys(slots));
|
|
@@ -878,7 +875,7 @@ var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
878
875
|
ref_key: "tableRef",
|
|
879
876
|
ref: tableRef
|
|
880
877
|
}, _ctx.$attrs), createSlots({
|
|
881
|
-
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
878
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleColumns.value, (col) => {
|
|
882
879
|
return openBlock(), createBlock(table_col_default, mergeProps({ key: col.label }, { ref_for: true }, col), null, 16);
|
|
883
880
|
}), 128))]),
|
|
884
881
|
_: 2
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiddy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
|
+
"packageManager": "pnpm@10.11.0",
|
|
4
5
|
"description": "A set of Vue 3 components based on element-plus",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"license": "MIT",
|
|
@@ -13,9 +14,7 @@
|
|
|
13
14
|
"url": "git+https://github.com/leemotive/tiddy.git"
|
|
14
15
|
},
|
|
15
16
|
"author": "leemotive <wstation@163.com>",
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
17
|
+
"files": ["dist"],
|
|
19
18
|
"main": "./dist/index.js",
|
|
20
19
|
"module": "./dist/index.js",
|
|
21
20
|
"types": "./dist/index.d.ts",
|
|
@@ -24,6 +23,19 @@
|
|
|
24
23
|
"./package.json": "./package.json",
|
|
25
24
|
"./*": "./dist/*"
|
|
26
25
|
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"lint": "biome lint .",
|
|
28
|
+
"build": "tsdown",
|
|
29
|
+
"dev": "tsdown --watch",
|
|
30
|
+
"play": "vite",
|
|
31
|
+
"test": "vitest",
|
|
32
|
+
"type": "vue-tsc --noEmit",
|
|
33
|
+
"format": "biome format --write .",
|
|
34
|
+
"prepublishOnly": "pnpm run build",
|
|
35
|
+
"docs:dev": "vitepress dev docs",
|
|
36
|
+
"docs:build": "vitepress build docs",
|
|
37
|
+
"docs:preview": "vitepress preview docs"
|
|
38
|
+
},
|
|
27
39
|
"peerDependencies": {
|
|
28
40
|
"element-plus": "^2.11.7",
|
|
29
41
|
"vue": "^3.0.0"
|
|
@@ -51,17 +63,5 @@
|
|
|
51
63
|
},
|
|
52
64
|
"dependencies": {
|
|
53
65
|
"yatter": "^3.0.0"
|
|
54
|
-
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"lint": "biome lint .",
|
|
57
|
-
"build": "tsdown",
|
|
58
|
-
"dev": "tsdown --watch",
|
|
59
|
-
"play": "vite",
|
|
60
|
-
"test": "vitest",
|
|
61
|
-
"type": "vue-tsc --noEmit",
|
|
62
|
-
"format": "biome format --write .",
|
|
63
|
-
"docs:dev": "vitepress dev docs",
|
|
64
|
-
"docs:build": "vitepress build docs",
|
|
65
|
-
"docs:preview": "vitepress preview docs"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|