@jeecg/online 3.4.4-beta2 → 3.5.3-beta

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.
@@ -1,1211 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
40
- import { UploadTypeEnum } from "/@/components/Form/src/jeecg/components/JUpload";
41
- const SUBMIT_FLOW_KEY = "jeecg_submit_form_and_flow";
42
- const SUBMIT_FLOW_ID = "flow_submit_id";
43
- const ONL_FORM_TABLE_NAME = "online_form_table_name";
44
- const VALIDATE_FAILED = "validate-failed";
45
- const SETUP = "setup";
46
- const ENHANCEJS = "EnhanceJS";
47
- const FORM_VIEW_TO_QUERY_VIEW = {
48
- password: "text",
49
- file: "text",
50
- image: "text",
51
- textarea: "text",
52
- umeditor: "text",
53
- markdown: "text",
54
- checkbox: "list_multi",
55
- radio: "list"
56
- };
57
- const POP_CONTAINER = ".jeecg-online-modal .ant-modal-content";
58
- const ONL_AUTH_PRE = "online_";
59
- class IFormSchema {
60
- constructor(key, data) {
61
- this._data = data;
62
- this.field = key;
63
- this.label = data.title;
64
- this.hidden = false;
65
- this.order = data.order || 999;
66
- this.required = false;
67
- this.onlyValidator = "";
68
- this.setFieldsValue = "";
69
- this.hasChange = true;
70
- if (key.indexOf("@") > 0) {
71
- this.pre = key.substring(0, key.indexOf("@") + 1);
72
- } else {
73
- this.pre = "";
74
- }
75
- this.schemaProp = {};
76
- this.searchForm = false;
77
- this.disabled = false;
78
- this.popContainer = "";
79
- this.handleWidgetAttr(data);
80
- this.inPopover = false;
81
- }
82
- getFormItemSchema() {
83
- let schema = this.getItem();
84
- this.addDefaultChangeEvent(schema);
85
- return schema;
86
- }
87
- getItem() {
88
- let fs = {
89
- field: this.field,
90
- label: this.label,
91
- labelLength: 4,
92
- component: "Input",
93
- itemProps: {
94
- labelCol: {
95
- class: "online-form-label"
96
- }
97
- }
98
- };
99
- let rules = this.getRule();
100
- if (rules.length > 0 && this.onlyValidator) {
101
- fs["rules"] = rules;
102
- }
103
- if (this.hidden === true) {
104
- fs["show"] = false;
105
- }
106
- return fs;
107
- }
108
- setFormRef(ref) {
109
- this.formRef = ref;
110
- }
111
- isHidden() {
112
- this.hidden = true;
113
- return this;
114
- }
115
- isRequired(array) {
116
- if (array && array.length > 0) {
117
- if (array.indexOf(this.field) >= 0) {
118
- this.required = true;
119
- }
120
- }
121
- return this;
122
- }
123
- getExtendData() {
124
- let extend = {};
125
- let { fieldExtendJson } = this._data;
126
- if (fieldExtendJson) {
127
- if (typeof fieldExtendJson == "string") {
128
- try {
129
- let json = JSON.parse(fieldExtendJson);
130
- extend = __spreadValues({}, json);
131
- } catch (e) {
132
- console.error(e);
133
- }
134
- }
135
- }
136
- return extend;
137
- }
138
- getRelatedHideFields() {
139
- return [];
140
- }
141
- getPlaceholder() {
142
- return "\u8BF7\u8F93\u5165" + this.label;
143
- }
144
- setOnlyValidateFun(validateFun) {
145
- if (validateFun) {
146
- this.onlyValidator = (rule, value) => __async(this, null, function* () {
147
- let error = yield validateFun(rule, value);
148
- if (!error) {
149
- return Promise.resolve();
150
- } else {
151
- return Promise.reject(error);
152
- }
153
- });
154
- }
155
- }
156
- getRule() {
157
- let rules = [];
158
- const { view, errorInfo, pattern, type } = this._data;
159
- if (this.required === true) {
160
- let msg = this.getPlaceholder();
161
- if (errorInfo) {
162
- msg = errorInfo;
163
- }
164
- if (view == "sel_depart" || view == "sel_user") {
165
- this.schemaProp["required"] = true;
166
- } else {
167
- rules.push({ required: true, message: msg });
168
- }
169
- }
170
- if ("sel_user" == view) {
171
- if (pattern === "only" && this.onlyValidator) {
172
- rules.push({ validator: this.onlyValidator });
173
- }
174
- }
175
- if ("list" === view || "radio" === view || "markdown" === view || "pca" === view || view.indexOf("sel") >= 0 || "time" === view) {
176
- return rules;
177
- }
178
- if (view.indexOf("upload") >= 0 || view.indexOf("file") >= 0 || view.indexOf("image") >= 0) {
179
- return rules;
180
- }
181
- if (pattern) {
182
- if (pattern === "only") {
183
- if (this.onlyValidator) {
184
- rules.push({ validator: this.onlyValidator });
185
- }
186
- } else if (pattern === "z") {
187
- if (type == "number" || type == "integer")
188
- ;
189
- else {
190
- rules.push({ pattern: /^-?\d+$/, message: "\u8BF7\u8F93\u5165\u6574\u6570" });
191
- }
192
- } else {
193
- let msg = errorInfo || "\u6B63\u5219\u8868\u8FBE\u5F0F\u4E0D\u6B63\u786E";
194
- rules.push({ pattern, message: msg });
195
- }
196
- }
197
- return rules;
198
- }
199
- addDefaultChangeEvent(schema) {
200
- if (this.hasChange) {
201
- if (!schema.componentProps) {
202
- schema.componentProps = {};
203
- }
204
- if (this.disabled == true) {
205
- schema.componentProps.disabled = true;
206
- }
207
- if (!schema.componentProps.hasOwnProperty("onChange")) {
208
- schema.componentProps["onChange"] = (value, formData) => {
209
- if (value instanceof Event) {
210
- value = value.target.value;
211
- }
212
- if (value instanceof Array) {
213
- value = value.join(",");
214
- }
215
- if (!this.formRef || !this.formRef.value || !this.formRef.value.$formValueChange) {
216
- console.log("\u5F53\u524D\u8868\u5355\u65E0\u6CD5\u89E6\u53D1change\u4E8B\u4EF6,field\uFF1A" + this.field);
217
- } else {
218
- this.formRef.value.$formValueChange(this.field, value, formData);
219
- }
220
- };
221
- }
222
- }
223
- Object.keys(this.schemaProp).map((k) => {
224
- schema[k] = this.schemaProp[k];
225
- });
226
- }
227
- noChange() {
228
- this.hasChange = false;
229
- }
230
- updateField(field) {
231
- this.field = field;
232
- }
233
- setFunctionForFieldValue(func) {
234
- if (func) {
235
- this.setFieldsValue = func;
236
- }
237
- }
238
- asSearchForm() {
239
- this.searchForm = true;
240
- }
241
- getModalAsContainer() {
242
- let ele = this.getPopContainer();
243
- return document.querySelector(ele);
244
- }
245
- getPopContainer() {
246
- if (this.searchForm === true) {
247
- return "body";
248
- } else if (this.inPopover === true) {
249
- return `.${this.popContainer}`;
250
- } else if (this.popContainer) {
251
- return `.${this.popContainer} .ant-modal-content`;
252
- } else {
253
- return POP_CONTAINER;
254
- }
255
- }
256
- handleWidgetAttr(data) {
257
- if (data.ui) {
258
- if (data.ui.widgetattrs) {
259
- if (data.ui.widgetattrs.disabled == true) {
260
- this.disabled = true;
261
- }
262
- }
263
- }
264
- }
265
- setCustomPopContainer(modalClass) {
266
- this.popContainer = modalClass;
267
- }
268
- getLinkFieldInfo() {
269
- return "";
270
- }
271
- setOtherInfo(_arg) {
272
- }
273
- isInPopover() {
274
- this.inPopover = true;
275
- }
276
- }
277
- class InputWidget extends IFormSchema {
278
- getItem() {
279
- let item = super.getItem();
280
- if (this.hidden === true) {
281
- item["show"] = false;
282
- }
283
- return item;
284
- }
285
- }
286
- var DateFormat = /* @__PURE__ */ ((DateFormat2) => {
287
- DateFormat2["datetime"] = "YYYY-MM-DD HH:mm:ss";
288
- DateFormat2["date"] = "YYYY-MM-DD";
289
- return DateFormat2;
290
- })(DateFormat || {});
291
- class DateWidget extends IFormSchema {
292
- constructor(key, data) {
293
- super(key, data);
294
- this.format = DateFormat[data.view];
295
- this.showTime = data.view == "date" ? false : true;
296
- }
297
- getItem() {
298
- let item = super.getItem();
299
- return Object.assign({}, item, {
300
- component: "DatePicker",
301
- componentProps: {
302
- placeholder: `\u8BF7\u9009\u62E9${this.label}`,
303
- showTime: this.showTime,
304
- valueFormat: this.format,
305
- style: {
306
- width: "100%"
307
- },
308
- getPopupContainer: (_node) => {
309
- return this.getModalAsContainer();
310
- }
311
- }
312
- });
313
- }
314
- }
315
- class SelectWidget extends IFormSchema {
316
- constructor(key, data) {
317
- super(key, data);
318
- this.options = this.getOptions(data["enum"]);
319
- this.dictTable = data["dictTable"];
320
- this.dictText = data["dictText"];
321
- this.dictCode = data["dictCode"];
322
- this.multi = data["multi"] || false;
323
- }
324
- getItem() {
325
- let item = super.getItem();
326
- let component = this.getFormComponent();
327
- let componentProps = this.getComponentProps();
328
- return Object.assign({}, item, {
329
- component,
330
- componentProps
331
- });
332
- }
333
- getFormComponent() {
334
- if (this.options.length > 0) {
335
- return "Select";
336
- } else {
337
- return "JDictSelectTag";
338
- }
339
- }
340
- getComponentProps() {
341
- let mode = this.multi === true ? "multiple" : "combobox";
342
- let props = {
343
- allowClear: true,
344
- mode,
345
- style: {
346
- width: "100%"
347
- },
348
- getPopupContainer: (_node) => {
349
- return this.getModalAsContainer();
350
- }
351
- };
352
- if (this.options.length > 0) {
353
- props["options"] = this.options;
354
- } else {
355
- if (!this.dictTable) {
356
- props["dictCode"] = this.dictCode;
357
- } else {
358
- let temp = `${this.dictTable},${this.dictText},${this.dictCode}`;
359
- props["dictCode"] = encodeURI(temp);
360
- }
361
- }
362
- return props;
363
- }
364
- getOptions(array) {
365
- if (!array || array.length == 0) {
366
- return [];
367
- }
368
- let arr = [];
369
- for (let item of array) {
370
- arr.push({
371
- value: item.value,
372
- label: item.title
373
- });
374
- }
375
- return arr;
376
- }
377
- }
378
- class PasswordWidget extends IFormSchema {
379
- getItem() {
380
- let item = super.getItem();
381
- return Object.assign({}, item, {
382
- component: "InputPassword"
383
- });
384
- }
385
- }
386
- class FileWidget extends IFormSchema {
387
- getItem() {
388
- let item = super.getItem();
389
- let componentProps = this.getComponentProps();
390
- return Object.assign({}, item, {
391
- component: "JUpload",
392
- componentProps
393
- });
394
- }
395
- getComponentProps() {
396
- let json = this.getExtendData();
397
- if (json && json.uploadnum) {
398
- return {
399
- maxCount: Number(json.uploadnum)
400
- };
401
- }
402
- return {};
403
- }
404
- }
405
- class ImageWidget extends IFormSchema {
406
- getItem() {
407
- let item = super.getItem();
408
- let componentProps = this.getComponentProps();
409
- return Object.assign({}, item, {
410
- component: "JUpload",
411
- componentProps
412
- });
413
- }
414
- getComponentProps() {
415
- let props = {
416
- fileType: UploadTypeEnum.image
417
- };
418
- let json = this.getExtendData();
419
- if (json && json.uploadnum) {
420
- props["maxCount"] = Number(json.uploadnum);
421
- }
422
- return props;
423
- }
424
- }
425
- class TextAreaWidget extends IFormSchema {
426
- getItem() {
427
- let item = super.getItem();
428
- return Object.assign({}, item, {
429
- component: "InputTextArea"
430
- });
431
- }
432
- }
433
- class SelectMultiWidget extends IFormSchema {
434
- constructor(key, data) {
435
- super(key, data);
436
- this.dictTable = data["dictTable"];
437
- this.dictText = data["dictText"];
438
- this.dictCode = data["dictCode"];
439
- }
440
- getItem() {
441
- let item = super.getItem();
442
- let componentProps = this.getComponentProps();
443
- return Object.assign({}, item, {
444
- component: "JSelectMultiple",
445
- componentProps
446
- });
447
- }
448
- getComponentProps() {
449
- if (!this.dictTable && !this.dictCode) {
450
- return {};
451
- } else {
452
- let props = {};
453
- if (!this.dictTable) {
454
- props["dictCode"] = this.dictCode;
455
- } else {
456
- let temp = `${this.dictTable},${this.dictText},${this.dictCode}`;
457
- props["dictCode"] = encodeURI(temp);
458
- }
459
- props["triggerChange"] = true;
460
- props["popContainer"] = this.getPopContainer();
461
- return props;
462
- }
463
- }
464
- }
465
- class SelectSearchWidget extends IFormSchema {
466
- constructor(key, data) {
467
- super(key, data);
468
- this.dict = encodeURI(`${data.dictTable},${data.dictText},${data.dictCode}`);
469
- }
470
- getItem() {
471
- let item = super.getItem();
472
- let popContainer = this.getPopContainer();
473
- return Object.assign({}, item, {
474
- component: "JSearchSelect",
475
- componentProps: {
476
- dict: this.dict,
477
- pageSize: 6,
478
- async: true,
479
- popContainer
480
- }
481
- });
482
- }
483
- }
484
- class PopupWidget extends IFormSchema {
485
- constructor(key, data) {
486
- super(key, data);
487
- this.code = data["code"];
488
- this.multi = data["popupMulti"];
489
- this.fieldConfig = this.getFieldConfig(data);
490
- }
491
- getItem() {
492
- let item = super.getItem();
493
- let componentProps = this.getComponentProps();
494
- return Object.assign({}, item, {
495
- component: "JPopup",
496
- componentProps
497
- });
498
- }
499
- getComponentProps() {
500
- let props = {
501
- code: this.code,
502
- multi: this.multi,
503
- fieldConfig: this.fieldConfig
504
- };
505
- if (this.formRef) {
506
- props["formElRef"] = this.formRef;
507
- } else {
508
- props["setFieldsValue"] = this.setFieldsValue;
509
- }
510
- if (this.inPopover === true) {
511
- props["getContainer"] = () => {
512
- return this.getModalAsContainer();
513
- };
514
- }
515
- return props;
516
- }
517
- getFieldConfig(data) {
518
- let { destFields, orgFields } = data;
519
- if (!destFields || destFields.length == 0) {
520
- return [];
521
- }
522
- let arr1 = destFields.split(",");
523
- let arr2 = orgFields.split(",");
524
- let config = [];
525
- const pre = this.pre;
526
- for (let i = 0; i < arr1.length; i++) {
527
- config.push({
528
- target: pre + arr1[i],
529
- source: arr2[i]
530
- });
531
- }
532
- return config;
533
- }
534
- }
535
- class TreeCategoryWidget extends IFormSchema {
536
- constructor(key, data) {
537
- super(key, data);
538
- this.multi = false;
539
- this.pid = data["pidValue"];
540
- this.pcode = data["pcode"];
541
- this.textField = data["textField"];
542
- }
543
- getItem() {
544
- let item = super.getItem();
545
- let componentProps = this.getComponentProps();
546
- return Object.assign({}, item, {
547
- componentProps,
548
- component: "JCategorySelect"
549
- });
550
- }
551
- getComponentProps() {
552
- let param = {
553
- placeholder: "\u8BF7\u9009\u62E9" + this.label
554
- };
555
- if (this.pcode) {
556
- param["pcode"] = this.pcode;
557
- } else {
558
- let pidValue = this.pid || "EMPTY_PID";
559
- param["pid"] = pidValue;
560
- }
561
- if (!this.textField) {
562
- return __spreadValues({
563
- multiple: this.multi
564
- }, param);
565
- } else {
566
- return __spreadProps(__spreadValues({
567
- loadTriggleChange: true,
568
- multiple: this.multi
569
- }, param), {
570
- back: this.textField,
571
- onChange: (val, backVal) => {
572
- if (this.formRef) {
573
- this.formRef.value.setFieldsValue(backVal);
574
- this.formRef.value.$formValueChange(this.field, val);
575
- }
576
- }
577
- });
578
- }
579
- }
580
- getRelatedHideFields() {
581
- let arr = [];
582
- if (this.textField) {
583
- arr.push(this.textField);
584
- }
585
- return arr;
586
- }
587
- }
588
- class SelectDepartWidget extends IFormSchema {
589
- getItem() {
590
- let item = super.getItem();
591
- let componentProps = this.getComponentProps();
592
- return Object.assign({}, item, {
593
- component: "JSelectDept",
594
- componentProps
595
- });
596
- }
597
- getComponentProps() {
598
- let extend = this.getExtendData();
599
- let props = {
600
- checkStrictly: true,
601
- showButton: false
602
- };
603
- if (extend.text) {
604
- props["labelKey"] = extend.text;
605
- }
606
- if (extend.store) {
607
- props["rowKey"] = extend.store;
608
- }
609
- if (extend.multiSelect === false) {
610
- props["multiple"] = false;
611
- }
612
- if (this.inPopover === true) {
613
- props["getContainer"] = () => {
614
- return this.getModalAsContainer();
615
- };
616
- }
617
- return props;
618
- }
619
- }
620
- class SelectUserWidget extends IFormSchema {
621
- constructor(key, data) {
622
- super(key, data);
623
- this.showButton = data.showButton === false ? false : true;
624
- }
625
- getItem() {
626
- let item = super.getItem();
627
- let componentProps = this.getComponentProps();
628
- return Object.assign({}, item, {
629
- component: "JSelectUser",
630
- componentProps
631
- });
632
- }
633
- getComponentProps() {
634
- let extend = this.getExtendData();
635
- let props = {
636
- showSelected: false,
637
- allowClear: true,
638
- isRadioSelection: false,
639
- showButton: this.showButton
640
- };
641
- if (extend.text) {
642
- props["labelKey"] = extend.text;
643
- }
644
- if (extend.store) {
645
- props["rowKey"] = extend.store;
646
- }
647
- if (extend.multiSelect === false) {
648
- props["isRadioSelection"] = true;
649
- }
650
- if (this.inPopover === true) {
651
- props["getContainer"] = () => {
652
- return this.getModalAsContainer();
653
- };
654
- }
655
- return props;
656
- }
657
- }
658
- class EditorWidget extends IFormSchema {
659
- getItem() {
660
- let item = super.getItem();
661
- return Object.assign({}, item, {
662
- component: "JEditor",
663
- componentProps: {
664
- options: {
665
- auto_focus: false
666
- }
667
- }
668
- });
669
- }
670
- }
671
- class MarkdownWidget extends IFormSchema {
672
- getItem() {
673
- let item = super.getItem();
674
- return Object.assign({}, item, {
675
- component: "JMarkdownEditor",
676
- componentProps: {}
677
- });
678
- }
679
- }
680
- class PcaWidget extends IFormSchema {
681
- getItem() {
682
- let item = super.getItem();
683
- return Object.assign({}, item, {
684
- component: "JAreaSelect"
685
- });
686
- }
687
- }
688
- class TreeSelectWidget extends IFormSchema {
689
- constructor(key, data) {
690
- super(key, data);
691
- this.dict = data["dict"];
692
- this.pidField = data["pidField"];
693
- this.pidValue = data["pidValue"];
694
- }
695
- getItem() {
696
- let item = super.getItem();
697
- return Object.assign({}, item, {
698
- component: "JTreeSelect",
699
- componentProps: {
700
- dict: this.dict,
701
- pidField: this.pidField,
702
- pidValue: this.pidValue
703
- }
704
- });
705
- }
706
- }
707
- class RadioWidget extends IFormSchema {
708
- constructor(key, data) {
709
- super(key, data);
710
- this.dictTable = data["dictTable"];
711
- this.dictText = data["dictText"];
712
- this.dictCode = data["dictCode"];
713
- }
714
- getItem() {
715
- let item = super.getItem();
716
- let componentProps = this.getComponentProps();
717
- return Object.assign({}, item, {
718
- component: "JDictSelectTag",
719
- componentProps
720
- });
721
- }
722
- getComponentProps() {
723
- if (!this.dictTable && !this.dictCode) {
724
- return {};
725
- } else {
726
- if (!this.dictTable) {
727
- return {
728
- dictCode: this.dictCode,
729
- type: "radio"
730
- };
731
- } else {
732
- let temp = `${this.dictTable},${this.dictText},${this.dictCode}`;
733
- return {
734
- dictCode: encodeURI(temp),
735
- type: "radio"
736
- };
737
- }
738
- }
739
- }
740
- }
741
- class CheckboxWidget extends IFormSchema {
742
- constructor(key, data) {
743
- super(key, data);
744
- this.options = this.getOptions(data["enum"]);
745
- }
746
- getItem() {
747
- let item = super.getItem();
748
- return Object.assign({}, item, {
749
- component: "JCheckbox",
750
- componentProps: {
751
- options: this.options,
752
- triggerChange: true
753
- }
754
- });
755
- }
756
- getOptions(array) {
757
- if (!array || array.length == 0) {
758
- return [];
759
- }
760
- let arr = [];
761
- for (let item of array) {
762
- arr.push({
763
- value: item.value,
764
- label: item.title
765
- });
766
- }
767
- return arr;
768
- }
769
- }
770
- class SwitchWidget extends IFormSchema {
771
- constructor(key, data) {
772
- super(key, data);
773
- this.hasChange = false;
774
- }
775
- getItem() {
776
- let item = super.getItem();
777
- let componentProps = this.getComponentProps();
778
- return Object.assign({}, item, {
779
- component: "JSwitch",
780
- componentProps
781
- });
782
- }
783
- getComponentProps() {
784
- let { fieldExtendJson } = this._data;
785
- let options = ["Y", "N"];
786
- if (fieldExtendJson) {
787
- if (typeof fieldExtendJson == "string") {
788
- let arr = JSON.parse(fieldExtendJson);
789
- if (arr.length == 2) {
790
- options = arr;
791
- }
792
- }
793
- }
794
- return {
795
- options
796
- };
797
- }
798
- }
799
- class TimeWidget extends IFormSchema {
800
- getItem() {
801
- let item = super.getItem();
802
- return Object.assign({}, item, {
803
- component: "TimePicker",
804
- componentProps: {
805
- placeholder: `\u8BF7\u9009\u62E9${this.label}`,
806
- valueFormat: "HH:mm:ss",
807
- getPopupContainer: (_node) => {
808
- return this.getModalAsContainer();
809
- },
810
- style: {
811
- width: "100%"
812
- }
813
- }
814
- });
815
- }
816
- }
817
- class LinkDownWidget extends IFormSchema {
818
- constructor(key, data) {
819
- super(key, data);
820
- const { dictTable, dictText, dictCode, pidField, idField, origin, condition } = data;
821
- this.table = dictTable;
822
- this.txt = dictText;
823
- this.store = dictCode;
824
- this.idField = idField;
825
- this.pidField = pidField;
826
- this.origin = origin;
827
- this.condition = condition;
828
- this.options = [];
829
- this.next = data.next || "";
830
- this.type = data.type;
831
- }
832
- getItem() {
833
- let item = super.getItem();
834
- let componentProps = this.getComponentProps();
835
- return Object.assign({}, item, {
836
- component: "OnlineSelectCascade",
837
- componentProps
838
- });
839
- }
840
- getComponentProps() {
841
- let baseProp = {
842
- table: this.table,
843
- txt: this.txt,
844
- store: this.store,
845
- pidField: this.pidField,
846
- idField: this.idField,
847
- origin: this.origin,
848
- pidValue: "-1",
849
- style: {
850
- width: "100%"
851
- },
852
- onChange: (value) => {
853
- console.log("\u7EA7\u8054\u7EC4\u4EF6-onChange", value);
854
- this.valueChange(value);
855
- },
856
- onNext: (pidValue) => {
857
- console.log("\u7EA7\u8054\u7EC4\u4EF6-onNext", pidValue);
858
- this.nextOptionsChange(pidValue);
859
- }
860
- };
861
- if (this._data.origin === true) {
862
- baseProp["condition"] = this.condition;
863
- }
864
- return baseProp;
865
- }
866
- nextOptionsChange(pidValue) {
867
- return __async(this, null, function* () {
868
- if (!this.formRef) {
869
- console.error("\u8868\u5355\u5F15\u7528\u627E\u4E0D\u5230");
870
- return;
871
- }
872
- if (!this.next) {
873
- return;
874
- }
875
- let ref = this.formRef.value;
876
- yield ref.updateSchema({
877
- field: this.next,
878
- componentProps: {
879
- pidValue
880
- }
881
- });
882
- });
883
- }
884
- valueChange(value) {
885
- return __async(this, null, function* () {
886
- if (!this.formRef) {
887
- console.error("\u8868\u5355\u5F15\u7528\u627E\u4E0D\u5230");
888
- return;
889
- }
890
- if (!this.next) {
891
- return;
892
- }
893
- let ref = this.formRef.value;
894
- ref.$formValueChange(this.field, value);
895
- yield ref.setFieldsValue({ [this.next]: "" });
896
- });
897
- }
898
- }
899
- class SlotWidget extends IFormSchema {
900
- constructor(key, data) {
901
- super(key, data);
902
- this.slot = "";
903
- }
904
- getItem() {
905
- let item = super.getItem();
906
- let slot = this.slot;
907
- return Object.assign({}, item, { slot });
908
- }
909
- groupDate() {
910
- this.slot = "groupDate";
911
- return this;
912
- }
913
- groupDatetime() {
914
- this.slot = "groupDatetime";
915
- return this;
916
- }
917
- groupNumber() {
918
- this.slot = "groupNumber";
919
- return this;
920
- }
921
- }
922
- class NumberWidget extends IFormSchema {
923
- constructor(key, data) {
924
- super(key, data);
925
- this.dbPointLength = data.dbPointLength;
926
- }
927
- getItem() {
928
- let item = super.getItem();
929
- let componentProps = this.getComponentProps();
930
- return Object.assign({}, item, {
931
- component: "InputNumber",
932
- componentProps
933
- });
934
- }
935
- getComponentProps() {
936
- const props = {
937
- style: {
938
- width: "100%"
939
- }
940
- };
941
- if (this.dbPointLength >= 0) {
942
- props["precision"] = this.dbPointLength;
943
- }
944
- return props;
945
- }
946
- }
947
- class LinkTableWidget extends IFormSchema {
948
- constructor(key, data) {
949
- super(key, data);
950
- this.dictTable = data.dictTable;
951
- this.dictText = data.dictText;
952
- this.dictCode = data.dictCode;
953
- this.view = data.view;
954
- this.componentString = "";
955
- this.linkFields = [];
956
- }
957
- getItem() {
958
- let item = super.getItem();
959
- const componentProps = this.getComponentProps();
960
- return Object.assign({}, item, {
961
- component: this.componentString,
962
- componentProps
963
- });
964
- }
965
- getComponentProps() {
966
- let props = {
967
- textField: this.dictText,
968
- tableName: this.dictTable,
969
- valueField: this.dictCode
970
- };
971
- let extend = this.getExtendData();
972
- if (extend.multiSelect) {
973
- props["multi"] = true;
974
- } else {
975
- props["multi"] = false;
976
- }
977
- if (extend.imageField) {
978
- props["imageField"] = extend.imageField;
979
- } else {
980
- props["imageField"] = "";
981
- }
982
- if (extend.showType == "select") {
983
- this.componentString = "LinkTableSelect";
984
- let popContainer = this.getPopContainer();
985
- props["popContainer"] = popContainer;
986
- } else {
987
- this.componentString = "LinkTableCard";
988
- }
989
- if (this.linkFields.length > 0) {
990
- props["linkFields"] = this.linkFields;
991
- }
992
- return props;
993
- }
994
- setOtherInfo(arr) {
995
- this.linkFields = arr;
996
- }
997
- }
998
- class LinkTableFieldWidget extends IFormSchema {
999
- constructor(key, data) {
1000
- super(key, data);
1001
- this.dictTable = data["dictTable"];
1002
- this.dictText = data["dictText"];
1003
- }
1004
- getItem() {
1005
- let item = super.getItem();
1006
- return Object.assign({}, item, {
1007
- componentProps: {
1008
- readOnly: true,
1009
- allowClear: false,
1010
- disabled: true,
1011
- style: {
1012
- background: "none",
1013
- color: "rgba(0, 0, 0, 0.85)",
1014
- border: "none"
1015
- }
1016
- }
1017
- });
1018
- }
1019
- getLinkFieldInfo() {
1020
- let arr = [this.dictTable, `${this.field},${this.dictText}`];
1021
- return arr;
1022
- }
1023
- }
1024
- class LinkTableForQueryWidget extends IFormSchema {
1025
- constructor(key, data) {
1026
- super(key, data);
1027
- this.code = data["code"];
1028
- this.titleField = data["titleField"];
1029
- this.multi = data["multi"] || false;
1030
- }
1031
- getItem() {
1032
- let item = super.getItem();
1033
- return Object.assign({}, item, {
1034
- component: "LinkTableForQuery",
1035
- componentProps: {
1036
- code: this.code,
1037
- multi: this.multi,
1038
- field: this.titleField,
1039
- style: {
1040
- width: "100%"
1041
- }
1042
- }
1043
- });
1044
- }
1045
- }
1046
- class CascaderPcaForQueryWidget extends IFormSchema {
1047
- getItem() {
1048
- let item = super.getItem();
1049
- return Object.assign({}, item, {
1050
- component: "CascaderPcaForQuery",
1051
- componentProps: {
1052
- style: {
1053
- width: "100%"
1054
- }
1055
- }
1056
- });
1057
- }
1058
- }
1059
- class SelectUser2Widget extends IFormSchema {
1060
- constructor(key, data) {
1061
- super(key, data);
1062
- this.multi = data.multi === true ? true : false;
1063
- this.store = data.store || "";
1064
- this.query = data.query || false;
1065
- }
1066
- getItem() {
1067
- let item = super.getItem();
1068
- let componentProps = this.getComponentProps();
1069
- return Object.assign({}, item, {
1070
- component: "UserSelect",
1071
- componentProps
1072
- });
1073
- }
1074
- getComponentProps() {
1075
- let props = {
1076
- multi: this.multi,
1077
- store: this.store,
1078
- query: this.query
1079
- };
1080
- if (this.inPopover === true) {
1081
- props["getContainer"] = () => {
1082
- return this.getModalAsContainer();
1083
- };
1084
- }
1085
- return props;
1086
- }
1087
- }
1088
- class RangeWidget extends IFormSchema {
1089
- constructor(key, data) {
1090
- super(key, data);
1091
- let view = data.view;
1092
- this.datetime = false;
1093
- if ("rangeNumber" === view) {
1094
- this.componentType = "JRangeNumber";
1095
- } else {
1096
- this.componentType = "RangeDate";
1097
- if (data.datetime === true) {
1098
- this.datetime = true;
1099
- }
1100
- }
1101
- }
1102
- getItem() {
1103
- let item = super.getItem();
1104
- return Object.assign({}, item, {
1105
- component: this.componentType,
1106
- componentProps: {
1107
- datetime: this.datetime,
1108
- getPopupContainer: (_node) => {
1109
- return this.getModalAsContainer();
1110
- }
1111
- }
1112
- });
1113
- }
1114
- }
1115
- class FormSchemaFactory {
1116
- static createFormSchema(key, data) {
1117
- let view = data.view;
1118
- switch (view) {
1119
- case "password":
1120
- return new PasswordWidget(key, data);
1121
- case "list":
1122
- return new SelectWidget(key, data);
1123
- case "radio":
1124
- return new RadioWidget(key, data);
1125
- case "checkbox":
1126
- return new CheckboxWidget(key, data);
1127
- case "date":
1128
- case "datetime":
1129
- return new DateWidget(key, data);
1130
- case "time":
1131
- return new TimeWidget(key, data);
1132
- case "file":
1133
- return new FileWidget(key, data);
1134
- case "image":
1135
- return new ImageWidget(key, data);
1136
- case "textarea":
1137
- return new TextAreaWidget(key, data);
1138
- case "list_multi":
1139
- return new SelectMultiWidget(key, data);
1140
- case "sel_search":
1141
- return new SelectSearchWidget(key, data);
1142
- case "popup":
1143
- return new PopupWidget(key, data);
1144
- case "cat_tree":
1145
- return new TreeCategoryWidget(key, data);
1146
- case "sel_depart":
1147
- return new SelectDepartWidget(key, data);
1148
- case "sel_user":
1149
- return new SelectUserWidget(key, data);
1150
- case "umeditor":
1151
- return new EditorWidget(key, data);
1152
- case "markdown":
1153
- return new MarkdownWidget(key, data);
1154
- case "pca":
1155
- return new PcaWidget(key, data);
1156
- case "link_down":
1157
- return new LinkDownWidget(key, data);
1158
- case "sel_tree":
1159
- return new TreeSelectWidget(key, data);
1160
- case "switch":
1161
- return new SwitchWidget(key, data);
1162
- case "link_table":
1163
- return new LinkTableWidget(key, data);
1164
- case "link_table_field":
1165
- return new LinkTableFieldWidget(key, data);
1166
- case "slot":
1167
- return new SlotWidget(key, data);
1168
- case "LinkTableForQuery":
1169
- return new LinkTableForQueryWidget(key, data);
1170
- case "CascaderPcaForQuery":
1171
- return new CascaderPcaForQueryWidget(key, data);
1172
- case "select_user2":
1173
- return new SelectUser2Widget(key, data);
1174
- case "rangeDate":
1175
- case "rangeNumber":
1176
- return new RangeWidget(key, data);
1177
- case "hidden":
1178
- return new InputWidget(key, data).isHidden();
1179
- default:
1180
- if (data.type == "number") {
1181
- return new NumberWidget(key, data);
1182
- } else {
1183
- return new InputWidget(key, data);
1184
- }
1185
- }
1186
- }
1187
- static createSlotFormSchema(key, data) {
1188
- let slotFs = new SlotWidget(key, data);
1189
- let view = data.view;
1190
- if ("date" == view) {
1191
- slotFs.groupDate();
1192
- } else if ("datetime" == view) {
1193
- slotFs.groupDatetime();
1194
- } else {
1195
- let type = data.type;
1196
- if (type == "number" || type == "integer") {
1197
- slotFs.groupNumber();
1198
- }
1199
- }
1200
- return slotFs;
1201
- }
1202
- static createIdField() {
1203
- return {
1204
- label: "",
1205
- field: "id",
1206
- component: "Input",
1207
- show: false
1208
- };
1209
- }
1210
- }
1211
- export { ENHANCEJS as E, FormSchemaFactory as F, ONL_FORM_TABLE_NAME as O, SUBMIT_FLOW_KEY as S, VALIDATE_FAILED as V, ONL_AUTH_PRE as a, SUBMIT_FLOW_ID as b, FORM_VIEW_TO_QUERY_VIEW as c, SETUP as d };