@stonecrop/atable 0.3.10 → 0.4.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.
@@ -27,9 +27,9 @@ export declare const createTableStore: (initData: {
27
27
  pinned?: boolean | undefined;
28
28
  cellComponent?: string | undefined;
29
29
  cellComponentProps?: Record<string, any> | undefined;
30
- modalComponent?: string | ((context: CellContext) => string) | undefined;
30
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
31
31
  modalComponentExtraProps?: Record<string, any> | undefined;
32
- format?: string | ((value: any, context: CellContext) => string) | undefined;
32
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
33
33
  mask?: ((value: any) => any) | undefined;
34
34
  }[], TableColumn[] | {
35
35
  name: string;
@@ -41,16 +41,16 @@ export declare const createTableStore: (initData: {
41
41
  pinned?: boolean | undefined;
42
42
  cellComponent?: string | undefined;
43
43
  cellComponentProps?: Record<string, any> | undefined;
44
- modalComponent?: string | ((context: CellContext) => string) | undefined;
44
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
45
45
  modalComponentExtraProps?: Record<string, any> | undefined;
46
- format?: string | ((value: any, context: CellContext) => string) | undefined;
46
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
47
47
  mask?: ((value: any) => any) | undefined;
48
48
  }[]>;
49
49
  config: import("vue").Ref<{
50
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
50
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
51
51
  fullWidth?: boolean | undefined;
52
52
  }, TableConfig | {
53
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
53
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
54
54
  fullWidth?: boolean | undefined;
55
55
  }>;
56
56
  display: import("vue").Ref<{
@@ -133,9 +133,9 @@ export declare const createTableStore: (initData: {
133
133
  pinned?: boolean | undefined;
134
134
  cellComponent?: string | undefined;
135
135
  cellComponentProps?: Record<string, any> | undefined;
136
- modalComponent?: string | ((context: CellContext) => string) | undefined;
136
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
137
137
  modalComponentExtraProps?: Record<string, any> | undefined;
138
- format?: string | ((value: any, context: CellContext) => string) | undefined;
138
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
139
139
  mask?: ((value: any) => any) | undefined;
140
140
  }[], TableColumn[] | {
141
141
  name: string;
@@ -147,16 +147,16 @@ export declare const createTableStore: (initData: {
147
147
  pinned?: boolean | undefined;
148
148
  cellComponent?: string | undefined;
149
149
  cellComponentProps?: Record<string, any> | undefined;
150
- modalComponent?: string | ((context: CellContext) => string) | undefined;
150
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
151
151
  modalComponentExtraProps?: Record<string, any> | undefined;
152
- format?: string | ((value: any, context: CellContext) => string) | undefined;
152
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
153
153
  mask?: ((value: any) => any) | undefined;
154
154
  }[]>;
155
155
  config: import("vue").Ref<{
156
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
156
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
157
157
  fullWidth?: boolean | undefined;
158
158
  }, TableConfig | {
159
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
159
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
160
160
  fullWidth?: boolean | undefined;
161
161
  }>;
162
162
  display: import("vue").Ref<{
@@ -239,9 +239,9 @@ export declare const createTableStore: (initData: {
239
239
  pinned?: boolean | undefined;
240
240
  cellComponent?: string | undefined;
241
241
  cellComponentProps?: Record<string, any> | undefined;
242
- modalComponent?: string | ((context: CellContext) => string) | undefined;
242
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
243
243
  modalComponentExtraProps?: Record<string, any> | undefined;
244
- format?: string | ((value: any, context: CellContext) => string) | undefined;
244
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
245
245
  mask?: ((value: any) => any) | undefined;
246
246
  }[], TableColumn[] | {
247
247
  name: string;
@@ -253,16 +253,16 @@ export declare const createTableStore: (initData: {
253
253
  pinned?: boolean | undefined;
254
254
  cellComponent?: string | undefined;
255
255
  cellComponentProps?: Record<string, any> | undefined;
256
- modalComponent?: string | ((context: CellContext) => string) | undefined;
256
+ modalComponent?: (string | ((context: CellContext) => string)) | undefined;
257
257
  modalComponentExtraProps?: Record<string, any> | undefined;
258
- format?: string | ((value: any, context: CellContext) => string) | undefined;
258
+ format?: (string | ((value: any, context: CellContext) => string)) | undefined;
259
259
  mask?: ((value: any) => any) | undefined;
260
260
  }[]>;
261
261
  config: import("vue").Ref<{
262
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
262
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
263
263
  fullWidth?: boolean | undefined;
264
264
  }, TableConfig | {
265
- view?: "uncounted" | "list" | "list-expansion" | "tree" | undefined;
265
+ view?: ("uncounted" | "list" | "list-expansion" | "tree") | undefined;
266
266
  fullWidth?: boolean | undefined;
267
267
  }>;
268
268
  display: import("vue").Ref<{
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEzG;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aAAc;IAC1C,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IAC9B,OAAO,CAAC,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Cd,UAAU;kBAtFhB,CAAC,kBAAkB,MAAM,YAAY,MAAM,KAAG,CAAC;oCA4D7B,MAAM,YAAY,MAAM;kCAK1B,MAAM,YAAY,MAAM,SAAS,GAAG;iCA3CrC,WAAW,KAAG,aAAa;0BA0ElC,MAAM,gBAAgB,MAAM;mCAhEnB,MAAM;6BAJZ,MAAM;4BA3BP,MAAM,YAAY,MAAM,SAAS,GAAG;4BAYpC,MAAM,YAAY,MAAM,SAAS,MAAM;gCA+BnC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0Cd,UAAU;kBAtFhB,CAAC,kBAAkB,MAAM,YAAY,MAAM,KAAG,CAAC;oCA4D7B,MAAM,YAAY,MAAM;kCAK1B,MAAM,YAAY,MAAM,SAAS,GAAG;iCA3CrC,WAAW,KAAG,aAAa;0BA0ElC,MAAM,gBAAgB,MAAM;mCAhEnB,MAAM;6BAJZ,MAAM;4BA3BP,MAAM,YAAY,MAAM,SAAS,GAAG;4BAYpC,MAAM,YAAY,MAAM,SAAS,MAAM;gCA+BnC,MAAM;gNA2F1C,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export declare const isHtmlString: (htmlString: string) => boolean;
2
+ export declare const generateHash: (length?: number) => string;
2
3
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,eAAgB,MAAM,YAG9C,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,eAAgB,MAAM,YAG9C,CAAA;AAED,eAAO,MAAM,YAAY,6BAExB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { defineStore } from 'pinia';
2
2
  import { computed, ref } from 'vue';
3
+ import { generateHash } from '../utils';
3
4
  /**
4
5
  * Create a table store
5
6
  * @param initData - Initial data for the table store
@@ -7,7 +8,7 @@ import { computed, ref } from 'vue';
7
8
  * @public
8
9
  */
9
10
  export const createTableStore = (initData) => {
10
- const id = initData.id || crypto.randomUUID();
11
+ const id = initData.id || generateHash();
11
12
  const createStore = defineStore(`table-${id}`, () => {
12
13
  // util functions
13
14
  const createTableObject = () => {
package/dist/utils.js CHANGED
@@ -2,3 +2,6 @@ export const isHtmlString = (htmlString) => {
2
2
  const $document = new DOMParser().parseFromString(htmlString, 'text/html');
3
3
  return Array.from($document.body.childNodes).some(node => node.nodeType === 1);
4
4
  };
5
+ export const generateHash = (length = 8) => {
6
+ return Array.from({ length }, () => Math.floor(Math.random() * 16).toString(16)).join('');
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/atable",
3
- "version": "0.3.10",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -38,8 +38,8 @@
38
38
  "@vueuse/core": "^12.0.0",
39
39
  "pinia": "^2.3.0",
40
40
  "vue": "^3.5.11",
41
- "@stonecrop/themes": "0.3.10",
42
- "@stonecrop/utilities": "0.3.10"
41
+ "@stonecrop/themes": "0.4.0",
42
+ "@stonecrop/utilities": "0.4.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-documenter": "^7.26.2",
@@ -55,7 +55,7 @@
55
55
  "eslint-plugin-vue": "^9.11.1",
56
56
  "eslint": "^8.40.0",
57
57
  "jsdom": "^25.0.0",
58
- "typescript": "^5.6.3",
58
+ "typescript": "~5.6.3",
59
59
  "vite-plugin-lib-inject-css": "^2.1.1",
60
60
  "vite": "^5.4.5",
61
61
  "vitest": "^2.1.1",
@@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
2
2
  import { type CSSProperties, computed, ref } from 'vue'
3
3
 
4
4
  import type { CellContext, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '../types'
5
+ import { generateHash } from '../utils'
5
6
 
6
7
  /**
7
8
  * Create a table store
@@ -18,7 +19,7 @@ export const createTableStore = (initData: {
18
19
  display?: TableDisplay[]
19
20
  modal?: TableModal
20
21
  }) => {
21
- const id = initData.id || crypto.randomUUID()
22
+ const id = initData.id || generateHash()
22
23
  const createStore = defineStore(`table-${id}`, () => {
23
24
  // util functions
24
25
  const createTableObject = () => {
package/src/utils.ts CHANGED
@@ -2,3 +2,7 @@ export const isHtmlString = (htmlString: string) => {
2
2
  const $document = new DOMParser().parseFromString(htmlString, 'text/html')
3
3
  return Array.from($document.body.childNodes).some(node => node.nodeType === 1)
4
4
  }
5
+
6
+ export const generateHash = (length = 8) => {
7
+ return Array.from({ length }, () => Math.floor(Math.random() * 16).toString(16)).join('')
8
+ }