@fastkit/vui 0.7.32 → 0.7.35
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 +51 -24
- package/dist/vui.cjs.prod.js +51 -24
- package/dist/vui.d.ts +39 -12
- package/dist/vui.mjs +52 -26
- package/package.json +6 -6
- package/src/components/VWysiwygEditor/index.ts +1 -0
- package/src/service.tsx +69 -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,53 @@ 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
|
-
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4374
|
+
default: _form => {
|
|
4375
|
+
form = _form;
|
|
4376
|
+
return slot(_state, {
|
|
4377
|
+
form,
|
|
4378
|
+
stack
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4386
4381
|
});
|
|
4387
4382
|
}
|
|
4388
4383
|
});
|
|
4389
4384
|
return this.dialog(resolved);
|
|
4390
4385
|
}
|
|
4391
4386
|
|
|
4387
|
+
prompt(rawOptions = {}) {
|
|
4388
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4389
|
+
input: {
|
|
4390
|
+
label: rawOptions
|
|
4391
|
+
}
|
|
4392
|
+
} : { ...rawOptions
|
|
4393
|
+
};
|
|
4394
|
+
options.input = { ...options.input
|
|
4395
|
+
};
|
|
4396
|
+
options.dense = true;
|
|
4397
|
+
const {
|
|
4398
|
+
initialValue: value = ''
|
|
4399
|
+
} = options.input;
|
|
4400
|
+
const {
|
|
4401
|
+
size
|
|
4402
|
+
} = options.input;
|
|
4403
|
+
delete options.input.initialValue;
|
|
4404
|
+
return this.formPrompt({
|
|
4405
|
+
size,
|
|
4406
|
+
...options,
|
|
4407
|
+
state: {
|
|
4408
|
+
input: value
|
|
4409
|
+
}
|
|
4410
|
+
}, state => vue.createVNode(VTextField, vue.mergeProps(options.input, {
|
|
4411
|
+
"modelValue": state.input,
|
|
4412
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4413
|
+
}), null)).then(result => {
|
|
4414
|
+
return result ? result.input : result;
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4392
4418
|
}
|
|
4393
4419
|
|
|
4394
4420
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4555,6 +4581,7 @@ exports.rawIconProp = rawIconProp;
|
|
|
4555
4581
|
exports.renderNavigationItemInput = renderNavigationItemInput;
|
|
4556
4582
|
exports.resolveNavigationItemInput = resolveNavigationItemInput;
|
|
4557
4583
|
exports.resolveRawIconProp = resolveRawIconProp;
|
|
4584
|
+
exports.resolveRawWysiwygEditorTools = resolveRawWysiwygEditorTools;
|
|
4558
4585
|
exports.useControl = useControl;
|
|
4559
4586
|
exports.useControlField = useControlField;
|
|
4560
4587
|
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,53 @@ 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
|
-
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4374
|
+
default: _form => {
|
|
4375
|
+
form = _form;
|
|
4376
|
+
return slot(_state, {
|
|
4377
|
+
form,
|
|
4378
|
+
stack
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4386
4381
|
});
|
|
4387
4382
|
}
|
|
4388
4383
|
});
|
|
4389
4384
|
return this.dialog(resolved);
|
|
4390
4385
|
}
|
|
4391
4386
|
|
|
4387
|
+
prompt(rawOptions = {}) {
|
|
4388
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4389
|
+
input: {
|
|
4390
|
+
label: rawOptions
|
|
4391
|
+
}
|
|
4392
|
+
} : { ...rawOptions
|
|
4393
|
+
};
|
|
4394
|
+
options.input = { ...options.input
|
|
4395
|
+
};
|
|
4396
|
+
options.dense = true;
|
|
4397
|
+
const {
|
|
4398
|
+
initialValue: value = ''
|
|
4399
|
+
} = options.input;
|
|
4400
|
+
const {
|
|
4401
|
+
size
|
|
4402
|
+
} = options.input;
|
|
4403
|
+
delete options.input.initialValue;
|
|
4404
|
+
return this.formPrompt({
|
|
4405
|
+
size,
|
|
4406
|
+
...options,
|
|
4407
|
+
state: {
|
|
4408
|
+
input: value
|
|
4409
|
+
}
|
|
4410
|
+
}, state => vue.createVNode(VTextField, vue.mergeProps(options.input, {
|
|
4411
|
+
"modelValue": state.input,
|
|
4412
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4413
|
+
}), null)).then(result => {
|
|
4414
|
+
return result ? result.input : result;
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
|
|
4392
4418
|
}
|
|
4393
4419
|
|
|
4394
4420
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4555,6 +4581,7 @@ exports.rawIconProp = rawIconProp;
|
|
|
4555
4581
|
exports.renderNavigationItemInput = renderNavigationItemInput;
|
|
4556
4582
|
exports.resolveNavigationItemInput = resolveNavigationItemInput;
|
|
4557
4583
|
exports.resolveRawIconProp = resolveRawIconProp;
|
|
4584
|
+
exports.resolveRawWysiwygEditorTools = resolveRawWysiwygEditorTools;
|
|
4558
4585
|
exports.useControl = useControl;
|
|
4559
4586
|
exports.useControlField = useControlField;
|
|
4560
4587
|
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,53 @@ 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
|
-
|
|
4379
|
-
}
|
|
4380
|
-
}
|
|
4369
|
+
default: _form => {
|
|
4370
|
+
form = _form;
|
|
4371
|
+
return slot(_state, {
|
|
4372
|
+
form,
|
|
4373
|
+
stack
|
|
4374
|
+
});
|
|
4375
|
+
}
|
|
4381
4376
|
});
|
|
4382
4377
|
}
|
|
4383
4378
|
});
|
|
4384
4379
|
return this.dialog(resolved);
|
|
4385
4380
|
}
|
|
4386
4381
|
|
|
4382
|
+
prompt(rawOptions = {}) {
|
|
4383
|
+
const options = typeof rawOptions === 'string' ? {
|
|
4384
|
+
input: {
|
|
4385
|
+
label: rawOptions
|
|
4386
|
+
}
|
|
4387
|
+
} : { ...rawOptions
|
|
4388
|
+
};
|
|
4389
|
+
options.input = { ...options.input
|
|
4390
|
+
};
|
|
4391
|
+
options.dense = true;
|
|
4392
|
+
const {
|
|
4393
|
+
initialValue: value = ''
|
|
4394
|
+
} = options.input;
|
|
4395
|
+
const {
|
|
4396
|
+
size
|
|
4397
|
+
} = options.input;
|
|
4398
|
+
delete options.input.initialValue;
|
|
4399
|
+
return this.formPrompt({
|
|
4400
|
+
size,
|
|
4401
|
+
...options,
|
|
4402
|
+
state: {
|
|
4403
|
+
input: value
|
|
4404
|
+
}
|
|
4405
|
+
}, state => createVNode(VTextField, mergeProps(options.input, {
|
|
4406
|
+
"modelValue": state.input,
|
|
4407
|
+
"onUpdate:modelValue": $event => state.input = $event
|
|
4408
|
+
}), null)).then(result => {
|
|
4409
|
+
return result ? result.input : result;
|
|
4410
|
+
});
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4387
4413
|
}
|
|
4388
4414
|
|
|
4389
4415
|
function mergeVuiPluginOptions(base, override) {
|
|
@@ -4455,4 +4481,4 @@ function installVuiPlugin(app, opts) {
|
|
|
4455
4481
|
return app.use(VuiPlugin, opts);
|
|
4456
4482
|
}
|
|
4457
4483
|
|
|
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 };
|
|
4484
|
+
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.35",
|
|
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.35",
|
|
36
|
+
"@fastkit/icon-font": "0.7.35",
|
|
37
|
+
"@fastkit/tiny-logger": "0.7.35",
|
|
38
|
+
"@fastkit/vite-kit": "0.7.35",
|
|
39
|
+
"@fastkit/vue-kit": "0.7.35",
|
|
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,56 @@ export class VuiService {
|
|
|
297
299
|
form = undefined;
|
|
298
300
|
}}
|
|
299
301
|
onSubmit={(ev) => {
|
|
300
|
-
stack.resolve(
|
|
301
|
-
}}
|
|
302
|
-
|
|
303
|
-
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
/>
|
|
310
|
-
</VForm>
|
|
302
|
+
stack.resolve(_state);
|
|
303
|
+
}}
|
|
304
|
+
v-slots={{
|
|
305
|
+
default: (_form) => {
|
|
306
|
+
form = _form;
|
|
307
|
+
return slot(_state, { form, stack });
|
|
308
|
+
},
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
311
|
);
|
|
312
312
|
},
|
|
313
313
|
});
|
|
314
314
|
|
|
315
315
|
return this.dialog(resolved);
|
|
316
316
|
}
|
|
317
|
+
|
|
318
|
+
prompt(rawOptions: RawVuiPromptOptions = {}) {
|
|
319
|
+
const options: VuiPromptOptions =
|
|
320
|
+
typeof rawOptions === 'string'
|
|
321
|
+
? {
|
|
322
|
+
input: {
|
|
323
|
+
label: rawOptions,
|
|
324
|
+
},
|
|
325
|
+
}
|
|
326
|
+
: {
|
|
327
|
+
...rawOptions,
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
options.input = {
|
|
331
|
+
...options.input,
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
options.dense = true;
|
|
335
|
+
|
|
336
|
+
const { initialValue: value = '' } = options.input;
|
|
337
|
+
const { size } = options.input;
|
|
338
|
+
|
|
339
|
+
delete options.input.initialValue;
|
|
340
|
+
|
|
341
|
+
return this.formPrompt(
|
|
342
|
+
{
|
|
343
|
+
size,
|
|
344
|
+
...options,
|
|
345
|
+
state: {
|
|
346
|
+
input: value,
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
(state) => <VTextField {...options.input} v-model={state.input} />,
|
|
350
|
+
).then((result) => {
|
|
351
|
+
return result ? result.input : result;
|
|
352
|
+
});
|
|
353
|
+
}
|
|
317
354
|
}
|