cloud-web-corejs 1.0.54-dev.691 → 1.0.54-dev.693

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.691",
4
+ "version": "1.0.54-dev.693",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
package/src/api/user.js CHANGED
@@ -119,6 +119,14 @@ export function getLoginConfig(option) {
119
119
  });
120
120
  }
121
121
 
122
+ export function getLogicParamValue(option) {
123
+ return request({
124
+ url: USER_PREFIX + "/logic_param/getParamValue",
125
+ method: "post",
126
+ ...option,
127
+ });
128
+ }
129
+
122
130
  export function getIdmLoginUrl(option) {
123
131
  return request({
124
132
  url: USER_PREFIX + "/auth/idmLoginUrl",
@@ -1,148 +1,148 @@
1
- import {
2
- isEmptyStr,
3
- isEmptyArrayFieldValue,
4
- isArrayValueWidgetType,
5
- isVabsearchWidgetType,
6
- isVabsearchMultiWidget,
7
- } from "./util";
8
- import { resolveColumnRequiredFlag } from "./tableColumnHelper";
9
-
10
- /** 数据表格行内字段候选 key(column.prop 为权威存储字段) */
11
- export function getCellFieldKeys(fieldWidget, columnConfig) {
12
- const keys = [];
13
- const addKey = (key) => {
14
- if (key && !keys.includes(key)) {
15
- keys.push(key);
16
- }
17
- };
18
-
19
- addKey(columnConfig?.prop);
20
-
21
- if (!fieldWidget) {
22
- return keys;
23
- }
24
-
25
- const options = fieldWidget.options || {};
26
- if (
27
- isVabsearchWidgetType(fieldWidget.type) &&
28
- !isVabsearchMultiWidget(fieldWidget)
29
- ) {
30
- addKey(options.vabSearchName);
31
- addKey(getWidgetFieldKey(fieldWidget));
32
- } else {
33
- addKey(getWidgetFieldKey(fieldWidget));
34
- }
35
-
36
- return keys;
37
- }
38
-
39
- export function getCellFieldKey(fieldWidget, columnConfig) {
40
- const keys = getCellFieldKeys(fieldWidget, columnConfig);
41
- return keys.length ? keys[0] : null;
42
- }
43
-
44
- export function getWidgetFieldKey(widget) {
45
- if (!widget?.options) {
46
- return null;
47
- }
48
- const o = widget.options.name;
49
- return (widget.options.keyNameEnabled && widget.options.keyName) || o;
50
- }
51
-
52
- export function isCellFieldRequired(columnConfig, fieldWidget) {
53
- if (!fieldWidget || fieldWidget.options?.hidden) {
54
- return false;
55
- }
56
- if (fieldWidget.options?.required) {
57
- return true;
58
- }
59
- return resolveColumnRequiredFlag(columnConfig);
60
- }
61
-
62
- export function shouldSkipCellValidation(fieldWidget) {
63
- if (!fieldWidget) {
64
- return true;
65
- }
66
- if (fieldWidget.options?.hidden) {
67
- return true;
68
- }
69
- if (fieldWidget.options?.disabled) {
70
- return true;
71
- }
72
- return false;
73
- }
74
-
75
- export function isEmptyCellValue(fieldWidget, value) {
76
- if (!fieldWidget) {
77
- return false;
78
- }
79
- const type = fieldWidget.type;
80
- const options = fieldWidget.options || {};
81
-
82
- if (type === "number") {
83
- return value === null || value === undefined || value === "";
84
- }
85
-
86
- if (isArrayValueWidgetType(type, options)) {
87
- return isEmptyArrayFieldValue(value, type, options);
88
- }
89
-
90
- if (type === "select" || type === "radio" || type === "status") {
91
- if (value === null || value === undefined || value === "") {
92
- return true;
93
- }
94
- if (typeof value === "string" && !/[^\s]/.test(value)) {
95
- return true;
96
- }
97
- return false;
98
- }
99
-
100
- return isEmptyStr(value);
101
- }
102
-
103
- /** 从行数据中读取单元格值(兼容 column.prop 与 widget 字段名不一致) */
104
- export function getCellValueFromRow(row, fieldWidget, columnConfig) {
105
- if (!row) {
106
- return undefined;
107
- }
108
- const keys = getCellFieldKeys(fieldWidget, columnConfig);
109
- if (!keys.length) {
110
- return undefined;
111
- }
112
- let fallbackValue;
113
- for (const key of keys) {
114
- const value = row[key];
115
- if (fallbackValue === undefined) {
116
- fallbackValue = value;
117
- }
118
- if (!isEmptyCellValue(fieldWidget, value)) {
119
- return value;
120
- }
121
- }
122
- return fallbackValue;
123
- }
124
-
125
- export function isEmptyCellValueInRow(row, fieldWidget, columnConfig) {
126
- return isEmptyCellValue(
127
- fieldWidget,
128
- getCellValueFromRow(row, fieldWidget, columnConfig)
129
- );
130
- }
131
-
132
- export function buildCellRequiredHint(fieldWidget, columnConfig, t1Fn) {
133
- const options = fieldWidget?.options || {};
134
- if (options.requiredHint) {
135
- return t1Fn(options.requiredHint);
136
- }
137
- const label = t1Fn(
138
- options.label || columnConfig?.label || columnConfig?.prop || ""
139
- );
140
- return t1Fn("[{label}]不能为空", { label });
141
- }
142
-
143
- export function buildTableCellFormProp(tableFieldKeyName, rowIndex, fieldKey) {
144
- if (!tableFieldKeyName || !fieldKey || rowIndex < 0) {
145
- return null;
146
- }
147
- return `${tableFieldKeyName}.${rowIndex}.${fieldKey}`;
148
- }
1
+ import {
2
+ isEmptyStr,
3
+ isEmptyArrayFieldValue,
4
+ isArrayValueWidgetType,
5
+ isVabsearchWidgetType,
6
+ isVabsearchMultiWidget,
7
+ } from "./util";
8
+ import { resolveColumnRequiredFlag } from "./tableColumnHelper";
9
+
10
+ /** 数据表格行内字段候选 key(column.prop 为权威存储字段) */
11
+ export function getCellFieldKeys(fieldWidget, columnConfig) {
12
+ const keys = [];
13
+ const addKey = (key) => {
14
+ if (key && !keys.includes(key)) {
15
+ keys.push(key);
16
+ }
17
+ };
18
+
19
+ addKey(columnConfig?.prop);
20
+
21
+ if (!fieldWidget) {
22
+ return keys;
23
+ }
24
+
25
+ const options = fieldWidget.options || {};
26
+ if (
27
+ isVabsearchWidgetType(fieldWidget.type) &&
28
+ !isVabsearchMultiWidget(fieldWidget)
29
+ ) {
30
+ addKey(options.vabSearchName);
31
+ addKey(getWidgetFieldKey(fieldWidget));
32
+ } else {
33
+ addKey(getWidgetFieldKey(fieldWidget));
34
+ }
35
+
36
+ return keys;
37
+ }
38
+
39
+ export function getCellFieldKey(fieldWidget, columnConfig) {
40
+ const keys = getCellFieldKeys(fieldWidget, columnConfig);
41
+ return keys.length ? keys[0] : null;
42
+ }
43
+
44
+ export function getWidgetFieldKey(widget) {
45
+ if (!widget?.options) {
46
+ return null;
47
+ }
48
+ const o = widget.options.name;
49
+ return (widget.options.keyNameEnabled && widget.options.keyName) || o;
50
+ }
51
+
52
+ export function isCellFieldRequired(columnConfig, fieldWidget) {
53
+ if (!fieldWidget || fieldWidget.options?.hidden) {
54
+ return false;
55
+ }
56
+ if (fieldWidget.options?.required) {
57
+ return true;
58
+ }
59
+ return resolveColumnRequiredFlag(columnConfig);
60
+ }
61
+
62
+ export function shouldSkipCellValidation(fieldWidget) {
63
+ if (!fieldWidget) {
64
+ return true;
65
+ }
66
+ if (fieldWidget.options?.hidden) {
67
+ return true;
68
+ }
69
+ if (fieldWidget.options?.disabled) {
70
+ return true;
71
+ }
72
+ return false;
73
+ }
74
+
75
+ export function isEmptyCellValue(fieldWidget, value) {
76
+ if (!fieldWidget) {
77
+ return false;
78
+ }
79
+ const type = fieldWidget.type;
80
+ const options = fieldWidget.options || {};
81
+
82
+ if (type === "number") {
83
+ return value === null || value === undefined || value === "";
84
+ }
85
+
86
+ if (isArrayValueWidgetType(type, options)) {
87
+ return isEmptyArrayFieldValue(value, type, options);
88
+ }
89
+
90
+ if (type === "select" || type === "radio" || type === "status") {
91
+ if (value === null || value === undefined || value === "") {
92
+ return true;
93
+ }
94
+ if (typeof value === "string" && !/[^\s]/.test(value)) {
95
+ return true;
96
+ }
97
+ return false;
98
+ }
99
+
100
+ return isEmptyStr(value);
101
+ }
102
+
103
+ /** 从行数据中读取单元格值(兼容 column.prop 与 widget 字段名不一致) */
104
+ export function getCellValueFromRow(row, fieldWidget, columnConfig) {
105
+ if (!row) {
106
+ return undefined;
107
+ }
108
+ const keys = getCellFieldKeys(fieldWidget, columnConfig);
109
+ if (!keys.length) {
110
+ return undefined;
111
+ }
112
+ let fallbackValue;
113
+ for (const key of keys) {
114
+ const value = row[key];
115
+ if (fallbackValue === undefined) {
116
+ fallbackValue = value;
117
+ }
118
+ if (!isEmptyCellValue(fieldWidget, value)) {
119
+ return value;
120
+ }
121
+ }
122
+ return fallbackValue;
123
+ }
124
+
125
+ export function isEmptyCellValueInRow(row, fieldWidget, columnConfig) {
126
+ return isEmptyCellValue(
127
+ fieldWidget,
128
+ getCellValueFromRow(row, fieldWidget, columnConfig)
129
+ );
130
+ }
131
+
132
+ export function buildCellRequiredHint(fieldWidget, columnConfig, t1Fn) {
133
+ const options = fieldWidget?.options || {};
134
+ if (options.requiredHint) {
135
+ return t1Fn(options.requiredHint);
136
+ }
137
+ const label = t1Fn(
138
+ options.label || columnConfig?.label || columnConfig?.prop || ""
139
+ );
140
+ return t1Fn("[{label}]不能为空", { label });
141
+ }
142
+
143
+ export function buildTableCellFormProp(tableFieldKeyName, rowIndex, fieldKey) {
144
+ if (!tableFieldKeyName || !fieldKey || rowIndex < 0) {
145
+ return null;
146
+ }
147
+ return `${tableFieldKeyName}.${rowIndex}.${fieldKey}`;
148
+ }