@ng-atomic/common 2.0.1 → 3.0.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 (267) hide show
  1. package/directives/ios-safari-scroll-buggyfill/package.json +5 -5
  2. package/directives/package.json +5 -5
  3. package/esm2020/directives/index.mjs +2 -0
  4. package/esm2020/directives/ios-safari-scroll-buggyfill/index.mjs +3 -0
  5. package/esm2020/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.directive.mjs +24 -0
  6. package/esm2020/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.module.mjs +26 -0
  7. package/esm2020/directives/ios-safari-scroll-buggyfill/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs +5 -0
  8. package/esm2020/directives/ng-atomic-common-directives.mjs +5 -0
  9. package/esm2020/index.mjs +2 -0
  10. package/esm2020/models/action-item.mjs +2 -0
  11. package/esm2020/models/index.mjs +2 -0
  12. package/esm2020/models/menu-item.mjs +2 -0
  13. package/esm2020/models/ng-atomic-common-models.mjs +5 -0
  14. package/esm2020/models/public_api.mjs +3 -0
  15. package/esm2020/ng-atomic-common.mjs +5 -0
  16. package/esm2020/pipes/domain/domain.module.mjs +26 -0
  17. package/esm2020/pipes/domain/domain.pipe.mjs +27 -0
  18. package/esm2020/pipes/domain/index.mjs +3 -0
  19. package/esm2020/pipes/index.mjs +7 -0
  20. package/esm2020/pipes/ng-atomic-common-pipes.mjs +5 -0
  21. package/esm2020/pipes/smart-clamp/index.mjs +3 -0
  22. package/esm2020/pipes/smart-clamp/smart-clamp.module.mjs +26 -0
  23. package/esm2020/pipes/smart-clamp/smart-clamp.pipe.mjs +44 -0
  24. package/esm2020/pipes/smart-exp/index.mjs +3 -0
  25. package/esm2020/pipes/smart-exp/smart-exp.module.mjs +16 -0
  26. package/esm2020/pipes/smart-exp/smart-exp.pipe.mjs +27 -0
  27. package/esm2020/pipes/smart-field/index.mjs +3 -0
  28. package/esm2020/pipes/smart-field/smart-field.module.mjs +26 -0
  29. package/esm2020/pipes/smart-field/smart-field.pipe.mjs +31 -0
  30. package/esm2020/pipes/smart-sort-by/index.mjs +3 -0
  31. package/esm2020/pipes/smart-sort-by/smart-sort-by.module.mjs +26 -0
  32. package/esm2020/pipes/smart-sort-by/smart-sort-by.pipe.mjs +31 -0
  33. package/esm2020/pipes/yen/index.mjs +3 -0
  34. package/esm2020/pipes/yen/yen.module.mjs +26 -0
  35. package/esm2020/pipes/yen/yen.pipe.mjs +17 -0
  36. package/esm2020/services/form/form.service.mjs +38 -0
  37. package/esm2020/services/form/index.mjs +2 -0
  38. package/esm2020/services/index.mjs +5 -0
  39. package/esm2020/services/loading/index.mjs +2 -0
  40. package/esm2020/services/loading/loading.service.mjs +32 -0
  41. package/esm2020/services/ng-atomic-common-services.mjs +5 -0
  42. package/esm2020/services/query-resolver/index.mjs +2 -0
  43. package/esm2020/services/query-resolver/query-resolver.service.mjs +27 -0
  44. package/esm2020/services/snack-bar/index.mjs +3 -0
  45. package/esm2020/services/snack-bar/snack-bar.module.mjs +24 -0
  46. package/esm2020/services/snack-bar/snack-bar.service.mjs +23 -0
  47. package/esm2020/store/entities.page.store.mjs +44 -0
  48. package/esm2020/store/entity.page.store.mjs +40 -0
  49. package/esm2020/store/index.mjs +3 -0
  50. package/esm2020/store/ng-atomic-common-store.mjs +5 -0
  51. package/esm2020/utils/comma/comma.mjs +4 -0
  52. package/esm2020/utils/comma/index.mjs +2 -0
  53. package/esm2020/utils/compare-by-id/compare-by-id.mjs +2 -0
  54. package/esm2020/utils/compare-by-id/index.mjs +2 -0
  55. package/esm2020/utils/date-utils/date-utils.mjs +13 -0
  56. package/esm2020/utils/date-utils/index.mjs +2 -0
  57. package/esm2020/utils/index.mjs +9 -0
  58. package/esm2020/utils/mat-dayjs-date/dayjs-date.adapter.mjs +191 -0
  59. package/esm2020/utils/mat-dayjs-date/dayjs-date.formats.mjs +15 -0
  60. package/esm2020/utils/mat-dayjs-date/dayjs-date.module.mjs +41 -0
  61. package/esm2020/utils/mat-dayjs-date/dayjs-jp-providers.mjs +20 -0
  62. package/esm2020/utils/mat-dayjs-date/index.mjs +5 -0
  63. package/esm2020/utils/ng-atomic-common-utils.mjs +5 -0
  64. package/esm2020/utils/query/index.mjs +2 -0
  65. package/esm2020/utils/query/query.resolver.mjs +97 -0
  66. package/esm2020/utils/smart-exp-transformer/index.mjs +2 -0
  67. package/esm2020/utils/smart-exp-transformer/smart-exp-transformer.mjs +18 -0
  68. package/esm2020/utils/to-object/index.mjs +2 -0
  69. package/esm2020/utils/to-object/to-object.mjs +10 -0
  70. package/fesm2015/{ng-atomic-common-directives-ios-safari-scroll-buggyfill.js → ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs} +8 -8
  71. package/fesm2015/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs.map +1 -0
  72. package/fesm2015/{ng-atomic-common-directives.js → ng-atomic-common-directives.mjs} +8 -8
  73. package/fesm2015/ng-atomic-common-directives.mjs.map +1 -0
  74. package/fesm2015/ng-atomic-common-models.mjs +4 -0
  75. package/fesm2015/ng-atomic-common-models.mjs.map +1 -0
  76. package/fesm2015/ng-atomic-common-pipes.mjs +312 -0
  77. package/fesm2015/ng-atomic-common-pipes.mjs.map +1 -0
  78. package/fesm2015/{ng-atomic-common-services.js → ng-atomic-common-services.mjs} +24 -26
  79. package/fesm2015/ng-atomic-common-services.mjs.map +1 -0
  80. package/fesm2015/{ng-atomic-common-store.js → ng-atomic-common-store.mjs} +1 -1
  81. package/fesm2015/ng-atomic-common-store.mjs.map +1 -0
  82. package/fesm2015/{ng-atomic-common-utils.js → ng-atomic-common-utils.mjs} +9 -9
  83. package/fesm2015/ng-atomic-common-utils.mjs.map +1 -0
  84. package/fesm2015/{ng-atomic-common.js → ng-atomic-common.mjs} +1 -1
  85. package/fesm2015/ng-atomic-common.mjs.map +1 -0
  86. package/fesm2020/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs +54 -0
  87. package/fesm2020/ng-atomic-common-directives-ios-safari-scroll-buggyfill.mjs.map +1 -0
  88. package/fesm2020/ng-atomic-common-directives.mjs +54 -0
  89. package/fesm2020/ng-atomic-common-directives.mjs.map +1 -0
  90. package/fesm2020/ng-atomic-common-models.mjs +4 -0
  91. package/fesm2020/ng-atomic-common-models.mjs.map +1 -0
  92. package/{fesm2015/ng-atomic-common-pipes.js → fesm2020/ng-atomic-common-pipes.mjs} +51 -58
  93. package/fesm2020/ng-atomic-common-pipes.mjs.map +1 -0
  94. package/fesm2020/ng-atomic-common-services.mjs +142 -0
  95. package/fesm2020/ng-atomic-common-services.mjs.map +1 -0
  96. package/fesm2020/ng-atomic-common-store.mjs +89 -0
  97. package/fesm2020/ng-atomic-common-store.mjs.map +1 -0
  98. package/fesm2020/ng-atomic-common-utils.mjs +406 -0
  99. package/fesm2020/ng-atomic-common-utils.mjs.map +1 -0
  100. package/fesm2020/ng-atomic-common.mjs +4 -0
  101. package/fesm2020/ng-atomic-common.mjs.map +1 -0
  102. package/models/package.json +5 -5
  103. package/package.json +77 -8
  104. package/pipes/package.json +5 -5
  105. package/services/package.json +5 -5
  106. package/store/package.json +5 -5
  107. package/utils/mat-dayjs-date/dayjs-jp-providers.d.ts +1 -1
  108. package/utils/package.json +5 -5
  109. package/bundles/ng-atomic-common-directives-ios-safari-scroll-buggyfill.umd.js +0 -87
  110. package/bundles/ng-atomic-common-directives-ios-safari-scroll-buggyfill.umd.js.map +0 -1
  111. package/bundles/ng-atomic-common-directives.umd.js +0 -87
  112. package/bundles/ng-atomic-common-directives.umd.js.map +0 -1
  113. package/bundles/ng-atomic-common-models.umd.js +0 -11
  114. package/bundles/ng-atomic-common-models.umd.js.map +0 -1
  115. package/bundles/ng-atomic-common-pipes.umd.js +0 -378
  116. package/bundles/ng-atomic-common-pipes.umd.js.map +0 -1
  117. package/bundles/ng-atomic-common-services.umd.js +0 -526
  118. package/bundles/ng-atomic-common-services.umd.js.map +0 -1
  119. package/bundles/ng-atomic-common-store.umd.js +0 -460
  120. package/bundles/ng-atomic-common-store.umd.js.map +0 -1
  121. package/bundles/ng-atomic-common-utils.umd.js +0 -806
  122. package/bundles/ng-atomic-common-utils.umd.js.map +0 -1
  123. package/bundles/ng-atomic-common.umd.js +0 -11
  124. package/bundles/ng-atomic-common.umd.js.map +0 -1
  125. package/esm2015/directives/index.js +0 -2
  126. package/esm2015/directives/index.js.map +0 -1
  127. package/esm2015/directives/ios-safari-scroll-buggyfill/index.js +0 -3
  128. package/esm2015/directives/ios-safari-scroll-buggyfill/index.js.map +0 -1
  129. package/esm2015/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.directive.js +0 -24
  130. package/esm2015/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.directive.js.map +0 -1
  131. package/esm2015/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.module.js +0 -26
  132. package/esm2015/directives/ios-safari-scroll-buggyfill/ios-safari-scroll-buggyfill.module.js.map +0 -1
  133. package/esm2015/directives/ios-safari-scroll-buggyfill/ng-atomic-common-directives-ios-safari-scroll-buggyfill.js +0 -5
  134. package/esm2015/directives/ios-safari-scroll-buggyfill/ng-atomic-common-directives-ios-safari-scroll-buggyfill.js.map +0 -1
  135. package/esm2015/directives/ng-atomic-common-directives.js +0 -5
  136. package/esm2015/directives/ng-atomic-common-directives.js.map +0 -1
  137. package/esm2015/index.js +0 -2
  138. package/esm2015/index.js.map +0 -1
  139. package/esm2015/models/action-item.js +0 -2
  140. package/esm2015/models/action-item.js.map +0 -1
  141. package/esm2015/models/index.js +0 -2
  142. package/esm2015/models/index.js.map +0 -1
  143. package/esm2015/models/menu-item.js +0 -2
  144. package/esm2015/models/menu-item.js.map +0 -1
  145. package/esm2015/models/ng-atomic-common-models.js +0 -5
  146. package/esm2015/models/ng-atomic-common-models.js.map +0 -1
  147. package/esm2015/models/public_api.js +0 -3
  148. package/esm2015/models/public_api.js.map +0 -1
  149. package/esm2015/ng-atomic-common.js +0 -5
  150. package/esm2015/ng-atomic-common.js.map +0 -1
  151. package/esm2015/pipes/domain/domain.module.js +0 -26
  152. package/esm2015/pipes/domain/domain.module.js.map +0 -1
  153. package/esm2015/pipes/domain/domain.pipe.js +0 -29
  154. package/esm2015/pipes/domain/domain.pipe.js.map +0 -1
  155. package/esm2015/pipes/domain/index.js +0 -3
  156. package/esm2015/pipes/domain/index.js.map +0 -1
  157. package/esm2015/pipes/index.js +0 -7
  158. package/esm2015/pipes/index.js.map +0 -1
  159. package/esm2015/pipes/ng-atomic-common-pipes.js +0 -5
  160. package/esm2015/pipes/ng-atomic-common-pipes.js.map +0 -1
  161. package/esm2015/pipes/smart-clamp/index.js +0 -3
  162. package/esm2015/pipes/smart-clamp/index.js.map +0 -1
  163. package/esm2015/pipes/smart-clamp/smart-clamp.module.js +0 -26
  164. package/esm2015/pipes/smart-clamp/smart-clamp.module.js.map +0 -1
  165. package/esm2015/pipes/smart-clamp/smart-clamp.pipe.js +0 -45
  166. package/esm2015/pipes/smart-clamp/smart-clamp.pipe.js.map +0 -1
  167. package/esm2015/pipes/smart-exp/index.js +0 -3
  168. package/esm2015/pipes/smart-exp/index.js.map +0 -1
  169. package/esm2015/pipes/smart-exp/smart-exp.module.js +0 -16
  170. package/esm2015/pipes/smart-exp/smart-exp.module.js.map +0 -1
  171. package/esm2015/pipes/smart-exp/smart-exp.pipe.js +0 -28
  172. package/esm2015/pipes/smart-exp/smart-exp.pipe.js.map +0 -1
  173. package/esm2015/pipes/smart-field/index.js +0 -3
  174. package/esm2015/pipes/smart-field/index.js.map +0 -1
  175. package/esm2015/pipes/smart-field/smart-field.module.js +0 -26
  176. package/esm2015/pipes/smart-field/smart-field.module.js.map +0 -1
  177. package/esm2015/pipes/smart-field/smart-field.pipe.js +0 -33
  178. package/esm2015/pipes/smart-field/smart-field.pipe.js.map +0 -1
  179. package/esm2015/pipes/smart-sort-by/index.js +0 -3
  180. package/esm2015/pipes/smart-sort-by/index.js.map +0 -1
  181. package/esm2015/pipes/smart-sort-by/smart-sort-by.module.js +0 -26
  182. package/esm2015/pipes/smart-sort-by/smart-sort-by.module.js.map +0 -1
  183. package/esm2015/pipes/smart-sort-by/smart-sort-by.pipe.js +0 -32
  184. package/esm2015/pipes/smart-sort-by/smart-sort-by.pipe.js.map +0 -1
  185. package/esm2015/pipes/yen/index.js +0 -3
  186. package/esm2015/pipes/yen/index.js.map +0 -1
  187. package/esm2015/pipes/yen/yen.module.js +0 -26
  188. package/esm2015/pipes/yen/yen.module.js.map +0 -1
  189. package/esm2015/pipes/yen/yen.pipe.js +0 -17
  190. package/esm2015/pipes/yen/yen.pipe.js.map +0 -1
  191. package/esm2015/services/form/form.service.js +0 -35
  192. package/esm2015/services/form/form.service.js.map +0 -1
  193. package/esm2015/services/form/index.js +0 -2
  194. package/esm2015/services/form/index.js.map +0 -1
  195. package/esm2015/services/index.js +0 -5
  196. package/esm2015/services/index.js.map +0 -1
  197. package/esm2015/services/loading/index.js +0 -2
  198. package/esm2015/services/loading/index.js.map +0 -1
  199. package/esm2015/services/loading/loading.service.js +0 -32
  200. package/esm2015/services/loading/loading.service.js.map +0 -1
  201. package/esm2015/services/ng-atomic-common-services.js +0 -5
  202. package/esm2015/services/ng-atomic-common-services.js.map +0 -1
  203. package/esm2015/services/query-resolver/index.js +0 -2
  204. package/esm2015/services/query-resolver/index.js.map +0 -1
  205. package/esm2015/services/query-resolver/query-resolver.service.js +0 -31
  206. package/esm2015/services/query-resolver/query-resolver.service.js.map +0 -1
  207. package/esm2015/services/snack-bar/index.js +0 -3
  208. package/esm2015/services/snack-bar/index.js.map +0 -1
  209. package/esm2015/services/snack-bar/snack-bar.module.js +0 -24
  210. package/esm2015/services/snack-bar/snack-bar.module.js.map +0 -1
  211. package/esm2015/services/snack-bar/snack-bar.service.js +0 -23
  212. package/esm2015/services/snack-bar/snack-bar.service.js.map +0 -1
  213. package/esm2015/store/entities.page.store.js +0 -44
  214. package/esm2015/store/entities.page.store.js.map +0 -1
  215. package/esm2015/store/entity.page.store.js +0 -41
  216. package/esm2015/store/entity.page.store.js.map +0 -1
  217. package/esm2015/store/index.js +0 -3
  218. package/esm2015/store/index.js.map +0 -1
  219. package/esm2015/store/ng-atomic-common-store.js +0 -5
  220. package/esm2015/store/ng-atomic-common-store.js.map +0 -1
  221. package/esm2015/utils/comma/comma.js +0 -4
  222. package/esm2015/utils/comma/comma.js.map +0 -1
  223. package/esm2015/utils/comma/index.js +0 -2
  224. package/esm2015/utils/comma/index.js.map +0 -1
  225. package/esm2015/utils/compare-by-id/compare-by-id.js +0 -2
  226. package/esm2015/utils/compare-by-id/compare-by-id.js.map +0 -1
  227. package/esm2015/utils/compare-by-id/index.js +0 -2
  228. package/esm2015/utils/compare-by-id/index.js.map +0 -1
  229. package/esm2015/utils/date-utils/date-utils.js +0 -13
  230. package/esm2015/utils/date-utils/date-utils.js.map +0 -1
  231. package/esm2015/utils/date-utils/index.js +0 -2
  232. package/esm2015/utils/date-utils/index.js.map +0 -1
  233. package/esm2015/utils/index.js +0 -9
  234. package/esm2015/utils/index.js.map +0 -1
  235. package/esm2015/utils/mat-dayjs-date/dayjs-date.adapter.js +0 -191
  236. package/esm2015/utils/mat-dayjs-date/dayjs-date.adapter.js.map +0 -1
  237. package/esm2015/utils/mat-dayjs-date/dayjs-date.formats.js +0 -15
  238. package/esm2015/utils/mat-dayjs-date/dayjs-date.formats.js.map +0 -1
  239. package/esm2015/utils/mat-dayjs-date/dayjs-date.module.js +0 -41
  240. package/esm2015/utils/mat-dayjs-date/dayjs-date.module.js.map +0 -1
  241. package/esm2015/utils/mat-dayjs-date/dayjs-jp-providers.js +0 -20
  242. package/esm2015/utils/mat-dayjs-date/dayjs-jp-providers.js.map +0 -1
  243. package/esm2015/utils/mat-dayjs-date/index.js +0 -5
  244. package/esm2015/utils/mat-dayjs-date/index.js.map +0 -1
  245. package/esm2015/utils/ng-atomic-common-utils.js +0 -5
  246. package/esm2015/utils/ng-atomic-common-utils.js.map +0 -1
  247. package/esm2015/utils/query/index.js +0 -2
  248. package/esm2015/utils/query/index.js.map +0 -1
  249. package/esm2015/utils/query/query.resolver.js +0 -100
  250. package/esm2015/utils/query/query.resolver.js.map +0 -1
  251. package/esm2015/utils/smart-exp-transformer/index.js +0 -2
  252. package/esm2015/utils/smart-exp-transformer/index.js.map +0 -1
  253. package/esm2015/utils/smart-exp-transformer/smart-exp-transformer.js +0 -18
  254. package/esm2015/utils/smart-exp-transformer/smart-exp-transformer.js.map +0 -1
  255. package/esm2015/utils/to-object/index.js +0 -2
  256. package/esm2015/utils/to-object/index.js.map +0 -1
  257. package/esm2015/utils/to-object/to-object.js +0 -10
  258. package/esm2015/utils/to-object/to-object.js.map +0 -1
  259. package/fesm2015/ng-atomic-common-directives-ios-safari-scroll-buggyfill.js.map +0 -1
  260. package/fesm2015/ng-atomic-common-directives.js.map +0 -1
  261. package/fesm2015/ng-atomic-common-models.js +0 -4
  262. package/fesm2015/ng-atomic-common-models.js.map +0 -1
  263. package/fesm2015/ng-atomic-common-pipes.js.map +0 -1
  264. package/fesm2015/ng-atomic-common-services.js.map +0 -1
  265. package/fesm2015/ng-atomic-common-store.js.map +0 -1
  266. package/fesm2015/ng-atomic-common-utils.js.map +0 -1
  267. package/fesm2015/ng-atomic-common.js.map +0 -1
@@ -1,41 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { ComponentStore } from '@ngrx/component-store';
3
- import { filter, switchMap, tap } from 'rxjs/operators';
4
- export const tryCatch = (promise) => new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
5
- try {
6
- resolve(yield promise);
7
- }
8
- catch (error) {
9
- reject(error);
10
- }
11
- }));
12
- export class EntityPageStore extends ComponentStore {
13
- constructor(initialState) {
14
- super(initialState);
15
- this.mode$ = this.select(state => state.mode);
16
- this.entityId$ = this.select(state => state.entityId).pipe(filter(id => !!id));
17
- this.entity$ = this.select(state => state.entity);
18
- this.setMode = this.updater((state, mode) => (Object.assign(Object.assign({}, state), { mode })));
19
- this.setEntityId = this.updater((state, entityId) => (Object.assign(Object.assign({}, state), { entityId })));
20
- this.setEntity = this.updater((state, entity) => (Object.assign(Object.assign({}, state), { entity })));
21
- this.getEntityIdAndMode = this.effect((entityId$) => entityId$.pipe(tap(id => this.setMode(id === 'new' ? 'create' : 'update')), filter(id => id !== 'new'), tap((id) => this.setEntityId(id))));
22
- this.getEntity = this.effect((entityId$) => entityId$.pipe(switchMap(id => this._getEntity(id)), tap((entity) => this.setEntity(entity))));
23
- this.getEntity(this.entityId$);
24
- }
25
- get entity() { return this.get().entity; }
26
- createEntity(value) {
27
- const entity = (Object.assign(Object.assign({}, this.entity), value));
28
- this.loading.setKey('[pages/stores/pages/store] Create Store');
29
- return tryCatch(this._createEntity(entity))
30
- .catch(error => (console.error(error), this.snackBar.openSnackBar('作成に失敗しました。')))
31
- .finally(() => this.loading.removeKey('[pages/stores/pages/store] Create Store'));
32
- }
33
- updateEntity(value) {
34
- const entity = (Object.assign(Object.assign({}, this.entity), value));
35
- this.loading.setKey('[pages/stores/pages/store] Create Store');
36
- return this._updateEntity(entity)
37
- .catch(error => (console.error(error), this.snackBar.openSnackBar('更新に失敗しました。')))
38
- .finally(() => this.loading.removeKey('[pages/stores/pages/store] Create Store'));
39
- }
40
- }
41
- //# sourceMappingURL=entity.page.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity.page.store.js","sourceRoot":"","sources":["../../../../../libs/common/store/entity.page.store.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAUxD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAqB,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;IACvF,IAAI;QAAE,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC;KAAE;IAAC,OAAO,KAAK,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OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;aAC9B,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;aAChF,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC,CAAC;IACtF,CAAC;CASF","sourcesContent":["import { ComponentStore } from '@ngrx/component-store';\nimport { LoadingService, SnackBarService } from '@ng-atomic/common/services';\nimport { Observable } from 'rxjs';\nimport { filter, switchMap, tap } from 'rxjs/operators';\n\nexport type Mode = 'create' | 'update'\n\nexport interface EntityPageState<Entity> {\n mode: Mode;\n entityId: string;\n entity: Entity;\n}\n\nexport const tryCatch = (promise: Promise<any>) => new Promise(async (resolve, reject) => {\n try { resolve(await promise); } catch (error) { reject(error); }\n});\n\nexport abstract class EntityPageStore<S extends EntityPageState<Entity>, Entity> extends ComponentStore<S> {\n get entity() { return this.get().entity}\n\n mode$ = this.select(state => state.mode);\n entityId$ = this.select(state => state.entityId).pipe(filter(id => !!id));\n entity$ = this.select(state => state.entity);\n\n setMode = this.updater((state, mode: Mode) => ({...state, mode}));\n setEntityId = this.updater((state, entityId: string) => ({...state, entityId}));\n setEntity = this.updater((state, entity: Entity) => ({...state, entity}));\n\n constructor(initialState?: S) {\n super(initialState);\n this.getEntity(this.entityId$);\n }\n\n getEntityIdAndMode = this.effect((entityId$: Observable<string>) => entityId$.pipe(\n tap(id => this.setMode(id === 'new' ? 'create' : 'update')),\n filter(id => id !== 'new'),\n tap((id: string) => this.setEntityId(id)),\n ));\n\n getEntity = this.effect((entityId$: Observable<string>) => entityId$.pipe(\n switchMap(id => this._getEntity(id)),\n tap((entity: Entity) => this.setEntity(entity)),\n ));\n\n createEntity(value: Partial<Entity>) {\n const entity: Entity = ({...this.entity, ...value});\n\n this.loading.setKey('[pages/stores/pages/store] Create Store');\n\n return tryCatch(this._createEntity(entity))\n .catch(error => (console.error(error), this.snackBar.openSnackBar('作成に失敗しました。')))\n .finally(() => this.loading.removeKey('[pages/stores/pages/store] Create Store'));\n }\n\n updateEntity(value: Partial<Entity>) {\n const entity: Entity = ({...this.entity, ...value});\n\n this.loading.setKey('[pages/stores/pages/store] Create Store');\n return this._updateEntity(entity)\n .catch(error => (console.error(error), this.snackBar.openSnackBar('更新に失敗しました。')))\n .finally(() => this.loading.removeKey('[pages/stores/pages/store] Create Store'));\n }\n\n abstract _getEntity(idOrParams: string): Observable<Entity>;\n abstract _createEntity(entity: Entity): Promise<Entity>;\n abstract _updateEntity(entity: Entity): Promise<void>;\n\n abstract get loading(): LoadingService;\n abstract get snackBar(): SnackBarService;\n\n}\n"]}
@@ -1,3 +0,0 @@
1
- export * from './entity.page.store';
2
- export * from './entities.page.store';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './entity.page.store';\nexport * from './entities.page.store';\n"]}
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=ng-atomic-common-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ng-atomic-common-store.js","sourceRoot":"","sources":["../../../../../libs/common/store/ng-atomic-common-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -1,4 +0,0 @@
1
- export const comma = (n) => n === null ? '0' : n.toLocaleString();
2
- export const commaStr = (n, unit = '円') => n < 0 ? `-${comma(abs(n))}${unit}` : `${comma(n)}${unit}`;
3
- export const abs = (n) => Math.abs(n);
4
- //# sourceMappingURL=comma.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"comma.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/comma/comma.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAgB,EAAU,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;AACzF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,OAAe,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;AACrH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC","sourcesContent":["export const comma = (n: number | null): string => n === null ? '0' : n.toLocaleString();\nexport const commaStr = (n: number, unit: string = '円') => n < 0 ? `-${comma(abs(n))}${unit}` : `${comma(n)}${unit}`;\nexport const abs = (n: number) => Math.abs(n);"]}
@@ -1,2 +0,0 @@
1
- export * from './comma';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/comma/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","sourcesContent":["export * from './comma';\n"]}
@@ -1,2 +0,0 @@
1
- export const compareById = (a, b) => parseInt(a.id, 10) - parseInt(b.id, 10);
2
- //# sourceMappingURL=compare-by-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compare-by-id.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/compare-by-id/compare-by-id.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAE,CAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC","sourcesContent":["export type HasId = { id: string };\nexport const compareById = (a: HasId, b: HasId) => parseInt(a.id, 10) - parseInt(b.id, 10);\n"]}
@@ -1,2 +0,0 @@
1
- export * from './compare-by-id';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/compare-by-id/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC","sourcesContent":["export * from './compare-by-id';\n"]}
@@ -1,13 +0,0 @@
1
- import dayjs from 'dayjs';
2
- export const removeComma = (str) => str.replace(/\,/g, '');
3
- export const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
4
- const DATE_REGEX = /^[0-9]{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])$/;
5
- const DATETIME_REGEX = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\+([+-][0-2]\d:[0-5]\d)$/;
6
- export const isDateStr = (str) => str && !!str.match(DATE_REGEX);
7
- export const isDateTimeStr = (str) => str && !!str.match(DATE_REGEX);
8
- const ISO_REGEX = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
9
- export const isIsoString = (str) => str && !!str.match(ISO_REGEX);
10
- export function timestampToDayjs(timestamp) {
11
- return timestamp ? dayjs(timestamp.toDate()) : null;
12
- }
13
- //# sourceMappingURL=date-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/date-utils/date-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AACjD,MAAM,UAAU,GAAG,uDAAuD,CAAC;AAC3E,MAAM,cAAc,GAAG,uEAAuE,CAAC;AAC/F,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAkB,EAAiB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAkB,EAAiB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAEnG,MAAM,SAAS,GAAG,0EAA0E,CAAC;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAkB,EAAiB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAOhG,MAAM,UAAU,gBAAgB,CAAC,SAA2B;IAC1D,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC","sourcesContent":["import dayjs from 'dayjs';\n\nexport const removeComma = (str: string) => str.replace(/\\,/g, '');\n\nexport const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ss';\nconst DATE_REGEX = /^[0-9]{4}\\/(0[1-9]|1[0-2])\\/(0[1-9]|[12][0-9]|3[01])$/;\nconst DATETIME_REGEX = /^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\+([+-][0-2]\\d:[0-5]\\d)$/;\nexport const isDateStr = (str: string | null): str is string => str && !!str.match(DATE_REGEX);\nexport const isDateTimeStr = (str: string | null): str is string => str && !!str.match(DATE_REGEX);\n\nconst ISO_REGEX = /\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/;\nexport const isIsoString = (str: string | null): str is string => str && !!str.match(ISO_REGEX);\n\n\nexport interface Timestamp {\n toDate: () => Date;\n}\n\nexport function timestampToDayjs(timestamp: Timestamp | null): dayjs.Dayjs | null {\n return timestamp ? dayjs(timestamp.toDate()) : null;\n}"]}
@@ -1,2 +0,0 @@
1
- export * from './date-utils';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/date-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC","sourcesContent":["export * from './date-utils';"]}
@@ -1,9 +0,0 @@
1
- export * from './comma';
2
- export * from './compare-by-id';
3
- export * from './date-utils';
4
- export * from './mat-dayjs-date';
5
- export * from './smart-exp-transformer';
6
- export * from './to-object';
7
- export * from './query';
8
- // export * from './define-element';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,oCAAoC","sourcesContent":["export * from './comma';\nexport * from './compare-by-id';\nexport * from './date-utils';\nexport * from './mat-dayjs-date';\nexport * from './smart-exp-transformer';\nexport * from './to-object';\nexport * from './query';\n// export * from './define-element';\n"]}
@@ -1,191 +0,0 @@
1
- import { __decorate, __metadata, __param } from "tslib";
2
- import { Optional, Inject, InjectionToken } from '@angular/core';
3
- import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
4
- import dayjs from 'dayjs';
5
- import utc from 'dayjs/plugin/utc';
6
- import localeData from 'dayjs/plugin/localeData';
7
- import LocalizedFormat from 'dayjs/plugin/localizedFormat';
8
- import customParseFormat from 'dayjs/plugin/customParseFormat';
9
- /** InjectionToken for Dayjs date adapter to configure options. */
10
- export const MAT_DAYJS_DATE_ADAPTER_OPTIONS = new InjectionToken('MAT_DAYJS_DATE_ADAPTER_OPTIONS', {
11
- providedIn: 'root',
12
- factory: MAT_DAYJS_DATE_ADAPTER_OPTIONS_FACTORY
13
- });
14
- export function MAT_DAYJS_DATE_ADAPTER_OPTIONS_FACTORY() {
15
- return {
16
- useUtc: false
17
- };
18
- }
19
- /** Creates an array and fills it with values. */
20
- function range(length, valueFunction) {
21
- const valuesArray = Array(length);
22
- for (let i = 0; i < length; i++) {
23
- valuesArray[i] = valueFunction(i);
24
- }
25
- return valuesArray;
26
- }
27
- /** Adapts Dayjs Dates for use with Angular Material. */
28
- let DayjsDateAdapter = class DayjsDateAdapter extends DateAdapter {
29
- constructor(dateLocale, options) {
30
- super();
31
- this.dateLocale = dateLocale;
32
- this.options = options;
33
- this.initializeParser(dateLocale);
34
- }
35
- // TODO: Implement
36
- setLocale(locale) {
37
- super.setLocale(locale);
38
- const dayJsLocaleData = this.dayJs().localeData();
39
- this.localeData = {
40
- firstDayOfWeek: dayJsLocaleData.firstDayOfWeek(),
41
- longMonths: dayJsLocaleData.months(),
42
- shortMonths: dayJsLocaleData.monthsShort(),
43
- dates: range(31, (i) => this.createDate(2017, 0, i + 1).format('D')),
44
- longDaysOfWeek: range(7, (i) => this.dayJs().set('day', i).format('dddd')),
45
- shortDaysOfWeek: dayJsLocaleData.weekdaysShort(),
46
- narrowDaysOfWeek: dayJsLocaleData.weekdaysMin(),
47
- };
48
- }
49
- getYear(date) {
50
- return this.dayJs(date).year();
51
- }
52
- getMonth(date) {
53
- return this.dayJs(date).month();
54
- }
55
- getDate(date) {
56
- return this.dayJs(date).date();
57
- }
58
- getDayOfWeek(date) {
59
- return this.dayJs(date).day();
60
- }
61
- getMonthNames(style) {
62
- return style === 'long' ? this.localeData.longMonths : this.localeData.shortMonths;
63
- }
64
- getDateNames() {
65
- return this.localeData.dates;
66
- }
67
- getDayOfWeekNames(style) {
68
- if (style === 'long') {
69
- return this.localeData.longDaysOfWeek;
70
- }
71
- if (style === 'short') {
72
- return this.localeData.shortDaysOfWeek;
73
- }
74
- return this.localeData.narrowDaysOfWeek;
75
- }
76
- getYearName(date) {
77
- return this.dayJs(date).format('YYYY');
78
- }
79
- getFirstDayOfWeek() {
80
- return this.localeData.firstDayOfWeek;
81
- }
82
- getNumDaysInMonth(date) {
83
- return this.dayJs(date).daysInMonth();
84
- }
85
- clone(date) {
86
- return date.clone();
87
- }
88
- createDate(year, month, date) {
89
- const returnDayjs = this.dayJs()
90
- .set('year', year)
91
- .set('month', month)
92
- .set('date', date);
93
- return returnDayjs;
94
- }
95
- today() {
96
- return this.dayJs();
97
- }
98
- parse(value, parseFormat) {
99
- if (value && typeof value === 'string') {
100
- return this.dayJs(value, dayjs().localeData().longDateFormat(parseFormat), this.locale);
101
- }
102
- return value ? this.dayJs(value).locale(this.locale) : null;
103
- }
104
- format(date, displayFormat) {
105
- if (!this.isValid(date)) {
106
- throw Error('DayjsDateAdapter: Cannot format invalid date.');
107
- }
108
- return date.locale(this.locale).format(displayFormat);
109
- }
110
- addCalendarYears(date, years) {
111
- return date.add(years, 'year');
112
- }
113
- addCalendarMonths(date, months) {
114
- return date.add(months, 'month');
115
- }
116
- addCalendarDays(date, days) {
117
- return date.add(days, 'day');
118
- }
119
- toIso8601(date) {
120
- return date.toISOString();
121
- }
122
- /**
123
- * Attempts to deserialize a value to a valid date object. This is different from parsing in that
124
- * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601
125
- * string). The default implementation does not allow any deserialization, it simply checks that
126
- * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
127
- * method on all of it's `@Input()` properties that accept dates. It is therefore possible to
128
- * support passing values from your backend directly to these properties by overriding this method
129
- * to also deserialize the format used by your backend.
130
- * @param value The value to be deserialized into a date object.
131
- * @returns The deserialized date object, either a valid date, null if the value can be
132
- * deserialized into a null date (e.g. the empty string), or an invalid date.
133
- */
134
- deserialize(value) {
135
- let date;
136
- if (value instanceof Date) {
137
- date = this.dayJs(value);
138
- }
139
- else if (this.isDateInstance(value)) {
140
- // NOTE: assumes that cloning also sets the correct locale.
141
- return this.clone(value);
142
- }
143
- if (typeof value === 'string') {
144
- if (!value) {
145
- return null;
146
- }
147
- date = this.dayJs(value).toISOString();
148
- }
149
- if (date && this.isValid(date)) {
150
- return this.dayJs(date); // NOTE: Is this necessary since Dayjs is immutable and Moment was not?
151
- }
152
- return super.deserialize(value);
153
- }
154
- isDateInstance(obj) {
155
- return dayjs.isDayjs(obj);
156
- }
157
- isValid(date) {
158
- return this.dayJs(date).isValid();
159
- }
160
- invalid() {
161
- return this.dayJs(null);
162
- }
163
- dayJs(input, format, locale) {
164
- if (!this.shouldUseUtc) {
165
- return dayjs(input, { format, locale }, locale);
166
- }
167
- return dayjs(input, { format, locale, utc: this.shouldUseUtc }, locale).utc();
168
- }
169
- get shouldUseUtc() {
170
- const { useUtc } = this.options || {};
171
- return !!useUtc;
172
- }
173
- initializeParser(dateLocale) {
174
- if (this.shouldUseUtc) {
175
- dayjs.extend(utc);
176
- }
177
- dayjs.extend(LocalizedFormat);
178
- dayjs.extend(customParseFormat);
179
- dayjs.extend(localeData);
180
- this.setLocale(dateLocale);
181
- }
182
- };
183
- DayjsDateAdapter = __decorate([
184
- __param(0, Optional()),
185
- __param(0, Inject(MAT_DATE_LOCALE)),
186
- __param(1, Optional()),
187
- __param(1, Inject(MAT_DAYJS_DATE_ADAPTER_OPTIONS)),
188
- __metadata("design:paramtypes", [String, Object])
189
- ], DayjsDateAdapter);
190
- export { DayjsDateAdapter };
191
- //# sourceMappingURL=dayjs-date.adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file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AAC;IAClB,CAAC;IAEO,gBAAgB,CAAC,UAAkB;QACzC,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACnB;QAED,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC9B,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEzB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;CACF,CAAA;AAlMY,gBAAgB;IAYxB,WAAA,QAAQ,EAAE,CAAA;IAAE,WAAA,MAAM,CAAC,eAAe,CAAC,CAAA;IACnC,WAAA,QAAQ,EAAE,CAAA;IAAE,WAAA,MAAM,CAAC,8BAA8B,CAAC,CAAA;;GAb1C,gBAAgB,CAkM5B;SAlMY,gBAAgB","sourcesContent":["\nimport { Optional, Inject, InjectionToken } from '@angular/core';\nimport { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';\nimport dayjs from 'dayjs';\nimport { Dayjs } from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport localeData from 'dayjs/plugin/localeData';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\n\n\nexport interface DayJsDateAdapterOptions {\n /**\n * Turns the use of utc dates on or off.\n * Changing this will change how Angular Material components like DatePicker output dates.\n * {@default false}\n */\n useUtc?: boolean;\n}\n\n/** InjectionToken for Dayjs date adapter to configure options. */\nexport const MAT_DAYJS_DATE_ADAPTER_OPTIONS = new InjectionToken<DayJsDateAdapterOptions>(\n 'MAT_DAYJS_DATE_ADAPTER_OPTIONS', {\n providedIn: 'root',\n factory: MAT_DAYJS_DATE_ADAPTER_OPTIONS_FACTORY\n});\n\nexport function MAT_DAYJS_DATE_ADAPTER_OPTIONS_FACTORY(): DayJsDateAdapterOptions {\n return {\n useUtc: false\n };\n}\n\n/** Creates an array and fills it with values. */\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\n const valuesArray = Array(length);\n for (let i = 0; i < length; i++) {\n valuesArray[i] = valueFunction(i);\n }\n return valuesArray;\n}\n\n/** Adapts Dayjs Dates for use with Angular Material. */\nexport class DayjsDateAdapter extends DateAdapter<Dayjs> {\n private localeData!: {\n firstDayOfWeek: number,\n longMonths: string[],\n shortMonths: string[],\n dates: string[],\n longDaysOfWeek: string[],\n shortDaysOfWeek: string[],\n narrowDaysOfWeek: string[]\n };\n\n constructor(\n @Optional() @Inject(MAT_DATE_LOCALE) public dateLocale: string,\n @Optional() @Inject(MAT_DAYJS_DATE_ADAPTER_OPTIONS) private options?: DayJsDateAdapterOptions\n ) {\n super();\n this.initializeParser(dateLocale);\n }\n\n // TODO: Implement\n setLocale(locale: string) {\n super.setLocale(locale);\n\n const dayJsLocaleData = this.dayJs().localeData();\n this.localeData = {\n firstDayOfWeek: dayJsLocaleData.firstDayOfWeek(),\n longMonths: dayJsLocaleData.months(),\n shortMonths: dayJsLocaleData.monthsShort(),\n dates: range(31, (i) => this.createDate(2017, 0, i + 1).format('D')),\n longDaysOfWeek: range(7, (i) => this.dayJs().set('day', i).format('dddd')),\n shortDaysOfWeek: dayJsLocaleData.weekdaysShort(),\n narrowDaysOfWeek: dayJsLocaleData.weekdaysMin(),\n };\n }\n\n getYear(date: Dayjs): number {\n return this.dayJs(date).year();\n }\n\n getMonth(date: Dayjs): number {\n return this.dayJs(date).month();\n }\n\n getDate(date: Dayjs): number {\n return this.dayJs(date).date();\n }\n\n getDayOfWeek(date: Dayjs): number {\n return this.dayJs(date).day();\n }\n\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n return style === 'long' ? this.localeData.longMonths : this.localeData.shortMonths;\n }\n\n getDateNames(): string[] {\n return this.localeData.dates;\n }\n\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n if (style === 'long') {\n return this.localeData.longDaysOfWeek;\n }\n if (style === 'short') {\n return this.localeData.shortDaysOfWeek;\n }\n return this.localeData.narrowDaysOfWeek;\n }\n\n getYearName(date: Dayjs): string {\n return this.dayJs(date).format('YYYY');\n }\n\n getFirstDayOfWeek(): number {\n return this.localeData.firstDayOfWeek;\n }\n\n getNumDaysInMonth(date: Dayjs): number {\n return this.dayJs(date).daysInMonth();\n }\n\n clone(date: Dayjs): Dayjs {\n return date.clone();\n }\n\n createDate(year: number, month: number, date: number): Dayjs {\n const returnDayjs = this.dayJs()\n .set('year', year)\n .set('month', month)\n .set('date', date);\n return returnDayjs;\n }\n\n today(): Dayjs {\n return this.dayJs();\n }\n\n parse(value: any, parseFormat: string): Dayjs | null {\n if (value && typeof value === 'string') {\n return this.dayJs(value, dayjs().localeData().longDateFormat(parseFormat), this.locale);\n }\n return value ? this.dayJs(value).locale(this.locale) : null;\n }\n\n format(date: Dayjs, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('DayjsDateAdapter: Cannot format invalid date.');\n }\n return date.locale(this.locale).format(displayFormat);\n }\n\n addCalendarYears(date: Dayjs, years: number): Dayjs {\n return date.add(years, 'year');\n }\n\n addCalendarMonths(date: Dayjs, months: number): Dayjs {\n return date.add(months, 'month');\n }\n\n addCalendarDays(date: Dayjs, days: number): Dayjs {\n return date.add(days, 'day');\n }\n\n toIso8601(date: Dayjs): string {\n return date.toISOString();\n }\n\n /**\n * Attempts to deserialize a value to a valid date object. This is different from parsing in that\n * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601\n * string). The default implementation does not allow any deserialization, it simply checks that\n * the given value is already a valid date object or null. The `<mat-datepicker>` will call this\n * method on all of it's `@Input()` properties that accept dates. It is therefore possible to\n * support passing values from your backend directly to these properties by overriding this method\n * to also deserialize the format used by your backend.\n * @param value The value to be deserialized into a date object.\n * @returns The deserialized date object, either a valid date, null if the value can be\n * deserialized into a null date (e.g. the empty string), or an invalid date.\n */\n deserialize(value: any): Dayjs | null {\n let date;\n if (value instanceof Date) {\n date = this.dayJs(value);\n } else if (this.isDateInstance(value)) {\n // NOTE: assumes that cloning also sets the correct locale.\n return this.clone(value);\n }\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n date = this.dayJs(value).toISOString();\n }\n if (date && this.isValid(date as Dayjs)) {\n return this.dayJs(date); // NOTE: Is this necessary since Dayjs is immutable and Moment was not?\n }\n return super.deserialize(value);\n }\n\n isDateInstance(obj: any): boolean {\n return dayjs.isDayjs(obj);\n }\n\n isValid(date: Dayjs): boolean {\n return this.dayJs(date).isValid();\n }\n\n invalid(): Dayjs {\n return this.dayJs(null);\n }\n\n private dayJs(input?: any, format?: string, locale?: string): Dayjs {\n if (!this.shouldUseUtc) {\n return dayjs(input, { format, locale }, locale);\n }\n return dayjs(input, { format, locale, utc: this.shouldUseUtc }, locale).utc();\n }\n\n private get shouldUseUtc(): boolean {\n const { useUtc }: DayJsDateAdapterOptions = this.options || {};\n return !!useUtc;\n }\n\n private initializeParser(dateLocale: string) {\n if (this.shouldUseUtc) {\n dayjs.extend(utc);\n }\n\n dayjs.extend(LocalizedFormat);\n dayjs.extend(customParseFormat);\n dayjs.extend(localeData);\n\n this.setLocale(dateLocale);\n }\n}"]}
@@ -1,15 +0,0 @@
1
- /**
2
- * Custom Date-Formats and Adapter (using https://github.com/iamkun/dayjs)
3
- */
4
- export const MAT_DAYJS_DATE_FORMATS = {
5
- parse: {
6
- dateInput: 'MM/DD/YYYY',
7
- },
8
- display: {
9
- dateInput: 'MM/DD/YYYY',
10
- monthYearLabel: 'MMM YYYY',
11
- dateA11yLabel: 'LL',
12
- monthYearA11yLabel: 'MMMM YYYY',
13
- }
14
- };
15
- //# sourceMappingURL=dayjs-date.formats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dayjs-date.formats.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/mat-dayjs-date/dayjs-date.formats.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,KAAK,EAAE;QACL,SAAS,EAAE,YAAY;KACxB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;KAChC;CACF,CAAC","sourcesContent":["import { MatDateFormats } from '@angular/material/core';\n\n/**\n * Custom Date-Formats and Adapter (using https://github.com/iamkun/dayjs)\n */\nexport const MAT_DAYJS_DATE_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'MM/DD/YYYY',\n },\n display: {\n dateInput: 'MM/DD/YYYY',\n monthYearLabel: 'MMM YYYY',\n dateA11yLabel: 'LL',\n monthYearA11yLabel: 'MMMM YYYY',\n }\n};"]}
@@ -1,41 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
3
- import { DayjsDateAdapter, MAT_DAYJS_DATE_ADAPTER_OPTIONS } from './dayjs-date.adapter';
4
- import { MAT_DAYJS_DATE_FORMATS } from './dayjs-date.formats';
5
- import * as i0 from "@angular/core";
6
- export class DayjsDateModule {
7
- }
8
- DayjsDateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DayjsDateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
9
- DayjsDateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DayjsDateModule });
10
- DayjsDateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DayjsDateModule, providers: [
11
- {
12
- provide: DateAdapter,
13
- useClass: DayjsDateAdapter,
14
- deps: [MAT_DATE_LOCALE, MAT_DAYJS_DATE_ADAPTER_OPTIONS]
15
- },
16
- ] });
17
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DayjsDateModule, decorators: [{
18
- type: NgModule,
19
- args: [{
20
- providers: [
21
- {
22
- provide: DateAdapter,
23
- useClass: DayjsDateAdapter,
24
- deps: [MAT_DATE_LOCALE, MAT_DAYJS_DATE_ADAPTER_OPTIONS]
25
- },
26
- ],
27
- }]
28
- }] });
29
- export class MatDayjsDateModule {
30
- }
31
- MatDayjsDateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MatDayjsDateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
32
- MatDayjsDateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MatDayjsDateModule, imports: [DayjsDateModule] });
33
- MatDayjsDateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MatDayjsDateModule, providers: [{ provide: MAT_DATE_FORMATS, useValue: MAT_DAYJS_DATE_FORMATS }], imports: [[DayjsDateModule]] });
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MatDayjsDateModule, decorators: [{
35
- type: NgModule,
36
- args: [{
37
- imports: [DayjsDateModule],
38
- providers: [{ provide: MAT_DATE_FORMATS, useValue: MAT_DAYJS_DATE_FORMATS }],
39
- }]
40
- }] });
41
- //# sourceMappingURL=dayjs-date.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dayjs-date.module.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/mat-dayjs-date/dayjs-date.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;;AAW9D,MAAM,OAAO,eAAe;;6GAAf,eAAe;8GAAf,eAAe;8GAAf,eAAe,aARf;QACT;YACE,OAAO,EAAE,WAAW;YACpB,QAAQ,EAAE,gBAAgB;YAC1B,IAAI,EAAE,CAAC,eAAe,EAAE,8BAA8B,CAAC;SACxD;KACF;4FAEU,eAAe;kBAT3B,QAAQ;mBAAC;oBACR,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,WAAW;4BACpB,QAAQ,EAAE,gBAAgB;4BAC1B,IAAI,EAAE,CAAC,eAAe,EAAE,8BAA8B,CAAC;yBACxD;qBACF;iBACF;;AAOD,MAAM,OAAO,kBAAkB;;gHAAlB,kBAAkB;iHAAlB,kBAAkB,YANlB,eAAe;iHAMf,kBAAkB,aAFlB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC,YADnE,CAAC,eAAe,CAAC;4FAGf,kBAAkB;kBAJ9B,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,eAAe,CAAC;oBAC1B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC;iBAC7E","sourcesContent":["import { NgModule } from '@angular/core';\nimport { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';\nimport { DayjsDateAdapter, MAT_DAYJS_DATE_ADAPTER_OPTIONS } from './dayjs-date.adapter';\nimport { MAT_DAYJS_DATE_FORMATS } from './dayjs-date.formats';\n\n@NgModule({\n providers: [\n {\n provide: DateAdapter,\n useClass: DayjsDateAdapter,\n deps: [MAT_DATE_LOCALE, MAT_DAYJS_DATE_ADAPTER_OPTIONS]\n },\n ],\n})\nexport class DayjsDateModule { }\n\n@NgModule({\n imports: [DayjsDateModule],\n providers: [{ provide: MAT_DATE_FORMATS, useValue: MAT_DAYJS_DATE_FORMATS }],\n})\nexport class MatDayjsDateModule { }"]}
@@ -1,20 +0,0 @@
1
- import { MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
2
- import dayjs from 'dayjs';
3
- import 'dayjs/locale/ja';
4
- dayjs.locale('ja');
5
- export const MAT_DAYJS_DATE_FORMATS_FOR_JP = {
6
- parse: {
7
- dateInput: 'YYYY/MM/DD',
8
- },
9
- display: {
10
- dateInput: 'YYYY/MM/DD',
11
- monthYearLabel: 'MMM YYYY',
12
- dateA11yLabel: 'LL',
13
- monthYearA11yLabel: 'MMMM YYYY',
14
- }
15
- };
16
- export const MAT_DAYJS_JP_PROVIDERS = [
17
- { provide: MAT_DATE_LOCALE, useValue: 'ja' },
18
- { provide: MAT_DATE_FORMATS, useValue: MAT_DAYJS_DATE_FORMATS_FOR_JP },
19
- ];
20
- //# sourceMappingURL=dayjs-jp-providers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dayjs-jp-providers.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/mat-dayjs-date/dayjs-jp-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,CAAA;AACxB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,CAAC,MAAM,6BAA6B,GAAmB;IAC3D,KAAK,EAAE;QACL,SAAS,EAAE,YAAY;KACxB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,UAAU;QAC1B,aAAa,EAAE,IAAI;QACnB,kBAAkB,EAAE,WAAW;KAChC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5C,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,6BAA6B,EAAE;CACvE,CAAC","sourcesContent":["import { MatDateFormats, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';\nimport dayjs from 'dayjs';\nimport 'dayjs/locale/ja'\ndayjs.locale('ja');\n\nexport const MAT_DAYJS_DATE_FORMATS_FOR_JP: MatDateFormats = {\n parse: {\n dateInput: 'YYYY/MM/DD',\n },\n display: {\n dateInput: 'YYYY/MM/DD',\n monthYearLabel: 'MMM YYYY',\n dateA11yLabel: 'LL',\n monthYearA11yLabel: 'MMMM YYYY',\n }\n};\n\nexport const MAT_DAYJS_JP_PROVIDERS = [\n { provide: MAT_DATE_LOCALE, useValue: 'ja' },\n { provide: MAT_DATE_FORMATS, useValue: MAT_DAYJS_DATE_FORMATS_FOR_JP },\n];\n"]}
@@ -1,5 +0,0 @@
1
- export * from './dayjs-date.adapter';
2
- export * from './dayjs-date.formats';
3
- export * from './dayjs-jp-providers';
4
- export * from './dayjs-date.module';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/mat-dayjs-date/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './dayjs-date.adapter';\nexport * from './dayjs-date.formats';\nexport * from './dayjs-jp-providers';\nexport * from './dayjs-date.module';"]}
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=ng-atomic-common-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ng-atomic-common-utils.js","sourceRoot":"","sources":["../../../../../libs/common/utils/ng-atomic-common-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -1,2 +0,0 @@
1
- export * from './query.resolver';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/common/utils/query/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './query.resolver';\n"]}
@@ -1,100 +0,0 @@
1
- import { flatten } from 'flat';
2
- import { smartExpTransformer } from '../smart-exp-transformer';
3
- import { toObject } from '../to-object';
4
- import dayjs from 'dayjs';
5
- export const filterByQuery = (items, queryString, dlm = {}, transformer = smartExpTransformer) => {
6
- return new QueryResolver(dlm, transformer).resolve(items, queryString);
7
- };
8
- class QueryResolver {
9
- constructor(map, transformer) {
10
- this.transformer = transformer;
11
- this.inQueryByKey = (items, query) => {
12
- var _a, _b;
13
- const [not, _key, value] = this.parseQuery(query);
14
- const key = (_b = (_a = this.REVERSED_MAP) === null || _a === void 0 ? void 0 : _a[_key]) !== null && _b !== void 0 ? _b : _key;
15
- return items.filter(item => { var _a; return _not(this.in(key, (_a = flatten(toObject(item))) === null || _a === void 0 ? void 0 : _a[key], value), not); });
16
- };
17
- this.gtQueryByKey = (items, query) => {
18
- var _a, _b;
19
- const [_key, value] = query.split('>');
20
- const key = (_b = (_a = this.REVERSED_MAP) === null || _a === void 0 ? void 0 : _a[_key]) !== null && _b !== void 0 ? _b : _key;
21
- return items.filter(item => {
22
- var _a, _b, _c;
23
- // TODO(nontangent): flattenしたときにdayjsが壊れる
24
- const v = (_b = (_a = flatten(toObject(item))) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : (_c = toObject(item)) === null || _c === void 0 ? void 0 : _c[key];
25
- return this.gt(key, v, value);
26
- });
27
- };
28
- this.ltQueryByKey = (items, query) => {
29
- var _a, _b;
30
- const [_key, value] = query.split('<');
31
- const key = (_b = (_a = this.REVERSED_MAP) === null || _a === void 0 ? void 0 : _a[_key]) !== null && _b !== void 0 ? _b : _key;
32
- return items.filter(item => {
33
- var _a, _b, _c;
34
- // TODO(nontangent): flattenしたときにdayjsが壊れる
35
- const v = (_b = (_a = flatten(toObject(item))) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : (_c = toObject(item)) === null || _c === void 0 ? void 0 : _c[key];
36
- return this.lt(key, v, value);
37
- });
38
- };
39
- this.inQuery = (items, q) => {
40
- return items.filter(item => Object.entries(flatten(toObject(item))).some(([k, v]) => this.in(k, v, q)));
41
- };
42
- this.REVERSED_MAP = Object.entries(map).reduce((p, [k, v]) => (Object.assign(Object.assign({}, p), { [v]: k })), {});
43
- }
44
- resolve(items, queryString) {
45
- return this.resolveQueries(items, queryString.split(' ').filter(q => q.length));
46
- }
47
- resolveQueries(items, queries) {
48
- return queries.reduce((_items, query) => {
49
- if (query.includes(':'))
50
- return this.inQueryByKey(_items, query);
51
- if (query.includes('='))
52
- return this.inQueryByKey(_items, query);
53
- if (query.includes('>'))
54
- return this.gtQueryByKey(_items, query);
55
- if (query.includes('<'))
56
- return this.ltQueryByKey(_items, query);
57
- return this.inQuery(_items, query);
58
- }, items);
59
- }
60
- parseQuery(query) {
61
- const [_key, value] = query.split(':');
62
- return [_key.startsWith('-'), _key.startsWith('-') ? _key.slice(1) : _key, value];
63
- }
64
- in(k, v, q) {
65
- return _in(this.transformer(v, k), q);
66
- }
67
- gt(k, v, q) {
68
- // const value = dayjs.isDayjs(v) ? v : this.transformer(v, k);
69
- return _gt(v, q);
70
- }
71
- lt(k, v, q) {
72
- // const value = dayjs.isDayjs(v) ? v : this.transformer(v, k);
73
- return _lt(v, q);
74
- }
75
- }
76
- const _not = (bool, not) => {
77
- return not ? !bool : bool;
78
- };
79
- const _in = (value, query) => {
80
- return typeof value === 'string' ? value === null || value === void 0 ? void 0 : value.includes(query) : false;
81
- };
82
- const _gt = (value, query) => {
83
- return typeof value === 'string'
84
- ? parseFloat(value) > parseFloat(query)
85
- : typeof value === 'number'
86
- ? value > parseFloat(query)
87
- : dayjs.isDayjs(value)
88
- ? dayjs(query).isBefore(value)
89
- : false;
90
- };
91
- const _lt = (value, query) => {
92
- return typeof value === 'string'
93
- ? parseFloat(value) < parseFloat(query)
94
- : typeof value === 'number'
95
- ? value < parseFloat(query)
96
- : dayjs.isDayjs(value)
97
- ? dayjs(query).isAfter(value)
98
- : false;
99
- };
100
- //# sourceMappingURL=query.resolver.js.map