@finema/core 2.1.1 → 2.2.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.
Files changed (40) hide show
  1. package/README.md +79 -79
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/App.vue +7 -7
  5. package/dist/runtime/components/DevToolsWindow/index.vue +95 -95
  6. package/dist/runtime/components/Dialog/index.vue +45 -45
  7. package/dist/runtime/components/Empty.vue +12 -12
  8. package/dist/runtime/components/FlexDeck/Base.vue +67 -67
  9. package/dist/runtime/components/FlexDeck/index.vue +33 -33
  10. package/dist/runtime/components/Form/FieldWrapper.vue +13 -13
  11. package/dist/runtime/components/Form/Fields.vue +13 -13
  12. package/dist/runtime/components/Form/InputCheckbox/index.vue +18 -18
  13. package/dist/runtime/components/Form/InputDateTime/index.vue +44 -44
  14. package/dist/runtime/components/Form/InputNumber/index.vue +20 -20
  15. package/dist/runtime/components/Form/InputSelect/index.vue +38 -38
  16. package/dist/runtime/components/Form/InputSelectMultiple/index.vue +43 -43
  17. package/dist/runtime/components/Form/InputText/index.vue +48 -48
  18. package/dist/runtime/components/Form/InputTextarea/index.vue +18 -18
  19. package/dist/runtime/components/Form/InputToggle/index.vue +17 -17
  20. package/dist/runtime/components/Form/index.vue +5 -5
  21. package/dist/runtime/components/Image.vue +28 -28
  22. package/dist/runtime/components/Loader.vue +10 -10
  23. package/dist/runtime/components/Log/index.vue +17 -17
  24. package/dist/runtime/components/Table/Base.vue +76 -76
  25. package/dist/runtime/components/Table/ColumnDate.vue +1 -1
  26. package/dist/runtime/components/Table/ColumnDateTime.vue +1 -1
  27. package/dist/runtime/components/Table/ColumnImage.vue +4 -4
  28. package/dist/runtime/components/Table/ColumnNumber.vue +1 -1
  29. package/dist/runtime/components/Table/ColumnText.vue +1 -1
  30. package/dist/runtime/components/Table/Simple.vue +21 -21
  31. package/dist/runtime/components/Table/index.vue +100 -100
  32. package/dist/runtime/helpers/apiPageHelper.js +2 -1
  33. package/dist/runtime/server/tsconfig.json +3 -3
  34. package/dist/runtime/types/common.d.ts +1 -1
  35. package/dist/runtime/utils/ArrayHelper.js +1 -1
  36. package/dist/runtime/utils/ObjectHelper.js +1 -2
  37. package/dist/runtime/utils/ParamHelper.js +1 -1
  38. package/dist/runtime/utils/lodash.d.ts +15 -0
  39. package/dist/runtime/utils/lodash.js +27 -0
  40. package/package.json +2 -2
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "../../../.nuxt/tsconfig.server.json",
3
- }
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -3,7 +3,7 @@ export interface IError {
3
3
  message: any;
4
4
  }
5
5
  export interface IOption extends Record<string, any> {
6
- value: any;
6
+ value: any | null;
7
7
  label: string;
8
8
  }
9
9
  export interface IGetParams {
@@ -1,4 +1,4 @@
1
- import { get as _get } from "lodash";
1
+ import { _get } from "./lodash.js";
2
2
  export class ArrayHelper {
3
3
  static toOptions(data, valueAttr = "id", labelAttr = "name") {
4
4
  return ArrayHelper.toArray(data).map((item) => {
@@ -1,6 +1,5 @@
1
- import { get as _get } from "lodash";
2
1
  import { ParamHelper } from "./ParamHelper.js";
3
- import { _isEmpty } from "./lodash.js";
2
+ import { _isEmpty, _get } from "./lodash.js";
4
3
  export class ObjectHelper {
5
4
  static createOption(value, label = "") {
6
5
  return {
@@ -1,4 +1,4 @@
1
- import { get as _get } from "lodash";
1
+ import { _get } from "./lodash.js";
2
2
  export class ParamHelper {
3
3
  static getParams = (opts, reqOptions) => {
4
4
  if (opts.params) {
@@ -1 +1,16 @@
1
1
  export declare const _isEmpty: (value: any) => boolean;
2
+ /**
3
+ * Gets the value at path of object. If the resolved value is undefined,
4
+ * the defaultValue is returned in its place.
5
+ */
6
+ type PathKeys<T> = {
7
+ [K in keyof T]: T[K] extends object ? K extends string | number ? `${K}` | `${K}.${PathKeys<T[K]>}` : never : K extends string | number ? `${K}` : never;
8
+ }[keyof T];
9
+ interface GetFunction {
10
+ <T extends object, K extends PathKeys<T>>(object: T, path: K): any;
11
+ <T extends object, K extends PathKeys<T>, D>(object: T, path: K, defaultValue: D): D;
12
+ <T>(object: any, path: string | (string | number)[], defaultValue: T): T;
13
+ <T = any>(object: any, path: string | (string | number)[]): T | undefined;
14
+ }
15
+ export declare const _get: GetFunction;
16
+ export {};
@@ -10,3 +10,30 @@ export const _isEmpty = (value) => {
10
10
  }
11
11
  return false;
12
12
  };
13
+ export const _get = (object, path, defaultValue) => {
14
+ if (object == null) {
15
+ return defaultValue;
16
+ }
17
+ const pathArray = Array.isArray(path) ? path : stringToPath(path);
18
+ let current = object;
19
+ for (let i = 0; i < pathArray.length; i++) {
20
+ if (current == null) {
21
+ return defaultValue;
22
+ }
23
+ current = current[pathArray[i]];
24
+ }
25
+ return current === void 0 ? defaultValue : current;
26
+ };
27
+ const stringToPath = (path) => {
28
+ if (typeof path !== "string") {
29
+ return [path];
30
+ }
31
+ const normalizedPath = path.replace(/\[(\d+)\]/g, ".$1").replace(/\[['"]([^'"]*)['"]\]/g, ".$1").replace(/^\./, "");
32
+ if (normalizedPath === "") {
33
+ return [];
34
+ }
35
+ return normalizedPath.split(".").map((key) => {
36
+ const numKey = Number(key);
37
+ return !Number.isNaN(numKey) && key === numKey.toString() ? numKey : key;
38
+ });
39
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -88,4 +88,4 @@
88
88
  "lint-staged": {
89
89
  "*": "eslint --fix ."
90
90
  }
91
- }
91
+ }