@fctc/sme-widget-ui 1.1.2 → 1.1.4

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/dist/.babelrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ "@babel/preset-react",
5
+ "@babel/preset-typescript"
6
+ ]
7
+ }
@@ -0,0 +1,10 @@
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ insert_final_newline = true
6
+
7
+ [*.{js,json,yml}]
8
+ charset = utf-8
9
+ indent_style = space
10
+ indent_size = 2
@@ -0,0 +1,6 @@
1
+ dist
2
+ .cache
3
+ package-lock.json
4
+ public
5
+ node_modules
6
+ yarn.lock
@@ -0,0 +1,66 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: { browser: true, es2020: true },
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:prettier/recommended',
8
+ ],
9
+ ignorePatterns: ['dist', '.eslintrc.cjs', 'commitlint.config.cjs'],
10
+ parser: '@typescript-eslint/parser',
11
+ overrides: [
12
+ {
13
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.cjs'],
14
+ plugins: [
15
+ '@typescript-eslint',
16
+ 'unused-imports',
17
+ 'simple-import-sort',
18
+ 'react-refresh',
19
+ ],
20
+ rules: {
21
+ 'react-refresh/only-export-components': [
22
+ 'warn',
23
+ { allowConstantExport: true },
24
+ ],
25
+ 'import/prefer-default-export': 'off',
26
+ 'simple-import-sort/imports': [
27
+ 'error',
28
+ {
29
+ groups: [
30
+ // Packages `react` related packages come first.
31
+ ['^react', '^@?\\w'],
32
+ // Internal packages.
33
+ ['^(@|components)(/.*|$)'],
34
+ // Side effect imports.
35
+ ['^\\u0000'],
36
+ // Parent imports. Put `..` last.
37
+ ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
38
+ // Other relative imports. Put same-folder imports and `.` last.
39
+ ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
40
+ // Style imports.
41
+ ['^.+\\.?(css)$'],
42
+ ],
43
+ },
44
+ ],
45
+ 'prettier/prettier': [
46
+ 'error',
47
+ {
48
+ endOfLine: 'auto',
49
+ },
50
+ ],
51
+ 'react/react-in-jsx-scope': 'off',
52
+ 'no-param-reassign': 'off',
53
+ 'simple-import-sort/exports': 'error',
54
+ '@typescript-eslint/no-unused-vars': 'off',
55
+ '@typescript-eslint/no-non-null-assertion': 'off',
56
+ '@typescript-eslint/no-explicit-any': 'off',
57
+ '@typescript-eslint/ban-ts-comment': 'off',
58
+ '@typescript-eslint/ban-types': 'off',
59
+ 'unused-imports/no-unused-imports': 'error',
60
+ 'unused-imports/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
61
+ 'no-plusplus': 'off',
62
+ 'no-case-declarations': 'off',
63
+ },
64
+ },
65
+ ],
66
+ }
@@ -0,0 +1,4 @@
1
+ /.yarn/** linguist-vendored
2
+ /.yarn/releases/* binary
3
+ /.yarn/plugins/**/* binary
4
+ /.pnp.* binary linguist-generated
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": false
4
+ }
package/dist/index.js CHANGED
@@ -12410,9 +12410,12 @@ var TableBodyRow = (props) => {
12410
12410
  isForm,
12411
12411
  typeCo,
12412
12412
  selectedRowKeys,
12413
+ tableGroupController,
12414
+ groupByList,
12415
+ setIsAutoSelect,
12416
+ isAutoSelect,
12413
12417
  isEditTable
12414
12418
  } = props;
12415
- const [isAutoSelect, setIsAutoSelect] = (0, import_react12.useState)(false);
12416
12419
  const rootStyle = getComputedStyle(document.documentElement);
12417
12420
  const colorPrimary = rootStyle.getPropertyValue("--primary").trim();
12418
12421
  return rows && rows?.length > 0 ? rows?.map((row, index4) => {
@@ -12420,21 +12423,24 @@ var TableBodyRow = (props) => {
12420
12423
  TableGroup,
12421
12424
  {
12422
12425
  columns,
12423
- indexRow: index4,
12424
12426
  rows,
12425
12427
  row,
12428
+ indexRow: index4,
12426
12429
  model,
12427
12430
  viewData,
12428
12431
  renderField,
12429
12432
  level: level + 1,
12430
12433
  specification,
12431
- domain: row?.__domain,
12432
12434
  context,
12433
12435
  checkedAll,
12434
12436
  isDisplayCheckbox,
12435
12437
  selectedRowKeysRef,
12436
12438
  isAutoSelect,
12437
- setIsAutoSelect
12439
+ setIsAutoSelect,
12440
+ groupByList,
12441
+ tableGroupController,
12442
+ setSelectedRowKeys,
12443
+ selectedRowKeys
12438
12444
  },
12439
12445
  `record-group-${index4}`
12440
12446
  ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -12473,7 +12479,15 @@ var TableBodyRow = (props) => {
12473
12479
  ) }) });
12474
12480
  };
12475
12481
  var TableBody = (props) => {
12476
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tbody", { className: "overflow-hidden z-0", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TableBodyRow, { ...props }) });
12482
+ const [isAutoSelect, setIsAutoSelect] = (0, import_react12.useState)(false);
12483
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("tbody", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
12484
+ TableBodyRow,
12485
+ {
12486
+ ...props,
12487
+ isAutoSelect,
12488
+ setIsAutoSelect
12489
+ }
12490
+ ) });
12477
12491
  };
12478
12492
 
12479
12493
  // src/widgets/advanced/table/table-filter.tsx
@@ -34027,176 +34041,185 @@ var Many2ManyField = (props) => {
34027
34041
  clearSearch
34028
34042
  } = searchController;
34029
34043
  return (0, import_react_dom8.createPortal)(
34030
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
34031
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
34032
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 overflow-auto px-6 flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
34033
- "div",
34034
- {
34035
- style: {
34036
- zIndex: 1
34037
- },
34038
- className: "relative p-4 flex flex-col gap-2 max-w-full lg:max-w-[1000px] lg:min-w-[1000px] transform rounded-3xl bg-[#FFF] min-h-[90%] max-h-[90%] h-fit",
34039
- children: [
34040
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
34041
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-[20px] font-semibold", children: title }),
34042
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(CloseIcon, {}) })
34043
- ] }),
34044
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "grid grid-cols-3 gap-2 items-center py-2", children: [
34045
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "col-span-3 sm:col-span-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34046
- Search,
34047
- {
34048
- removeSearchItems,
34049
- selectedTags,
34050
- filterBy,
34051
- setFilterBy,
34052
- searchString,
34053
- onSearchString,
34054
- handleAddTagSearch,
34055
- searchBy,
34056
- groupBy,
34057
- showFiltersGroups: true,
34058
- setGroupBy,
34059
- setDomainList: setDomain,
34060
- setPage: (pages) => {
34061
- setPage?.(pages);
34062
- },
34063
- fieldsList: [
34064
- ...columns?.filter(
34065
- (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
34066
- )?.map((col) => ({ ...col.field })) ?? []
34067
- ],
34068
- setSelectedRowKeys,
34069
- viewData,
34070
- context,
34071
- selectedRowKeys,
34072
- aid,
34073
- domainSearch,
34074
- evalJSONContext,
34075
- clearSearch
34076
- }
34077
- ) }),
34078
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34079
- PaginationView,
34080
- {
34081
- className: "pagination-bar col-span-3 sm:col-span-1 justify-end flex-1",
34082
- currentPage: page,
34083
- totalCount: totalRows ?? 0,
34084
- pageSize: 10,
34085
- onPageChange: (page2) => {
34086
- if (typeof setPage === "function") {
34087
- setPage(page2);
34044
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
34045
+ "div",
34046
+ {
34047
+ style: {
34048
+ zIndex: 99999
34049
+ },
34050
+ className: "fixed bottom-0 left-0 right-0 top-0",
34051
+ children: [
34052
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
34053
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "absolute inset-0 overflow-auto px-6 flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
34054
+ "div",
34055
+ {
34056
+ style: {
34057
+ zIndex: 1
34058
+ },
34059
+ className: "relative p-4 flex flex-col gap-2 max-w-full lg:max-w-[1000px] lg:min-w-[1000px] transform rounded-3xl bg-[#FFF] min-h-[90%] max-h-[90%] h-fit",
34060
+ children: [
34061
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
34062
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-[20px] font-semibold", children: title }),
34063
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("button", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(CloseIcon, {}) })
34064
+ ] }),
34065
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "grid grid-cols-3 gap-2 items-center py-2", children: [
34066
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "col-span-3 sm:col-span-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34067
+ Search,
34068
+ {
34069
+ removeSearchItems,
34070
+ selectedTags,
34071
+ filterBy,
34072
+ setFilterBy,
34073
+ searchString,
34074
+ onSearchString,
34075
+ handleAddTagSearch,
34076
+ searchBy,
34077
+ groupBy,
34078
+ showFiltersGroups: true,
34079
+ setGroupBy,
34080
+ setDomainList: setDomain,
34081
+ setPage: (pages) => {
34082
+ setPage?.(pages);
34083
+ },
34084
+ fieldsList: [
34085
+ ...columns?.filter(
34086
+ (col) => col?.field?.type_co === "field" && col?.optional !== "hide"
34087
+ )?.map((col) => ({ ...col.field })) ?? []
34088
+ ],
34089
+ setSelectedRowKeys,
34090
+ viewData,
34091
+ context,
34092
+ selectedRowKeys,
34093
+ aid,
34094
+ domainSearch,
34095
+ evalJSONContext,
34096
+ clearSearch
34088
34097
  }
34089
- },
34090
- displayPageNumberDots: false,
34091
- displayRowsNumberOption: false
34092
- }
34093
- )
34094
- ] }),
34095
- !isDataLoading && isDataFetched || isPlaceholderData ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34096
- "div",
34097
- {
34098
- className: `border-[1px] h-full border-solid border-[#dbe0e6] rounded-[10px] relative w-full overflow-hidden`,
34099
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex flex-col gap-[16px] w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: `relative w-full h-full`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34098
+ ) }),
34099
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34100
+ PaginationView,
34101
+ {
34102
+ className: "pagination-bar col-span-3 sm:col-span-1 justify-end flex-1",
34103
+ currentPage: page,
34104
+ totalCount: totalRows ?? 0,
34105
+ pageSize: 10,
34106
+ onPageChange: (page2) => {
34107
+ if (typeof setPage === "function") {
34108
+ setPage(page2);
34109
+ }
34110
+ },
34111
+ displayPageNumberDots: false,
34112
+ displayRowsNumberOption: false
34113
+ }
34114
+ )
34115
+ ] }),
34116
+ !isDataLoading && isDataFetched || isPlaceholderData ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "relative h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34100
34117
  "div",
34101
34118
  {
34102
- className: `flex w-full items-center h-full overflow-auto `,
34103
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full h-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
34104
- "table",
34119
+ className: `border-[1px] h-full border-solid border-[#dbe0e6] rounded-[10px] relative w-full overflow-hidden`,
34120
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex flex-col gap-[16px] w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: `relative w-full h-full`, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34121
+ "div",
34105
34122
  {
34106
- className: `relative w-full bg-white custom-dropdown `,
34107
- children: [
34108
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34109
- TableHead,
34110
- {
34111
- columns,
34112
- onToggleColumnOptional,
34113
- isDisplayCheckbox,
34114
- checkedAll,
34115
- handleCheckBoxAll
34116
- }
34117
- ),
34118
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34119
- TableBody,
34120
- {
34121
- columns,
34122
- rows,
34123
- rootField,
34124
- isDisplayCheckbox,
34125
- model: relation,
34126
- renderField: ({
34127
- row,
34128
- col,
34129
- indexRow,
34130
- onChangeData,
34131
- rootField: rootField2
34132
- }) => {
34133
- if (typeof renderField === "function") {
34134
- return renderField({
34123
+ className: `flex w-full items-center h-full overflow-auto `,
34124
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "w-full h-full max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
34125
+ "table",
34126
+ {
34127
+ className: `relative w-full bg-white custom-dropdown `,
34128
+ children: [
34129
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34130
+ TableHead,
34131
+ {
34132
+ columns,
34133
+ onToggleColumnOptional,
34134
+ isDisplayCheckbox,
34135
+ checkedAll,
34136
+ handleCheckBoxAll
34137
+ }
34138
+ ),
34139
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34140
+ TableBody,
34141
+ {
34142
+ columns,
34143
+ rows,
34144
+ rootField,
34145
+ isDisplayCheckbox,
34146
+ model: relation,
34147
+ renderField: ({
34135
34148
  row,
34136
34149
  col,
34137
34150
  indexRow,
34138
34151
  onChangeData,
34139
34152
  rootField: rootField2
34140
- });
34153
+ }) => {
34154
+ if (typeof renderField === "function") {
34155
+ return renderField({
34156
+ row,
34157
+ col,
34158
+ indexRow,
34159
+ onChangeData,
34160
+ rootField: rootField2
34161
+ });
34162
+ }
34163
+ },
34164
+ onRemoveRow: null,
34165
+ onAddRow,
34166
+ onClickRow,
34167
+ typeTable,
34168
+ selectedRowKeysRef,
34169
+ selectedRowKeys,
34170
+ setSelectedRowKeys
34141
34171
  }
34142
- },
34143
- onRemoveRow: null,
34144
- onAddRow,
34145
- onClickRow,
34146
- typeTable,
34147
- selectedRowKeysRef,
34148
- selectedRowKeys,
34149
- setSelectedRowKeys
34150
- }
34151
- )
34152
- ]
34172
+ )
34173
+ ]
34174
+ }
34175
+ ) })
34153
34176
  }
34154
- ) })
34177
+ ) }) })
34155
34178
  }
34156
- ) }) })
34157
- }
34158
- ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
34159
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
34160
- isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34161
- "button",
34162
- {
34163
- disabled: selectedRowKeys?.length === 0,
34164
- type: "button",
34165
- onClick: () => onChoose(selectedRowKeys),
34166
- className: "button-primary",
34167
- children: instance.t("choose")
34168
- }
34169
- ),
34170
- optionsObject && "no_create" in optionsObject && optionsObject?.no_create === false && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34171
- "button",
34172
- {
34173
- type: "button",
34174
- onClick: () => {
34175
- if (typeof onAddNew === "function") {
34176
- onAddNew();
34177
- onClose();
34178
- } else {
34179
- handleCreateNewOnPage();
34179
+ ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
34180
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
34181
+ isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34182
+ "button",
34183
+ {
34184
+ disabled: selectedRowKeys?.length === 0,
34185
+ type: "button",
34186
+ onClick: () => onChoose(selectedRowKeys),
34187
+ className: "button-primary",
34188
+ children: instance.t("choose")
34180
34189
  }
34181
- },
34182
- className: "button-primary",
34183
- children: instance.t("new")
34184
- }
34185
- ),
34186
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34187
- "button",
34188
- {
34189
- type: "button",
34190
- onClick: onClose,
34191
- className: "button-secondary",
34192
- children: instance.t("cancel_button")
34193
- }
34194
- )
34195
- ] })
34196
- ]
34197
- }
34198
- ) })
34199
- ] }),
34190
+ ),
34191
+ optionsObject && "no_create" in optionsObject && optionsObject?.no_create === false && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34192
+ "button",
34193
+ {
34194
+ type: "button",
34195
+ onClick: () => {
34196
+ if (typeof onAddNew === "function") {
34197
+ onAddNew();
34198
+ onClose();
34199
+ } else {
34200
+ handleCreateNewOnPage();
34201
+ }
34202
+ },
34203
+ className: "button-primary",
34204
+ children: instance.t("new")
34205
+ }
34206
+ ),
34207
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
34208
+ "button",
34209
+ {
34210
+ type: "button",
34211
+ onClick: onClose,
34212
+ className: "button-secondary",
34213
+ children: instance.t("cancel_button")
34214
+ }
34215
+ )
34216
+ ] })
34217
+ ]
34218
+ }
34219
+ ) })
34220
+ ]
34221
+ }
34222
+ ),
34200
34223
  document.body
34201
34224
  );
34202
34225
  };