cnhis-design-vue 3.1.9-beta.1 → 3.1.9-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -22
- package/es/packages/big-table/index.d.ts +1 -1
- package/es/packages/big-table/src/BigTable.vue.d.ts +1 -1
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.mjs +3 -1
- package/es/packages/big-table/style/index.less +557 -557
- package/es/packages/bpmn-workflow/style/index.less +29 -29
- package/es/packages/button-print/style/index.less +30 -30
- package/es/packages/chunk-upload/src/chunk-upload-new.vue.d.ts +4 -6
- package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +0 -3
- package/es/packages/chunk-upload/style/index.less +394 -394
- package/es/packages/drag-layout/src/DragLayout.vue.d.ts +5 -8
- package/es/packages/drag-layout/style/index.less +208 -208
- package/es/packages/field-set/style/index.less +157 -157
- package/es/packages/form-render/index.d.ts +267 -3
- package/es/packages/form-render/index.mjs +2 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +267 -3
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.mjs +39 -25
- package/es/packages/form-render/src/components/cascader.d.ts +6 -2
- package/es/packages/form-render/src/components/cascader.mjs +12 -6
- package/es/packages/form-render/src/components/select.d.ts +12 -2
- package/es/packages/form-render/src/components/select.mjs +65 -29
- package/es/packages/form-render/src/constants/index.d.ts +4 -1
- package/es/packages/form-render/src/constants/index.mjs +3 -1
- package/es/packages/form-render/src/hooks/index.d.ts +11 -9
- package/es/packages/form-render/src/hooks/index.mjs +2 -0
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +13 -33
- package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +5 -3
- package/es/packages/form-render/src/hooks/useBusinessBinding.mjs +15 -15
- package/es/packages/form-render/src/hooks/useChangeContext.d.ts +11 -0
- package/es/packages/form-render/src/hooks/useChangeContext.mjs +21 -0
- package/es/packages/form-render/src/hooks/useFormField.d.ts +1 -0
- package/es/packages/form-render/src/hooks/useFormField.mjs +7 -1
- package/es/packages/form-render/src/hooks/useFormItemDeps.d.ts +8 -0
- package/es/packages/form-render/src/hooks/useFormItemDeps.mjs +29 -0
- package/es/packages/form-render/src/types/index.d.ts +16 -6
- package/es/packages/form-render/src/utils/index.d.ts +5 -3
- package/es/packages/form-render/src/utils/index.mjs +13 -1
- package/es/packages/form-table/style/index.less +301 -301
- package/es/packages/grid/style/index.less +12 -12
- package/es/packages/index.css +0 -3
- package/es/packages/index.less +2941 -2945
- package/es/packages/index.mjs +2 -0
- package/es/packages/info-header/index.d.ts +18 -2
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +29 -13
- package/es/packages/info-header/src/HiddenContent.vue_vue_type_script_setup_true_lang.mjs +6 -4
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +18 -2
- package/es/packages/info-header/src/InfoHeader.vue_vue_type_script_setup_true_lang.mjs +10 -5
- package/es/packages/info-header/style/index.css +0 -3
- package/es/packages/info-header/style/index.less +149 -153
- package/es/packages/map/style/index.less +59 -59
- package/es/packages/scale-view/style/index.less +748 -748
- package/es/packages/select-label/src/LabelFormContent.vue.d.ts +0 -3
- package/es/packages/select-label/style/index.less +151 -151
- package/es/packages/select-person/src/SelectPerson.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/packages/select-person/style/index.less +229 -229
- package/es/packages/time-line/style/index.less +34 -34
- package/es/src/types/index.d.ts +1 -0
- package/es/src/utils/anime.mjs +1 -1
- package/global.d.ts +8 -8
- package/package.json +1 -1
- package/yarn-error.log +8659 -103
|
@@ -186,9 +186,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
186
186
|
onFormChange?: ((...args: any[]) => any) | undefined;
|
|
187
187
|
}>>;
|
|
188
188
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
businessCollector: import("./hooks").BusinessCollector;
|
|
190
|
+
changeContextCollector: import("./hooks").ContextCollector;
|
|
191
|
+
formItemDepsCollector: import("./hooks").FormItemDepsCollector;
|
|
192
192
|
formModel: import("@formily/core").Form<{
|
|
193
193
|
[x: string]: any;
|
|
194
194
|
}>;
|
|
@@ -313,6 +313,270 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
313
313
|
form: any;
|
|
314
314
|
}>;
|
|
315
315
|
FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
316
|
+
NForm: import("vue").DefineComponent<{
|
|
317
|
+
readonly inline: BooleanConstructor;
|
|
318
|
+
readonly labelWidth: PropType<string | number>;
|
|
319
|
+
readonly labelAlign: PropType<import("naive-ui/es/form/src/interface").LabelAlign>;
|
|
320
|
+
readonly labelPlacement: {
|
|
321
|
+
readonly type: PropType<import("naive-ui/es/form/src/interface").LabelPlacement>;
|
|
322
|
+
readonly default: "top";
|
|
323
|
+
};
|
|
324
|
+
readonly model: {
|
|
325
|
+
readonly type: PropType<Record<string, any>>;
|
|
326
|
+
readonly default: () => void;
|
|
327
|
+
};
|
|
328
|
+
readonly rules: PropType<import("naive-ui").FormRules>;
|
|
329
|
+
readonly disabled: BooleanConstructor;
|
|
330
|
+
readonly size: PropType<import("naive-ui/es/form/src/interface").Size>;
|
|
331
|
+
readonly showRequireMark: {
|
|
332
|
+
readonly type: PropType<boolean | undefined>;
|
|
333
|
+
readonly default: undefined;
|
|
334
|
+
};
|
|
335
|
+
readonly requireMarkPlacement: PropType<"left" | "right" | "right-hanging">;
|
|
336
|
+
readonly showFeedback: {
|
|
337
|
+
readonly type: BooleanConstructor;
|
|
338
|
+
readonly default: true;
|
|
339
|
+
};
|
|
340
|
+
readonly onSubmit: {
|
|
341
|
+
readonly type: PropType<(e: Event) => void>;
|
|
342
|
+
readonly default: (e: Event) => void;
|
|
343
|
+
};
|
|
344
|
+
readonly showLabel: {
|
|
345
|
+
readonly type: PropType<boolean | undefined>;
|
|
346
|
+
readonly default: undefined;
|
|
347
|
+
};
|
|
348
|
+
readonly validateMessages: PropType<Partial<import("naive-ui/es/form/src/interface").FormValidateMessages>>;
|
|
349
|
+
readonly theme: PropType<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
350
|
+
blankHeightSmall: string;
|
|
351
|
+
blankHeightMedium: string;
|
|
352
|
+
blankHeightLarge: string;
|
|
353
|
+
lineHeight: string;
|
|
354
|
+
labelTextColor: string;
|
|
355
|
+
asteriskColor: string;
|
|
356
|
+
feedbackTextColorError: string;
|
|
357
|
+
feedbackTextColorWarning: string;
|
|
358
|
+
feedbackTextColor: string;
|
|
359
|
+
feedbackPadding: string;
|
|
360
|
+
feedbackHeightSmall: string;
|
|
361
|
+
feedbackHeightMedium: string;
|
|
362
|
+
feedbackHeightLarge: string;
|
|
363
|
+
feedbackFontSizeSmall: string;
|
|
364
|
+
feedbackFontSizeMedium: string;
|
|
365
|
+
feedbackFontSizeLarge: string;
|
|
366
|
+
labelFontSizeLeftSmall: string;
|
|
367
|
+
labelFontSizeLeftMedium: string;
|
|
368
|
+
labelFontSizeLeftLarge: string;
|
|
369
|
+
labelFontSizeTopSmall: string;
|
|
370
|
+
labelFontSizeTopMedium: string;
|
|
371
|
+
labelFontSizeTopLarge: string;
|
|
372
|
+
labelHeightSmall: string;
|
|
373
|
+
labelHeightMedium: string;
|
|
374
|
+
labelHeightLarge: string;
|
|
375
|
+
labelPaddingVertical: string;
|
|
376
|
+
labelPaddingHorizontal: string;
|
|
377
|
+
labelTextAlignVertical: string;
|
|
378
|
+
labelTextAlignHorizontal: string;
|
|
379
|
+
}, any>>;
|
|
380
|
+
readonly themeOverrides: PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
381
|
+
blankHeightSmall: string;
|
|
382
|
+
blankHeightMedium: string;
|
|
383
|
+
blankHeightLarge: string;
|
|
384
|
+
lineHeight: string;
|
|
385
|
+
labelTextColor: string;
|
|
386
|
+
asteriskColor: string;
|
|
387
|
+
feedbackTextColorError: string;
|
|
388
|
+
feedbackTextColorWarning: string;
|
|
389
|
+
feedbackTextColor: string;
|
|
390
|
+
feedbackPadding: string;
|
|
391
|
+
feedbackHeightSmall: string;
|
|
392
|
+
feedbackHeightMedium: string;
|
|
393
|
+
feedbackHeightLarge: string;
|
|
394
|
+
feedbackFontSizeSmall: string;
|
|
395
|
+
feedbackFontSizeMedium: string;
|
|
396
|
+
feedbackFontSizeLarge: string;
|
|
397
|
+
labelFontSizeLeftSmall: string;
|
|
398
|
+
labelFontSizeLeftMedium: string;
|
|
399
|
+
labelFontSizeLeftLarge: string;
|
|
400
|
+
labelFontSizeTopSmall: string;
|
|
401
|
+
labelFontSizeTopMedium: string;
|
|
402
|
+
labelFontSizeTopLarge: string;
|
|
403
|
+
labelHeightSmall: string;
|
|
404
|
+
labelHeightMedium: string;
|
|
405
|
+
labelHeightLarge: string;
|
|
406
|
+
labelPaddingVertical: string;
|
|
407
|
+
labelPaddingHorizontal: string;
|
|
408
|
+
labelTextAlignVertical: string;
|
|
409
|
+
labelTextAlignHorizontal: string;
|
|
410
|
+
}, any>>>;
|
|
411
|
+
readonly builtinThemeOverrides: PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
412
|
+
blankHeightSmall: string;
|
|
413
|
+
blankHeightMedium: string;
|
|
414
|
+
blankHeightLarge: string;
|
|
415
|
+
lineHeight: string;
|
|
416
|
+
labelTextColor: string;
|
|
417
|
+
asteriskColor: string;
|
|
418
|
+
feedbackTextColorError: string;
|
|
419
|
+
feedbackTextColorWarning: string;
|
|
420
|
+
feedbackTextColor: string;
|
|
421
|
+
feedbackPadding: string;
|
|
422
|
+
feedbackHeightSmall: string;
|
|
423
|
+
feedbackHeightMedium: string;
|
|
424
|
+
feedbackHeightLarge: string;
|
|
425
|
+
feedbackFontSizeSmall: string;
|
|
426
|
+
feedbackFontSizeMedium: string;
|
|
427
|
+
feedbackFontSizeLarge: string;
|
|
428
|
+
labelFontSizeLeftSmall: string;
|
|
429
|
+
labelFontSizeLeftMedium: string;
|
|
430
|
+
labelFontSizeLeftLarge: string;
|
|
431
|
+
labelFontSizeTopSmall: string;
|
|
432
|
+
labelFontSizeTopMedium: string;
|
|
433
|
+
labelFontSizeTopLarge: string;
|
|
434
|
+
labelHeightSmall: string;
|
|
435
|
+
labelHeightMedium: string;
|
|
436
|
+
labelHeightLarge: string;
|
|
437
|
+
labelPaddingVertical: string;
|
|
438
|
+
labelPaddingHorizontal: string;
|
|
439
|
+
labelTextAlignVertical: string;
|
|
440
|
+
labelTextAlignHorizontal: string;
|
|
441
|
+
}, any>>>;
|
|
442
|
+
}, import("naive-ui").FormInst & {
|
|
443
|
+
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
444
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
445
|
+
readonly inline: BooleanConstructor;
|
|
446
|
+
readonly labelWidth: PropType<string | number>;
|
|
447
|
+
readonly labelAlign: PropType<import("naive-ui/es/form/src/interface").LabelAlign>;
|
|
448
|
+
readonly labelPlacement: {
|
|
449
|
+
readonly type: PropType<import("naive-ui/es/form/src/interface").LabelPlacement>;
|
|
450
|
+
readonly default: "top";
|
|
451
|
+
};
|
|
452
|
+
readonly model: {
|
|
453
|
+
readonly type: PropType<Record<string, any>>;
|
|
454
|
+
readonly default: () => void;
|
|
455
|
+
};
|
|
456
|
+
readonly rules: PropType<import("naive-ui").FormRules>;
|
|
457
|
+
readonly disabled: BooleanConstructor;
|
|
458
|
+
readonly size: PropType<import("naive-ui/es/form/src/interface").Size>;
|
|
459
|
+
readonly showRequireMark: {
|
|
460
|
+
readonly type: PropType<boolean | undefined>;
|
|
461
|
+
readonly default: undefined;
|
|
462
|
+
};
|
|
463
|
+
readonly requireMarkPlacement: PropType<"left" | "right" | "right-hanging">;
|
|
464
|
+
readonly showFeedback: {
|
|
465
|
+
readonly type: BooleanConstructor;
|
|
466
|
+
readonly default: true;
|
|
467
|
+
};
|
|
468
|
+
readonly onSubmit: {
|
|
469
|
+
readonly type: PropType<(e: Event) => void>;
|
|
470
|
+
readonly default: (e: Event) => void;
|
|
471
|
+
};
|
|
472
|
+
readonly showLabel: {
|
|
473
|
+
readonly type: PropType<boolean | undefined>;
|
|
474
|
+
readonly default: undefined;
|
|
475
|
+
};
|
|
476
|
+
readonly validateMessages: PropType<Partial<import("naive-ui/es/form/src/interface").FormValidateMessages>>;
|
|
477
|
+
readonly theme: PropType<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
478
|
+
blankHeightSmall: string;
|
|
479
|
+
blankHeightMedium: string;
|
|
480
|
+
blankHeightLarge: string;
|
|
481
|
+
lineHeight: string;
|
|
482
|
+
labelTextColor: string;
|
|
483
|
+
asteriskColor: string;
|
|
484
|
+
feedbackTextColorError: string;
|
|
485
|
+
feedbackTextColorWarning: string;
|
|
486
|
+
feedbackTextColor: string;
|
|
487
|
+
feedbackPadding: string;
|
|
488
|
+
feedbackHeightSmall: string;
|
|
489
|
+
feedbackHeightMedium: string;
|
|
490
|
+
feedbackHeightLarge: string;
|
|
491
|
+
feedbackFontSizeSmall: string;
|
|
492
|
+
feedbackFontSizeMedium: string;
|
|
493
|
+
feedbackFontSizeLarge: string;
|
|
494
|
+
labelFontSizeLeftSmall: string;
|
|
495
|
+
labelFontSizeLeftMedium: string;
|
|
496
|
+
labelFontSizeLeftLarge: string;
|
|
497
|
+
labelFontSizeTopSmall: string;
|
|
498
|
+
labelFontSizeTopMedium: string;
|
|
499
|
+
labelFontSizeTopLarge: string;
|
|
500
|
+
labelHeightSmall: string;
|
|
501
|
+
labelHeightMedium: string;
|
|
502
|
+
labelHeightLarge: string;
|
|
503
|
+
labelPaddingVertical: string;
|
|
504
|
+
labelPaddingHorizontal: string;
|
|
505
|
+
labelTextAlignVertical: string;
|
|
506
|
+
labelTextAlignHorizontal: string;
|
|
507
|
+
}, any>>;
|
|
508
|
+
readonly themeOverrides: PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
509
|
+
blankHeightSmall: string;
|
|
510
|
+
blankHeightMedium: string;
|
|
511
|
+
blankHeightLarge: string;
|
|
512
|
+
lineHeight: string;
|
|
513
|
+
labelTextColor: string;
|
|
514
|
+
asteriskColor: string;
|
|
515
|
+
feedbackTextColorError: string;
|
|
516
|
+
feedbackTextColorWarning: string;
|
|
517
|
+
feedbackTextColor: string;
|
|
518
|
+
feedbackPadding: string;
|
|
519
|
+
feedbackHeightSmall: string;
|
|
520
|
+
feedbackHeightMedium: string;
|
|
521
|
+
feedbackHeightLarge: string;
|
|
522
|
+
feedbackFontSizeSmall: string;
|
|
523
|
+
feedbackFontSizeMedium: string;
|
|
524
|
+
feedbackFontSizeLarge: string;
|
|
525
|
+
labelFontSizeLeftSmall: string;
|
|
526
|
+
labelFontSizeLeftMedium: string;
|
|
527
|
+
labelFontSizeLeftLarge: string;
|
|
528
|
+
labelFontSizeTopSmall: string;
|
|
529
|
+
labelFontSizeTopMedium: string;
|
|
530
|
+
labelFontSizeTopLarge: string;
|
|
531
|
+
labelHeightSmall: string;
|
|
532
|
+
labelHeightMedium: string;
|
|
533
|
+
labelHeightLarge: string;
|
|
534
|
+
labelPaddingVertical: string;
|
|
535
|
+
labelPaddingHorizontal: string;
|
|
536
|
+
labelTextAlignVertical: string;
|
|
537
|
+
labelTextAlignHorizontal: string;
|
|
538
|
+
}, any>>>;
|
|
539
|
+
readonly builtinThemeOverrides: PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Form", {
|
|
540
|
+
blankHeightSmall: string;
|
|
541
|
+
blankHeightMedium: string;
|
|
542
|
+
blankHeightLarge: string;
|
|
543
|
+
lineHeight: string;
|
|
544
|
+
labelTextColor: string;
|
|
545
|
+
asteriskColor: string;
|
|
546
|
+
feedbackTextColorError: string;
|
|
547
|
+
feedbackTextColorWarning: string;
|
|
548
|
+
feedbackTextColor: string;
|
|
549
|
+
feedbackPadding: string;
|
|
550
|
+
feedbackHeightSmall: string;
|
|
551
|
+
feedbackHeightMedium: string;
|
|
552
|
+
feedbackHeightLarge: string;
|
|
553
|
+
feedbackFontSizeSmall: string;
|
|
554
|
+
feedbackFontSizeMedium: string;
|
|
555
|
+
feedbackFontSizeLarge: string;
|
|
556
|
+
labelFontSizeLeftSmall: string;
|
|
557
|
+
labelFontSizeLeftMedium: string;
|
|
558
|
+
labelFontSizeLeftLarge: string;
|
|
559
|
+
labelFontSizeTopSmall: string;
|
|
560
|
+
labelFontSizeTopMedium: string;
|
|
561
|
+
labelFontSizeTopLarge: string;
|
|
562
|
+
labelHeightSmall: string;
|
|
563
|
+
labelHeightMedium: string;
|
|
564
|
+
labelHeightLarge: string;
|
|
565
|
+
labelPaddingVertical: string;
|
|
566
|
+
labelPaddingHorizontal: string;
|
|
567
|
+
labelTextAlignVertical: string;
|
|
568
|
+
labelTextAlignHorizontal: string;
|
|
569
|
+
}, any>>>;
|
|
570
|
+
}>>, {
|
|
571
|
+
readonly inline: boolean;
|
|
572
|
+
readonly disabled: boolean;
|
|
573
|
+
readonly onSubmit: (e: Event) => void;
|
|
574
|
+
readonly labelPlacement: import("naive-ui/es/form/src/interface").LabelPlacement;
|
|
575
|
+
readonly model: Record<string, any>;
|
|
576
|
+
readonly showRequireMark: boolean | undefined;
|
|
577
|
+
readonly showFeedback: boolean;
|
|
578
|
+
readonly showLabel: boolean | undefined;
|
|
579
|
+
}>;
|
|
316
580
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "formChange"[], "formChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
317
581
|
fieldList: {
|
|
318
582
|
type: PropType<FieldItem[]>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock,
|
|
1
|
+
import { defineComponent, provide, computed, openBlock, createBlock, unref, normalizeStyle, withCtx, createVNode, renderSlot, createElementVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
2
2
|
import { injectOrProvide } from './utils/index.mjs';
|
|
3
3
|
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import { InjectionBusinessCollector, InjectAsyncQueue, InjectionSchemaField } from './constants/index.mjs';
|
|
4
|
+
import { InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectAsyncQueue, InjectionSchemaField } from './constants/index.mjs';
|
|
5
5
|
import * as index from './components/index.mjs';
|
|
6
6
|
import { createForm, onFieldValueChange } from '@formily/core';
|
|
7
7
|
import { FormProvider, FormConsumer, createSchemaField } from '@formily/vue';
|
|
8
|
+
import { NForm } from 'naive-ui';
|
|
8
9
|
import { useBusinessBinding } from './hooks/useBusinessBinding.mjs';
|
|
9
10
|
import { useAsyncQueue } from './hooks/useAsyncQueue.mjs';
|
|
11
|
+
import { useChangeContext } from './hooks/useChangeContext.mjs';
|
|
12
|
+
import { useFormItemDeps } from './hooks/useFormItemDeps.mjs';
|
|
10
13
|
import { useFieldVisitor } from './hooks/useFieldVisitor.mjs';
|
|
11
14
|
import { useFieldList2Schema } from './hooks/useFieldList2Schema.mjs';
|
|
12
15
|
|
|
@@ -32,20 +35,27 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
32
35
|
],
|
|
33
36
|
setup(__props, { expose, emit }) {
|
|
34
37
|
const props = __props;
|
|
35
|
-
const { create, trigger } = useBusinessBinding();
|
|
36
|
-
const collector = injectOrProvide(InjectionBusinessCollector, create);
|
|
37
38
|
injectOrProvide(InjectAsyncQueue, () => useAsyncQueue().create(props.parallelism));
|
|
39
|
+
const businessCollector = useBusinessBinding().create();
|
|
40
|
+
provide(InjectionBusinessCollector, businessCollector);
|
|
41
|
+
const changeContextCollector = useChangeContext().create();
|
|
42
|
+
provide(InjectionChangeContextCollector, changeContextCollector);
|
|
43
|
+
const formItemDepsCollector = useFormItemDeps().create();
|
|
44
|
+
provide(InjectionFormItemDepsCollector, formItemDepsCollector);
|
|
38
45
|
const formModel = createForm({
|
|
39
46
|
initialValues: props.initialData,
|
|
40
47
|
effects() {
|
|
41
48
|
onFieldValueChange("*", (field) => {
|
|
49
|
+
const fieldKey = field.props.name.toString();
|
|
42
50
|
emit("formChange", {
|
|
43
51
|
fieldInstance: field,
|
|
44
|
-
fieldKey
|
|
52
|
+
fieldKey,
|
|
45
53
|
fieldName: field.title,
|
|
46
|
-
value: field.value
|
|
54
|
+
value: field.value,
|
|
55
|
+
context: changeContextCollector.getContext(fieldKey)
|
|
47
56
|
});
|
|
48
|
-
trigger(
|
|
57
|
+
businessCollector.trigger(formModel, fieldKey, field.value);
|
|
58
|
+
formItemDepsCollector.trigger(fieldKey);
|
|
49
59
|
});
|
|
50
60
|
}
|
|
51
61
|
});
|
|
@@ -54,11 +64,12 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
54
64
|
scope: props.scope
|
|
55
65
|
}).SchemaField);
|
|
56
66
|
const { traverse } = useFieldVisitor();
|
|
57
|
-
const { transform } = useFieldList2Schema(
|
|
67
|
+
const { transform } = useFieldList2Schema(businessCollector);
|
|
58
68
|
const renderSchema = computed(() => {
|
|
59
69
|
if (props.schema) {
|
|
60
70
|
return props.schema;
|
|
61
|
-
}
|
|
71
|
+
}
|
|
72
|
+
if (props.fieldList) {
|
|
62
73
|
const _fieldList = traverse(cloneDeep(props.fieldList), props.fieldVisitor);
|
|
63
74
|
return { type: "object", properties: transform(_fieldList) };
|
|
64
75
|
}
|
|
@@ -75,25 +86,28 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
75
86
|
setFieldState: formModel.setFieldState.bind(formModel)
|
|
76
87
|
});
|
|
77
88
|
return (_ctx, _cache) => {
|
|
78
|
-
return openBlock(),
|
|
89
|
+
return openBlock(), createBlock(unref(NForm), {
|
|
79
90
|
class: "form-render__wrapper",
|
|
80
91
|
style: normalizeStyle({ "--column": __props.column })
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
__props.consumer ? (openBlock(), createBlock(unref(FormConsumer), { key: 0 }, {
|
|
88
|
-
default: withCtx(({ form }) => [
|
|
89
|
-
createElementVNode("div", _hoisted_1, toDisplayString(JSON.stringify(form.values, null, 2)), 1)
|
|
92
|
+
}, {
|
|
93
|
+
default: withCtx(() => [
|
|
94
|
+
createVNode(unref(FormProvider), { form: unref(formModel) }, {
|
|
95
|
+
default: withCtx(() => [
|
|
96
|
+
renderSlot(_ctx.$slots, "default", { schemaFiled: unref(SchemaField) }, () => [
|
|
97
|
+
createVNode(unref(SchemaField), { schema: unref(renderSchema) }, null, 8, ["schema"])
|
|
90
98
|
]),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
__props.consumer ? (openBlock(), createBlock(unref(FormConsumer), { key: 0 }, {
|
|
100
|
+
default: withCtx(({ form }) => [
|
|
101
|
+
createElementVNode("div", _hoisted_1, toDisplayString(JSON.stringify(form.values, null, 2)), 1)
|
|
102
|
+
]),
|
|
103
|
+
_: 1
|
|
104
|
+
})) : createCommentVNode("v-if", true)
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 8, ["form"])
|
|
108
|
+
]),
|
|
109
|
+
_: 3
|
|
110
|
+
}, 8, ["style"]);
|
|
97
111
|
};
|
|
98
112
|
}
|
|
99
113
|
});
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { AnyObject } from 'cnhis-design-vue/es/src/types';
|
|
1
|
+
import { AnyObject, ArrayAble } from 'cnhis-design-vue/es/src/types';
|
|
2
2
|
import { FormRequestType } from '../types';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
+
declare type DependKeyObj = {
|
|
5
|
+
paramName: string;
|
|
6
|
+
paramValue: string;
|
|
7
|
+
};
|
|
4
8
|
declare type UrlConfig = {
|
|
5
9
|
method: FormRequestType;
|
|
6
10
|
nameKey: string;
|
|
7
|
-
dependKey: string
|
|
11
|
+
dependKey: ArrayAble<string> | ArrayAble<DependKeyObj>;
|
|
8
12
|
url: string;
|
|
9
13
|
valueKey: string;
|
|
10
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
2
|
+
import { isObject, isString } from 'lodash-es';
|
|
2
3
|
import { InjectAsyncQueue } from '../constants/index.mjs';
|
|
3
|
-
import { assignUpdateValue, formRenderLog } from '../utils/index.mjs';
|
|
4
|
-
import { isObject } from '@vueuse/core';
|
|
4
|
+
import { assignUpdateValue, formRenderLog, arrayed } from '../utils/index.mjs';
|
|
5
5
|
import { connect, mapProps } from '@formily/vue';
|
|
6
6
|
import { NCascader } from 'naive-ui';
|
|
7
7
|
import { useFormField } from '../hooks/useFormField.mjs';
|
|
@@ -52,11 +52,17 @@ const script = defineComponent({
|
|
|
52
52
|
lvlnr: parentDepth + 1 + ""
|
|
53
53
|
};
|
|
54
54
|
if (option) {
|
|
55
|
-
if (!
|
|
56
|
-
formRenderLog(`invalid urlConfig.dependKey ${
|
|
55
|
+
if (!config.dependKey) {
|
|
56
|
+
formRenderLog(`invalid urlConfig.dependKey ${config.dependKey} in CASCADER => ${title.value}`, "warn");
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
arrayed(config.dependKey).forEach((key) => {
|
|
60
|
+
if (isString(key)) {
|
|
61
|
+
params[key] = option[config.valueKey];
|
|
62
|
+
} else if (isObject(key)) {
|
|
63
|
+
params[key.paramName] = option[key.paramValue];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
}
|
|
61
67
|
const data = await asyncQueue.addAsync({
|
|
62
68
|
...config,
|
|
@@ -77,7 +83,7 @@ const script = defineComponent({
|
|
|
77
83
|
const renderOptions = computed(() => {
|
|
78
84
|
return _options.value || props.options || [];
|
|
79
85
|
});
|
|
80
|
-
watch(() =>
|
|
86
|
+
watch(() => props.value, (n, o) => {
|
|
81
87
|
if (n != null && o == null) {
|
|
82
88
|
fetchData();
|
|
83
89
|
}
|
|
@@ -3,11 +3,16 @@ import { FormRequestType } from '../types';
|
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
4
|
declare type UrlConfig = {
|
|
5
5
|
method: FormRequestType;
|
|
6
|
+
dependKey?: string | string[];
|
|
6
7
|
nameKey: string;
|
|
7
8
|
url: string;
|
|
9
|
+
params?: AnyObject;
|
|
8
10
|
valueKey: string;
|
|
9
11
|
};
|
|
10
12
|
export declare const SELECT: import("vue").DefineComponent<{
|
|
13
|
+
value: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
11
16
|
options: {
|
|
12
17
|
type: PropType<AnyObject[]>;
|
|
13
18
|
default: () => never[];
|
|
@@ -18,7 +23,10 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
18
23
|
onChange: {
|
|
19
24
|
type: FunctionConstructor;
|
|
20
25
|
};
|
|
21
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
26
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
value: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
22
30
|
options: {
|
|
23
31
|
type: PropType<AnyObject[]>;
|
|
24
32
|
default: () => never[];
|
|
@@ -29,7 +37,9 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
29
37
|
onChange: {
|
|
30
38
|
type: FunctionConstructor;
|
|
31
39
|
};
|
|
32
|
-
}
|
|
40
|
+
}>> & {
|
|
41
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
42
|
+
}, {
|
|
33
43
|
options: AnyObject[];
|
|
34
44
|
}>;
|
|
35
45
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../constants/index.mjs';
|
|
4
|
+
import { assignUpdateValue, formRenderLog, generateUrlParams } from '../utils/index.mjs';
|
|
4
5
|
import { isObject } from '@vueuse/core';
|
|
5
6
|
import { connect, mapProps } from '@formily/vue';
|
|
6
7
|
import { NSelect } from 'naive-ui';
|
|
@@ -9,6 +10,9 @@ import { useFormField } from '../hooks/useFormField.mjs';
|
|
|
9
10
|
const script = defineComponent({
|
|
10
11
|
name: "FormSelect",
|
|
11
12
|
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
12
16
|
options: {
|
|
13
17
|
type: Array,
|
|
14
18
|
default: () => []
|
|
@@ -20,21 +24,32 @@ const script = defineComponent({
|
|
|
20
24
|
type: Function
|
|
21
25
|
}
|
|
22
26
|
},
|
|
27
|
+
emits: ["update:value"],
|
|
23
28
|
setup(props, {
|
|
24
29
|
slots,
|
|
25
|
-
|
|
30
|
+
emit
|
|
26
31
|
}) {
|
|
27
32
|
const _options = ref(null);
|
|
28
33
|
let cachedOptions = null;
|
|
29
|
-
let lastSearch;
|
|
34
|
+
let lastSearch = ref("");
|
|
30
35
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
31
36
|
const {
|
|
32
|
-
title
|
|
37
|
+
title,
|
|
38
|
+
field,
|
|
39
|
+
fieldKey
|
|
33
40
|
} = useFormField();
|
|
41
|
+
function filterOption(options, searchContent) {
|
|
42
|
+
return options.filter((option) => {
|
|
43
|
+
return !searchContent || String(option[labelKey.value]).includes(searchContent);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
34
46
|
async function fetchData(content) {
|
|
35
|
-
if (content === lastSearch
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
if (content === lastSearch.value) {
|
|
48
|
+
if (cachedOptions)
|
|
49
|
+
return;
|
|
50
|
+
} else {
|
|
51
|
+
lastSearch.value = content || "";
|
|
52
|
+
}
|
|
38
53
|
const config = props.urlConfig;
|
|
39
54
|
if (!config) {
|
|
40
55
|
return cachedOptions = _options.value = null;
|
|
@@ -44,19 +59,17 @@ const script = defineComponent({
|
|
|
44
59
|
return cachedOptions = _options.value = null;
|
|
45
60
|
}
|
|
46
61
|
if (cachedOptions) {
|
|
47
|
-
return _options.value = cachedOptions
|
|
48
|
-
var _a;
|
|
49
|
-
return !content || ((_a = option[config.nameKey]) == null ? void 0 : _a.includes(content));
|
|
50
|
-
});
|
|
62
|
+
return _options.value = filterOption(cachedOptions, content);
|
|
51
63
|
}
|
|
52
64
|
try {
|
|
53
65
|
const data = await asyncQueue.addAsync({
|
|
54
66
|
...config,
|
|
55
|
-
key: title.value
|
|
67
|
+
key: title.value,
|
|
68
|
+
params: Object.assign({}, config.params, generateUrlParams(field.value, config.dependKey))
|
|
56
69
|
});
|
|
57
70
|
_options.value = data.reduce((res, d) => {
|
|
58
71
|
var _a;
|
|
59
|
-
if (((_a = d[
|
|
72
|
+
if (((_a = d[labelKey.value]) == null ? void 0 : _a.includes(content)) || !content) {
|
|
60
73
|
res.push(d);
|
|
61
74
|
}
|
|
62
75
|
return res;
|
|
@@ -67,30 +80,53 @@ const script = defineComponent({
|
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
const renderOptions = computed(() => {
|
|
70
|
-
|
|
83
|
+
if (_options.value)
|
|
84
|
+
return _options.value;
|
|
85
|
+
if (!Array.isArray(props.options))
|
|
86
|
+
return [];
|
|
87
|
+
return filterOption(props.options, lastSearch.value);
|
|
71
88
|
});
|
|
72
|
-
|
|
89
|
+
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
90
|
+
watch(() => props.urlConfig, (config) => {
|
|
73
91
|
cachedOptions = null;
|
|
92
|
+
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], () => {
|
|
93
|
+
cachedOptions = null;
|
|
94
|
+
props.value && fetchData();
|
|
95
|
+
});
|
|
96
|
+
}, {
|
|
97
|
+
immediate: true
|
|
74
98
|
});
|
|
75
|
-
watch(() =>
|
|
99
|
+
watch(() => props.value, (n, o) => {
|
|
76
100
|
if (o == null && n != null) {
|
|
77
101
|
fetchData();
|
|
78
102
|
}
|
|
79
103
|
}, {
|
|
80
104
|
immediate: true
|
|
81
105
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
107
|
+
function update(v, option) {
|
|
108
|
+
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, "currentOption", cloneDeep(option));
|
|
109
|
+
emit("update:value", v);
|
|
110
|
+
}
|
|
111
|
+
const labelKey = computed(() => {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
|
|
114
|
+
});
|
|
115
|
+
const valueKey = computed(() => {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
118
|
+
});
|
|
119
|
+
return () => createVNode(NSelect, {
|
|
120
|
+
"value": props.value,
|
|
121
|
+
"onUpdate:value": update,
|
|
122
|
+
"remote": true,
|
|
123
|
+
"filterable": true,
|
|
124
|
+
"labelField": labelKey.value,
|
|
125
|
+
"valueField": valueKey.value,
|
|
126
|
+
"onSearch": fetchData,
|
|
127
|
+
"onUpdate:show": (show) => show && fetchData(),
|
|
128
|
+
"options": renderOptions.value
|
|
129
|
+
}, slots);
|
|
94
130
|
}
|
|
95
131
|
});
|
|
96
132
|
const SELECT = connect(script, mapProps({
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextCollector } from 'cnhis-design-vue/es/packages/form-render/src/hooks/useChangeContext';
|
|
2
|
+
import { BusinessCollector, FormItemDepsCollector } from '../hooks';
|
|
2
3
|
import { FormAsyncQueue } from '../types';
|
|
3
4
|
import { Component, InjectionKey } from 'vue';
|
|
4
5
|
export declare const InjectAsyncQueue: InjectionKey<FormAsyncQueue>;
|
|
5
6
|
export declare const InjectionSchemaField: InjectionKey<Component>;
|
|
6
7
|
export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>;
|
|
8
|
+
export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
|
|
9
|
+
export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
|
|
7
10
|
export declare enum FIELD_BUSINESS_TYPE {
|
|
8
11
|
PASSWORD = "password",
|
|
9
12
|
ID_CARD = "id_card",
|