@fastkit/vui 0.7.31 → 0.7.34
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/vui.cjs.js +48 -24
- package/dist/vui.cjs.prod.js +48 -24
- package/dist/vui.d.ts +39 -12
- package/dist/vui.mjs +49 -26
- package/package.json +6 -6
- package/src/components/VWysiwygEditor/index.ts +1 -0
- package/src/service.tsx +66 -32
package/dist/vui.cjs.js
CHANGED
|
@@ -4332,24 +4332,19 @@ class VuiService {
|
|
|
4332
4332
|
return this.stack.snackbar(...args);
|
|
4333
4333
|
}
|
|
4334
4334
|
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
} : { ...rawOptions
|
|
4341
|
-
};
|
|
4342
|
-
options.input = { ...options.input
|
|
4335
|
+
formPrompt(settings, slot) {
|
|
4336
|
+
let form;
|
|
4337
|
+
const options = {
|
|
4338
|
+
dense: true,
|
|
4339
|
+
...settings
|
|
4343
4340
|
};
|
|
4344
|
-
options.dense = true;
|
|
4345
|
-
let {
|
|
4346
|
-
initialValue: value = ''
|
|
4347
|
-
} = options.input;
|
|
4348
4341
|
const {
|
|
4349
|
-
size
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4342
|
+
size,
|
|
4343
|
+
state
|
|
4344
|
+
} = options;
|
|
4345
|
+
|
|
4346
|
+
const _state = vue.reactive(state);
|
|
4347
|
+
|
|
4353
4348
|
options.actions = options.actions || [this.stack.action('cancel', undefined, {
|
|
4354
4349
|
size
|
|
4355
4350
|
}), this.stack.action('ok', undefined, {
|
|
@@ -4373,22 +4368,50 @@ class VuiService {
|
|
|
4373
4368
|
form = undefined;
|
|
4374
4369
|
},
|
|
4375
4370
|
"onSubmit": ev => {
|
|
4376
|
-
stack.resolve(
|
|
4371
|
+
stack.resolve(_state);
|
|
4377
4372
|
}
|
|
4378
4373
|
}, {
|
|
4379
|
-
default:
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
value = ev;
|
|
4384
|
-
}
|
|
4385
|
-
}), null)]
|
|
4374
|
+
default: form => slot(_state, {
|
|
4375
|
+
form,
|
|
4376
|
+
stack
|
|
4377
|
+
})
|
|
4386
4378
|
});
|
|
4387
4379
|
}
|
|
4388
4380
|
});
|
|
4389
4381
|
return this.dialog(resolved);
|
|
4390
4382
|
}
|
|
4391
4383
|
|
|
4384
|
+
prompt(rawOptions = {}) {
|
|
4385
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4386
|
+
input: {
|
|
4387
|
+
label: rawOptions
|
|
4388
|
+
}
|
|
4389
|
+
} : { ...rawOptions
|
|
4390
|
+
};
|
|
4391
|
+
options.input = { ...options.input
|
|
4392
|
+
};
|
|
4393
|
+
options.dense = true;
|
|
4394
|
+
const {
|
|
4395
|
+
initialValue: value = ''
|
|
4396
|
+
} = options.input;
|
|
4397
|
+
const {
|
|
4398
|
+
size
|
|
4399
|
+
} = options.input;
|
|
4400
|
+
delete options.input.initialValue;
|
|
4401
|
+
return this.formPrompt({
|
|
4402
|
+
size,
|
|
4403
|
+
...options,
|
|
4404
|
+
state: {
|
|
4405
|
+
input: value
|
|
4406
|
+
}
|
|
4407
|
+
}, state => vue.createVNode(VTextField, vue.mergeProps(options.input, {
|
|
4408
|
+
"modelValue": state.input,
|
|
4409
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4410
|
+
}), null)).then(result => {
|
|
4411
|
+
return result ? result.input : result;
|
|
4412
|
+
});
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4392
4415
|
}
|
|
4393
4416
|
|
|
4394
4417
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4555,6 +4578,7 @@ exports.rawIconProp = rawIconProp;
|
|
|
4555
4578
|
exports.renderNavigationItemInput = renderNavigationItemInput;
|
|
4556
4579
|
exports.resolveNavigationItemInput = resolveNavigationItemInput;
|
|
4557
4580
|
exports.resolveRawIconProp = resolveRawIconProp;
|
|
4581
|
+
exports.resolveRawWysiwygEditorTools = resolveRawWysiwygEditorTools;
|
|
4558
4582
|
exports.useControl = useControl;
|
|
4559
4583
|
exports.useControlField = useControlField;
|
|
4560
4584
|
exports.useElevation = useElevation;
|
package/dist/vui.cjs.prod.js
CHANGED
|
@@ -4332,24 +4332,19 @@ class VuiService {
|
|
|
4332
4332
|
return this.stack.snackbar(...args);
|
|
4333
4333
|
}
|
|
4334
4334
|
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
} : { ...rawOptions
|
|
4341
|
-
};
|
|
4342
|
-
options.input = { ...options.input
|
|
4335
|
+
formPrompt(settings, slot) {
|
|
4336
|
+
let form;
|
|
4337
|
+
const options = {
|
|
4338
|
+
dense: true,
|
|
4339
|
+
...settings
|
|
4343
4340
|
};
|
|
4344
|
-
options.dense = true;
|
|
4345
|
-
let {
|
|
4346
|
-
initialValue: value = ''
|
|
4347
|
-
} = options.input;
|
|
4348
4341
|
const {
|
|
4349
|
-
size
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4342
|
+
size,
|
|
4343
|
+
state
|
|
4344
|
+
} = options;
|
|
4345
|
+
|
|
4346
|
+
const _state = vue.reactive(state);
|
|
4347
|
+
|
|
4353
4348
|
options.actions = options.actions || [this.stack.action('cancel', undefined, {
|
|
4354
4349
|
size
|
|
4355
4350
|
}), this.stack.action('ok', undefined, {
|
|
@@ -4373,22 +4368,50 @@ class VuiService {
|
|
|
4373
4368
|
form = undefined;
|
|
4374
4369
|
},
|
|
4375
4370
|
"onSubmit": ev => {
|
|
4376
|
-
stack.resolve(
|
|
4371
|
+
stack.resolve(_state);
|
|
4377
4372
|
}
|
|
4378
4373
|
}, {
|
|
4379
|
-
default:
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
value = ev;
|
|
4384
|
-
}
|
|
4385
|
-
}), null)]
|
|
4374
|
+
default: form => slot(_state, {
|
|
4375
|
+
form,
|
|
4376
|
+
stack
|
|
4377
|
+
})
|
|
4386
4378
|
});
|
|
4387
4379
|
}
|
|
4388
4380
|
});
|
|
4389
4381
|
return this.dialog(resolved);
|
|
4390
4382
|
}
|
|
4391
4383
|
|
|
4384
|
+
prompt(rawOptions = {}) {
|
|
4385
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4386
|
+
input: {
|
|
4387
|
+
label: rawOptions
|
|
4388
|
+
}
|
|
4389
|
+
} : { ...rawOptions
|
|
4390
|
+
};
|
|
4391
|
+
options.input = { ...options.input
|
|
4392
|
+
};
|
|
4393
|
+
options.dense = true;
|
|
4394
|
+
const {
|
|
4395
|
+
initialValue: value = ''
|
|
4396
|
+
} = options.input;
|
|
4397
|
+
const {
|
|
4398
|
+
size
|
|
4399
|
+
} = options.input;
|
|
4400
|
+
delete options.input.initialValue;
|
|
4401
|
+
return this.formPrompt({
|
|
4402
|
+
size,
|
|
4403
|
+
...options,
|
|
4404
|
+
state: {
|
|
4405
|
+
input: value
|
|
4406
|
+
}
|
|
4407
|
+
}, state => vue.createVNode(VTextField, vue.mergeProps(options.input, {
|
|
4408
|
+
"modelValue": state.input,
|
|
4409
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4410
|
+
}), null)).then(result => {
|
|
4411
|
+
return result ? result.input : result;
|
|
4412
|
+
});
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4392
4415
|
}
|
|
4393
4416
|
|
|
4394
4417
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4555,6 +4578,7 @@ exports.rawIconProp = rawIconProp;
|
|
|
4555
4578
|
exports.renderNavigationItemInput = renderNavigationItemInput;
|
|
4556
4579
|
exports.resolveNavigationItemInput = resolveNavigationItemInput;
|
|
4557
4580
|
exports.resolveRawIconProp = resolveRawIconProp;
|
|
4581
|
+
exports.resolveRawWysiwygEditorTools = resolveRawWysiwygEditorTools;
|
|
4558
4582
|
exports.useControl = useControl;
|
|
4559
4583
|
exports.useControlField = useControlField;
|
|
4560
4584
|
exports.useElevation = useElevation;
|
package/dist/vui.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ import { TextareaControl } from '@fastkit/vue-kit';
|
|
|
70
70
|
import { TextInputControl } from '@fastkit/vue-kit';
|
|
71
71
|
import { TypedSlot } from '@fastkit/vue-kit';
|
|
72
72
|
import { UnderlineOptions } from '@tiptap/extension-underline';
|
|
73
|
+
import { UnwrapNestedRefs } from 'vue';
|
|
73
74
|
import { useLink } from 'vue-router';
|
|
74
75
|
import { ValidateTiming } from '@fastkit/vue-kit';
|
|
75
76
|
import { ValidationResult } from '@fastkit/vue-kit';
|
|
@@ -81,9 +82,11 @@ import { VNodeChild } from 'vue';
|
|
|
81
82
|
import { VNodeChildOrSlot } from '@fastkit/vue-kit';
|
|
82
83
|
import { VNodeProps } from 'vue';
|
|
83
84
|
import { VSnackbar } from '@fastkit/vue-kit';
|
|
85
|
+
import { VStackControl } from '@fastkit/vue-kit';
|
|
84
86
|
import { VTooltip } from '@fastkit/vue-kit';
|
|
85
87
|
import { VueColorSchemePluginSettings } from '@fastkit/vue-kit';
|
|
86
|
-
import { VueForm } from '@fastkit/vue-
|
|
88
|
+
import { VueForm } from '@fastkit/vue-form-control';
|
|
89
|
+
import { VueForm as VueForm_2 } from '@fastkit/vue-kit';
|
|
87
90
|
import { VueStackService } from '@fastkit/vue-kit';
|
|
88
91
|
import { VueStackServiceOptions } from '@fastkit/vue-kit';
|
|
89
92
|
import { WritableComputedRef } from 'vue';
|
|
@@ -1330,12 +1333,17 @@ export declare interface RawVuiServiceOptions extends Omit<Partial<VuiServiceOpt
|
|
|
1330
1333
|
|
|
1331
1334
|
export declare type RawVuiServiceUISettings = Partial<VuiServiceUISettings>;
|
|
1332
1335
|
|
|
1333
|
-
declare type RawWysiwygEditorTool = WysiwygEditorTool | WysiwygEditorToolFactory<any>;
|
|
1336
|
+
export declare type RawWysiwygEditorTool = WysiwygEditorTool | WysiwygEditorToolFactory<any>;
|
|
1334
1337
|
|
|
1335
1338
|
declare type RecursiveArray<T> = T | RecursiveArray<T>[];
|
|
1336
1339
|
|
|
1337
1340
|
export declare function renderNavigationItemInput(input: NavigationItemInput, extraProps?: Record<string, unknown> & VNodeProps): JSX.Element;
|
|
1338
1341
|
|
|
1342
|
+
export declare interface ResolvedWysiwygEditorSettings {
|
|
1343
|
+
tools: WysiwygEditorTool[];
|
|
1344
|
+
extensions: Extensions;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1339
1347
|
export declare function resolveNavigationItemInput(input: NavigationItemInput): {
|
|
1340
1348
|
label: VNodeChild;
|
|
1341
1349
|
props: NavigationItemInput;
|
|
@@ -1343,6 +1351,8 @@ export declare function resolveNavigationItemInput(input: NavigationItemInput):
|
|
|
1343
1351
|
|
|
1344
1352
|
export declare function resolveRawIconProp(payload: boolean, prop?: RawIconProp, extraProps?: Record<string, unknown> & VNodeProps): VNodeChild;
|
|
1345
1353
|
|
|
1354
|
+
export declare function resolveRawWysiwygEditorTools(raws: RawWysiwygEditorTool[], vui: VuiService): ResolvedWysiwygEditorSettings;
|
|
1355
|
+
|
|
1346
1356
|
declare interface Rule<C extends any = any> {
|
|
1347
1357
|
<EC extends C = C>(constraints: Partial<EC>, overRides?: string | Partial<RuleSettings<EC>>): Rule<EC>;
|
|
1348
1358
|
$name: string;
|
|
@@ -4602,7 +4612,7 @@ export declare const VForm: DefineComponent<{
|
|
|
4602
4612
|
'v-form--pending': boolean;
|
|
4603
4613
|
'v-form--submiting': boolean;
|
|
4604
4614
|
})[]>;
|
|
4605
|
-
form:
|
|
4615
|
+
form: VueForm_2;
|
|
4606
4616
|
formRef: () => Ref<HTMLFormElement | null>;
|
|
4607
4617
|
nativeAction: ComputedRef<string | undefined>;
|
|
4608
4618
|
nodeControl: FormNodeControl<any, any>;
|
|
@@ -4637,8 +4647,8 @@ export declare const VForm: DefineComponent<{
|
|
|
4637
4647
|
validateSelf: (force?: boolean | undefined) => Promise<ValidationResult>;
|
|
4638
4648
|
validate: () => Promise<boolean>;
|
|
4639
4649
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
4640
|
-
submit: (form:
|
|
4641
|
-
'update:submiting': (submiting: boolean, form:
|
|
4650
|
+
submit: (form: VueForm_2, ev: Event) => boolean;
|
|
4651
|
+
'update:submiting': (submiting: boolean, form: VueForm_2) => boolean;
|
|
4642
4652
|
'update:modelValue': (value: unknown) => boolean;
|
|
4643
4653
|
'update:errors': (errors: FormNodeError[]) => boolean;
|
|
4644
4654
|
change: (value: unknown) => boolean;
|
|
@@ -4690,8 +4700,8 @@ export declare const VForm: DefineComponent<{
|
|
|
4690
4700
|
}> & {
|
|
4691
4701
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
4692
4702
|
onChange?: ((value: unknown) => any) | undefined;
|
|
4693
|
-
onSubmit?: ((form:
|
|
4694
|
-
"onUpdate:submiting"?: ((submiting: boolean, form:
|
|
4703
|
+
onSubmit?: ((form: VueForm_2, ev: Event) => any) | undefined;
|
|
4704
|
+
"onUpdate:submiting"?: ((submiting: boolean, form: VueForm_2) => any) | undefined;
|
|
4695
4705
|
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
4696
4706
|
"onUpdate:errors"?: ((errors: FormNodeError[]) => any) | undefined;
|
|
4697
4707
|
onFocus?: ((ev: FocusEvent) => any) | undefined;
|
|
@@ -4811,7 +4821,7 @@ export declare const VFormControl: DefineComponent<{
|
|
|
4811
4821
|
}>;
|
|
4812
4822
|
|
|
4813
4823
|
export declare interface VFormSlots {
|
|
4814
|
-
default:
|
|
4824
|
+
default: VueForm_2;
|
|
4815
4825
|
}
|
|
4816
4826
|
|
|
4817
4827
|
export declare const VGridContainer: DefineComponent<{
|
|
@@ -10037,6 +10047,15 @@ export declare const VuiControlInjectionKey: InjectionKey<ControlProvider>;
|
|
|
10037
10047
|
|
|
10038
10048
|
export declare type VuiElevationValue = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
|
|
10039
10049
|
|
|
10050
|
+
export declare interface VuiFormPromptSettings<T extends {
|
|
10051
|
+
[key: string]: any;
|
|
10052
|
+
} = {
|
|
10053
|
+
[key: string]: any;
|
|
10054
|
+
}> extends Partial<VDialogProps> {
|
|
10055
|
+
state: T;
|
|
10056
|
+
size?: ControlSize;
|
|
10057
|
+
}
|
|
10058
|
+
|
|
10040
10059
|
export declare const VuiInjectionKey: InjectionKey<VuiService>;
|
|
10041
10060
|
|
|
10042
10061
|
export declare class VuiPlugin {
|
|
@@ -10145,7 +10164,15 @@ export declare class VuiService {
|
|
|
10145
10164
|
alert(...args: Parameters<VueStackService['alert']>): Promise<any>;
|
|
10146
10165
|
confirm(...args: Parameters<VueStackService['confirm']>): Promise<any>;
|
|
10147
10166
|
snackbar(...args: Parameters<VueStackService['snackbar']>): Promise<any>;
|
|
10148
|
-
|
|
10167
|
+
formPrompt<T extends {
|
|
10168
|
+
[key: string]: any;
|
|
10169
|
+
} = {
|
|
10170
|
+
[key: string]: any;
|
|
10171
|
+
}>(settings: VuiFormPromptSettings<T>, slot: (state: UnwrapNestedRefs<T>, ctx: {
|
|
10172
|
+
form: VueForm;
|
|
10173
|
+
stack: VStackControl;
|
|
10174
|
+
}) => VNodeChild): Promise<T | false | undefined>;
|
|
10175
|
+
prompt(rawOptions?: RawVuiPromptOptions): Promise<string | false | undefined>;
|
|
10149
10176
|
}
|
|
10150
10177
|
|
|
10151
10178
|
export declare interface VuiServiceIconSettings {
|
|
@@ -10480,12 +10507,12 @@ export declare const VWysiwygEditor: DefineComponent<{
|
|
|
10480
10507
|
|
|
10481
10508
|
export declare const WysiwygBulletListTool: WysiwygEditorToolFactory<BulletListOptions>;
|
|
10482
10509
|
|
|
10483
|
-
declare interface WysiwygEditorContext {
|
|
10510
|
+
export declare interface WysiwygEditorContext {
|
|
10484
10511
|
editor: Editor;
|
|
10485
10512
|
vui: VuiService;
|
|
10486
10513
|
}
|
|
10487
10514
|
|
|
10488
|
-
declare interface WysiwygEditorTool {
|
|
10515
|
+
export declare interface WysiwygEditorTool {
|
|
10489
10516
|
key: string;
|
|
10490
10517
|
icon: IconName | ((ctx: WysiwygEditorContext) => IconName);
|
|
10491
10518
|
active?: boolean | ((ctx: WysiwygEditorContext) => boolean);
|
|
@@ -10495,7 +10522,7 @@ declare interface WysiwygEditorTool {
|
|
|
10495
10522
|
extensions?: Extensions;
|
|
10496
10523
|
}
|
|
10497
10524
|
|
|
10498
|
-
declare type WysiwygEditorToolFactory<Options = void> = (vui: VuiService, options?: Options) => WysiwygEditorTool | WysiwygEditorTool[];
|
|
10525
|
+
export declare type WysiwygEditorToolFactory<Options = void> = (vui: VuiService, options?: Options) => WysiwygEditorTool | WysiwygEditorTool[];
|
|
10499
10526
|
|
|
10500
10527
|
export declare const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions>;
|
|
10501
10528
|
|
package/dist/vui.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, resolveVStackDynamicInput, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
3
|
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
|
4
|
-
import { inject, computed, provide, createVNode, mergeProps, defineComponent, isVNode, cloneVNode, ref, watch, withDirectives, createTextVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition } from 'vue';
|
|
4
|
+
import { inject, computed, provide, createVNode, mergeProps, defineComponent, isVNode, cloneVNode, ref, watch, withDirectives, createTextVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition, reactive } from 'vue';
|
|
5
5
|
import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
|
|
6
6
|
import { createPropsOptions as createPropsOptions$1, htmlAttributesPropOptions, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableInheritProps, VLink, isFragment, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
|
|
7
7
|
import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
|
|
@@ -4327,24 +4327,19 @@ class VuiService {
|
|
|
4327
4327
|
return this.stack.snackbar(...args);
|
|
4328
4328
|
}
|
|
4329
4329
|
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
} : { ...rawOptions
|
|
4336
|
-
};
|
|
4337
|
-
options.input = { ...options.input
|
|
4330
|
+
formPrompt(settings, slot) {
|
|
4331
|
+
let form;
|
|
4332
|
+
const options = {
|
|
4333
|
+
dense: true,
|
|
4334
|
+
...settings
|
|
4338
4335
|
};
|
|
4339
|
-
options.dense = true;
|
|
4340
|
-
let {
|
|
4341
|
-
initialValue: value = ''
|
|
4342
|
-
} = options.input;
|
|
4343
4336
|
const {
|
|
4344
|
-
size
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4337
|
+
size,
|
|
4338
|
+
state
|
|
4339
|
+
} = options;
|
|
4340
|
+
|
|
4341
|
+
const _state = reactive(state);
|
|
4342
|
+
|
|
4348
4343
|
options.actions = options.actions || [this.stack.action('cancel', undefined, {
|
|
4349
4344
|
size
|
|
4350
4345
|
}), this.stack.action('ok', undefined, {
|
|
@@ -4368,22 +4363,50 @@ class VuiService {
|
|
|
4368
4363
|
form = undefined;
|
|
4369
4364
|
},
|
|
4370
4365
|
"onSubmit": ev => {
|
|
4371
|
-
stack.resolve(
|
|
4366
|
+
stack.resolve(_state);
|
|
4372
4367
|
}
|
|
4373
4368
|
}, {
|
|
4374
|
-
default:
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
value = ev;
|
|
4379
|
-
}
|
|
4380
|
-
}), null)]
|
|
4369
|
+
default: form => slot(_state, {
|
|
4370
|
+
form,
|
|
4371
|
+
stack
|
|
4372
|
+
})
|
|
4381
4373
|
});
|
|
4382
4374
|
}
|
|
4383
4375
|
});
|
|
4384
4376
|
return this.dialog(resolved);
|
|
4385
4377
|
}
|
|
4386
4378
|
|
|
4379
|
+
prompt(rawOptions = {}) {
|
|
4380
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4381
|
+
input: {
|
|
4382
|
+
label: rawOptions
|
|
4383
|
+
}
|
|
4384
|
+
} : { ...rawOptions
|
|
4385
|
+
};
|
|
4386
|
+
options.input = { ...options.input
|
|
4387
|
+
};
|
|
4388
|
+
options.dense = true;
|
|
4389
|
+
const {
|
|
4390
|
+
initialValue: value = ''
|
|
4391
|
+
} = options.input;
|
|
4392
|
+
const {
|
|
4393
|
+
size
|
|
4394
|
+
} = options.input;
|
|
4395
|
+
delete options.input.initialValue;
|
|
4396
|
+
return this.formPrompt({
|
|
4397
|
+
size,
|
|
4398
|
+
...options,
|
|
4399
|
+
state: {
|
|
4400
|
+
input: value
|
|
4401
|
+
}
|
|
4402
|
+
}, state => createVNode(VTextField, mergeProps(options.input, {
|
|
4403
|
+
"modelValue": state.input,
|
|
4404
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4405
|
+
}), null)).then(result => {
|
|
4406
|
+
return result ? result.input : result;
|
|
4407
|
+
});
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4387
4410
|
}
|
|
4388
4411
|
|
|
4389
4412
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4455,4 +4478,4 @@ function installVuiPlugin(app, opts) {
|
|
|
4455
4478
|
return app.use(VuiPlugin, opts);
|
|
4456
4479
|
}
|
|
4457
4480
|
|
|
4458
|
-
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
|
4481
|
+
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.34",
|
|
4
4
|
"description": "@fastkit/vui",
|
|
5
5
|
"buildOptions": {
|
|
6
6
|
"name": "Vui",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"vue": "^3.2.26"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fastkit/color-scheme": "0.7.
|
|
36
|
-
"@fastkit/icon-font": "0.7.
|
|
37
|
-
"@fastkit/tiny-logger": "0.7.
|
|
38
|
-
"@fastkit/vite-kit": "0.7.
|
|
39
|
-
"@fastkit/vue-kit": "0.7.
|
|
35
|
+
"@fastkit/color-scheme": "0.7.34",
|
|
36
|
+
"@fastkit/icon-font": "0.7.34",
|
|
37
|
+
"@fastkit/tiny-logger": "0.7.34",
|
|
38
|
+
"@fastkit/vite-kit": "0.7.34",
|
|
39
|
+
"@fastkit/vue-kit": "0.7.34",
|
|
40
40
|
"@tiptap/extension-link": "^2.0.0-beta.36",
|
|
41
41
|
"@tiptap/extension-underline": "^2.0.0-beta.23",
|
|
42
42
|
"@tiptap/starter-kit": "^2.0.0-beta.183",
|
package/src/service.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { VuiInjectionKey } from './injections';
|
|
2
2
|
|
|
3
|
-
import { VNodeChild } from 'vue';
|
|
3
|
+
import { VNodeChild, reactive, UnwrapNestedRefs } from 'vue';
|
|
4
4
|
import { ScopeName, ColorVariant } from '@fastkit/color-scheme';
|
|
5
5
|
import type { IconName, RawIconProp } from './components/VIcon';
|
|
6
6
|
import {
|
|
7
7
|
type VueColorSchemePluginSettings,
|
|
8
8
|
type VueStackService,
|
|
9
9
|
type VDialogProps,
|
|
10
|
+
type VStackControl,
|
|
10
11
|
resolveVStackDynamicInput,
|
|
11
12
|
} from '@fastkit/vue-kit';
|
|
12
13
|
import type { Router } from 'vue-router';
|
|
@@ -16,6 +17,14 @@ import { VForm } from './components/VForm';
|
|
|
16
17
|
import { VTextField, TextFieldInput } from './components/VTextField';
|
|
17
18
|
import { VueForm, FormControlHinttipDelay } from '@fastkit/vue-form-control';
|
|
18
19
|
import { getDocumentScroller } from '@fastkit/vue-scroller';
|
|
20
|
+
import { ControlSize } from './schemes';
|
|
21
|
+
|
|
22
|
+
export interface VuiFormPromptSettings<
|
|
23
|
+
T extends { [key: string]: any } = { [key: string]: any },
|
|
24
|
+
> extends Partial<VDialogProps> {
|
|
25
|
+
state: T;
|
|
26
|
+
size?: ControlSize;
|
|
27
|
+
}
|
|
19
28
|
|
|
20
29
|
export interface VuiPromptOptions extends Partial<VDialogProps> {
|
|
21
30
|
input?: Omit<TextFieldInput, 'modelValue'> & { initialValue?: string };
|
|
@@ -245,30 +254,23 @@ export class VuiService {
|
|
|
245
254
|
return this.stack.snackbar(...args);
|
|
246
255
|
}
|
|
247
256
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
: {
|
|
257
|
-
...rawOptions,
|
|
258
|
-
};
|
|
257
|
+
formPrompt<T extends { [key: string]: any } = { [key: string]: any }>(
|
|
258
|
+
settings: VuiFormPromptSettings<T>,
|
|
259
|
+
slot: (
|
|
260
|
+
state: UnwrapNestedRefs<T>,
|
|
261
|
+
ctx: { form: VueForm; stack: VStackControl },
|
|
262
|
+
) => VNodeChild,
|
|
263
|
+
): Promise<T | false | undefined> {
|
|
264
|
+
let form: VueForm | undefined;
|
|
259
265
|
|
|
260
|
-
options
|
|
261
|
-
|
|
266
|
+
const options = {
|
|
267
|
+
dense: true,
|
|
268
|
+
...settings,
|
|
262
269
|
};
|
|
263
270
|
|
|
264
|
-
|
|
271
|
+
const { size, state } = options;
|
|
265
272
|
|
|
266
|
-
|
|
267
|
-
const { size } = options.input;
|
|
268
|
-
|
|
269
|
-
delete options.input.initialValue;
|
|
270
|
-
|
|
271
|
-
let form: VueForm | undefined;
|
|
273
|
+
const _state = reactive(state);
|
|
272
274
|
|
|
273
275
|
options.actions = options.actions || [
|
|
274
276
|
this.stack.action('cancel', undefined, { size }),
|
|
@@ -297,21 +299,53 @@ export class VuiService {
|
|
|
297
299
|
form = undefined;
|
|
298
300
|
}}
|
|
299
301
|
onSubmit={(ev) => {
|
|
300
|
-
stack.resolve(
|
|
301
|
-
}}
|
|
302
|
-
|
|
303
|
-
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
stack.value = ev;
|
|
307
|
-
value = ev;
|
|
308
|
-
}}
|
|
309
|
-
/>
|
|
310
|
-
</VForm>
|
|
302
|
+
stack.resolve(_state);
|
|
303
|
+
}}
|
|
304
|
+
v-slots={{
|
|
305
|
+
default: (form) => slot(_state, { form, stack }),
|
|
306
|
+
}}
|
|
307
|
+
/>
|
|
311
308
|
);
|
|
312
309
|
},
|
|
313
310
|
});
|
|
314
311
|
|
|
315
312
|
return this.dialog(resolved);
|
|
316
313
|
}
|
|
314
|
+
|
|
315
|
+
prompt(rawOptions: RawVuiPromptOptions = {}) {
|
|
316
|
+
const options: VuiPromptOptions =
|
|
317
|
+
typeof rawOptions === 'string'
|
|
318
|
+
? {
|
|
319
|
+
input: {
|
|
320
|
+
label: rawOptions,
|
|
321
|
+
},
|
|
322
|
+
}
|
|
323
|
+
: {
|
|
324
|
+
...rawOptions,
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
options.input = {
|
|
328
|
+
...options.input,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
options.dense = true;
|
|
332
|
+
|
|
333
|
+
const { initialValue: value = '' } = options.input;
|
|
334
|
+
const { size } = options.input;
|
|
335
|
+
|
|
336
|
+
delete options.input.initialValue;
|
|
337
|
+
|
|
338
|
+
return this.formPrompt(
|
|
339
|
+
{
|
|
340
|
+
size,
|
|
341
|
+
...options,
|
|
342
|
+
state: {
|
|
343
|
+
input: value,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
(state) => <VTextField {...options.input} v-model={state.input} />,
|
|
347
|
+
).then((result) => {
|
|
348
|
+
return result ? result.input : result;
|
|
349
|
+
});
|
|
350
|
+
}
|
|
317
351
|
}
|