flameresttable 1.0.1 → 1.0.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "flameresttable",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "./src/plugin.ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,7 @@
17
17
  "dependencies": {
18
18
  "@vuepic/vue-datepicker": "^3.6.8",
19
19
  "flamerest": "^1.0.63",
20
+ "lodash-es": "^4.17.21",
20
21
  "pinia": "^2.0.32",
21
22
  "pug": "github:FlameArt/pug-tailwind-only",
22
23
  "pug-lexer": "github:FlameArt/pug-lexer-only",
@@ -29,23 +30,23 @@
29
30
  "@capacitor/cli": "^3.9.0",
30
31
  "@capacitor/core": "^3.9.0",
31
32
  "@heroicons/vue": "^2.0.16",
33
+ "@types/lodash-es": "^4.17.6",
32
34
  "@types/lodash.merge": "^4.6.7",
33
35
  "@types/node": "18.8.0",
34
36
  "@typescript-eslint/eslint-plugin": "^5.53.0",
35
37
  "@typescript-eslint/parser": "^5.53.0",
36
38
  "@vitejs/plugin-vue": "^4.0.0",
37
- "@volar/vue-language-plugin-pug": "^1.1.7",
39
+ "@volar/vue-language-plugin-pug": "^1.2.0",
38
40
  "@vue/compiler-sfc": "^3.2.45",
39
41
  "autoprefixer": "^10.4.13",
40
42
  "eslint": "^8.34.0",
41
43
  "eslint-plugin-vue": "^8.7.1",
42
- "lodash.merge": "^4.6.2",
43
44
  "postcss": "^8.4.21",
44
45
  "postcss-import": "^14.1.0",
45
46
  "tailwindcss": "^3.2.7",
46
47
  "typescript": "^4.9.5",
47
48
  "vite": "^4.1.4",
48
- "vue-tsc": "^1.1.7",
49
+ "vue-tsc": "^1.2.0",
49
50
  "vue-universal-modal": "^1.1.4"
50
51
  },
51
52
  "rules": {}
@@ -2,7 +2,7 @@ import { Column } from './Columns';
2
2
  import { Rows, SavedObject } from 'flamerest';
3
3
  import TableOpts from "./TableOpts";
4
4
  import { reactive, UnwrapRef } from 'vue';
5
- import * as _ from 'lodash'
5
+ import merge from 'lodash-es/merge'
6
6
 
7
7
  // Подгрузчик типа класса
8
8
  type Class<T> = new (...args: any[]) => T
@@ -82,7 +82,7 @@ export default class FlameTable<T> {
82
82
  newCol.Popup.isEnabled = false
83
83
 
84
84
  // Мержим стандартные параметры с опциями юзера
85
- _.merge(newCol, opts.columnsOpts[key]);
85
+ merge(newCol, opts.columnsOpts[key]);
86
86
 
87
87
  // Жёстко устанавливаем название поля из базы для этой колонки
88
88
  newCol.name = key;
@@ -94,7 +94,7 @@ export default class FlameTable<T> {
94
94
  }
95
95
 
96
96
  // Мержим параметры с базовой версией
97
- _.merge(this.opts, opts);
97
+ merge(this.opts, opts);
98
98
 
99
99
  // TODO: Сортируем колонки, если указан порядок
100
100
  //this.columns
@@ -165,10 +165,19 @@ export default defineComponent({
165
165
  const getSelector = (arr: any, selectorKey: any, selectorVal: any) => {
166
166
  if (Array.isArray(arr)) return [selectorVal, selectorVal];
167
167
  // TODO: тут загрузка объекта должна быть
168
+ // сейчас объект перерабатывается где-то в map и теряет ключи и значения
168
169
  if (typeof arr === 'object' && arr !== null) return [selectorKey, selectorVal]
169
170
  return [selectorKey, selectorVal]
170
171
  }
171
172
 
173
+ // Автозагрузка первичной версии
174
+ if (props.opts.autoload === true) {
175
+ const tModel = (props.model as any)
176
+ tModel.all().then((r: any) => {
177
+ Table.load(r);
178
+ })
179
+ }
180
+
172
181
  return {
173
182
  Table,
174
183
  FlameTableModal,
@@ -1,10 +1,15 @@
1
1
  import { Column, IColumn } from './Columns';
2
2
 
3
- import * as _ from 'lodash'
3
+ import merge from 'lodash-es/merge'
4
4
  import FlameTable from './FlameTable';
5
5
 
6
6
  export default class TableOpts {
7
7
 
8
+ /**
9
+ * Нужна ли автозагрузка
10
+ */
11
+ public autoload: boolean = true;
12
+
8
13
  /**
9
14
  * Колонки
10
15
  */
@@ -13,7 +18,7 @@ export default class TableOpts {
13
18
  public set(ColumnName: string, mergingOpts: IColumn) {
14
19
  // TODO: ЕСТЬ ОШИБКА???
15
20
  if (this.columnsOpts[ColumnName] === undefined) this.columnsOpts[ColumnName] = new Column as any
16
- _.merge(this.columnsOpts[ColumnName], mergingOpts)
21
+ merge(this.columnsOpts[ColumnName], mergingOpts)
17
22
  }
18
23
 
19
24
  /**
@@ -29,7 +34,7 @@ export default class TableOpts {
29
34
  for (const key in arr) {
30
35
  // TODO: ????? as any
31
36
  if (this.columnsOpts[arr[key]] === undefined) this.columnsOpts[arr[key]] = new Column as any
32
- _.merge(this.columnsOpts[arr[key]], { Table: { isShow: false }, Popup: { isShow: false } })
37
+ merge(this.columnsOpts[arr[key]], { Table: { isShow: false }, Popup: { isShow: false } })
33
38
  }
34
39
 
35
40
  }