@kmkf-fe-packages/kmkf-utils 0.7.9 → 0.7.11-alpha.0

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.
@@ -0,0 +1,11 @@
1
+ declare type ConfigType = {
2
+ linkCondition: "every" | "some";
3
+ conditionList: Array<{
4
+ leftValue: string;
5
+ compareSymbol: string;
6
+ rightValue: any;
7
+ }>;
8
+ displayComponentList: Array<string>;
9
+ };
10
+ declare const formatDisplayConfig: (p: Array<ConfigType>) => any;
11
+ export default formatDisplayConfig;
@@ -0,0 +1,24 @@
1
+ var formatDisplayConfig = function formatDisplayConfig(p) {
2
+ return p.reduce(function (cur, nxt) {
3
+ var _nxt$displayComponent;
4
+ if (((_nxt$displayComponent = nxt.displayComponentList) === null || _nxt$displayComponent === void 0 ? void 0 : _nxt$displayComponent.length) > 0) {
5
+ nxt.displayComponentList.map(function (item) {
6
+ var linkCondition = nxt.linkCondition,
7
+ conditionList = nxt.conditionList;
8
+ if (!Reflect.has(cur, item)) {
9
+ cur[item] = [{
10
+ linkCondition: linkCondition,
11
+ conditionList: conditionList
12
+ }];
13
+ } else if (Array.isArray(cur[item])) {
14
+ cur[item].push({
15
+ linkCondition: linkCondition,
16
+ conditionList: conditionList
17
+ });
18
+ }
19
+ });
20
+ }
21
+ return cur;
22
+ }, {});
23
+ };
24
+ export default formatDisplayConfig;
@@ -0,0 +1,2 @@
1
+ declare const getExpression: (p: string, l: any, r?: any) => boolean;
2
+ export default getExpression;
@@ -0,0 +1,38 @@
1
+ import { isNull } from '@kmkf-fe-packages/kmkf-utils';
2
+ var getExpression = function getExpression(condition, l, r) {
3
+ if (condition === 'EQ') {
4
+ return l === r;
5
+ }
6
+ if (condition === 'GT') {
7
+ return l > r;
8
+ }
9
+ if (condition === 'GTE') {
10
+ return l >= r;
11
+ }
12
+ if (condition === 'LT') {
13
+ return l < r;
14
+ }
15
+ if (condition === 'LTE') {
16
+ return l <= r;
17
+ }
18
+ if (condition === 'IN') {
19
+ return l === null || l === void 0 ? void 0 : l.includes(r);
20
+ }
21
+ if (condition === 'NE') {
22
+ return l !== r;
23
+ }
24
+ if (condition === 'LIKE') {
25
+ return l === null || l === void 0 ? void 0 : l.includes(r);
26
+ }
27
+ if (condition === 'NIN') {
28
+ return !(l !== null && l !== void 0 && l.includes(r));
29
+ }
30
+ if (condition === 'NON') {
31
+ return isNull(l);
32
+ }
33
+ if (condition === 'NOTNULL') {
34
+ return !isNull(l);
35
+ }
36
+ return false;
37
+ };
38
+ export default getExpression;
@@ -3,6 +3,8 @@ export { default as findLabelBySelectValue } from './findLabelBySelectValue';
3
3
  export { default as transMultSelectOptions } from './transMultSelectOptions';
4
4
  export { default as imgResize } from './imgResize';
5
5
  export { default as isNull } from './isNull';
6
+ export { default as getExpression } from './getExpression';
7
+ export { default as formatDisplayConfig } from './formatDisplayConfig';
6
8
  export { default as orderBackFormValues } from './orderBackFormValues';
7
9
  export * as filterFn from './filterFn';
8
10
  export * as templateFn from './template';
@@ -3,6 +3,8 @@ export { default as findLabelBySelectValue } from "./findLabelBySelectValue";
3
3
  export { default as transMultSelectOptions } from "./transMultSelectOptions";
4
4
  export { default as imgResize } from "./imgResize";
5
5
  export { default as isNull } from "./isNull";
6
+ export { default as getExpression } from "./getExpression";
7
+ export { default as formatDisplayConfig } from "./formatDisplayConfig";
6
8
  export { default as orderBackFormValues } from "./orderBackFormValues";
7
9
  import * as _filterFn from "./filterFn";
8
10
  export { _filterFn as filterFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/kmkf-utils",
3
- "version": "0.7.9",
3
+ "version": "0.7.11-alpha.0",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -42,5 +42,5 @@
42
42
  "gitHooks": {
43
43
  "pre-commit": "lint-staged"
44
44
  },
45
- "gitHead": "d75ce8729a2c90929b0b21c87e5f60badec5b997"
45
+ "gitHead": "0971dba8b7fcdcda5020f2196ec774e5ebb8e633"
46
46
  }